From 473ca1ac4a5df336ff09ee2c666e437eabf43bc9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 7 Feb 2014 15:02:41 -0500 Subject: stringapi: Use string for OS X resource names --- Source/CPack/cmCPackOSXX11Generator.cxx | 6 +++--- Source/CPack/cmCPackOSXX11Generator.h | 5 +++-- Source/CPack/cmCPackPackageMakerGenerator.cxx | 9 +++++---- Source/CPack/cmCPackPackageMakerGenerator.h | 3 ++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx index 76e15fb..95ffab5 100644 --- a/Source/CPack/cmCPackOSXX11Generator.cxx +++ b/Source/CPack/cmCPackOSXX11Generator.cxx @@ -227,7 +227,7 @@ int cmCPackOSXX11Generator::InitializeInternal() //---------------------------------------------------------------------- /* -bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) +bool cmCPackOSXX11Generator::CopyCreateResourceFile(const std::string& name) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -271,7 +271,7 @@ bool cmCPackOSXX11Generator::CopyCreateResourceFile(const char* name) */ //---------------------------------------------------------------------- -bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, +bool cmCPackOSXX11Generator::CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName /* = 0 */, bool copyOnly /* = false */) { @@ -288,7 +288,7 @@ bool cmCPackOSXX11Generator::CopyResourcePlistFile(const char* name, if ( !outputFileName ) { - outputFileName = name; + outputFileName = name.c_str(); } std::string destFileName = dir; diff --git a/Source/CPack/cmCPackOSXX11Generator.h b/Source/CPack/cmCPackOSXX11Generator.h index b7bd243..7a93f5a 100644 --- a/Source/CPack/cmCPackOSXX11Generator.h +++ b/Source/CPack/cmCPackOSXX11Generator.h @@ -37,8 +37,9 @@ protected: virtual const char* GetPackagingInstallPrefix(); virtual const char* GetOutputExtension() { return ".dmg"; } - //bool CopyCreateResourceFile(const char* name, const char* dir); - bool CopyResourcePlistFile(const char* name, const char* dir, + //bool CopyCreateResourceFile(const std::string& name, + // const std::string& dir); + bool CopyResourcePlistFile(const std::string& name, const char* dir, const char* outputFileName = 0, bool copyOnly = false); std::string InstallPrefix; }; diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx index c5b9c6f..69886a1 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.cxx +++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx @@ -553,8 +553,9 @@ int cmCPackPackageMakerGenerator::InitializeInternal() } //---------------------------------------------------------------------- -bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, - const char* dirName) +bool cmCPackPackageMakerGenerator::CopyCreateResourceFile( + const std::string& name, + const std::string& dirName) { std::string uname = cmSystemTools::UpperCase(name); std::string cpackVar = "CPACK_RESOURCE_FILE_" + uname; @@ -563,7 +564,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, { cmCPackLogger(cmCPackLog::LOG_ERROR, "CPack option: " << cpackVar.c_str() << " not specified. It should point to " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << ".rtf, " << name << ".html, or " << name << ".txt file" << std::endl); return false; @@ -571,7 +572,7 @@ bool cmCPackPackageMakerGenerator::CopyCreateResourceFile(const char* name, if ( !cmSystemTools::FileExists(inFileName) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot find " - << (name ? name : "(NULL)") + << (!name.empty() ? name : "") << " resource file: " << inFileName << std::endl); return false; } diff --git a/Source/CPack/cmCPackPackageMakerGenerator.h b/Source/CPack/cmCPackPackageMakerGenerator.h index ba3d968..bebb633 100644 --- a/Source/CPack/cmCPackPackageMakerGenerator.h +++ b/Source/CPack/cmCPackPackageMakerGenerator.h @@ -51,7 +51,8 @@ protected: // CPACK_RESOURCE_FILE_${NAME} (where ${NAME} is the uppercased // version of name) specifies the input file to use for this file, // which will be configured via ConfigureFile. - bool CopyCreateResourceFile(const char* name, const char *dirName); + bool CopyCreateResourceFile(const std::string& name, + const std::string& dirName); bool CopyResourcePlistFile(const char* name, const char* outName = 0); // Run PackageMaker with the given command line, which will (if -- cgit v0.12