summaryrefslogtreecommitdiffstats
path: root/SystemTools.cxx
diff options
context:
space:
mode:
authorKWSys Upstream <kwrobot@kitware.com>2022-01-11 13:00:28 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-11 15:57:44 (GMT)
commit6e8a2de4cb2bacb9eab287fe096a8650e58b0e16 (patch)
treecb4b21f47540876b7ced35be7eabfd93e768e93f /SystemTools.cxx
parente9ab6eeeb5d7bdb7eeb84e20403b815b3624fb51 (diff)
downloadCMake-6e8a2de4cb2bacb9eab287fe096a8650e58b0e16.zip
CMake-6e8a2de4cb2bacb9eab287fe096a8650e58b0e16.tar.gz
CMake-6e8a2de4cb2bacb9eab287fe096a8650e58b0e16.tar.bz2
KWSys 2022-01-11 (15b0b0c4)
Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit 15b0b0c45e87c7f5bdc24ece6912c1a7dd9ef9f4 (master). Upstream Shortlog ----------------- Alexey Edelev (1): 549d3d0b SystemTools: Fix type of GetLineFromStream Jessica Clarke (1): ebfb5cdb SystemInformation: Change GetRealAddress to return a size_t
Diffstat (limited to 'SystemTools.cxx')
-rw-r--r--SystemTools.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 6a8520fe..c339fd5 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -4250,9 +4250,9 @@ std::string SystemTools::MakeCidentifier(const std::string& s)
// Convenience function around std::getline which removes a trailing carriage
// return and can truncate the buffer as needed. Returns true
// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(std::istream& is, std::string& line,
- bool* has_newline /* = 0 */,
- long sizeLimit /* = -1 */)
+bool SystemTools::GetLineFromStream(
+ std::istream& is, std::string& line, bool* has_newline /* = 0 */,
+ std::string::size_type sizeLimit /* = std::string::npos */)
{
// Start with an empty line.
line = "";
@@ -4277,7 +4277,7 @@ bool SystemTools::GetLineFromStream(std::istream& is, std::string& line,
}
// if we read too much then truncate the buffer
- if (sizeLimit >= 0 && line.size() >= static_cast<size_t>(sizeLimit)) {
+ if (sizeLimit != std::string::npos && line.size() > sizeLimit) {
line.resize(sizeLimit);
}
}