Core: Append single character to stream as character, not as a string

This commit is contained in:
Spp-
2011-07-29 14:18:28 +02:00
parent 06b46ba203
commit e47b96af3e
70 changed files with 432 additions and 424 deletions

View File

@@ -340,12 +340,12 @@ std::string MySQLPreparedStatement::getQueryString(const char *query)
pos = queryString.find("?", pos);
std::stringstream replace;
replace << "'";
replace << '\'';
switch (m_stmt->statement_data[i].type)
{
case TYPE_BOOL:
replace << (m_stmt->statement_data[i].data.boolean ? "1" : "0");
replace << (m_stmt->statement_data[i].data.boolean ? '1' : '0');
break;
case TYPE_UI8:
case TYPE_UI16:
@@ -373,7 +373,7 @@ std::string MySQLPreparedStatement::getQueryString(const char *query)
replace << m_stmt->statement_data[i].str;
break;
}
replace << "'";
replace << '\'';
queryString.replace(pos, 1, replace.str());
}

View File

@@ -120,7 +120,7 @@ void Log::Initialize()
m_logsDir = sConfig->GetStringDefault("LogsDir", "");
if (!m_logsDir.empty())
if ((m_logsDir.at(m_logsDir.length() - 1) != '/') && (m_logsDir.at(m_logsDir.length() - 1) != '\\'))
m_logsDir.append("/");
m_logsDir.push_back('/');
m_logsTimestamp = "_" + GetTimestampStr();
@@ -183,7 +183,7 @@ void Log::Initialize()
m_dumpsDir = sConfig->GetStringDefault("CharLogDump.SeparateDir", "");
if (!m_dumpsDir.empty())
if ((m_dumpsDir.at(m_dumpsDir.length() - 1) != '/') && (m_dumpsDir.at(m_dumpsDir.length() - 1) != '\\'))
m_dumpsDir.append("/");
m_dumpsDir.push_back('/');
}
}

View File

@@ -182,7 +182,7 @@ uint32 TimeStringToSecs(const std::string& timestring)
uint32 buffer = 0;
uint32 multiplier = 0;
for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
for (std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); ++itr)
{
if(isdigit(*itr))
{
@@ -318,11 +318,11 @@ bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
{
try
{
size_t len = utf8::distance(utf8str.c_str(), utf8str.c_str()+utf8str.size());
wstr.resize(len);
if (len)
if (size_t len = utf8::distance(utf8str.c_str(), utf8str.c_str()+utf8str.size()))
{
wstr.resize(len);
utf8::utf8to16(utf8str.c_str(), utf8str.c_str()+utf8str.size(), &wstr[0]);
}
}
catch(std::exception)
{