From afc6fe184c57091df0261bc623b81dc255bbb481 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 9 Aug 2017 22:08:16 +0200 Subject: [PATCH] hxcmod-player: Avoid playback error on platforms where char is unsigned --- 3rd-party/hxcmod-player/hxcmod.c | 4 ++-- 3rd-party/hxcmod-player/hxcmod.h | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/3rd-party/hxcmod-player/hxcmod.c b/3rd-party/hxcmod-player/hxcmod.c index da847b289..c9aab3c6a 100644 --- a/3rd-party/hxcmod-player/hxcmod.c +++ b/3rd-party/hxcmod-player/hxcmod.c @@ -231,7 +231,7 @@ static void worknote( note * nptr, hxcmod_channel * cptr,char t,modcontext * mod if( period || _sample ) { - cptr->sampdata =(char *) mod->sampledata[cptr->sampnum]; + cptr->sampdata = mod->sampledata[cptr->sampnum]; cptr->length = mod->song.samples[cptr->sampnum].length; cptr->reppnt = mod->song.samples[cptr->sampnum].reppnt; cptr->replen = mod->song.samples[cptr->sampnum].replen; @@ -984,7 +984,7 @@ int hxcmod_load( modcontext * modctx, void * mod_data, int mod_data_size ) if (sptr->length == 0) continue; - modctx->sampledata[i] = (char*)modmemory; + modctx->sampledata[i] = (mchar*)modmemory; modmemory += sptr->length; if (sptr->replen + sptr->reppnt > sptr->length) diff --git a/3rd-party/hxcmod-player/hxcmod.h b/3rd-party/hxcmod-player/hxcmod.h index 5b421601f..475d33169 100644 --- a/3rd-party/hxcmod-player/hxcmod.h +++ b/3rd-party/hxcmod-player/hxcmod.h @@ -30,6 +30,7 @@ extern "C" { // Basic type typedef unsigned char muchar; +typedef signed char mchar; typedef unsigned short muint; typedef short mint; typedef unsigned long mulong; @@ -75,7 +76,7 @@ typedef struct { // HxCMod Internal structures // typedef struct { - char * sampdata; + mchar * sampdata; muint sampnum; muint length; muint reppnt; @@ -112,7 +113,7 @@ typedef struct { typedef struct { module song; - char * sampledata[31]; + mchar * sampledata[31]; note * patterndata[128]; mulong playrate;