summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2021-09-17 09:56:48 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2021-09-17 09:58:46 (GMT)
commit7e154ebd59724d43bf29a8e1c648d6cf7f0e61e4 (patch)
tree1af10b5267eb0f9821313bb3eb47900b2d205fe8 /Source/cmSystemTools.cxx
parent241048d6ceb5dd4a16950c29286aebbcc46e565c (diff)
downloadCMake-7e154ebd59724d43bf29a8e1c648d6cf7f0e61e4.zip
CMake-7e154ebd59724d43bf29a8e1c648d6cf7f0e61e4.tar.gz
CMake-7e154ebd59724d43bf29a8e1c648d6cf7f0e61e4.tar.bz2
cmSystemTools::VersionCompare: use std::string for arguments
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r--Source/cmSystemTools.cxx28
1 files changed, 20 insertions, 8 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index a20e787..27cb90f 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2885,8 +2885,9 @@ bool cmSystemTools::SetRPath(std::string const& file,
return false;
}
-bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
- const char* lhss, const char* rhss)
+namespace {
+bool VersionCompare(cmSystemTools::CompareOp op, const char* lhss,
+ const char* rhss)
{
const char* endl = lhss;
const char* endr = rhss;
@@ -2919,26 +2920,37 @@ bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
// lhs == rhs, so true if operation is EQUAL
return (op & cmSystemTools::OP_EQUAL) != 0;
}
+}
+
+bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
+ const std::string& lhs,
+ const std::string& rhs)
+{
+ return ::VersionCompare(op, lhs.c_str(), rhs.c_str());
+}
+bool cmSystemTools::VersionCompare(cmSystemTools::CompareOp op,
+ const std::string& lhs, const char rhs[])
+{
+ return ::VersionCompare(op, lhs.c_str(), rhs);
+}
bool cmSystemTools::VersionCompareEqual(std::string const& lhs,
std::string const& rhs)
{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, lhs.c_str(),
- rhs.c_str());
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, lhs, rhs);
}
bool cmSystemTools::VersionCompareGreater(std::string const& lhs,
std::string const& rhs)
{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, lhs.c_str(),
- rhs.c_str());
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, lhs, rhs);
}
bool cmSystemTools::VersionCompareGreaterEq(std::string const& lhs,
std::string const& rhs)
{
- return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL,
- lhs.c_str(), rhs.c_str());
+ return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, lhs,
+ rhs);
}
static size_t cm_strverscmp_find_first_difference_or_end(const char* lhs,