From 2c2f66042d058e7120581b2bf494b9050d1b1acb Mon Sep 17 00:00:00 2001 From: Ben Boeckel <mathstuf@gmail.com> Date: Tue, 11 Mar 2014 13:22:04 -0400 Subject: [PATCH] SystemTools: Accept strings in IsSubDirectory The arguments are assumed to be non-null. Change-Id: Ibe8e9fc9c932efc55cc18f0e06b2db61bc168817 --- SystemTools.cxx | 4 ++-- SystemTools.hxx.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 430e582..2eff35f 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -4335,9 +4335,9 @@ kwsys_stl::string SystemTools::GetParentDirectory(const char* fileOrDir) return SystemTools::GetFilenamePath(fileOrDir); } -bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir) +bool SystemTools::IsSubDirectory(const kwsys_stl::string& cSubdir, const kwsys_stl::string& cDir) { - if(!*cDir) + if(cDir.empty()) { return false; } diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 4784e27..c0f3d30 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -487,7 +487,7 @@ public: /** * Check if the given file or directory is in subdirectory of dir */ - static bool IsSubDirectory(const char* fileOrDir, const char* dir); + static bool IsSubDirectory(const kwsys_stl::string& fileOrDir, const kwsys_stl::string& dir); /** ----------------------------------------------------------------- * File Manipulation Routines -- GitLab