Commit b3bf31a5 authored by Ben Boeckel's avatar Ben Boeckel Committed by Brad King

stringapi: Miscellaneous char* parameters

parent 5af95c39
......@@ -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();
......
......@@ -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);
......
......@@ -16,7 +16,8 @@
#include <string>
//----------------------------------------------------------------------
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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -90,7 +90,7 @@ public:
/**
* Initialize generator
*/
int Initialize(const char* name, cmMakefile* mf);
int Initialize(const std::string& name, cmMakefile* mf);
/**
* Construct generator
......
......@@ -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.";
......
......@@ -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;
};
......
......@@ -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.";
......
......@@ -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
......
......@@ -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());
}
......
......@@ -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");
......
......@@ -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<std::string> 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)
......
......@@ -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& )
{
}
......
......@@ -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());
}
......
......@@ -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();
}
......
......@@ -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:
......
......@@ -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);
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -37,7 +37,7 @@ public:
/**
* Set/Get the string.
*/
void SetString(</