Skip to content

Commit

Permalink
anticipate 64-bit support in DUMB 2.0
Browse files Browse the repository at this point in the history
The API in DUMB 2.0 is not yet 100 % stable. We will probably add 64-bit
support in the file-handling API, even though module files of 2 GB
and above are practically non-existant.
  • Loading branch information
SimonN committed Sep 21, 2017
1 parent d73050e commit c1b2600
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions addons/acodec/modaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand All @@ -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
Expand All @@ -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;
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit c1b2600

Please sign in to comment.