Forráskód Böngészése

Minor Windows fix (thanks, fydo!).

Ryan C. Gordon 18 éve
szülő
commit
0e720678af
2 módosított fájl, 5 hozzáadás és 2 törlés
  1. 1 0
      CHANGELOG
  2. 4 2
      platform/win32.c

+ 1 - 0
CHANGELOG

@@ -4,6 +4,7 @@
 
 -- stuff in the stable-1.0 branch, backported from 2.0.0 dev branch, etc ---
 
+02132008 - Minor Windows fix (thanks, fydo!).
 01222008 - Added zlib README, and updated LICENSE.txt.
 01212008 - Fixed HTTP header in physfshttpd.c.
 12112007 - Fixed incorrect directory test in Windows code (thanks, Buginator!).

+ 4 - 2
platform/win32.c

@@ -78,8 +78,7 @@ static const char *win32strerror(void)
 {
     static TCHAR msgbuf[255];
     TCHAR *ptr = msgbuf;
-
-    FormatMessage(
+    DWORD rc = FormatMessage(
         FORMAT_MESSAGE_FROM_SYSTEM |
         FORMAT_MESSAGE_IGNORE_INSERTS,
         NULL,
@@ -90,6 +89,9 @@ static const char *win32strerror(void)
         NULL 
     );
 
+    if (rc == 0)
+        msgbuf = '\0';  /* oh well. */
+
         /* chop off newlines. */
     for (ptr = msgbuf; *ptr; ptr++)
     {