r921 - in trunk: . platform

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Mon Jan 21 23:11:28 EST 2008


Author: icculus
Date: 2008-01-21 23:11:27 -0500 (Mon, 21 Jan 2008)
New Revision: 921

Modified:
   trunk/CHANGELOG.txt
   trunk/platform/windows.c
Log:
Fixed allocation size when converting from UTF-8 to UCS-2.


Modified: trunk/CHANGELOG.txt
===================================================================
--- trunk/CHANGELOG.txt	2008-01-22 03:46:44 UTC (rev 920)
+++ trunk/CHANGELOG.txt	2008-01-22 04:11:27 UTC (rev 921)
@@ -2,7 +2,8 @@
  * CHANGELOG.
  */
 
-01212008 - Fixed HTTP header in physfshttpd.c.
+01212008 - Fixed HTTP header in physfshttpd.c. Fixed utf-8 to UCS-2 allocation
+           size in Windows code.
 12112007 - Fixed incorrect directory test in Windows code (thanks, Buginator!).
 10012007 - More mingw32 fixes.
 07122007 - Maybe fixed compile on mingw32.

Modified: trunk/platform/windows.c
===================================================================
--- trunk/platform/windows.c	2008-01-22 03:46:44 UTC (rev 920)
+++ trunk/platform/windows.c	2008-01-22 04:11:27 UTC (rev 921)
@@ -47,7 +47,7 @@
     if (str == NULL) \
         w_assignto = NULL; \
     else { \
-        const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) * 4) + 1); \
+        const PHYSFS_uint64 len = (PHYSFS_uint64) ((strlen(str) + 1) * 2); \
         w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \
         if (w_assignto != NULL) \
             PHYSFS_utf8ToUcs2(str, (PHYSFS_uint16 *) w_assignto, len); \




More information about the physfs-commits mailing list