From b3bf31a5488a19ea3c357e346b882a2ca84c63b6 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 21 Feb 2014 19:05:55 -0500 Subject: [PATCH] stringapi: Miscellaneous char* parameters --- Source/CPack/WiX/cmWIXPatchParser.cxx | 12 +++---- Source/CPack/WiX/cmWIXPatchParser.h | 4 +-- Source/CPack/cmCPackComponentGroup.cxx | 5 +-- Source/CPack/cmCPackComponentGroup.h | 4 +-- Source/CPack/cmCPackGenerator.cxx | 2 +- Source/CPack/cmCPackGenerator.h | 2 +- Source/CPack/cmCPackOSXX11Generator.cxx | 2 +- Source/CPack/cmCPackOSXX11Generator.h | 2 +- Source/CPack/cmCPackPackageMakerGenerator.cxx | 15 ++++---- Source/CPack/cmCPackPackageMakerGenerator.h | 8 ++--- Source/CTest/cmCTestBZR.cxx | 36 +++++++++---------- Source/CTest/cmCTestBuildCommand.cxx | 4 +-- Source/CTest/cmCTestHG.cxx | 22 ++++++------ Source/CTest/cmCTestMemCheckHandler.cxx | 18 ++++------ Source/CTest/cmCTestSVN.cxx | 18 +++++----- Source/CTest/cmCTestSubmitHandler.cxx | 14 ++++---- Source/CTest/cmParsePythonCoverage.cxx | 8 ++--- Source/CursesDialog/cmCursesOptionsWidget.cxx | 2 +- Source/CursesDialog/cmCursesOptionsWidget.h | 2 +- Source/CursesDialog/cmCursesStringWidget.cxx | 2 +- Source/CursesDialog/cmCursesStringWidget.h | 2 +- Source/CursesDialog/cmCursesWidget.cxx | 4 +-- Source/CursesDialog/cmCursesWidget.h | 2 +- Source/cmCacheManager.cxx | 4 +-- Source/cmCacheManager.h | 2 +- Source/cmExportFileGenerator.h | 2 +- Source/cmGlobalGenerator.cxx | 9 ++--- Source/cmGlobalGenerator.h | 8 ++--- Source/cmGlobalVisualStudio6Generator.cxx | 4 +-- Source/cmGlobalVisualStudio6Generator.h | 4 +-- Source/cmGlobalVisualStudio7Generator.cxx | 6 ++-- Source/cmGlobalVisualStudio7Generator.h | 6 ++-- Source/cmGlobalXCodeGenerator.cxx | 14 ++++---- Source/cmGlobalXCodeGenerator.h | 4 +-- Source/cmLocalUnixMakefileGenerator3.cxx | 2 +- Source/cmLocalUnixMakefileGenerator3.h | 10 +++--- Source/cmLocalVisualStudio10Generator.cxx | 8 ++--- Source/cmLocalVisualStudio10Generator.h | 2 +- Source/cmLocalVisualStudio7Generator.cxx | 8 ++--- Source/cmLocalVisualStudio7Generator.h | 4 +-- Source/cmLocalVisualStudioGenerator.cxx | 4 +-- Source/cmLocalVisualStudioGenerator.h | 2 +- Source/cmTarget.cxx | 3 +- Source/cmTarget.h | 2 +- Source/cmVisualStudioWCEPlatformParser.cxx | 20 +++++------ Source/cmVisualStudioWCEPlatformParser.h | 4 +-- Source/cmXCodeObject.h | 18 +++++----- Source/cmXMLParser.cxx | 4 +-- Source/cmXMLParser.h | 4 +-- 49 files changed, 173 insertions(+), 175 deletions(-) diff --git a/Source/CPack/WiX/cmWIXPatchParser.cxx b/Source/CPack/WiX/cmWIXPatchParser.cxx index 10af1f6af..ef67b23ec 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.cxx +++ b/Source/CPack/WiX/cmWIXPatchParser.cxx @@ -34,12 +34,11 @@ cmWIXPatchParser::cmWIXPatchParser( } -void cmWIXPatchParser::StartElement(const char *name, const char **atts) +void cmWIXPatchParser::StartElement(const std::string& name, const char **atts) { - std::string name_str = name; if(State == BEGIN_DOCUMENT) { - if(name_str == "CPackWiXPatch") + if(name == "CPackWiXPatch") { State = BEGIN_FRAGMENTS; } @@ -50,7 +49,7 @@ void cmWIXPatchParser::StartElement(const char *name, const char **atts) } else if(State == BEGIN_FRAGMENTS) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = INSIDE_FRAGMENT; StartFragment(atts); @@ -107,12 +106,11 @@ void cmWIXPatchParser::StartFragment(const char **attributes) } } -void cmWIXPatchParser::EndElement(const char *name) +void cmWIXPatchParser::EndElement(const std::string& name) { - std::string name_str = name; if(State == INSIDE_FRAGMENT) { - if(name_str == "CPackWiXFragment") + if(name == "CPackWiXFragment") { State = BEGIN_FRAGMENTS; ElementStack.clear(); diff --git a/Source/CPack/WiX/cmWIXPatchParser.h b/Source/CPack/WiX/cmWIXPatchParser.h index da3adf509..acfb4c071 100644 --- a/Source/CPack/WiX/cmWIXPatchParser.h +++ b/Source/CPack/WiX/cmWIXPatchParser.h @@ -43,11 +43,11 @@ public: cmWIXPatchParser(fragment_map_t& Fragments, cmCPackLog* logger); private: - virtual void StartElement(const char *name, const char **atts); + virtual void StartElement(const std::string& name, const char **atts); void StartFragment(const char **attributes); - virtual void EndElement(const char *name); + virtual void EndElement(const std::string& name); virtual void ReportError(int line, int column, const char* msg); void ReportValidationError(std::string const& message); diff --git a/Source/CPack/cmCPackComponentGroup.cxx b/Source/CPack/cmCPackComponentGroup.cxx index f93eca823..77f11cbf2 100644 --- a/Source/CPack/cmCPackComponentGroup.cxx +++ b/Source/CPack/cmCPackComponentGroup.cxx @@ -16,7 +16,8 @@ #include //---------------------------------------------------------------------- -unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const +unsigned long cmCPackComponent::GetInstalledSize( + const std::string& installDir) const { if (this->TotalSize != 0) { @@ -37,7 +38,7 @@ unsigned long cmCPackComponent::GetInstalledSize(const char* installDir) const //---------------------------------------------------------------------- unsigned long -cmCPackComponent::GetInstalledSizeInKbytes(const char* installDir) const +cmCPackComponent::GetInstalledSizeInKbytes(const std::string& installDir) const { unsigned long result = (GetInstalledSize(installDir) + 512) / 1024; return result? result : 1; diff --git a/Source/CPack/cmCPackComponentGroup.h b/Source/CPack/cmCPackComponentGroup.h index abae3724e..0679638a6 100644 --- a/Source/CPack/cmCPackComponentGroup.h +++ b/Source/CPack/cmCPackComponentGroup.h @@ -94,11 +94,11 @@ public: /// Get the total installed size of all of the files in this /// component, in bytes. installDir is the directory into which the /// component was installed. - unsigned long GetInstalledSize(const char* installDir) const; + unsigned long GetInstalledSize(const std::string& installDir) const; /// Identical to GetInstalledSize, but returns the result in /// kilobytes. - unsigned long GetInstalledSizeInKbytes(const char* installDir) const; + unsigned long GetInstalledSizeInKbytes(const std::string& installDir) const; private: mutable unsigned long TotalSize; diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 3e1bf3b7a..a8e104bd2 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1139,7 +1139,7 @@ int cmCPackGenerator::DoPackage() } //---------------------------------------------------------------------- -int cmCPackGenerator::Initialize(const char* name, cmMakefile* mf) +int cmCPackGenerator::Initialize(const std::string& name, cmMakefile* mf) { this->MakefileMap = mf; this->Name = name; diff --git a/Source/CPack/cmCPackGenerator.h b/Source/CPack/cmCPackGenerator.h index fadd1bf90..efd3bef73 100644 --- a/Source/CPack/cmCPackGenerator.h +++ b/Source/CPack/cmCPackGenerator.h @@ -90,7 +90,7 @@ public: /** * Initialize generator */ - int Initialize(const char* name, cmMakefile* mf); + int Initialize(const std::string& name, cmMakefile* mf); /** * Construct generator diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 95ffab581..28c7f1dc0 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -272,7 +272,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) //---------------------------------------------------------------------- bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, - const char* dir, const char* outputFileName /* = 0 */, + const std::string& dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index 7a93f5a57..9d0a6d188 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -39,7 +39,7 @@ protected: //bool CopyCreateResourceFile(const std::string& name, // const std::string& dir); - bool CopyResourcePlistFile(const std::string& name, const char* dir, + bool CopyResourcePlistFile(const std::string& name, const std::string& dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index 69886a1b7..d736948a2 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -43,14 +43,14 @@ bool cmCPackPackageMakerGenerator::SupportsComponentInstallation() const } //---------------------------------------------------------------------- -int cmCPackPackageMakerGenerator::CopyInstallScript(const char* resdir, - const char* script, - const char* name) +int cmCPackPackageMakerGenerator::CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name) { std::string dst = resdir; dst += "/"; dst += name; - cmSystemTools::CopyFileAlways(script, dst.c_str()); + cmSystemTools::CopyFileAlways(script.c_str(), dst.c_str()); cmSystemTools::SetPermissions(dst.c_str(),0777); cmCPackLogger(cmCPackLog::LOG_VERBOSE, "copy script : " << script << "\ninto " << dst.c_str() << @@ -601,12 +601,13 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( return true; } -bool cmCPackPackageMakerGenerator::CopyResourcePlistFile(const char* name, - const char* outName) +bool cmCPackPackageMakerGenerator::CopyResourcePlistFile( + const std::string& name, + const char* outName) { if (!outName) { - outName = name; + outName = name.c_str(); } std::string inFName = "CPack."; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index bebb63337..e350a609d 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -38,9 +38,9 @@ public: virtual bool SupportsComponentInstallation() const; protected: - int CopyInstallScript(const char* resdir, - const char* script, - const char* name); + int CopyInstallScript(const std::string& resdir, + const std::string& script, + const std::string& name); virtual int InitializeInternal(); int PackageFiles(); virtual const char* GetOutputExtension() { return ".dmg"; } @@ -53,7 +53,7 @@ protected: // which will be configured via ConfigureFile. bool CopyCreateResourceFile(const std::string& name, const std::string& dirName); - bool CopyResourcePlistFile(const char* name, const char* outName = 0); + bool CopyResourcePlistFile(const std::string& name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if // successful) produce the given package file. Returns true if diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index 840ebc93f..3014a9322 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -225,35 +225,35 @@ private: return true; } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { this->CData.clear(); - if(strcmp(name, "log") == 0) + if(name == "log") { this->Rev = Revision(); this->Changes.clear(); } // affected-files can contain blocks of // modified, unknown, renamed, kind-changed, removed, conflicts, added - else if(strcmp(name, "modified") == 0 - || strcmp(name, "renamed") == 0 - || strcmp(name, "kind-changed") == 0) + else if(name == "modified" + || name == "renamed" + || name == "kind-changed") { this->CurChange = Change(); this->CurChange.Action = 'M'; } - else if(strcmp(name, "added") == 0) + else if(name == "added") { this->CurChange = Change(); this->CurChange = 'A'; } - else if(strcmp(name, "removed") == 0) + else if(name == "removed") { this->CurChange = Change(); this->CurChange = 'D'; } - else if(strcmp(name, "unknown") == 0 - || strcmp(name, "conflicts") == 0) + else if(name == "unknown" + || name == "conflicts") { // Should not happen here this->CurChange = Change(); @@ -265,27 +265,27 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "log") == 0) + if(name == "log") { this->BZR->DoRevision(this->Rev, this->Changes); } - else if((strcmp(name, "file") == 0 || strcmp(name, "directory") == 0) - && !this->CData.empty()) + else if(!this->CData.empty() && + (name == "file" || name == "directory")) { this->CurChange.Path.assign(&this->CData[0], this->CData.size()); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "symlink") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "symlink") { // symlinks have an arobase at the end in the log this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1); cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "committer") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "committer") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); if(this->EmailRegex.find(this->Rev.Author)) @@ -294,15 +294,15 @@ private: this->Rev.EMail = this->EmailRegex.match(2); } } - else if(strcmp(name, "timestamp") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "timestamp") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "message") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "message") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "revno") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "revno") { this->Rev.Rev.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestBuildCommand.cxx b/Source/CTest/cmCTestBuildCommand.cxx index 9738bded9..c60ded065 100644 --- a/Source/CTest/cmCTestBuildCommand.cxx +++ b/Source/CTest/cmCTestBuildCommand.cxx @@ -131,8 +131,8 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler() std::string buildCommand = this->GlobalGenerator-> GenerateCMakeBuildCommand(cmakeBuildTarget ? cmakeBuildTarget : "", - cmakeBuildConfiguration, - cmakeBuildAdditionalFlags, true); + cmakeBuildConfiguration, + cmakeBuildAdditionalFlags ? cmakeBuildAdditionalFlags : "", true); cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "SetMakeCommand:" << buildCommand.c_str() << "\n"); diff --git a/Source/CTest/cmCTestHG.cxx b/Source/CTest/cmCTestHG.cxx index 5bf994989..0f79d68a0 100644 --- a/Source/CTest/cmCTestHG.cxx +++ b/Source/CTest/cmCTestHG.cxx @@ -189,10 +189,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); if(const char* rev = this->FindAttribute(atts, "revision")) @@ -208,29 +208,29 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->HG->DoRevision(this->Rev, this->Changes); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if ( strcmp(name, "email") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "email") { this->Rev.EMail.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "files") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "files") { std::vector paths = this->SplitCData(); for(unsigned int i = 0; i < paths.size(); ++i) @@ -242,7 +242,7 @@ private: this->Changes.push_back(this->CurChange); } } - else if(strcmp(name, "file_adds") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_adds") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) @@ -253,7 +253,7 @@ private: } } } - else if(strcmp(name, "file_dels") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "file_dels") { std::string added_paths(this->CData.begin(), this->CData.end()); for(unsigned int i = 0; i < this->Changes.size(); ++i) diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index f2982a4f2..f27dbc098 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -49,21 +49,15 @@ class cmBoundsCheckerParser : public cmXMLParser { public: cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;} - void StartElement(const char* name, const char** atts) + void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "MemoryLeak") == 0) + if(name == "MemoryLeak" || + name == "ResourceLeak") { this->Errors.push_back(cmCTestMemCheckHandler::MLK); } - if(strcmp(name, "ResourceLeak") == 0) - { - this->Errors.push_back(cmCTestMemCheckHandler::MLK); - } - if(strcmp(name, "Error") == 0) - { - this->ParseError(atts); - } - if(strcmp(name, "Dangling Pointer") == 0) + else if(name == "Error" || + name == "Dangling Pointer") { this->ParseError(atts); } @@ -79,7 +73,7 @@ public: ostr << "\n"; this->Log += ostr.str(); } - void EndElement(const char* ) + void EndElement(const std::string& ) { } diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 89592dd8e..86dc2f2fd 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -361,10 +361,10 @@ private: return true; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CData.clear(); - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->Rev = Revision(); this->Rev.SVNInfo = &SVNRepo; @@ -374,7 +374,7 @@ private: } this->Changes.clear(); } - else if(strcmp(name, "path") == 0) + else if(name == "path") { this->CurChange = Change(); if(const char* action = this->FindAttribute(atts, "action")) @@ -389,28 +389,28 @@ private: this->CData.insert(this->CData.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "logentry") == 0) + if(name == "logentry") { this->SVN->DoRevisionSVN(this->Rev, this->Changes); } - else if(strcmp(name, "path") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "path") { std::string orig_path(&this->CData[0], this->CData.size()); std::string new_path = SVNRepo.BuildLocalPath( orig_path ); this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } - else if(strcmp(name, "author") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "author") { this->Rev.Author.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "date") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "date") { this->Rev.Date.assign(&this->CData[0], this->CData.size()); } - else if(strcmp(name, "msg") == 0 && !this->CData.empty()) + else if(!this->CData.empty() && name == "msg") { this->Rev.Log.assign(&this->CData[0], this->CData.size()); } diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx index 1cd8fc76f..3173f1564 100644 --- a/Source/CTest/cmCTestSubmitHandler.cxx +++ b/Source/CTest/cmCTestSubmitHandler.cxx @@ -68,10 +68,10 @@ private: return val; } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { this->CurrentValue.clear(); - if(strcmp(name, "cdash") == 0) + if(name == "cdash") { this->CDashVersion = this->FindAttribute(atts, "version"); } @@ -82,9 +82,9 @@ private: this->CurrentValue.insert(this->CurrentValue.end(), data, data+length); } - virtual void EndElement(const char* name) + virtual void EndElement(const std::string& name) { - if(strcmp(name, "status") == 0) + if(name == "status") { std::string status = cmSystemTools::UpperCase(this->GetCurrentValue()); if(status == "OK" || status == "SUCCESS") @@ -100,15 +100,15 @@ private: this->Status = STATUS_ERROR; } } - else if(strcmp(name, "filename") == 0) + else if(name == "filename") { this->Filename = this->GetCurrentValue(); } - else if(strcmp(name, "md5") == 0) + else if(name == "md5") { this->MD5 = this->GetCurrentValue(); } - else if(strcmp(name, "message") == 0) + else if(name == "message") { this->Message = this->GetCurrentValue(); } diff --git a/Source/CTest/cmParsePythonCoverage.cxx b/Source/CTest/cmParsePythonCoverage.cxx index 38a770ac8..2578bb876 100644 --- a/Source/CTest/cmParsePythonCoverage.cxx +++ b/Source/CTest/cmParsePythonCoverage.cxx @@ -20,9 +20,9 @@ public: protected: - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { - if(strcmp(name, "class") == 0) + if(name == "class") { int tagCount = 0; while(true) @@ -57,7 +57,7 @@ protected: ++tagCount; } } - else if(strcmp(name, "line") == 0) + else if(name == "line") { int tagCount = 0; int curNumber = -1; @@ -85,7 +85,7 @@ protected: } } - virtual void EndElement(const char*) {} + virtual void EndElement(const std::string&) {} private: diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index 652b2df7a..aa680fb9a 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -89,7 +89,7 @@ void cmCursesOptionsWidget::PreviousOption() this->SetValue(this->Options[this->CurrentOption].c_str()); } -void cmCursesOptionsWidget::SetOption(const char* value) +void cmCursesOptionsWidget::SetOption(const std::string& value) { this->CurrentOption = 0; // default to 0 index this->SetValue(value); diff --git a/Source/CursesDialog/cmCursesOptionsWidget.h b/Source/CursesDialog/cmCursesOptionsWidget.h index b52ac9de9..5cee489b0 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.h +++ b/Source/CursesDialog/cmCursesOptionsWidget.h @@ -25,7 +25,7 @@ public: // when this widget has focus. Returns true if the input was // handled. virtual bool HandleInput(int& key, cmCursesMainForm* fm, WINDOW* w); - void SetOption(const char*); + void SetOption(const std::string&); void AddOption(std::string const &); void NextOption(); void PreviousOption(); diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index bd1ff71c6..d25022d59 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -195,7 +195,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm, return true; } -void cmCursesStringWidget::SetString(const char* value) +void cmCursesStringWidget::SetString(const std::string& value) { this->SetValue(value); } diff --git a/Source/CursesDialog/cmCursesStringWidget.h b/Source/CursesDialog/cmCursesStringWidget.h index e939049df..dd8c02a32 100644 --- a/Source/CursesDialog/cmCursesStringWidget.h +++ b/Source/CursesDialog/cmCursesStringWidget.h @@ -37,7 +37,7 @@ public: /** * Set/Get the string. */ - void SetString(const char* value); + void SetString(const std::string& value); const char* GetString(); virtual const char* GetValue(); diff --git a/Source/CursesDialog/cmCursesWidget.cxx b/Source/CursesDialog/cmCursesWidget.cxx index 5dffcaa5c..e5363f489 100644 --- a/Source/CursesDialog/cmCursesWidget.cxx +++ b/Source/CursesDialog/cmCursesWidget.cxx @@ -46,10 +46,10 @@ void cmCursesWidget::Move(int x, int y, bool isNewPage) } } -void cmCursesWidget::SetValue(const char* value) +void cmCursesWidget::SetValue(const std::string& value) { this->Value = value; - set_field_buffer(this->Field, 0, value); + set_field_buffer(this->Field, 0, value.c_str()); } const char* cmCursesWidget::GetValue() diff --git a/Source/CursesDialog/cmCursesWidget.h b/Source/CursesDialog/cmCursesWidget.h index 952c67a86..d91a0cb5f 100644 --- a/Source/CursesDialog/cmCursesWidget.h +++ b/Source/CursesDialog/cmCursesWidget.h @@ -40,7 +40,7 @@ public: * Set/Get the value (setting the value also changes the contents * of the field buffer). */ - virtual void SetValue(const char* value); + virtual void SetValue(const std::string& value); virtual const char* GetValue(); /** diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx index 39b9ae53c..159f9c307 100644 --- a/Source/cmCacheManager.cxx +++ b/Source/cmCacheManager.cxx @@ -94,7 +94,7 @@ bool cmCacheManager::LoadCache(const std::string& path, return this->LoadCache(path, internal, emptySet, emptySet); } -static bool ParseEntryWithoutType(const char* entry, +static bool ParseEntryWithoutType(const std::string& entry, std::string& var, std::string& value) { @@ -132,7 +132,7 @@ static bool ParseEntryWithoutType(const char* entry, return flag; } -bool cmCacheManager::ParseEntry(const char* entry, +bool cmCacheManager::ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type) diff --git a/Source/cmCacheManager.h b/Source/cmCacheManager.h index 573f828f1..07a8675b1 100644 --- a/Source/cmCacheManager.h +++ b/Source/cmCacheManager.h @@ -136,7 +136,7 @@ public: return static_cast(this->Cache.size()); } ///! Break up a line like VAR:type="value" into var, type and value - static bool ParseEntry(const char* entry, + static bool ParseEntry(const std::string& entry, std::string& var, std::string& value, CacheEntryType& type); diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h index cf91c6985..abd8ad531 100644 --- a/Source/cmExportFileGenerator.h +++ b/Source/cmExportFileGenerator.h @@ -50,7 +50,7 @@ public: const char *GetMainExportFileName() const; /** Set the namespace in which to place exported target names. */ - void SetNamespace(const char* ns) { this->Namespace = ns; } + void SetNamespace(const std::string& ns) { this->Namespace = ns; } std::string GetNamespace() const { return this->Namespace; } void SetExportOld(bool exportOld) { this->ExportOld = exportOld; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b7af21bb6..a14696d25 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1790,7 +1790,7 @@ int cmGlobalGenerator::Build( //---------------------------------------------------------------------------- std::string cmGlobalGenerator::GenerateCMakeBuildCommand( const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors) { std::string makeCommand = cmSystemTools::GetCMakeCommand(); @@ -1819,7 +1819,7 @@ std::string cmGlobalGenerator::GenerateCMakeBuildCommand( sep = " "; } } - if(native && *native) + if(!native.empty()) { makeCommand += sep; makeCommand += native; @@ -2528,9 +2528,10 @@ std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage( } //---------------------------------------------------------------------------- -void cmGlobalGenerator::AppendDirectoryForConfig(const char*, +void cmGlobalGenerator::AppendDirectoryForConfig(const std::string&, const std::string&, - const char*, std::string&) + const std::string&, + std::string&) { // Subclasses that support multiple configurations should implement // this method to append the subdirectory for the given build diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index e9a1b4740..5b979605a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -138,7 +138,7 @@ public: /** Generate a "cmake --build" call for a given target and config. */ std::string GenerateCMakeBuildCommand(const std::string& target, const std::string& config, - const char* native, + const std::string& native, bool ignoreErrors); ///! Set the CMake instance @@ -230,9 +230,9 @@ public: /** Append the subdirectory for the given configuration. If anything is appended the given prefix and suffix will be appended around it, which is useful for leading or trailing slashes. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); /** Get the manifest of all targets that will be built for each @@ -292,7 +292,7 @@ public: return this->BinaryDirectories.insert(dir).second; } /** Supported systems creates a GUID for the given name */ - virtual void CreateGUID(const char*) {} + virtual void CreateGUID(const std::string&) {} /** Return true if the generated build tree may contain multiple builds. i.e. "Can I build Debug and Release in the same tree?" */ diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index f69bcfd99..82047d744 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -418,9 +418,9 @@ void cmGlobalVisualStudio6Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio6Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h index 22ec926a8..f7ef9729a 100644 --- a/Source/cmGlobalVisualStudio6Generator.h +++ b/Source/cmGlobalVisualStudio6Generator.h @@ -81,9 +81,9 @@ public: std::vector& generators); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 18f7f195f..c65bdaacb 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -924,7 +924,7 @@ std::string cmGlobalVisualStudio7Generator::GetGUID(const std::string& name) } -void cmGlobalVisualStudio7Generator::CreateGUID(const char* name) +void cmGlobalVisualStudio7Generator::CreateGUID(const std::string& name) { std::string guidStoreName = name; guidStoreName += "_GUID_CMAKE"; @@ -961,9 +961,9 @@ void cmGlobalVisualStudio7Generator //---------------------------------------------------------------------------- void cmGlobalVisualStudio7Generator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(!config.empty()) diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 009f0025b..342fa88d5 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -89,13 +89,13 @@ public: std::vector *GetConfigurations(); ///! Create a GUID or get an existing one. - void CreateGUID(const char* name); + void CreateGUID(const std::string& name); std::string GetGUID(const std::string& name); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index c0077b923..ec2e1e983 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -34,17 +34,17 @@ class cmXcodeVersionParser : public cmXMLParser { public: cmXcodeVersionParser(): Version("1.5") {} - void StartElement(const char* , const char** ) + void StartElement(const std::string&, const char**) { this->Data = ""; } - void EndElement(const char* name) + void EndElement(const std::string& name) { - if(strcmp(name, "key") == 0) + if(name == "key") { this->Key = this->Data; } - else if(strcmp(name, "string") == 0) + else if(name == "string") { if(this->Key == "CFBundleShortVersionString") { @@ -1005,7 +1005,7 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen, gtgt->GetTargetSourceFileFlags(*i); if(filetype && - strcmp(filetype->GetString(), "compiled.mach-o.objfile") == 0) + filetype->GetString() == "compiled.mach-o.objfile") { externalObjFiles.push_back(xsf); } @@ -3771,9 +3771,9 @@ std::string cmGlobalXCodeGenerator::XCodeEscapePath(const char* p) //---------------------------------------------------------------------------- void cmGlobalXCodeGenerator -::AppendDirectoryForConfig(const char* prefix, +::AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir) { if(this->XcodeVersion > 20) diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 03e75c4d6..e9149c2d4 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -72,9 +72,9 @@ public: virtual void Generate(); /** Append the subdirectory for the given configuration. */ - virtual void AppendDirectoryForConfig(const char* prefix, + virtual void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, - const char* suffix, + const std::string& suffix, std::string& dir); ///! What is the configurations directory variable called? diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 251661391..f7088c2da 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -1299,7 +1299,7 @@ cmLocalUnixMakefileGenerator3::AppendEcho(std::vector& commands, //---------------------------------------------------------------------------- std::string cmLocalUnixMakefileGenerator3 -::CreateMakeVariable(const char* sin, const char* s2in) +::CreateMakeVariable(const std::string& sin, const std::string& s2in) { std::string s = sin; std::string s2 = s2in; diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index 37ee87474..39f213b65 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -75,7 +75,7 @@ public: /** * Set the flag used to keep the make program silent. */ - void SetMakeSilentFlag(const char* s) { this->MakeSilentFlag = s; } + void SetMakeSilentFlag(const std::string& s) { this->MakeSilentFlag = s; } std::string &GetMakeSilentFlag() { return this->MakeSilentFlag; } /** @@ -130,8 +130,9 @@ public: * Set the string used to include one makefile into another default * is include. */ - void SetIncludeDirective(const char* s) { this->IncludeDirective = s; } - const char *GetIncludeDirective() { return this->IncludeDirective.c_str(); } + void SetIncludeDirective(const std::string& s) + { this->IncludeDirective = s; } + const std::string& GetIncludeDirective() { return this->IncludeDirective; } /** * Set max makefile variable size, default is 0 which means unlimited. @@ -192,7 +193,8 @@ public: static std::string ConvertToQuotedOutputPath(const char* p); - std::string CreateMakeVariable(const char* sin, const char* s2in); + std::string CreateMakeVariable(const std::string& sin, + const std::string& s2in); /** Called from command-line hook to bring dependencies up to date for a target. */ diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx index aedd6edbf..aa70ab9d6 100644 --- a/Source/cmLocalVisualStudio10Generator.cxx +++ b/Source/cmLocalVisualStudio10Generator.cxx @@ -19,7 +19,7 @@ class cmVS10XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } virtual void CharacterDataHandler(const char* data, int length) @@ -30,14 +30,14 @@ class cmVS10XMLParser : public cmXMLParser this->DoGUID = false; } } - virtual void StartElement(const char* name, const char**) + virtual void StartElement(const std::string& name, const char**) { // once the GUID is found do nothing if(this->GUID.size()) { return; } - if(strcmp("ProjectGUID", name) == 0 || strcmp("ProjectGuid", name) == 0) + if("ProjectGUID" == name || "ProjectGuid" == name) { this->DoGUID = true; } @@ -98,7 +98,7 @@ void cmLocalVisualStudio10Generator::Generate() void cmLocalVisualStudio10Generator -::ReadAndStoreExternalGUID(const char* name, +::ReadAndStoreExternalGUID(const std::string& name, const char* path) { cmVS10XMLParser parser; diff --git a/Source/cmLocalVisualStudio10Generator.h b/Source/cmLocalVisualStudio10Generator.h index 41db735b2..b50e3458b 100644 --- a/Source/cmLocalVisualStudio10Generator.h +++ b/Source/cmLocalVisualStudio10Generator.h @@ -34,7 +34,7 @@ public: * Generate the makefile for this directory. */ virtual void Generate(); - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); protected: diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 5f98a713e..0bbafd80d 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -2146,10 +2146,10 @@ std::string cmLocalVisualStudio7Generator class cmVS7XMLParser : public cmXMLParser { public: - virtual void EndElement(const char* /* name */) + virtual void EndElement(const std::string& /* name */) { } - virtual void StartElement(const char* name, const char** atts) + virtual void StartElement(const std::string& name, const char** atts) { // once the GUID is found do nothing if(this->GUID.size()) @@ -2157,7 +2157,7 @@ public: return; } int i =0; - if(strcmp("VisualStudioProject", name) == 0) + if("VisualStudioProject" == name) { while(atts[i]) { @@ -2194,7 +2194,7 @@ public: }; void cmLocalVisualStudio7Generator::ReadAndStoreExternalGUID( - const char* name, + const std::string& name, const char* path) { cmVS7XMLParser parser; diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index f9bb6e195..d2e66a5c9 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -51,7 +51,7 @@ public: /** * Specify the type of the build: static, dll, or executable. */ - void SetBuildType(BuildType,const char *name); + void SetBuildType(BuildType,const std::string& name); void SetPlatformName(const char* n) { this->PlatformName = n;} @@ -62,7 +62,7 @@ public: void WriteStampFiles(); virtual std::string ComputeLongestObjectDirectory(cmTarget&) const; - virtual void ReadAndStoreExternalGUID(const char* name, + virtual void ReadAndStoreExternalGUID(const std::string& name, const char* path); virtual void AddCMakeListsRules(); protected: diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx index 11b038772..6e93d22c2 100644 --- a/Source/cmLocalVisualStudioGenerator.cxx +++ b/Source/cmLocalVisualStudioGenerator.cxx @@ -81,7 +81,7 @@ std::string cmLocalVisualStudioGenerator ::ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline_text) + const std::string& newline_text) { bool useLocal = this->CustomCommandUseLocal(); const char* workingDirectory = cc.GetWorkingDirectory(); @@ -89,7 +89,7 @@ cmLocalVisualStudioGenerator RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT; // Avoid leading or trailing newlines. - const char* newline = ""; + std::string newline = ""; // Line to check for error between commands. std::string check_error = newline_text; diff --git a/Source/cmLocalVisualStudioGenerator.h b/Source/cmLocalVisualStudioGenerator.h index 2297072b5..94a6293b6 100644 --- a/Source/cmLocalVisualStudioGenerator.h +++ b/Source/cmLocalVisualStudioGenerator.h @@ -48,7 +48,7 @@ public: /** Construct a script from the given list of command lines. */ std::string ConstructScript(cmCustomCommand const& cc, const std::string& configName, - const char* newline = "\n"); + const std::string& newline = "\n"); /** Label to which to jump in a batch file after a failed step in a sequence of custom commands. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 25ca1683a..595244436 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4100,7 +4100,8 @@ bool cmTarget::ComputeOutputDir(const std::string& config, } //---------------------------------------------------------------------------- -bool cmTarget::ComputePDBOutputDir(const char* kind, const std::string& config, +bool cmTarget::ComputePDBOutputDir(const std::string& kind, + const std::string& config, std::string& out) const { // Look for a target property defining the target output directory diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 15f00bec6..d5ef18d9f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -714,7 +714,7 @@ private: bool ComputeOutputDir(const std::string& config, bool implib, std::string& out) const; - bool ComputePDBOutputDir(const char* kind, const std::string& config, + bool ComputePDBOutputDir(const std::string& kind, const std::string& config, std::string& out) const; // Cache import information from properties for each configuration. diff --git a/Source/cmVisualStudioWCEPlatformParser.cxx b/Source/cmVisualStudioWCEPlatformParser.cxx index 219a5eb49..ca226fb50 100644 --- a/Source/cmVisualStudioWCEPlatformParser.cxx +++ b/Source/cmVisualStudioWCEPlatformParser.cxx @@ -62,7 +62,7 @@ const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const return 0; } -void cmVisualStudioWCEPlatformParser::StartElement(const char* name, +void cmVisualStudioWCEPlatformParser::StartElement(const std::string& name, const char** attributes) { if(this->FoundRequiredName) @@ -72,7 +72,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->CharacterData = ""; - if(strcmp(name, "PlatformData") == 0) + if(name == "PlatformData") { this->PlatformName = ""; this->OSMajorVersion = ""; @@ -80,7 +80,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros.clear(); } - if(strcmp(name, "Macro") == 0) + if(name == "Macro") { std::string macroName; std::string macroValue; @@ -102,7 +102,7 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, this->Macros[macroName] = macroValue; } } - else if(strcmp(name, "Directories") == 0) + else if(name == "Directories") { for(const char** attr = attributes; *attr; attr += 2) { @@ -122,11 +122,11 @@ void cmVisualStudioWCEPlatformParser::StartElement(const char* name, } } -void cmVisualStudioWCEPlatformParser::EndElement(const char* name) +void cmVisualStudioWCEPlatformParser::EndElement(const std::string& name) { if(!this->RequiredName) { - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->AvailablePlatforms.push_back(this->CharacterData); } @@ -138,19 +138,19 @@ void cmVisualStudioWCEPlatformParser::EndElement(const char* name) return; } - if(strcmp(name, "PlatformName") == 0) + if(name == "PlatformName") { this->PlatformName = this->CharacterData; } - else if(strcmp(name, "OSMajorVersion") == 0) + else if(name == "OSMajorVersion") { this->OSMajorVersion = this->CharacterData; } - else if(strcmp(name, "OSMinorVersion") == 0) + else if(name == "OSMinorVersion") { this->OSMinorVersion = this->CharacterData; } - else if(strcmp(name, "Platform") == 0) + else if(name == "Platform") { if(this->PlatformName == this->RequiredName) { diff --git a/Source/cmVisualStudioWCEPlatformParser.h b/Source/cmVisualStudioWCEPlatformParser.h index 466e1dd43..042df0142 100644 --- a/Source/cmVisualStudioWCEPlatformParser.h +++ b/Source/cmVisualStudioWCEPlatformParser.h @@ -41,8 +41,8 @@ public: return this->AvailablePlatforms; } protected: - virtual void StartElement(const char* name, const char** attributes); - void EndElement(const char* name); + virtual void StartElement(const std::string& name, const char** attributes); + void EndElement(const std::string& name); void CharacterDataHandler(const char* data, int length); private: diff --git a/Source/cmXCodeObject.h b/Source/cmXCodeObject.h index 3a6528ae9..ed2940a0c 100644 --- a/Source/cmXCodeObject.h +++ b/Source/cmXCodeObject.h @@ -38,12 +38,12 @@ public: PBXType GetIsA() { return this->IsA;} void SetString(const std::string& s); - const char* GetString() + const std::string& GetString() { - return this->String.c_str(); + return this->String; } - void AddAttribute(const char* name, cmXCodeObject* value) + void AddAttribute(const std::string& name, cmXCodeObject* value) { this->ObjectAttributes[name] = value; } @@ -79,11 +79,11 @@ public: static void PrintList(std::vector const&, std::ostream& out); - const char* GetId() + const std::string& GetId() { - return this->Id.c_str(); + return this->Id; } - void SetId(const char* id) + void SetId(const std::string& id) { this->Id = id; } @@ -95,8 +95,8 @@ public: { this->Target = t; } - const char* GetComment() {return this->Comment.c_str();} - bool HasComment() { return (this->Comment.size() != 0);} + const std::string& GetComment() {return this->Comment;} + bool HasComment() { return (!this->Comment.empty());} cmXCodeObject* GetObject(const char* name) { if(this->ObjectAttributes.count(name)) @@ -141,7 +141,7 @@ public: return this->DependTargets; } std::vector const& GetObjectList() { return this->List;} - void SetComment(const char* c) { this->Comment = c;} + void SetComment(const std::string& c) { this->Comment = c;} static void PrintString(std::ostream& os,std::string String); protected: void PrintString(std::ostream& os) const; diff --git a/Source/cmXMLParser.cxx b/Source/cmXMLParser.cxx index 0c53440ef..a73fd7032 100644 --- a/Source/cmXMLParser.cxx +++ b/Source/cmXMLParser.cxx @@ -152,14 +152,14 @@ int cmXMLParser::ParsingComplete() } //---------------------------------------------------------------------------- -void cmXMLParser::StartElement(const char * name, +void cmXMLParser::StartElement(const std::string& name, const char ** /*atts*/) { std::cout << "Start element: " << name << std::endl; } //---------------------------------------------------------------------------- -void cmXMLParser::EndElement(const char * name) +void cmXMLParser::EndElement(const std::string& name) { std::cout << "End element: " << name << std::endl; } diff --git a/Source/cmXMLParser.h b/Source/cmXMLParser.h index d916075e5..84a5a7dd6 100644 --- a/Source/cmXMLParser.h +++ b/Source/cmXMLParser.h @@ -74,11 +74,11 @@ protected: * element. atts = Null-terminated array of attribute name/value pairs. * Even indices are attribute names, and odd indices are values. */ - virtual void StartElement(const char* name, const char** atts); + virtual void StartElement(const std::string& name, const char** atts); //! Called at the end of an element in the XML source opened when //StartElement was called. - virtual void EndElement(const char* name); + virtual void EndElement(const std::string& name); //! Called when there is character data to handle. virtual void CharacterDataHandler(const char* data, int length);