sscanf format parameter fixups

git-svn-id: https://svn.eduke32.com/eduke32@7083 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2018-10-25 23:29:20 +00:00
parent 9e68009725
commit 4bb9a4b792
6 changed files with 10 additions and 8 deletions

View file

@ -188,7 +188,7 @@ static void decodeSoundSectMono(XASector *ssct, xa_data * xad)
} }
if (count > xad->blocksize) if (count > xad->blocksize)
xad->block = (int8_t *)realloc(xad->block, count); xad->block = (int8_t *)Xrealloc(xad->block, count);
memcpy(xad->block, decodeBuf, count); memcpy(xad->block, decodeBuf, count);
xad->blocksize = count; xad->blocksize = count;
@ -268,7 +268,7 @@ static void decodeSoundSectStereo(XASector *ssct, xa_data * xad)
} }
if (count > xad->blocksize) if (count > xad->blocksize)
xad->block = (int8_t *)realloc(xad->block, count); xad->block = (int8_t *)Xrealloc(xad->block, count);
memcpy(xad->block, decodeBuf, count); memcpy(xad->block, decodeBuf, count);
xad->blocksize = count; xad->blocksize = count;
@ -448,7 +448,7 @@ int32_t MV_PlayXA
return MV_Error; return MV_Error;
} }
xad = (xa_data *) calloc( 1, sizeof(xa_data) ); xad = (xa_data *) Xcalloc( 1, sizeof(xa_data) );
if (!xad) { if (!xad) {
MV_SetErrorCode( MV_InvalidFile ); MV_SetErrorCode( MV_InvalidFile );
return MV_Error; return MV_Error;

View file

@ -255,7 +255,9 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "remap", val, VL) > 0) if (readconfig(fp, "remap", val, VL) > 0)
{ {
char *p=val; int32_t v1,v2; char *p=val;
uint32_t v1,v2;
while (*p) while (*p)
{ {
if (!sscanf(p,"%x",&v1))break; if (!sscanf(p,"%x",&v1))break;

View file

@ -379,7 +379,7 @@ int32_t scriptfile_getsymbolvalue(char const *name, int32_t *val)
{ {
if (name[0] == '0' && tolower(name[1]) == 'x') // hex constants if (name[0] == '0' && tolower(name[1]) == 'x') // hex constants
{ {
int64_t x; uint64_t x;
sscanf(name + 2, "%" PRIx64 "", &x); sscanf(name + 2, "%" PRIx64 "", &x);
if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX)) if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX))

View file

@ -140,7 +140,7 @@ static void G_AddDemo(const char* param)
// -d<filename>:<num>[,<num>] // -d<filename>:<num>[,<num>]
// profiling options // profiling options
*(colon++) = 0; *(colon++) = 0;
Bsscanf(colon, "%u,%u", &framespertic, &numrepeats); Bsscanf(colon, "%d,%d", &framespertic, &numrepeats);
} }
Demo_SetFirst(tempbuf); Demo_SetFirst(tempbuf);

View file

@ -1793,7 +1793,7 @@ static int32_t parse_decimal_number(void) // (textptr)
static int32_t parse_hex_constant(const char *hexnum) static int32_t parse_hex_constant(const char *hexnum)
{ {
int64_t x; uint64_t x;
sscanf(hexnum, "%" PRIx64 "", &x); sscanf(hexnum, "%" PRIx64 "", &x);
if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX)) if (EDUKE32_PREDICT_FALSE(x > UINT32_MAX))

View file

@ -958,7 +958,7 @@ static int32_t GetGamearrayID(const char *szGameLabel, int32_t searchlocals)
static int32_t parse_integer_literal(int32_t *num) static int32_t parse_integer_literal(int32_t *num)
{ {
if (textptr[0] == '0' && tolower(textptr[1])=='x') if (textptr[0] == '0' && tolower(textptr[1])=='x')
sscanf(textptr+2, "%" SCNx32, num); sscanf(textptr+2, "%" SCNx32, (uint32_t *)&num);
else else
{ {
long lnum; long lnum;