Fix warnings on Windows

This was SVN commit r6776.
This commit is contained in:
Ykkrosh
2009-03-24 23:07:48 +00:00
parent 6426777e61
commit 433c34cd94
3 changed files with 17 additions and 3 deletions
+2
View File
@@ -91,6 +91,8 @@ void CEntityManager::DeleteAll()
void CEntityManager::updateObstacle( CEntity* tempHandle )
{
(void)tempHandle;
#ifdef USE_DCDT
if(g_Pathfinder.dcdtInitialized)
{
@@ -45,7 +45,7 @@ public:
case 4: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
case 3: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
case 2: *--target = ((ch | 0x80) & 0xBF); ch >>= 6;
case 1: *--target = (ch | firstByteMark[bytesToWrite]);
case 1: *--target = (char)(ch | firstByteMark[bytesToWrite]);
}
data += std::string(buf, bytesToWrite);
}
@@ -66,7 +66,7 @@ std::wstring fromXmlChar(const xmlChar* str)
const xmlChar* sourceEnd = str + strlen((const char*)str);
while (source < sourceEnd)
{
wchar_t ch = 0;
unsigned long ch = 0;
int extraBytesToRead = trailingBytesForUTF8[*source];
assert(source + extraBytesToRead < sourceEnd);
switch (extraBytesToRead)
@@ -79,8 +79,11 @@ std::wstring fromXmlChar(const xmlChar* str)
case 0: ch += *source++;
}
ch -= offsetsFromUTF8[extraBytesToRead];
// Make sure it fits in a 16-bit wchar_t
if (ch > 0xFFFF)
ch = 0xFFFD;
result += ch;
result += (wchar_t)ch;
}
return result;
}
@@ -119,6 +119,15 @@ public:
);
}
void test_parse_unicode_nonbmp()
{
try_parse_save(
"<?xml version=\"1.0\" encoding=\"utf-8\"?><foo>&#xfffc;&#xfffd;&#x10000;&#x10ffff;</foo>",
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<foo>\xEF\xBF\xBC\xEF\xBF\xBD\xEF\xBF\xBD\xEF\xBF\xBD</foo>\n"
);
}
void test_parse_iso88591()
{
try_parse_save(