spaces fix
This commit is contained in:
parent
0e332f2709
commit
311bdf84bc
@ -671,4 +671,3 @@ void ResDataHolder::load(const std::wstring &name)
|
||||
data = resources->getRef(name, s);
|
||||
size = (size_t)s;
|
||||
}
|
||||
|
||||
|
18
unicode.cpp
18
unicode.cpp
@ -221,7 +221,7 @@ g_utf8_to_ucs4 (const char *str,
|
||||
long len,
|
||||
long *items_read,
|
||||
long *items_written,
|
||||
wchar_t **error)
|
||||
const wchar_t **error)
|
||||
{
|
||||
wchar_t *result = NULL;
|
||||
int n_chars, i;
|
||||
@ -363,7 +363,7 @@ g_ucs4_to_utf8 (const wchar_t *str,
|
||||
long len,
|
||||
long *items_read,
|
||||
long *items_written,
|
||||
wchar_t **error)
|
||||
const wchar_t **error)
|
||||
{
|
||||
int result_length;
|
||||
char *result = NULL;
|
||||
@ -410,7 +410,7 @@ g_ucs4_to_utf8 (const wchar_t *str,
|
||||
std::string toUtf8(const std::wstring &str)
|
||||
{
|
||||
long readed, writed;
|
||||
wchar_t *errMsg = NULL;
|
||||
const wchar_t *errMsg = NULL;
|
||||
|
||||
char *res = g_ucs4_to_utf8(str.c_str(), str.length(), &readed,
|
||||
&writed, &errMsg);
|
||||
@ -430,10 +430,9 @@ std::string toUtf8(const std::wstring &str)
|
||||
std::wstring fromUtf8(const std::string &str)
|
||||
{
|
||||
long readed, writed;
|
||||
wchar_t *errMsg = NULL;
|
||||
const wchar_t *errMsg = NULL;
|
||||
|
||||
wchar_t *res = g_utf8_to_ucs4(str.c_str(), str.length(), &readed,
|
||||
&writed, &errMsg);
|
||||
wchar_t *res = g_utf8_to_ucs4(str.c_str(), str.length(), &readed, &writed, &errMsg);
|
||||
if (! res) {
|
||||
if (errMsg)
|
||||
throw Exception(errMsg);
|
||||
@ -587,10 +586,13 @@ std::ostream& operator << (std::ostream &stream, const std::wstring &str)
|
||||
int getUtf8Length(unsigned char c)
|
||||
{
|
||||
int mask, len;
|
||||
|
||||
UTF8_COMPUTE(c, mask, len);
|
||||
if (-1 == len)
|
||||
|
||||
if (-1 == len) {
|
||||
throw Exception(L"Invalid utf-8 character");
|
||||
else
|
||||
} else {
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user