aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared/Utilities/Util.cpp
diff options
context:
space:
mode:
authorDDuarte <dnpd.dd@gmail.com>2014-09-19 03:30:02 +0100
committerDDuarte <dnpd.dd@gmail.com>2014-09-19 03:30:02 +0100
commitcefcde9ba9a4d951500ffb267134eaebaad6b928 (patch)
tree7082078a89fa484c798b8ee89eccb9b5afb1f434 /src/server/shared/Utilities/Util.cpp
parente6b7de8c9762b47be3e20feb65164c8c72523fe4 (diff)
Core/Misc: Multiple static analysis issues fixed (small optimizations and clear code)
Diffstat (limited to 'src/server/shared/Utilities/Util.cpp')
-rw-r--r--src/server/shared/Utilities/Util.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index f2c02510ed4..e577797d3e0 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;