diff options
author | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-01-28 14:00:28 (GMT) |
---|---|---|
committer | Vitaly Stakhovsky <vvs31415@gitlab.org> | 2019-01-28 14:09:59 (GMT) |
commit | 2fc69ba0b33e8f5f1b6301f37fc1479fba420b93 (patch) | |
tree | 3e870a7ce9eac0b8d2eeaab9aa537efba4941b41 /Source/cmFileTimeComparison.cxx | |
parent | 1593e16d881bf74fd8981e1290d20f28191f1f0e (diff) | |
download | CMake-2fc69ba0b33e8f5f1b6301f37fc1479fba420b93.zip CMake-2fc69ba0b33e8f5f1b6301f37fc1479fba420b93.tar.gz CMake-2fc69ba0b33e8f5f1b6301f37fc1479fba420b93.tar.bz2 |
cmFileTimeComparison: use std::string arguments
Diffstat (limited to 'Source/cmFileTimeComparison.cxx')
-rw-r--r-- | Source/cmFileTimeComparison.cxx | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Source/cmFileTimeComparison.cxx b/Source/cmFileTimeComparison.cxx index 8f6993d..8b3911e 100644 --- a/Source/cmFileTimeComparison.cxx +++ b/Source/cmFileTimeComparison.cxx @@ -21,9 +21,10 @@ class cmFileTimeComparisonInternal { public: // Internal comparison method. - inline bool FileTimeCompare(const char* f1, const char* f2, int* result); + inline bool FileTimeCompare(const std::string& f1, const std::string& f2, + int* result); - bool FileTimesDiffer(const char* f1, const char* f2); + bool FileTimesDiffer(const std::string& f1, const std::string& f2); private: typedef std::unordered_map<std::string, cmFileTimeComparison_Type> @@ -31,14 +32,14 @@ private: FileStatsMap Files; // Internal methods to lookup and compare modification times. - inline bool Stat(const char* fname, cmFileTimeComparison_Type* st); + inline bool Stat(const std::string& fname, cmFileTimeComparison_Type* st); inline int Compare(cmFileTimeComparison_Type* st1, cmFileTimeComparison_Type* st2); inline bool TimesDiffer(cmFileTimeComparison_Type* st1, cmFileTimeComparison_Type* st2); }; -bool cmFileTimeComparisonInternal::Stat(const char* fname, +bool cmFileTimeComparisonInternal::Stat(const std::string& fname, cmFileTimeComparison_Type* st) { // Use the stored time if available. @@ -51,7 +52,7 @@ bool cmFileTimeComparisonInternal::Stat(const char* fname, #if !defined(_WIN32) || defined(__CYGWIN__) // POSIX version. Use the stat function. - int res = ::stat(fname, st); + int res = ::stat(fname.c_str(), st); if (res != 0) { return false; } @@ -83,13 +84,14 @@ cmFileTimeComparison::~cmFileTimeComparison() delete this->Internals; } -bool cmFileTimeComparison::FileTimeCompare(const char* f1, const char* f2, - int* result) +bool cmFileTimeComparison::FileTimeCompare(const std::string& f1, + const std::string& f2, int* result) { return this->Internals->FileTimeCompare(f1, f2, result); } -bool cmFileTimeComparison::FileTimesDiffer(const char* f1, const char* f2) +bool cmFileTimeComparison::FileTimesDiffer(const std::string& f1, + const std::string& f2) { return this->Internals->FileTimesDiffer(f1, f2); } @@ -199,8 +201,9 @@ bool cmFileTimeComparisonInternal::TimesDiffer(cmFileTimeComparison_Type* s1, #endif } -bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1, - const char* f2, int* result) +bool cmFileTimeComparisonInternal::FileTimeCompare(const std::string& f1, + const std::string& f2, + int* result) { // Get the modification time for each file. cmFileTimeComparison_Type s1; @@ -215,8 +218,8 @@ bool cmFileTimeComparisonInternal::FileTimeCompare(const char* f1, return false; } -bool cmFileTimeComparisonInternal::FileTimesDiffer(const char* f1, - const char* f2) +bool cmFileTimeComparisonInternal::FileTimesDiffer(const std::string& f1, + const std::string& f2) { // Get the modification time for each file. cmFileTimeComparison_Type s1; |