From 1defe94e31dcfdfb9a10c684ddf1b01761322bf2 Mon Sep 17 00:00:00 2001 From: Mathieu Malaterre Date: Thu, 9 Mar 2006 14:36:53 -0500 Subject: [PATCH] STYLE: Minor style --- Source/kwsys/Directory.cxx | 16 +++++++------- Source/kwsys/DynamicLoader.cxx | 26 +++++++++++------------ Source/kwsys/testSystemTools.cxx | 36 ++++++++++++++++---------------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index 09e761537..79e8111f6 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -38,7 +38,7 @@ class DirectoryInternals public: // Array of Files kwsys_stl::vector Files; - + // Path to Open'ed directory kwsys_stl::string Path; }; @@ -113,32 +113,32 @@ bool Directory::Load(const char* name) #endif char* buf; size_t n = strlen(name); - if ( name[n - 1] == '/' ) + if ( name[n - 1] == '/' ) { buf = new char[n + 1 + 1]; sprintf(buf, "%s*", name); - } + } else { buf = new char[n + 2 + 1]; sprintf(buf, "%s/*", name); } struct _finddata_t data; // data of current file - + // Now put them into the file array srchHandle = _findfirst(buf, &data); delete [] buf; - + if ( srchHandle == -1 ) { return 0; } - + // Loop through names - do + do { this->Internal->Files.push_back(data.name); - } + } while ( _findnext(srchHandle, &data) != -1 ); this->Internal->Path = name; return _findclose(srchHandle) != -1; diff --git a/Source/kwsys/DynamicLoader.cxx b/Source/kwsys/DynamicLoader.cxx index 9bbf07efb..8584a84f3 100644 --- a/Source/kwsys/DynamicLoader.cxx +++ b/Source/kwsys/DynamicLoader.cxx @@ -29,7 +29,7 @@ // 3. Windows which uses LoadLibrary // 4. Most unix systems (including Mac OS X 10.3 and later) which use dlopen (default) // Each part of the ifdef contains a complete implementation for -// the static methods of DynamicLoader. +// the static methods of DynamicLoader. namespace KWSYS_NAMESPACE { @@ -166,7 +166,7 @@ DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle /* lib */, const //---------------------------------------------------------------------------- const char* DynamicLoader::LibPrefix() -{ +{ return ""; } @@ -195,7 +195,7 @@ const char* DynamicLoader::LastError() namespace KWSYS_NAMESPACE { - + //---------------------------------------------------------------------------- LibHandle DynamicLoader::OpenLibrary(const char* libname) { @@ -218,7 +218,7 @@ int DynamicLoader::CloseLibrary(LibHandle lib) //---------------------------------------------------------------------------- DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle lib, const char* sym) -{ +{ void *result; #ifdef UNICODE wchar_t wsym[MB_CUR_MAX]; @@ -233,7 +233,7 @@ DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle lib, const char* //---------------------------------------------------------------------------- const char* DynamicLoader::LibPrefix() -{ +{ return ""; } @@ -248,16 +248,16 @@ const char* DynamicLoader::LastError() { LPVOID lpMsgBuf; - FormatMessage( + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, - NULL + NULL ); - + static char* str = 0; delete [] str; str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf); @@ -280,7 +280,7 @@ const char* DynamicLoader::LastError() namespace KWSYS_NAMESPACE { - + //---------------------------------------------------------------------------- LibHandle DynamicLoader::OpenLibrary(const char* libname ) { @@ -301,16 +301,16 @@ int DynamicLoader::CloseLibrary(LibHandle lib) //---------------------------------------------------------------------------- DynamicLoaderFunction DynamicLoader::GetSymbolAddress(LibHandle lib, const char* sym) -{ +{ void* result = dlsym(lib, sym); - + // Hack to cast pointer-to-data to pointer-to-function. return *reinterpret_cast(&result); } //---------------------------------------------------------------------------- const char* DynamicLoader::LibPrefix() -{ +{ return "lib"; } @@ -323,7 +323,7 @@ const char* DynamicLoader::LibExtension() //---------------------------------------------------------------------------- const char* DynamicLoader::LastError() { - return dlerror(); + return dlerror(); } } // namespace KWSYS_NAMESPACE diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 55682f44f..2106f7a09 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -30,7 +30,7 @@ #include "testSystemTools.h" //---------------------------------------------------------------------------- -const char* toUnixPaths[][2] = +const char* toUnixPaths[][2] = { { "/usr/local/bin/passwd", "/usr/local/bin/passwd" }, { "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" }, @@ -50,16 +50,16 @@ const char* toUnixPaths[][2] = {0, 0} }; -bool CheckConvertToUnixSlashes(kwsys_stl::string input, +bool CheckConvertToUnixSlashes(kwsys_stl::string input, kwsys_stl::string output) { kwsys_stl::string result = input; kwsys::SystemTools::ConvertToUnixSlashes(result); if ( result != output ) { - kwsys_ios::cerr - << "Problem with ConvertToUnixSlashes - input: " << input.c_str() - << " output: " << result.c_str() << " expected: " << output.c_str() + kwsys_ios::cerr + << "Problem with ConvertToUnixSlashes - input: " << input.c_str() + << " output: " << result.c_str() << " expected: " << output.c_str() << kwsys_ios::endl; return false; } @@ -67,25 +67,25 @@ bool CheckConvertToUnixSlashes(kwsys_stl::string input, } //---------------------------------------------------------------------------- -const char* checkEscapeChars[][4] = +const char* checkEscapeChars[][4] = { { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2"}, { " {} ", "{}", "#", " #{#} "}, {0, 0, 0, 0} }; -bool CheckEscapeChars(kwsys_stl::string input, - const char *chars_to_escape, - char escape_char, +bool CheckEscapeChars(kwsys_stl::string input, + const char *chars_to_escape, + char escape_char, kwsys_stl::string output) { kwsys_stl::string result = kwsys::SystemTools::EscapeChars( input.c_str(), chars_to_escape, escape_char); if (result != output) { - kwsys_ios::cerr - << "Problem with CheckEscapeChars - input: " << input.c_str() - << " output: " << result.c_str() << " expected: " << output.c_str() + kwsys_ios::cerr + << "Problem with CheckEscapeChars - input: " << input.c_str() + << " output: " << result.c_str() << " expected: " << output.c_str() << kwsys_ios::endl; return false; } @@ -97,20 +97,20 @@ bool CheckDetectFileType() { bool res = true; - if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_BIN_FILE) != + if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_BIN_FILE) != kwsys::SystemTools::FileTypeBinary) { - kwsys_ios::cerr - << "Problem with DetectFileType - failed to detect type of: " + kwsys_ios::cerr + << "Problem with DetectFileType - failed to detect type of: " << TEST_SYSTEMTOOLS_BIN_FILE << kwsys_ios::endl; res = false; } - if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_SRC_FILE) != + if (kwsys::SystemTools::DetectFileType(TEST_SYSTEMTOOLS_SRC_FILE) != kwsys::SystemTools::FileTypeText) { - kwsys_ios::cerr - << "Problem with DetectFileType - failed to detect type of: " + kwsys_ios::cerr + << "Problem with DetectFileType - failed to detect type of: " << TEST_SYSTEMTOOLS_SRC_FILE << kwsys_ios::endl; res = false; }