This commit is contained in:
unK
2008-09-13 15:46:33 +02:00
parent 0a534ad8cf
commit 0060450b10
4 changed files with 21 additions and 25 deletions

View File

@@ -629,7 +629,7 @@ char * ToString(const wchar_t *ws)
string s;
for (int i = 0; i < wcslen(ws); i++)
{
char *c = (char *)calloc(MB_CUR_MAX, sizeof(char));
char *c = new char[MB_CUR_MAX]();
wctomb(c, ws[i]);
s += c;
delete [] c;
@@ -640,7 +640,7 @@ char * ToString(const wchar_t *ws)
wchar_t * ToWString(const char *s)
{
wchar_t *ws = (wchar_t *)calloc(strlen(s)+1, sizeof(wchar_t));
wchar_t *ws = new wchar_t[strlen(s)+1]();
mbstowcs(ws, s, strlen(s));
return ws;
}
@@ -650,7 +650,7 @@ string ToString(const wstring &ws)
string s;
for (wstring::const_iterator it = ws.begin(); it != ws.end(); it++)
{
char *c = (char *)calloc(MB_CUR_MAX, sizeof(char));
char *c = new char[MB_CUR_MAX]();
wctomb(c, *it);
s += c;
delete [] c;
@@ -660,14 +660,13 @@ string ToString(const wstring &ws)
wstring ToWString(const string &s)
{
wchar_t *ws = (wchar_t *)calloc(s.length()+1, sizeof(wchar_t));
wchar_t *ws = new wchar_t[s.length()+1]();
mbstowcs(ws, s.c_str(), s.length());
wstring result = ws;
delete [] ws;
return result;
}
string Window::OmitBBCodes(const string &str)
{
bool collect = false;