shithub: mp3dec

Download patch

ref: ce65c4927428c76554284a84ff1be0cdcd15c3a2
parent: 43caa38fbbae491d64ccfbde1cc1eb7686beec05
author: BogDan Vatra <[email protected]>
date: Fri Jul 19 08:41:24 EDT 2019

Fix compile with MinGW64 7.3 & MSVC 2017

--- a/minimp3_ex.h
+++ b/minimp3_ex.h
@@ -277,6 +277,7 @@
 {
     memset(map_info, 0, sizeof(*map_info));
 
+    HANDLE mapping = NULL;
     HANDLE file = CreateFileA(file_name, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
     if (INVALID_HANDLE_VALUE == file)
         return -1;
@@ -286,10 +287,10 @@
         goto error;
     map_info->size = s.QuadPart;
 
-    HANDLE mapping = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL);
+    mapping = CreateFileMapping(file, NULL, PAGE_READONLY, 0, 0, NULL);
     if (!mapping)
         goto error;
-    map_info->buffer = MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, s.QuadPart);
+    map_info->buffer = (const uint8_t*) MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, s.QuadPart);
     CloseHandle(mapping);
     if (!map_info->buffer)
         goto error;
@@ -386,7 +387,7 @@
 #else
 void mp3dec_ex_close(mp3dec_ex_t *dec)
 {
-    free(dec->file.buffer);
+    free((void*)dec->file.buffer);
     memset(dec, 0, sizeof(*dec));
 }
 #endif