CHAMBER: Fix Various GCC Compiler Warnings

This commit does change the behaviour of the memset call in room.cpp
in the loadZone() function to clear the entire array. As noted, this
is likely an original bug, but can be changed with the associated
preprocessor define of #if 0 / #if 1 for testing. This now uses the
type size in both cases to avoid warnings.
This commit is contained in:
D G Turner 2023-02-20 00:27:04 +00:00
parent 3012d2ad6a
commit c22f5ded21
4 changed files with 11 additions and 4 deletions

View File

@ -49,7 +49,6 @@ uint16 dot_effect_delay;
extern uint16 cpu_speed_delay;
extern byte *seekToEntry(byte *bank, uint16 num, byte **end);
extern void loadLutinSprite(uint16 lutidx);
void getScratchBuffer(byte mode) {

View File

@ -1227,6 +1227,9 @@ static uint16 FPDiv(uint16 a, byte b) {
/*is it really any better than (uint32)(a << 8) / b ?*/
}
// call commented out in void cga_ZoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target, uint16 ofs) currently
// thus causes an unused function warning
#if 0
/*
Draw scaled image
NB! tw/th specify target width/height in pixels
@ -1301,6 +1304,7 @@ static void cga_Zoom(zoom_t *params, byte tw, byte th, byte *source, byte *targe
cga_BlitAndWait(scratch_mem2, params->fw, params->fw, th + 2, target, finofs);
}
#endif
/*
Draw scaled image

View File

@ -147,7 +147,7 @@ int16 loadStaticData() {
uint32 *modOffs = new uint32[numMods];
for (int i = 0; i < numMods; i++)
for (uint i = 0; i < numMods; i++)
modOffs[i] = modBase + pxi.readUint32BE();
// So far, take only resource 0. Additional selection is required
@ -182,7 +182,7 @@ int16 loadStaticData() {
const char *firstRes = "ARPLA.";
int32 resOffs = -1;
for (int i = off; i < rawSize; i++)
for (uint i = off; i < rawSize; i++)
if (!strncmp((char *)rawData + i, firstRes, strlen(firstRes))) {
resOffs = i;
break;

View File

@ -303,7 +303,11 @@ void loadZone(void) {
if (zone_obj_count != 0) {
uint16 i;
uint16 *zcmds = script_word_vars.zone_obj_cmds;
memset(script_word_vars.zone_obj_cmds, 0, 15 * 5); /*half of list: TODO: bug? wipe whole list?*/
#if 0
memset(script_word_vars.zone_obj_cmds, 0, 15 * 5 * sizeof(uint8)); /*Original code? - half of list: TODO: bug? wipe whole list?*/
#else
memset(script_word_vars.zone_obj_cmds, 0, 15 * 5 * sizeof(uint16)); /* wipe whole list */
#endif
for (i = 0; i < zone_obj_count; i++) {
/*load spot's reactions*/
uint16 flags = (*zptr++) << 8;