Commit 153f6df7 authored by Ben Boeckel's avatar Ben Boeckel Committed by Ben Boeckel
Browse files

SystemTools: Use strings in ComparePath

The arguments are assumed to be non-null anyways.

Change-Id: Iff75a677a051d04919871b3d9efd22ec663cdcd2
parent b07b5fc1
...@@ -3586,18 +3586,18 @@ SystemTools ...@@ -3586,18 +3586,18 @@ SystemTools
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
bool SystemTools::ComparePath(const char* c1, const char* c2) bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2)
{ {
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
# ifdef _MSC_VER # ifdef _MSC_VER
return _stricmp(c1, c2) == 0; return _stricmp(c1.c_str(), c2.c_str()) == 0;
# elif defined(__APPLE__) || defined(__GNUC__) # elif defined(__APPLE__) || defined(__GNUC__)
return strcasecmp(c1, c2) == 0; return strcasecmp(c1.c_str(), c2.c_str()) == 0;
#else #else
return SystemTools::Strucmp(c1, c2) == 0; return SystemTools::Strucmp(c1.c_str(), c2.c_str()) == 0;
# endif # endif
#else #else
return strcmp(c1, c2) == 0; return c1 == c2;
#endif #endif
} }
...@@ -4348,7 +4348,7 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir) ...@@ -4348,7 +4348,7 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
if(subdir.size() > dir.size() && subdir[dir.size()] == '/') if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
{ {
std::string s = subdir.substr(0, dir.size()); std::string s = subdir.substr(0, dir.size());
return SystemTools::ComparePath(s.c_str(), dir.c_str()); return SystemTools::ComparePath(s, dir);
} }
return false; return false;
} }
......
...@@ -413,7 +413,7 @@ public: ...@@ -413,7 +413,7 @@ public:
/** /**
* Compare a path or components of a path. * Compare a path or components of a path.
*/ */
static bool ComparePath(const char* c1, const char* c2); static bool ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2);
/** /**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment