1
0
Эх сурвалжийг харах

Fixed allocation size when converting from UTF-8 to UCS-2.

Ryan C. Gordon 18 жил өмнө
parent
commit
a863c128be

+ 2 - 1
CHANGELOG.txt

@@ -2,7 +2,8 @@
  * CHANGELOG.
  * 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!).
 12112007 - Fixed incorrect directory test in Windows code (thanks, Buginator!).
 10012007 - More mingw32 fixes.
 10012007 - More mingw32 fixes.
 07122007 - Maybe fixed compile on mingw32.
 07122007 - Maybe fixed compile on mingw32.

+ 1 - 1
platform/windows.c

@@ -47,7 +47,7 @@
     if (str == NULL) \
     if (str == NULL) \
         w_assignto = NULL; \
         w_assignto = NULL; \
     else { \
     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); \
         w_assignto = (WCHAR *) __PHYSFS_smallAlloc(len); \
         if (w_assignto != NULL) \
         if (w_assignto != NULL) \
             PHYSFS_utf8ToUcs2(str, (PHYSFS_uint16 *) w_assignto, len); \
             PHYSFS_utf8ToUcs2(str, (PHYSFS_uint16 *) w_assignto, len); \