Fix more warnings reported by clang

This commit is contained in:
GenericHeroGuy 2025-12-29 00:56:18 +01:00
parent 95a3af6a1a
commit 271cec1907
5 changed files with 18 additions and 32 deletions

View file

@ -953,15 +953,9 @@ void D_SRB2Loop(void)
// Check and print which version is executed.
// Use this as the border between setup and the main game loop being entered.
#ifdef BOOTDEVNAG
char bootnag[1024];
snprintf(bootnag,
sizeof(bootnag),
"%s is still in active development. Things may break or crash!\n", BLANNAME
);
CONS_Printf(
"===========================================================================\n");
CONS_Printf(bootnag);
"===========================================================================\n"
BLANNAME " is still in active development. Things may break or crash!\n");
#endif
CONS_Printf(
"===========================================================================\n"

View file

@ -4254,27 +4254,21 @@ void readkartresult(MYFILE *f, kartresult_t *result)
consvar_t *var = Z_Calloc(sizeof(consvar_t), PU_STATIC, &result->augcvar[idx]);
var->name = cvname;
var->defaultvalue = malloc(strlen(va("%d", result->baserunneraug[idx]))+1);
sprintf(var->defaultvalue, "%d", result->baserunneraug[idx]);
var->value = result->baserunneraug[idx];
char *defval = malloc(5+1); // UINT16_MAX + NUL
snprintf(defval, 6, "%u", result->baserunneraug[idx]);
var->defaultvalue = defval;
var->flags = CV_NETVAR|CV_CHEAT;
var->PossibleValue = kartrunneraugment_cons_t;
var->func = NULL;
CV_RegisterVar(var);
//CONS_Printf("Allocated cvar data successfully\n");
}
else if (result->augcvar[idx]->defaultvalue)
else
{
// Reallocate the data and set a new default value.
result->augcvar[idx]->defaultvalue = realloc(result->augcvar[idx]->defaultvalue, strlen(va("%d", result->baserunneraug[idx]))+1);
sprintf(result->augcvar[idx]->defaultvalue, "%d", result->baserunneraug[idx]);
char *defval; // uh oh! const cast!
memcpy(&defval, &result->augcvar[idx]->defaultvalue, sizeof(defval));
snprintf(defval, 6, "%u", result->baserunneraug[idx]);
CV_StealthSet(result->augcvar[idx], result->augcvar[idx]->defaultvalue);
//CONS_Printf("Reallocated cvar data successfully\n");
}
}
else if (fastncmp(word, "ODDS", 4))

View file

@ -126,8 +126,6 @@ struct kartresult_t
{
// this block is shared by all item variants
consvar_t *cvar; // contains name
consvar_t *augcvar[2]; // "Runner Augment" console variable
UINT16 baserunneraug[2]; // Base "max distance" value for KRF_RUNNERAUGMENT items
kartitemtype_e type;
UINT8 amount;
@ -135,6 +133,8 @@ struct kartresult_t
boolean isalt; // is alt (i salt)
kartresultflags_e flags;
UINT8 odds[MAXODDSTABLES][MAXODDS];
consvar_t *augcvar[2]; // "Runner Augment" console variable
UINT16 baserunneraug[2]; // Base "max distance" value for KRF_RUNNERAUGMENT items
// Functions that tell the game to use unique means of rolling these items.
// If NULL, the functions never execute.

View file

@ -9707,7 +9707,7 @@ static UINT32 K_UpdateDistanceFromCluster(player_t* player)
player->invincibilitybottleneck = (UINT16)(-1); // No bottlenecking!
return 0;
}
else if ((pingame == 3))
else if (pingame == 3)
{
// "Second place" in this case is actually second to last.
// In very small lobbies, it's harder for players to cluster together.

View file

@ -595,14 +595,12 @@ static void AudioThread(void *userdata)
TracyCZoneEnd(__zone);
}
static char *ds2chunk(void *stream, size_t *len, size_t *samplerate)
static char *ds2chunk(const void *stream, size_t *len, size_t *samplerate)
{
UINT16 ver, freq;
UINT32 samples, i;
UINT8 *sound;
SINT8 *s;
INT16 *d;
INT16 o;
// lump header
@ -622,8 +620,8 @@ static char *ds2chunk(void *stream, size_t *len, size_t *samplerate)
sound = Z_Malloc(samples<<2, PU_SOUND, NULL); // samples * frequency shift * bytes per sample * channels
s = (SINT8 *)stream;
d = (INT16 *)sound;
const SINT8 *s = stream;
UINT8 *d = sound;
i = 0;
@ -631,11 +629,11 @@ static char *ds2chunk(void *stream, size_t *len, size_t *samplerate)
while (i++ < samples)
{
o = ((INT16)(*s++)+0x80)<<8; // changed signedness and shift up to 16 bits
*d++ = o; // left channel
*d++ = o; // right channel
WRITEINT16(d, o); // left channel
WRITEINT16(d, o); // right channel
}
*len = (UINT8 *)d-sound;
*len = d - sound;
return (char *)sound;
}