spaces fix

This commit is contained in:
Gergely Polonkai 2015-10-04 14:07:19 +02:00
parent 0e332f2709
commit 311bdf84bc
3 changed files with 82 additions and 82 deletions

View File

@ -110,4 +110,3 @@ int main(int argc, char *argv[])
return 0;
}

View File

@ -671,4 +671,3 @@ void ResDataHolder::load(const std::wstring &name)
data = resources->getRef(name, s);
size = (size_t)s;
}

View File

@ -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;
}
}