diff --git a/addons/acodec/modaudio.c b/addons/acodec/modaudio.c index 7ef963cb42..9510d21424 100644 --- a/addons/acodec/modaudio.c +++ b/addons/acodec/modaudio.c @@ -59,13 +59,21 @@ static bool libdumb_loaded = false; static void *dumb_dll = NULL; #endif +/* + * DUMB_OFF_T is introduced in DUMB 2.0, it's a signed 64+ bit integer. + * DUMB 0.9.3 expects long wherever DUMB_OFF_T appears in the DUMB 2.0 API. + */ +#ifndef DUMB_OFF_T +#define DUMB_OFF_T long +#endif + static struct { long (*duh_sigrenderer_get_position)(DUH_SIGRENDERER *); void (*duh_end_sigrenderer)(DUH_SIGRENDERER *); void (*unload_duh)(DUH *); DUH_SIGRENDERER *(*duh_start_sigrenderer)(DUH *, int, int, long); - long (*duh_get_length)(DUH *); + DUMB_OFF_T (*duh_get_length)(DUH *); void (*dumb_exit)(void); DUMB_IT_SIGRENDERER *(*duh_get_it_sigrenderer)(DUH_SIGRENDERER *); void (*dumb_it_set_loop_callback)(DUMB_IT_SIGRENDERER *, int (*)(void *), void *); @@ -76,10 +84,12 @@ static struct /* * DUMB 2.0 deprecates duh_render, and suggests instead duh_render_int * and duh_render_float. But I (Simon N.) don't know how to use those. + * I have already written some documentation for DUMB 2.0 that got merged + * upstream, but I haven't gotten around to this issue yet. */ long (*duh_render)(DUH_SIGRENDERER *, - int, int, float, float, long, void *); - void (*register_dumbfile_system)(const DUMBFILE_SYSTEM *); + int, int, float, float, long, void *); /* deprecated */ + void (*register_dumbfile_system)(const DUMBFILE_SYSTEM *); DUMBFILE *(*dumbfile_open_ex)(void *, const DUMBFILE_SYSTEM *); DUH *(*dumb_read_any)(DUMBFILE *, int, int); #else @@ -102,7 +112,7 @@ static void *dfs_open(const char *filename) return al_fopen(filename, "rb"); } -static int dfs_skip(void *f, long n) +static int dfs_skip(void *f, DUMB_OFF_T n) { return al_fseek(f, n, ALLEGRO_SEEK_CUR) ? 0 : -1; } @@ -112,7 +122,7 @@ static int dfs_getc(void *f) return al_fgetc(f); } -static long dfs_getnc(char *ptr, long n, void *f) +static DUMB_OFF_T dfs_getnc(char *ptr, DUMB_OFF_T n, void *f) { return al_fread(f, ptr, n); } @@ -124,12 +134,12 @@ static void dfs_close(void *f) } #if (DUMB_MAJOR_VERSION) >= 2 -static int dfs_seek(void *f, long n) +static int dfs_seek(void *f, DUMB_OFF_T n) { return al_fseek(f, n, ALLEGRO_SEEK_SET) ? 0 : -1; } -static long dfs_get_size(void *f) +static DUMB_OFF_T dfs_get_size(void *f) { return al_fsize(f); }