STYLE: Remove trailing whitespaces

This commit is contained in:
Mathieu Malaterre 2006-03-10 13:34:41 -05:00
parent f90e754100
commit 509e383aac

View File

@ -263,8 +263,8 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
} }
kwsys_stl::string pathEnv = cpathEnv; kwsys_stl::string pathEnv = cpathEnv;
// A hack to make the below algorithm work. // A hack to make the below algorithm work.
if(pathEnv[pathEnv.length()-1] != ':') if(pathEnv[pathEnv.length()-1] != ':')
{ {
pathEnv += pathSep; pathEnv += pathSep;
@ -1473,8 +1473,8 @@ bool SystemTools::FilesDiffer(const char* source,
delete [] dest_buf; delete [] dest_buf;
return true; return true;
} }
int ret = memcmp((const void*)source_buf, int ret = memcmp((const void*)source_buf,
(const void*)dest_buf, (const void*)dest_buf,
statSource.st_size); statSource.st_size);
delete [] dest_buf; delete [] dest_buf;
@ -1662,23 +1662,22 @@ unsigned long SystemTools::FileLength(const char* filename)
int SystemTools::Strucmp(const char *s1, const char *s2) int SystemTools::Strucmp(const char *s1, const char *s2)
{ {
// lifted from Graphvis http://www.graphviz.org // lifted from Graphvis http://www.graphviz.org
while ((*s1 != '\0') while ((*s1 != '\0')
&& (tolower(*s1) == tolower(*s2))) && (tolower(*s1) == tolower(*s2)))
{ {
s1++; s1++;
s2++; s2++;
} }
return tolower(*s1) - tolower(*s2);
return tolower(*s1) - tolower(*s2);
} }
// return file's modified time // return file's modified time
long int SystemTools::ModifiedTime(const char* filename) long int SystemTools::ModifiedTime(const char* filename)
{ {
struct stat fs; struct stat fs;
if (stat(filename, &fs) != 0) if (stat(filename, &fs) != 0)
{ {
return 0; return 0;
} }
@ -1692,7 +1691,7 @@ long int SystemTools::ModifiedTime(const char* filename)
long int SystemTools::CreationTime(const char* filename) long int SystemTools::CreationTime(const char* filename)
{ {
struct stat fs; struct stat fs;
if (stat(filename, &fs) != 0) if (stat(filename, &fs) != 0)
{ {
return 0; return 0;
} }
@ -1714,7 +1713,7 @@ bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
// __DATE__ // __DATE__
// The compilation date of the current source file. The date is a string // The compilation date of the current source file. The date is a string
// literal of the form Mmm dd yyyy. The month name Mmm is the same as for // literal of the form Mmm dd yyyy. The month name Mmm is the same as for
// dates generated by the library function asctime declared in TIME.H. // dates generated by the library function asctime declared in TIME.H.
// index: 012345678901 // index: 012345678901
// format: Mmm dd yyyy // format: Mmm dd yyyy
@ -1760,9 +1759,9 @@ bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
struct tm tmt2; struct tm tmt2;
// __TIMESTAMP__ // __TIMESTAMP__
// The date and time of the last modification of the current source file, // The date and time of the last modification of the current source file,
// expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy, // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy,
/// where Ddd is the abbreviated day of the week and Date is an integer /// where Ddd is the abbreviated day of the week and Date is an integer
// from 1 to 31. // from 1 to 31.
// index: 0123456789 // index: 0123456789
@ -1878,11 +1877,11 @@ size_t SystemTools::GetMaximumFilePathLength()
* found. Otherwise, the empty string is returned. * found. Otherwise, the empty string is returned.
*/ */
kwsys_stl::string SystemTools kwsys_stl::string SystemTools
::FindFile(const char* name, ::FindFile(const char* name,
const kwsys_stl::vector<kwsys_stl::string>& userPaths) const kwsys_stl::vector<kwsys_stl::string>& userPaths)
{ {
// Add the system search path to our path first // Add the system search path to our path first
kwsys_stl::vector<kwsys_stl::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path, "CMAKE_FILE_PATH"); SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path); SystemTools::GetPath(path);
// now add the additional paths // now add the additional paths
@ -1957,7 +1956,7 @@ kwsys_stl::string SystemTools::FindProgram(
{ {
SystemTools::GetPath(path); SystemTools::GetPath(path);
} }
// now add the additional paths // now add the additional paths
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
i != userPaths.end(); ++i) i != userPaths.end(); ++i)
@ -2024,8 +2023,8 @@ kwsys_stl::string SystemTools::FindProgram(
it != names.end() ; ++it) it != names.end() ; ++it)
{ {
// Try to find the program. // Try to find the program.
kwsys_stl::string result = SystemTools::FindProgram(it->c_str(), kwsys_stl::string result = SystemTools::FindProgram(it->c_str(),
path, path,
noSystemPath); noSystemPath);
if ( !result.empty() ) if ( !result.empty() )
{ {
@ -2050,7 +2049,7 @@ kwsys_stl::string SystemTools
{ {
return SystemTools::CollapseFullPath(name); return SystemTools::CollapseFullPath(name);
} }
// Add the system search path to our path. // Add the system search path to our path.
kwsys_stl::vector<kwsys_stl::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path); SystemTools::GetPath(path);
@ -2080,7 +2079,7 @@ kwsys_stl::string SystemTools
tryPath += "/"; tryPath += "/";
tryPath += name; tryPath += name;
tryPath += ".lib"; tryPath += ".lib";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
@ -2090,7 +2089,7 @@ kwsys_stl::string SystemTools
tryPath += "/lib"; tryPath += "/lib";
tryPath += name; tryPath += name;
tryPath += ".so"; tryPath += ".so";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
@ -2099,7 +2098,7 @@ kwsys_stl::string SystemTools
tryPath += "/lib"; tryPath += "/lib";
tryPath += name; tryPath += name;
tryPath += ".a"; tryPath += ".a";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
@ -2108,7 +2107,7 @@ kwsys_stl::string SystemTools
tryPath += "/lib"; tryPath += "/lib";
tryPath += name; tryPath += name;
tryPath += ".sl"; tryPath += ".sl";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
@ -2117,7 +2116,7 @@ kwsys_stl::string SystemTools
tryPath += "/lib"; tryPath += "/lib";
tryPath += name; tryPath += name;
tryPath += ".dylib"; tryPath += ".dylib";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
@ -2126,20 +2125,20 @@ kwsys_stl::string SystemTools
tryPath += "/lib"; tryPath += "/lib";
tryPath += name; tryPath += name;
tryPath += ".dll"; tryPath += ".dll";
if(SystemTools::FileExists(tryPath.c_str()) if(SystemTools::FileExists(tryPath.c_str())
&& !SystemTools::FileIsDirectory(tryPath.c_str())) && !SystemTools::FileIsDirectory(tryPath.c_str()))
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
} }
#endif #endif
} }
// Couldn't find the library. // Couldn't find the library.
return ""; return "";
} }
bool SystemTools::FileIsDirectory(const char* name) bool SystemTools::FileIsDirectory(const char* name)
{ {
struct stat fs; struct stat fs;
if(stat(name, &fs) == 0) if(stat(name, &fs) == 0)
{ {
@ -2156,7 +2155,7 @@ bool SystemTools::FileIsDirectory(const char* name)
} }
bool SystemTools::FileIsSymlink(const char* name) bool SystemTools::FileIsSymlink(const char* name)
{ {
#if _WIN32 #if _WIN32
(void)name; (void)name;
return false; return false;
@ -2209,7 +2208,7 @@ bool SystemTools::SplitProgramPath(const char* in_name,
dir = in_name; dir = in_name;
file = ""; file = "";
SystemTools::ConvertToUnixSlashes(dir); SystemTools::ConvertToUnixSlashes(dir);
if(!SystemTools::FileIsDirectory(dir.c_str())) if(!SystemTools::FileIsDirectory(dir.c_str()))
{ {
kwsys_stl::string::size_type slashPos = dir.rfind("/"); kwsys_stl::string::size_type slashPos = dir.rfind("/");
@ -2234,11 +2233,11 @@ bool SystemTools::SplitProgramPath(const char* in_name,
return true; return true;
} }
bool SystemTools::FindProgramPath(const char* argv0, bool SystemTools::FindProgramPath(const char* argv0,
kwsys_stl::string& pathOut, kwsys_stl::string& pathOut,
kwsys_stl::string& errorMsg, kwsys_stl::string& errorMsg,
const char* exeName, const char* exeName,
const char* buildDir, const char* buildDir,
const char* installPrefix ) const char* installPrefix )
{ {
kwsys_stl::vector<kwsys_stl::string> failures; kwsys_stl::vector<kwsys_stl::string> failures;
@ -2308,13 +2307,13 @@ void SystemTools::AddTranslationPath(const char * a, const char * b)
if( SystemTools::FileIsDirectory( path_a.c_str() ) ) if( SystemTools::FileIsDirectory( path_a.c_str() ) )
{ {
// Make sure the path is a full path and does not contain no '..' // Make sure the path is a full path and does not contain no '..'
if( SystemTools::FileIsFullPath(path_b.c_str()) && path_b.find("..") if( SystemTools::FileIsFullPath(path_b.c_str()) && path_b.find("..")
== kwsys_stl::string::npos ) == kwsys_stl::string::npos )
{ {
// Before inserting make sure path ends with '/' // Before inserting make sure path ends with '/'
if(path_a.size() && path_a[path_a.size() -1] != '/') if(path_a.size() && path_a[path_a.size() -1] != '/')
{ {
path_a += '/'; path_a += '/';
} }
if(path_b.size() && path_b[path_b.size() -1] != '/') if(path_b.size() && path_b[path_b.size() -1] != '/')
{ {
@ -2460,7 +2459,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
{ {
return ""; return "";
} }
// split up both paths into arrays of strings using / as a separator // split up both paths into arrays of strings using / as a separator
kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true); kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true); kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
@ -2470,8 +2469,8 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
unsigned int sameCount = 0; unsigned int sameCount = 0;
while( while(
((sameCount <= (localSplit.size()-1)) && (sameCount <= (remoteSplit.size()-1))) ((sameCount <= (localSplit.size()-1)) && (sameCount <= (remoteSplit.size()-1)))
&& &&
// for windows and apple do a case insensitive string compare // for windows and apple do a case insensitive string compare
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
SystemTools::Strucmp(localSplit[sameCount].c_str(), SystemTools::Strucmp(localSplit[sameCount].c_str(),
remoteSplit[sameCount].c_str()) == 0 remoteSplit[sameCount].c_str()) == 0