浏览代码

stringapi: Use string for OS X resource names

Ben Boeckel 11 年之前
父节点
当前提交
473ca1ac4a

+ 3 - 3
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;

+ 3 - 2
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;
 };

+ 5 - 4
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 : "<empty>")
                   << ".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 : "<empty>")
                   << " resource file: " << inFileName << std::endl);
     return false;
     }

+ 2 - 1
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