diff options
Diffstat (limited to 'src/server/shared/Utilities')
| -rw-r--r-- | src/server/shared/Utilities/ServiceWin32.cpp | 3 | ||||
| -rw-r--r-- | src/server/shared/Utilities/Util.cpp | 16 | ||||
| -rw-r--r-- | src/server/shared/Utilities/Util.h | 7 |
3 files changed, 13 insertions, 13 deletions
diff --git a/src/server/shared/Utilities/ServiceWin32.cpp b/src/server/shared/Utilities/ServiceWin32.cpp index ecf403423f7..6e5309d70d7 100644 --- a/src/server/shared/Utilities/ServiceWin32.cpp +++ b/src/server/shared/Utilities/ServiceWin32.cpp @@ -204,7 +204,8 @@ void WINAPI ServiceMain(DWORD argc, char *argv[]) GetModuleFileName(0, path, sizeof(path)/sizeof(path[0])); - for (i = 0; i < std::strlen(path); i++) + size_t pathLen = std::strlen(path); + for (i = 0; i < pathLen; i++) { if (path[i] == '\\') last_slash = i; } diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 0bdc1fb714c..c4049ae6315 100644 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -294,7 +294,7 @@ size_t utf8length(std::string& utf8str) } catch(std::exception) { - utf8str = ""; + utf8str.clear(); return 0; } } @@ -316,7 +316,7 @@ void utf8truncate(std::string& utf8str, size_t len) } catch(std::exception) { - utf8str = ""; + utf8str.clear(); } } @@ -360,7 +360,7 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr) } catch(std::exception) { - wstr = L""; + wstr.clear(); return false; } @@ -383,14 +383,14 @@ bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str) } catch(std::exception) { - utf8str = ""; + utf8str.clear(); return false; } return true; } -bool WStrToUtf8(std::wstring wstr, std::string& utf8str) +bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str) { try { @@ -406,7 +406,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str) } catch(std::exception) { - utf8str = ""; + utf8str.clear(); return false; } @@ -415,7 +415,7 @@ bool WStrToUtf8(std::wstring wstr, std::string& utf8str) typedef wchar_t const* const* wstrlist; -std::wstring GetMainPartOfName(std::wstring wname, uint32 declension) +std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension) { // supported only Cyrillic cases if (wname.size() < 1 || !isCyrillicCharacter(wname[0]) || declension > 5) @@ -492,7 +492,7 @@ bool consoleToUtf8(const std::string& conStr, std::string& utf8str) #endif } -bool Utf8FitTo(const std::string& str, std::wstring search) +bool Utf8FitTo(const std::string& str, std::wstring const& search) { std::wstring temp; diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index d674acae09f..73ee37eb079 100644 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -147,7 +147,7 @@ inline bool Utf8toWStr(const std::string& utf8str, wchar_t* wstr, size_t& wsize) return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize); } -bool WStrToUtf8(std::wstring wstr, std::string& utf8str); +bool WStrToUtf8(std::wstring const& wstr, std::string& utf8str); // size==real string size bool WStrToUtf8(wchar_t* wstr, size_t size, std::string& utf8str); @@ -331,11 +331,11 @@ inline void wstrToLower(std::wstring& str) std::transform( str.begin(), str.end(), str.begin(), wcharToLower ); } -std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); +std::wstring GetMainPartOfName(std::wstring const& wname, uint32 declension); bool utf8ToConsole(const std::string& utf8str, std::string& conStr); bool consoleToUtf8(const std::string& conStr, std::string& utf8str); -bool Utf8FitTo(const std::string& str, std::wstring search); +bool Utf8FitTo(const std::string& str, std::wstring const& search); void utf8printf(FILE* out, const char *str, ...); void vutf8printf(FILE* out, const char *str, va_list* ap); bool Utf8ToUpperOnlyLatin(std::string& utf8String); @@ -878,7 +878,6 @@ class EventMap */ EventStore _eventMap; - /** * @name _lastEvent * @brief Stores information on the most recently executed event |
