yuzu/externals/vcpkg/ports/sdl2-mixer/fix-featurempg123.patch

48 lines
2.4 KiB
Diff
Executable File

diff --git a/music_mpg123.c b/music_mpg123.c
index cd151b9..b4294ab 100644
--- a/music_mpg123.c
+++ b/music_mpg123.c
@@ -31,7 +31,11 @@
#include "music_mpg123.h"
#include <mpg123.h>
-
+#ifdef _MSC_VER
+typedef ptrdiff_t MIX_SSIZE_T;
+#else
+typedef ssize_t MIX_SSIZE_T;
+#endif
typedef struct {
int loaded;
@@ -49,7 +53,7 @@ typedef struct {
const char* (*mpg123_plain_strerror)(int errcode);
void (*mpg123_rates)(const long **list, size_t *number);
int (*mpg123_read)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done );
- int (*mpg123_replace_reader_handle)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
+ int (*mpg123_replace_reader_handle)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
off_t (*mpg123_seek)( mpg123_handle *mh, off_t sampleoff, int whence );
const char* (*mpg123_strerror)(mpg123_handle *mh);
} mpg123_loader;
@@ -96,7 +100,7 @@ static int MPG123_Load(void)
FUNCTION_LOADER(mpg123_plain_strerror, const char* (*)(int errcode))
FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number));
FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done ))
- FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, ssize_t (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
+ FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
FUNCTION_LOADER(mpg123_seek, off_t (*)( mpg123_handle *mh, off_t sampleoff, int whence ))
FUNCTION_LOADER(mpg123_strerror, const char* (*)(mpg123_handle *mh))
}
@@ -181,9 +185,9 @@ static char const* mpg_err(mpg123_handle* mpg, int result)
}
/* we're gonna override mpg123's I/O with these wrappers for RWops */
-static ssize_t rwops_read(void* p, void* dst, size_t n)
+static MIX_SSIZE_T rwops_read(void* p, void* dst, size_t n)
{
- return (ssize_t)SDL_RWread((SDL_RWops*)p, dst, 1, n);
+ return (MIX_SSIZE_T )SDL_RWread((SDL_RWops*)p, dst, 1, n);
}
static off_t rwops_seek(void* p, off_t offset, int whence)