[Scummvm-cvs-logs] SF.net SVN: scummvm:[48679] tools/trunk/create_sjisfnt.cpp

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat Apr 17 04:14:22 CEST 2010


Revision: 48679
          http://scummvm.svn.sourceforge.net/scummvm/?rev=48679&view=rev
Author:   lordhoto
Date:     2010-04-17 02:14:22 +0000 (Sat, 17 Apr 2010)

Log Message:
-----------
Fix endian problems in UTF-32 conversion.

0xFEFF is actually the "byte order mark" (according to: http://www.unicode.org/reports/tr19/tr19-9.html)
for "UTF-32", thus we use that to determin the endianness.
In case there is no such byte order mark, we just assume
native endianness.

Modified Paths:
--------------
    tools/trunk/create_sjisfnt.cpp

Modified: tools/trunk/create_sjisfnt.cpp
===================================================================
--- tools/trunk/create_sjisfnt.cpp	2010-04-16 23:03:46 UTC (rev 48678)
+++ tools/trunk/create_sjisfnt.cpp	2010-04-17 02:14:22 UTC (rev 48679)
@@ -347,10 +347,12 @@
 
 	uint32 ret = *(uint32 *)outBuf;
 
-	// It might happen that iconv will add a "ZERO WIDTH NO-BREAK SPACE"
-	// before a character, we filter that out over here.
+	// It might happen that iconv will add a "byte order mark"
+	// we use that to determin the endianness.
 	if (ret == 0x0000FEFF)
 		ret = *(uint32 *)(outBuf + 4);
+	else if (SWAP_32(ret) == 0x0000FEFF)
+		ret = SWAP_32(*(uint32 *)(outBuf + 4));
 
 	return ret;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list