diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-07 17:51:17 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-07 17:51:17 (GMT) |
commit | b956fc24069c668978be67a6a4855c76806bf218 (patch) | |
tree | da5772b65227b13dd8408dbe6fe4a863bebf4743 /Source | |
parent | ca3a61359541c770fb9ca0ccab83b49fd1f3d68a (diff) | |
download | CMake-b956fc24069c668978be67a6a4855c76806bf218.zip CMake-b956fc24069c668978be67a6a4855c76806bf218.tar.gz CMake-b956fc24069c668978be67a6a4855c76806bf218.tar.bz2 |
STYLE: remove out commented code
Alex
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFileCommand.cxx | 97 | ||||
-rw-r--r-- | Source/cmFileCommand.h | 25 |
2 files changed, 33 insertions, 89 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index f75ed79..80b9008 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -76,10 +76,6 @@ bool cmFileCommand::InitialPass(std::vector<std::string> const& args) { return this->HandleStringsCommand(args); } -/* else if ( subCommand == "HEX_TO_BIN" ) - { - return this->HandleHex2BinCommand(args); - }*/ else if ( subCommand == "GLOB" ) { return this->HandleGlobCommand(args, false); @@ -236,7 +232,7 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) std::string line; bool has_newline = false; while (sizeLimit != 0 && - cmSystemTools::GetLineFromStream(file, line, &has_newline, + cmSystemTools::GetLineFromStream(file, line, &has_newline, sizeLimit) ) { if (sizeLimit > 0) @@ -262,53 +258,6 @@ bool cmFileCommand::HandleReadCommand(std::vector<std::string> const& args) } //---------------------------------------------------------------------------- -/*bool cmFileCommand::HandleHex2BinCommand(std::vector<std::string> const& args) -{ - if(args.size() != 3) - { - this->SetError("HEX_TO_BIN requires an input and an output file name"); - return false; - } - // Get the file to read. - std::string inFileName = args[1]; - if(!cmsys::SystemTools::FileIsFullPath(inFileName.c_str())) - { - inFileName = this->Makefile->GetCurrentDirectory(); - inFileName += "/" + args[1]; - } - - // Get the file to write. - std::string outFileName = args[2]; - if(!cmsys::SystemTools::FileIsFullPath(outFileName.c_str())) - { - outFileName = this->Makefile->GetCurrentDirectory(); - outFileName += "/" + args[2]; - } - - if ( !this->Makefile->CanIWriteThisFile(outFileName.c_str()) ) - { - std::string e - = "attempted to write a file: " + outFileName + - " into a source directory."; - this->SetError(e.c_str()); - cmSystemTools::SetFatalErrorOccured(); - return false; - } - - std::string dir = cmSystemTools::GetFilenamePath(outFileName); - cmSystemTools::MakeDirectory(dir.c_str()); - - bool success = cmHexFileConverter::TryConvert(inFileName.c_str(), - outFileName.c_str()); - if (!success) - { - success = cmSystemTools::CopyFileAlways(inFileName.c_str(), - outFileName.c_str()); - } - return success; -} */ - -//---------------------------------------------------------------------------- bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) { if(args.size() < 3) @@ -485,7 +434,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector<std::string> const& args) fileName = binaryFileName; } } - + // Open the specified file. #if defined(_WIN32) || defined(__CYGWIN__) std::ifstream fin(fileName.c_str(), std::ios::in | std::ios::binary); @@ -1089,7 +1038,7 @@ bool cmFileInstaller::InstallDirectory(const char* source, } //---------------------------------------------------------------------------- -void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, +void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, mode_t& permissions_file, mode_t& permissions_dir, int itype, @@ -1190,7 +1139,7 @@ void cmFileCommand //---------------------------------------------------------------------------- -bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, +bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, std::string& destination) { if ( destination.size() < 2 ) @@ -1199,7 +1148,7 @@ bool cmFileCommand::HandleInstallDestination(cmFileInstaller& installer, "No DESTINATION provided or ."); return false; } - + const char* destdir = cmSystemTools::GetEnv("DESTDIR"); if ( destdir && *destdir ) { @@ -1299,9 +1248,9 @@ bool cmFileCommand::HandleInstallCommand(std::vector<std::string> const& args) std::map<cmStdString, const char*> properties; bool optional = false; - bool result = this->ParseInstallArgs(args, installer, components, - configurations, properties, - itype, rename, destination, files, + bool result = this->ParseInstallArgs(args, installer, components, + configurations, properties, + itype, rename, destination, files, optional); if (result == true) { @@ -1640,7 +1589,7 @@ bool cmFileCommand::ParseInstallArgs(std::vector<std::string> const& args, this->GetTargetTypeFromString(stype, itype); - this->HandleInstallPermissions(installer, + this->HandleInstallPermissions(installer, permissions_file, permissions_dir, itype, @@ -1759,10 +1708,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, cmSystemTools::RemoveFile(soname.c_str()); cmSystemTools::RemoveFile(libname.c_str()); - if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(), + if (!cmSystemTools::CreateSymlink(soname_nopath.c_str(), libname.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + libname + " to " + soname_nopath; this->SetError(errstring.c_str()); return false; @@ -1770,10 +1719,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, installer.ManifestAppend(libname); if ( toFile != soname ) { - if ( !cmSystemTools::CreateSymlink(fromName.c_str(), + if ( !cmSystemTools::CreateSymlink(fromName.c_str(), soname.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + soname + " to " + fromName; this->SetError(errstring.c_str()); return false; @@ -1805,10 +1754,10 @@ bool cmFileCommand::DoInstall( cmFileInstaller& installer, cmSystemTools::RemoveFile(exename.c_str()); - if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), + if (!cmSystemTools::CreateSymlink(exename_nopath.c_str(), exename.c_str()) ) { - std::string errstring = "error when creating symlink from: " + std::string errstring = "error when creating symlink from: " + exename + " to " + exename_nopath; this->SetError(errstring.c_str()); return false; @@ -1901,22 +1850,22 @@ bool cmFileCommand::HandleRelativePathCommand( if(!cmSystemTools::FileIsFullPath(directoryName.c_str())) { - std::string errstring = - "RelativePath must be passed a full path to the directory: " + std::string errstring = + "RelativePath must be passed a full path to the directory: " + directoryName; this->SetError(errstring.c_str()); return false; } if(!cmSystemTools::FileIsFullPath(fileName.c_str())) { - std::string errstring = - "RelativePath must be passed a full path to the file: " + std::string errstring = + "RelativePath must be passed a full path to the file: " + fileName; this->SetError(errstring.c_str()); return false; } - std::string res = cmSystemTools::RelativePath(directoryName.c_str(), + std::string res = cmSystemTools::RelativePath(directoryName.c_str(), fileName.c_str()); this->Makefile->AddDefinition(outVar.c_str(), res.c_str()); @@ -1949,7 +1898,7 @@ bool cmFileCommand::HandleRemove(std::vector<std::string> const& args, //---------------------------------------------------------------------------- bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> - const& args, + const& args, bool nativePath) { std::vector<std::string>::const_iterator i = args.begin(); @@ -1965,7 +1914,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> #else char pathSep = ':'; #endif - std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), + std::vector<cmsys::String> path = cmSystemTools::SplitString(i->c_str(), pathSep); i++; const char* var = i->c_str(); @@ -1986,7 +1935,7 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string> *j = cmSystemTools::ConvertToOutputPath(j->c_str()); // remove double quotes in the path cmsys::String& s = *j; - + if(s.size() > 1 && s[0] == '\"' && s[s.size()-1] == '\"') { s = s.substr(1,s.size()-2); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 029e698..6dffd27 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -9,8 +9,8 @@ Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ @@ -31,7 +31,7 @@ public: /** * This is a virtual constructor for the command. */ - virtual cmCommand* Clone() + virtual cmCommand* Clone() { return new cmFileCommand; } @@ -55,11 +55,11 @@ public: /** * Succinct documentation. */ - virtual const char* GetTerseDocumentation() + virtual const char* GetTerseDocumentation() { return "File manipulation command."; } - + /** * More documentation. */ @@ -74,7 +74,6 @@ public: " [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n" " [NEWLINE_CONSUME] [REGEX regex]\n" " [NO_HEX_CONVERSION])\n" - " FILE(HEX_TO_BIN inputfile outputfile)\n" " FILE(GLOB variable [RELATIVE path] [globbing expressions]...)\n" " FILE(GLOB_RECURSE variable [RELATIVE path] \n" " [globbing expressions]...)\n" @@ -100,9 +99,6 @@ public: "return (CR) characters are ignored. It works also for Intel Hex and " "Motorola S-record files, which are automatically converted to binary " "format when reading them. Disable this using NO_HEX_CONVERSION.\n " -/* "HEX_TO_BIN will convert an Intel hex file or Motorola S-record file " - "to a binary file. If the input file is no such file it will simply " - "be copied. \n"*/ "LIMIT_COUNT sets the maximum number of strings to return. " "LIMIT_INPUT sets the maximum number of bytes to read from " "the input file. " @@ -145,7 +141,7 @@ public: " a cmake style path into the native path style \\ for windows and / " "for UNIX."; } - + cmTypeMacro(cmFileCommand, cmCommand); protected: @@ -153,15 +149,14 @@ protected: bool HandleWriteCommand(std::vector<std::string> const& args, bool append); bool HandleReadCommand(std::vector<std::string> const& args); bool HandleStringsCommand(std::vector<std::string> const& args); -// bool HandleHex2BinCommand(std::vector<std::string> const& args); bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse); bool HandleMakeDirectoryCommand(std::vector<std::string> const& args); - + bool HandleRelativePathCommand(std::vector<std::string> const& args); bool HandleCMakePathCommand(std::vector<std::string> const& args, bool nativePath); void ComputeVersionedName(std::string& name, const char* version); - + // FILE(INSTALL ...) related functions bool HandleInstallCommand(std::vector<std::string> const& args); bool ParseInstallArgs(std::vector<std::string> const& args, @@ -186,9 +181,9 @@ protected: const bool optional ); void GetTargetTypeFromString(const std::string& stype, int& itype) const; - bool HandleInstallDestination(cmFileInstaller& installer, + bool HandleInstallDestination(cmFileInstaller& installer, std::string& destination); - void HandleInstallPermissions(cmFileInstaller& installer, + void HandleInstallPermissions(cmFileInstaller& installer, mode_t& permissions_file, mode_t& permissions_dir, int itype, |