make str_pool return const char * instead of char *

This commit is contained in:
Andrzej Rybczak
2009-07-10 14:44:20 +02:00
parent d8b8d4aeda
commit 209f5337ee
6 changed files with 32 additions and 32 deletions

View File

@@ -55,7 +55,7 @@ namespace
return false;
}
void charset_convert(const char *from, const char *to, char *&inbuf, size_t len = 0)
void charset_convert(const char *from, const char *to, const char *&inbuf, size_t len = 0)
{
if (!inbuf || !from || !to)
return;
@@ -70,7 +70,7 @@ namespace
size_t buflen = len*6+1;
char *outbuf = new char[buflen];
char *outstart = outbuf;
char *instart = inbuf;
const char *instart = inbuf;
if (iconv(cd, const_cast<ICONV_CONST char **>(&inbuf), &len, &outbuf, &buflen) == size_t(-1))
{
@@ -90,7 +90,7 @@ void utf_to_locale(std::string &s)
{
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
return;
char *tmp = str_pool_get(s.c_str());
const char *tmp = str_pool_get(s.c_str());
charset_convert("utf-8", Config.system_encoding.c_str(), tmp, s.length());
s = tmp;
str_pool_put(tmp);
@@ -107,7 +107,7 @@ void locale_to_utf(std::string &s)
{
if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s))
return;
char *tmp = str_pool_get(s.c_str());
const char *tmp = str_pool_get(s.c_str());
charset_convert(Config.system_encoding.c_str(), "utf-8", tmp, s.length());
s = tmp;
str_pool_put(tmp);
@@ -120,14 +120,14 @@ std::string locale_to_utf_cpy(const std::string &s)
return result;
}
void str_pool_utf_to_locale(char *&s)
void str_pool_utf_to_locale(const char *&s)
{
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
return;
charset_convert("utf-8", Config.system_encoding.c_str(), s);
}
void str_pool_locale_to_utf(char *&s)
void str_pool_locale_to_utf(const char *&s)
{
if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s))
return;