From 4b409aa4b833a4276cdc784f2f626e68b2fcb305 Mon Sep 17 00:00:00 2001 From: Ben Boeckel <mathstuf@gmail.com> Date: Tue, 11 Mar 2014 13:23:46 -0400 Subject: [PATCH] SystemTools: Take strings in SplitPath Change-Id: Ic80a61bd1bb23f46b2b1875e672a4dc4f93cc7ce --- SystemTools.cxx | 14 +++++++------- SystemTools.hxx.in | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 4e412e3..7b29778 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -3307,7 +3307,7 @@ static int GetCasePathName(const kwsys_stl::string & pathIn, kwsys_stl::string & casePath) { kwsys_stl::vector<kwsys_stl::string> path_components; - SystemTools::SplitPath(pathIn.c_str(), path_components); + SystemTools::SplitPath(pathIn, path_components); if(path_components[0].empty()) // First component always exists. { // Relative paths cannot be converted. @@ -3389,11 +3389,11 @@ kwsys_stl::string SystemTools::GetActualCaseForPath(const char* p) } //---------------------------------------------------------------------------- -const char* SystemTools::SplitPathRootComponent(const char* p, +const char* SystemTools::SplitPathRootComponent(const std::string& p, kwsys_stl::string* root) { // Identify the root component. - const char* c = p; + const char* c = p.c_str(); if((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\')) { // Network path. @@ -3475,17 +3475,17 @@ const char* SystemTools::SplitPathRootComponent(const char* p, } //---------------------------------------------------------------------------- -void SystemTools::SplitPath(const char* p, +void SystemTools::SplitPath(const std::string& p, kwsys_stl::vector<kwsys_stl::string>& components, bool expand_home_dir) { - const char* c = p; + const char* c; components.clear(); // Identify the root component. { kwsys_stl::string root; - c = SystemTools::SplitPathRootComponent(c, &root); + c = SystemTools::SplitPathRootComponent(p, &root); // Expand home directory references if requested. if(expand_home_dir && !root.empty() && root[0] == '~') @@ -3520,7 +3520,7 @@ void SystemTools::SplitPath(const char* p, { homedir.resize(homedir.size() - 1); } - SystemTools::SplitPath(homedir.c_str(), components); + SystemTools::SplitPath(homedir, components); } else { diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 644f498..e4244b7 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -383,7 +383,7 @@ public: * returned. The root component is stored in the "root" string if * given. */ - static const char* SplitPathRootComponent(const char* p, + static const char* SplitPathRootComponent(const std::string& p, kwsys_stl::string* root=0); /** @@ -396,7 +396,7 @@ public: * automatically expanded if expand_home_dir is true and this * platform supports them. */ - static void SplitPath(const char* p, + static void SplitPath(const std::string& p, kwsys_stl::vector<kwsys_stl::string>& components, bool expand_home_dir = true); -- GitLab