Sfoglia il codice sorgente

Fix -Wcast-function-type MinGW warnings (enabled through -Wextra)

Anonymous Maarten 3 mesi fa
parent
commit
9bfabcfa9b
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      src/physfs_platform_windows.c

+ 4 - 2
src/physfs_platform_windows.c

@@ -11,6 +11,8 @@
 
 #ifdef PHYSFS_PLATFORM_WINDOWS
 
+typedef void (*fnFunctionPointer)(void);
+
 /* Forcibly disable UNICODE macro, since we manage this ourselves. */
 #ifdef UNICODE
 #undef UNICODE
@@ -249,7 +251,7 @@ static DWORD pollDiscDrives(void)
     DWORD i;
 
     if (lib)
-        stem = (fnSTEM) GetProcAddress(lib, "SetThreadErrorMode");
+        stem = (fnSTEM)(fnFunctionPointer) GetProcAddress(lib, "SetThreadErrorMode");
 
     if (stem)
         stem(SEM_FAILCRITICALERRORS, &oldErrorMode);
@@ -558,7 +560,7 @@ char *__PHYSFS_platformCalcUserDir(void)
 
     lib = LoadLibraryA("userenv.dll");
     BAIL_IF(!lib, errcodeFromWinApi(), NULL);
-    pGetDir=(fnGetUserProfDirW) GetProcAddress(lib,"GetUserProfileDirectoryW");
+    pGetDir=(fnGetUserProfDirW)(fnFunctionPointer) GetProcAddress(lib,"GetUserProfileDirectoryW");
     GOTO_IF(!pGetDir, errcodeFromWinApi(), done);
 
     if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &accessToken))