summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-01-11 15:57:44 (GMT)
committerBrad King <brad.king@kitware.com>2022-01-11 15:57:44 (GMT)
commitf52dac56a012b1456c63ec352b298ed236d059fb (patch)
tree993c9413ff8c35ef45afdaf1b96c20552e3c7a37 /Source/kwsys/SystemTools.cxx
parentddc6be2c196fab3eedf5e243cb0fb387a52a4271 (diff)
parent6e8a2de4cb2bacb9eab287fe096a8650e58b0e16 (diff)
downloadCMake-f52dac56a012b1456c63ec352b298ed236d059fb.zip
CMake-f52dac56a012b1456c63ec352b298ed236d059fb.tar.gz
CMake-f52dac56a012b1456c63ec352b298ed236d059fb.tar.bz2
Merge branch 'upstream-KWSys' into update-kwsys
# By KWSys Upstream * upstream-KWSys: KWSys 2022-01-11 (15b0b0c4)
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 6a8520fe..c339fd5 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/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);
}
}