mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
libxmp-lite: Changes to build as C++: pointer casting
git-svn-id: https://svn.eduke32.com/eduke32@6162 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6700a2a93d
commit
d77d1cff29
14 changed files with 50 additions and 50 deletions
|
@ -39,7 +39,7 @@ int libxmp_init_instrument(struct module_data *m)
|
|||
struct xmp_module *mod = &m->mod;
|
||||
|
||||
if (mod->ins > 0) {
|
||||
mod->xxi = calloc(sizeof (struct xmp_instrument), mod->ins);
|
||||
mod->xxi = (struct xmp_instrument *)calloc(sizeof (struct xmp_instrument), mod->ins);
|
||||
if (mod->xxi == NULL)
|
||||
return -1;
|
||||
}
|
||||
|
@ -47,10 +47,10 @@ int libxmp_init_instrument(struct module_data *m)
|
|||
if (mod->smp > 0) {
|
||||
int i;
|
||||
|
||||
mod->xxs = calloc(sizeof (struct xmp_sample), mod->smp);
|
||||
mod->xxs = (struct xmp_sample *)calloc(sizeof (struct xmp_sample), mod->smp);
|
||||
if (mod->xxs == NULL)
|
||||
return -1;
|
||||
m->xtra = calloc(sizeof (struct extra_sample_data), mod->smp);
|
||||
m->xtra = (struct extra_sample_data *)calloc(sizeof (struct extra_sample_data), mod->smp);
|
||||
if (m->xtra == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -67,7 +67,7 @@ int libxmp_alloc_subinstrument(struct xmp_module *mod, int i, int num)
|
|||
if (num == 0)
|
||||
return 0;
|
||||
|
||||
mod->xxi[i].sub = calloc(sizeof (struct xmp_subinstrument), num);
|
||||
mod->xxi[i].sub = (struct xmp_subinstrument *)calloc(sizeof (struct xmp_subinstrument), num);
|
||||
if (mod->xxi[i].sub == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -76,11 +76,11 @@ int libxmp_alloc_subinstrument(struct xmp_module *mod, int i, int num)
|
|||
|
||||
int libxmp_init_pattern(struct xmp_module *mod)
|
||||
{
|
||||
mod->xxt = calloc(sizeof (struct xmp_track *), mod->trk);
|
||||
mod->xxt = (struct xmp_track **)calloc(sizeof (struct xmp_track *), mod->trk);
|
||||
if (mod->xxt == NULL)
|
||||
return -1;
|
||||
|
||||
mod->xxp = calloc(sizeof (struct xmp_pattern *), mod->pat);
|
||||
mod->xxp = (struct xmp_pattern **)calloc(sizeof (struct xmp_pattern *), mod->pat);
|
||||
if (mod->xxp == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -93,7 +93,7 @@ int libxmp_alloc_pattern(struct xmp_module *mod, int num)
|
|||
if (num < 0 || num >= mod->pat || mod->xxp[num] != NULL)
|
||||
return -1;
|
||||
|
||||
mod->xxp[num] = calloc(1, sizeof (struct xmp_pattern) +
|
||||
mod->xxp[num] = (struct xmp_pattern *)calloc(1, sizeof (struct xmp_pattern) +
|
||||
sizeof (int) * (mod->chn - 1));
|
||||
if (mod->xxp[num] == NULL)
|
||||
return -1;
|
||||
|
@ -107,7 +107,7 @@ int libxmp_alloc_track(struct xmp_module *mod, int num, int rows)
|
|||
if (num < 0 || num >= mod->trk || mod->xxt[num] != NULL || rows <= 0)
|
||||
return -1;
|
||||
|
||||
mod->xxt[num] = calloc(sizeof (struct xmp_track) +
|
||||
mod->xxt[num] = (struct xmp_track *)calloc(sizeof (struct xmp_track) +
|
||||
sizeof (struct xmp_event) * (rows - 1), 1);
|
||||
if (mod->xxt[num] == NULL)
|
||||
return -1;
|
||||
|
@ -155,7 +155,7 @@ int libxmp_alloc_pattern_tracks(struct xmp_module *mod, int num, int rows)
|
|||
/* Sample number adjustment by Vitamin/CAIG */
|
||||
struct xmp_sample *libxmp_realloc_samples(struct xmp_sample *buf, int *size, int new_size)
|
||||
{
|
||||
buf = realloc(buf, sizeof (struct xmp_sample) * new_size);
|
||||
buf = (struct xmp_sample *)realloc(buf, sizeof (struct xmp_sample) * new_size);
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
if (new_size > *size)
|
||||
|
|
|
@ -37,7 +37,7 @@ xmp_context xmp_create_context()
|
|||
{
|
||||
struct context_data *ctx;
|
||||
|
||||
ctx = calloc(1, sizeof(struct context_data));
|
||||
ctx = (struct context_data *)calloc(1, sizeof(struct context_data));
|
||||
if (ctx == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -305,7 +305,7 @@ HIO_HANDLE *hio_open(const void *path, const char *mode)
|
|||
|
||||
h->error = 0;
|
||||
h->type = HIO_HANDLE_TYPE_FILE;
|
||||
h->handle.file = fopen(path, mode);
|
||||
h->handle.file = fopen((const char *)path, mode);
|
||||
if (h->handle.file == NULL)
|
||||
goto err2;
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ static const uint8 fx[] = {
|
|||
};
|
||||
|
||||
|
||||
int itsex_decompress8 (HIO_HANDLE *, void *, int, int);
|
||||
int itsex_decompress16 (HIO_HANDLE *, void *, int, int);
|
||||
int itsex_decompress8 (HIO_HANDLE *, uint8 *, int, int);
|
||||
int itsex_decompress16 (HIO_HANDLE *, int16 *, int, int);
|
||||
|
||||
|
||||
static void xlat_fx(int c, struct xmp_event *e, uint8 *last_fxp, int new_fx)
|
||||
|
@ -518,7 +518,7 @@ static int load_old_it_instrument(struct xmp_instrument *xxi, HIO_HANDLE *f)
|
|||
xxi->vol = 0x40;
|
||||
|
||||
if (k) {
|
||||
xxi->sub = calloc(sizeof(struct xmp_subinstrument), k);
|
||||
xxi->sub = (struct xmp_subinstrument *)calloc(sizeof(struct xmp_subinstrument), k);
|
||||
if (xxi->sub == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -669,7 +669,7 @@ static int load_new_it_instrument(struct xmp_instrument *xxi, HIO_HANDLE *f)
|
|||
xxi->vol = i2h.gbv >> 1;
|
||||
|
||||
if (k) {
|
||||
xxi->sub = calloc(sizeof(struct xmp_subinstrument), k);
|
||||
xxi->sub = (struct xmp_subinstrument *)calloc(sizeof(struct xmp_subinstrument), k);
|
||||
if (xxi->sub == NULL)
|
||||
return -1;
|
||||
|
||||
|
@ -713,7 +713,7 @@ static int load_it_sample(struct module_data *m, int i, int start,
|
|||
uint8 buf[80];
|
||||
|
||||
if (sample_mode) {
|
||||
mod->xxi[i].sub = calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
mod->xxi[i].sub = (struct xmp_subinstrument *)calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
if (mod->xxi[i].sub == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -854,12 +854,12 @@ static int load_it_sample(struct module_data *m, int i, int start,
|
|||
uint8 *buf;
|
||||
int ret;
|
||||
|
||||
buf = calloc(1, xxs->len * 2);
|
||||
buf = (uint8 *)calloc(1, xxs->len * 2);
|
||||
if (buf == NULL)
|
||||
return -1;
|
||||
|
||||
if (ish.flags & IT_SMP_16BIT) {
|
||||
itsex_decompress16(f, buf, xxs->len,
|
||||
itsex_decompress16(f, (int16 *)buf, xxs->len,
|
||||
ish.convert & IT_CVT_DIFF);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
|
@ -869,7 +869,7 @@ static int load_it_sample(struct module_data *m, int i, int start,
|
|||
cvt |= SAMPLE_FLAG_BIGEND;
|
||||
#endif
|
||||
} else {
|
||||
itsex_decompress8(f, buf, xxs->len,
|
||||
itsex_decompress8(f, (uint8 *)buf, xxs->len,
|
||||
ish.convert & IT_CVT_DIFF);
|
||||
}
|
||||
|
||||
|
@ -1103,18 +1103,18 @@ static int it_load(struct module_data *m, HIO_HANDLE *f, const int start)
|
|||
}
|
||||
|
||||
if (mod->ins) {
|
||||
pp_ins = calloc(4, mod->ins);
|
||||
pp_ins = (uint32 *)calloc(4, mod->ins);
|
||||
if (pp_ins == NULL)
|
||||
goto err;
|
||||
} else {
|
||||
pp_ins = NULL;
|
||||
}
|
||||
|
||||
pp_smp = calloc(4, mod->smp);
|
||||
pp_smp = (uint32 *)calloc(4, mod->smp);
|
||||
if (pp_smp == NULL)
|
||||
goto err2;
|
||||
|
||||
pp_pat = calloc(4, mod->pat);
|
||||
pp_pat = (uint32 *)calloc(4, mod->pat);
|
||||
if (pp_pat == NULL)
|
||||
goto err3;
|
||||
|
||||
|
@ -1188,7 +1188,7 @@ static int it_load(struct module_data *m, HIO_HANDLE *f, const int start)
|
|||
|
||||
/* Alloc extra samples for sustain loop */
|
||||
if (mod->smp > 0) {
|
||||
m->xsmp = calloc(sizeof (struct xmp_sample), mod->smp);
|
||||
m->xsmp = (xmp_sample *)calloc(sizeof (struct xmp_sample), mod->smp);
|
||||
if (m->xsmp == NULL) {
|
||||
goto err4;
|
||||
}
|
||||
|
@ -1342,7 +1342,7 @@ static int it_load(struct module_data *m, HIO_HANDLE *f, const int start)
|
|||
/* Song message */
|
||||
|
||||
if (ifh.special & IT_HAS_MSG) {
|
||||
if ((m->comment = malloc(ifh.msglen)) != NULL) {
|
||||
if ((m->comment = (char *)malloc(ifh.msglen)) != NULL) {
|
||||
hio_seek(f, start + ifh.msgofs, SEEK_SET);
|
||||
|
||||
D_(D_INFO "Message length : %d", ifh.msglen);
|
||||
|
|
|
@ -324,7 +324,7 @@ int libxmp_prepare_scan(struct context_data *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
m->scan_cnt = calloc(sizeof (char *), mod->len);
|
||||
m->scan_cnt = (char **)calloc(sizeof (char *), mod->len);
|
||||
if (m->scan_cnt == NULL)
|
||||
return -XMP_ERROR_SYSTEM;
|
||||
|
||||
|
@ -340,7 +340,7 @@ int libxmp_prepare_scan(struct context_data *ctx)
|
|||
}
|
||||
|
||||
pat = pat_idx >= mod->pat ? NULL : mod->xxp[pat_idx];
|
||||
m->scan_cnt[i] = calloc(1, pat && pat->rows ? pat->rows : 1);
|
||||
m->scan_cnt[i] = (char *)calloc(1, pat && pat->rows ? pat->rows : 1);
|
||||
if (m->scan_cnt[i] == NULL)
|
||||
return -XMP_ERROR_SYSTEM;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ MFILE *mopen(const void *ptr, long size)
|
|||
if (m == NULL)
|
||||
return NULL;
|
||||
|
||||
m->start = ptr;
|
||||
m->start = (const unsigned char *)ptr;
|
||||
m->pos = 0;
|
||||
m->size = size;
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@
|
|||
|
||||
#define VAR_NORM(x) \
|
||||
register int smp_in; \
|
||||
x *sptr = vi->sptr; \
|
||||
x *sptr = (x *)vi->sptr; \
|
||||
unsigned int pos = vi->pos; \
|
||||
int frac = (1 << SMIX_SHIFT) * (vi->pos - (int)vi->pos)
|
||||
|
||||
|
|
|
@ -346,25 +346,25 @@ void libxmp_mixer_softmixer(struct context_data *ctx)
|
|||
|
||||
switch (s->interp) {
|
||||
case XMP_INTERP_NEAREST:
|
||||
mixers = &nearest_mixers;
|
||||
mixers = (mixer_set *)&nearest_mixers;
|
||||
break;
|
||||
case XMP_INTERP_LINEAR:
|
||||
mixers = &linear_mixers;
|
||||
mixers = (mixer_set *)&linear_mixers;
|
||||
break;
|
||||
case XMP_INTERP_SPLINE:
|
||||
mixers = &spline_mixers;
|
||||
mixers = (mixer_set *)&spline_mixers;
|
||||
break;
|
||||
default:
|
||||
mixers = &linear_mixers;
|
||||
mixers = (mixer_set *)&linear_mixers;
|
||||
}
|
||||
|
||||
#ifdef LIBXMP_PAULA_SIMULATOR
|
||||
if (p->flags & XMP_FLAGS_A500) {
|
||||
if (IS_AMIGA_MOD()) {
|
||||
if (p->filter) {
|
||||
mixers = &a500led_mixers;
|
||||
mixers = (mixer_set *)&a500led_mixers;
|
||||
} else {
|
||||
mixers = &a500_mixers;
|
||||
mixers = (mixer_set *)&a500_mixers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -803,11 +803,11 @@ int libxmp_mixer_on(struct context_data *ctx, int rate, int format, int c4rate)
|
|||
{
|
||||
struct mixer_data *s = &ctx->s;
|
||||
|
||||
s->buffer = calloc(2, XMP_MAX_FRAMESIZE);
|
||||
s->buffer = (char *)calloc(2, XMP_MAX_FRAMESIZE);
|
||||
if (s->buffer == NULL)
|
||||
goto err;
|
||||
|
||||
s->buf32 = calloc(sizeof(int), XMP_MAX_FRAMESIZE);
|
||||
s->buf32 = (int32 *)calloc(sizeof(int32), XMP_MAX_FRAMESIZE);
|
||||
if (s->buf32 == NULL)
|
||||
goto err1;
|
||||
|
||||
|
|
|
@ -1541,13 +1541,13 @@ int xmp_start_player(xmp_context opaque, int rate, int format)
|
|||
f->pbreak = 0;
|
||||
f->rowdelay_set = 0;
|
||||
|
||||
f->loop = calloc(p->virt.virt_channels, sizeof(struct pattern_loop));
|
||||
f->loop = (struct pattern_loop *)calloc(p->virt.virt_channels, sizeof(struct pattern_loop));
|
||||
if (f->loop == NULL) {
|
||||
ret = -XMP_ERROR_SYSTEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
p->xc_data = calloc(p->virt.virt_channels, sizeof(struct channel_data));
|
||||
p->xc_data = (struct channel_data *)calloc(p->virt.virt_channels, sizeof(struct channel_data));
|
||||
if (p->xc_data == NULL) {
|
||||
ret = -XMP_ERROR_SYSTEM;
|
||||
goto err1;
|
||||
|
@ -1747,7 +1747,7 @@ int xmp_play_buffer(xmp_context opaque, void *out_buffer, int size, int loop)
|
|||
}
|
||||
|
||||
p->buffer_data.consumed = 0;
|
||||
p->buffer_data.in_buffer = fi.buffer;
|
||||
p->buffer_data.in_buffer = (char *)fi.buffer;
|
||||
p->buffer_data.in_size = fi.buffer_size;
|
||||
}
|
||||
|
||||
|
|
|
@ -293,12 +293,12 @@ static int s3m_load(struct module_data *m, HIO_HANDLE * f, const int start)
|
|||
|
||||
libxmp_copy_adjust(mod->name, sfh.name, 28);
|
||||
|
||||
pp_ins = calloc(2, sfh.insnum);
|
||||
pp_ins = (uint16 *)calloc(2, sfh.insnum);
|
||||
if (pp_ins == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
||||
pp_pat = calloc(2, sfh.patnum);
|
||||
pp_pat = (uint16 *)calloc(2, sfh.patnum);
|
||||
if (pp_pat == NULL) {
|
||||
goto err2;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@ static int s3m_load(struct module_data *m, HIO_HANDLE * f, const int start)
|
|||
struct xmp_sample *xxs = &mod->xxs[i];
|
||||
struct xmp_subinstrument *sub;
|
||||
|
||||
xxi->sub = calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
xxi->sub = (struct xmp_subinstrument *)calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
if (xxi->sub == NULL) {
|
||||
goto err3;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ int libxmp_load_sample(struct module_data *m, HIO_HANDLE *f, int flags, struct x
|
|||
}
|
||||
|
||||
/* add guard bytes before the buffer for higher order interpolation */
|
||||
xxs->data = malloc(bytelen + extralen + unroll_extralen + 4);
|
||||
xxs->data = (unsigned char *)malloc(bytelen + extralen + unroll_extralen + 4);
|
||||
if (xxs->data == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
|
|
@ -72,11 +72,11 @@ int xmp_start_smix(xmp_context opaque, int chn, int smp)
|
|||
return -XMP_ERROR_STATE;
|
||||
}
|
||||
|
||||
smix->xxi = calloc(sizeof (struct xmp_instrument), smp);
|
||||
smix->xxi = (struct xmp_instrument *)calloc(sizeof (struct xmp_instrument), smp);
|
||||
if (smix->xxi == NULL) {
|
||||
goto err;
|
||||
}
|
||||
smix->xxs = calloc(sizeof (struct xmp_sample), smp);
|
||||
smix->xxs = (struct xmp_sample *)calloc(sizeof (struct xmp_sample), smp);
|
||||
if (smix->xxs == NULL) {
|
||||
goto err1;
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ int xmp_smix_load_sample(xmp_context opaque, int num, char *path)
|
|||
|
||||
/* Init instrument */
|
||||
|
||||
xxi->sub = calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
xxi->sub = (struct xmp_subinstrument *)calloc(sizeof(struct xmp_subinstrument), 1);
|
||||
if (xxi->sub == NULL) {
|
||||
retval = -XMP_ERROR_SYSTEM;
|
||||
goto err1;
|
||||
|
@ -263,7 +263,7 @@ int xmp_smix_load_sample(xmp_context opaque, int num, char *path)
|
|||
xxs->lpe = 0;
|
||||
xxs->flg = bits == 16 ? XMP_SAMPLE_16BIT : 0;
|
||||
|
||||
xxs->data = malloc(size);
|
||||
xxs->data = (unsigned char *)malloc(size);
|
||||
if (xxs->data == NULL) {
|
||||
retval = -XMP_ERROR_SYSTEM;
|
||||
goto err2;
|
||||
|
|
|
@ -104,7 +104,7 @@ int libxmp_virt_on(struct context_data *ctx, int num)
|
|||
|
||||
p->virt.maxvoc = libxmp_mixer_numvoices(ctx, num);
|
||||
|
||||
p->virt.voice_array = calloc(p->virt.maxvoc,
|
||||
p->virt.voice_array = (struct mixer_voice *)calloc(p->virt.maxvoc,
|
||||
sizeof(struct mixer_voice));
|
||||
if (p->virt.voice_array == NULL)
|
||||
goto err;
|
||||
|
@ -127,7 +127,7 @@ int libxmp_virt_on(struct context_data *ctx, int num)
|
|||
}
|
||||
#endif
|
||||
|
||||
p->virt.virt_channel = malloc(p->virt.virt_channels *
|
||||
p->virt.virt_channel = (struct virt_channel *)malloc(p->virt.virt_channels *
|
||||
sizeof(struct virt_channel));
|
||||
if (p->virt.virt_channel == NULL)
|
||||
goto err2;
|
||||
|
|
|
@ -100,7 +100,7 @@ static int load_xm_pattern(struct module_data *m, int num, int version, HIO_HAND
|
|||
|
||||
size = xph.datasize;
|
||||
|
||||
pat = patbuf = calloc(1, size);
|
||||
pat = patbuf = (uint8 *)calloc(1, size);
|
||||
if (patbuf == NULL) {
|
||||
goto err;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue