[6899] Pass const reference instead of value for some strings in some functions.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2008-12-12 14:16:24 +01:00
parent d386a67d27
commit 0f12997ef1
40 changed files with 108 additions and 108 deletions

View file

@ -131,13 +131,13 @@ std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly)
return ss.str();
}
uint32 TimeStringToSecs(std::string timestring)
uint32 TimeStringToSecs(const std::string& timestring)
{
uint32 secs = 0;
uint32 buffer = 0;
uint32 multiplier = 0;
for(std::string::iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
{
if(isdigit(*itr))
{
@ -193,7 +193,7 @@ bool IsIPAddress(char const* ipaddress)
}
/// create PID file
uint32 CreatePIDFile(std::string filename)
uint32 CreatePIDFile(const std::string& filename)
{
FILE * pid_file = fopen (filename.c_str(), "w" );
if (pid_file == NULL)
@ -271,7 +271,7 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
return true;
}
bool Utf8toWStr(std::string utf8str, std::wstring& wstr)
bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
{
try
{
@ -376,7 +376,7 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
return wname;
}
bool utf8ToConsole(std::string utf8str, std::string& conStr)
bool utf8ToConsole(const std::string& utf8str, std::string& conStr)
{
#if PLATFORM == PLATFORM_WINDOWS
std::wstring wstr;
@ -393,7 +393,7 @@ bool utf8ToConsole(std::string utf8str, std::string& conStr)
return true;
}
bool consoleToUtf8(std::string conStr,std::string& utf8str)
bool consoleToUtf8(const std::string& conStr,std::string& utf8str)
{
#if PLATFORM == PLATFORM_WINDOWS
std::wstring wstr;
@ -408,7 +408,7 @@ bool consoleToUtf8(std::string conStr,std::string& utf8str)
#endif
}
bool Utf8FitTo(std::string str, std::wstring search)
bool Utf8FitTo(const std::string& str, std::wstring search)
{
std::wstring temp;