SCP: Cleanup potential compiler warnings

This commit is contained in:
Mark Pizzolato 2021-08-13 09:09:53 -07:00
parent 502ebeafc3
commit f95b20e1f3
7 changed files with 23 additions and 23 deletions

20
scp.c
View file

@ -4614,7 +4614,7 @@ char gbuf[CBUFSIZE];
char *ip = instr, *op, *oend, *istart, *tmpbuf; char *ip = instr, *op, *oend, *istart, *tmpbuf;
const char *ap; const char *ap;
char rbuf[CBUFSIZE]; char rbuf[CBUFSIZE];
int i; uint32 i;
size_t outstr_off = 0; size_t outstr_off = 0;
sim_exp_argv = do_arg; sim_exp_argv = do_arg;
@ -4677,7 +4677,7 @@ for (; *ip && (op < oend); ) {
} }
if ((*ip >= '0') && (*ip <= ('9'))) { /* %n = sub */ if ((*ip >= '0') && (*ip <= ('9'))) { /* %n = sub */
ap = do_arg[*ip - '0']; ap = do_arg[*ip - '0'];
for (i=0; i<*ip - '0'; ++i) /* make sure we're not past the list end */ for (i=0; i < (uint32)(*ip - '0'); ++i) /* make sure we're not past the list end */
if (do_arg[i] == NULL) { if (do_arg[i] == NULL) {
ap = NULL; ap = NULL;
break; break;
@ -9664,7 +9664,7 @@ void put_rval_pcchk (REG *rptr, uint32 idx, t_value val, t_bool pc_chk)
size_t sz; size_t sz;
t_value mask; t_value mask;
uint32 *ptr; uint32 *ptr;
t_value prev_val; t_value prev_val = 0;
if ((!(sim_switches & SWMASK ('Z'))) && if ((!(sim_switches & SWMASK ('Z'))) &&
(rptr->flags & REG_DEPOSIT) && sim_vm_reg_update) (rptr->flags & REG_DEPOSIT) && sim_vm_reg_update)
@ -11125,7 +11125,7 @@ for (logop = cmpop = -1; (c = *cptr++); ) { /* loop thru clauses */
return NULL; return NULL;
} }
} /* end for */ } /* end for */
if (schptr->count != (1 - reason)) { if (schptr->count != (uint32)(1 - reason)) {
schptr->count = 1 - reason; schptr->count = 1 - reason;
free (schptr->mask); free (schptr->mask);
schptr->mask = (t_value *)calloc (sim_emax, sizeof(*schptr->mask)); schptr->mask = (t_value *)calloc (sim_emax, sizeof(*schptr->mask));
@ -12221,7 +12221,7 @@ bp = sim_brk_fnd (loc); /* loc present? */
if (!bp) /* no, allocate */ if (!bp) /* no, allocate */
bp = sim_brk_new (loc, sw); bp = sim_brk_new (loc, sw);
else { else {
while (bp && (bp->typ != sw)) while (bp && (bp->typ != (uint32)sw))
bp = bp->next; bp = bp->next;
if (!bp) if (!bp)
bp = sim_brk_new (loc, sw); bp = sim_brk_new (loc, sw);
@ -14106,7 +14106,7 @@ static volatile struct {
size_t block; size_t block;
size_t line; size_t line;
} help_where = { "", NULL, 0, 0 }; } help_where = { "", NULL, 0, 0 };
jmp_buf (help_env); jmp_buf help_env;
#define FAIL(why,text,here) { help_where.error = #text; help_where.prox = here; longjmp (help_env, (why)); } #define FAIL(why,text,here) { help_where.error = #text; help_where.prox = here; longjmp (help_env, (why)); }
/* Add to topic text. /* Add to topic text.
@ -15889,7 +15889,7 @@ static struct validation_test {
{ ORDATAD (REGVAL, tregval, 8*sizeof(tregval), "value register") }, { ORDATAD (REGVAL, tregval, 8*sizeof(tregval), "value register") },
{NULL} }, {NULL} },
SCPE_OK}, SCPE_OK},
{NULL} { { {NULL} } }
}; };
static UNIT validate_units[3]; static UNIT validate_units[3];
@ -16047,7 +16047,7 @@ static t_stat test_scp_event_sequencing (void)
{ {
DEVICE *dptr = &sim_scp_dev; DEVICE *dptr = &sim_scp_dev;
uint32 i; uint32 i;
int active; uint32 active;
t_stat r = SCPE_OK; t_stat r = SCPE_OK;
int32 start_deb_switches = sim_set_deb_switches (0); int32 start_deb_switches = sim_set_deb_switches (0);
@ -16071,7 +16071,7 @@ for (i = 0; i < dptr->numunits; i++) {
for (i = 0; i < dptr->numunits; i++) { for (i = 0; i < dptr->numunits; i++) {
int32 t = sim_activate_time (&dptr->units[i]); int32 t = sim_activate_time (&dptr->units[i]);
if (t != i + 1) if (t != (int32)(i + 1))
return sim_messagef (SCPE_IERR, "sim_activate_time() unexpected result for unit %d: %d\n", i, t); return sim_messagef (SCPE_IERR, "sim_activate_time() unexpected result for unit %d: %d\n", i, t);
} }
sim_printf ("sim_interval = %d, sim_gtime = %.0f\n", sim_interval, sim_gtime ()); sim_printf ("sim_interval = %d, sim_gtime = %.0f\n", sim_interval, sim_gtime ());
@ -16081,7 +16081,7 @@ sim_printf ("sim_interval = %d, sim_gtime = %.0f\n", sim_interval, sim_gtime ())
for (i = 0; i < dptr->numunits; i++) { for (i = 0; i < dptr->numunits; i++) {
int32 t = sim_activate_time (&dptr->units[i]); int32 t = sim_activate_time (&dptr->units[i]);
if (t != i + 1) if (t != (int32)(i + 1))
return sim_messagef (SCPE_IERR, "sim_activate_time() unexpected result for unit %d: %d\n", i, t); return sim_messagef (SCPE_IERR, "sim_activate_time() unexpected result for unit %d: %d\n", i, t);
} }
r = sim_process_event (); r = sim_process_event ();

View file

@ -2145,7 +2145,7 @@ sim_debug_unit (ctx->dbit, uptr, "get_disk_footer(%s)\n", sim_uname (uptr));
switch (DK_GET_FMT (uptr)) { /* case on format */ switch (DK_GET_FMT (uptr)) { /* case on format */
case DKUF_F_STD: /* SIMH format */ case DKUF_F_STD: /* SIMH format */
container_size = sim_fsize_ex (uptr->fileref); container_size = sim_fsize_ex (uptr->fileref);
if ((container_size != (t_offset)-1) && (container_size > sizeof (*f)) && if ((container_size != (t_offset)-1) && (container_size > (t_offset)sizeof (*f)) &&
(sim_fseeko (uptr->fileref, container_size - sizeof (*f), SEEK_SET) == 0) && (sim_fseeko (uptr->fileref, container_size - sizeof (*f), SEEK_SET) == 0) &&
(sizeof (*f) == sim_fread (f, 1, sizeof (*f), uptr->fileref))) (sizeof (*f) == sim_fread (f, 1, sizeof (*f), uptr->fileref)))
break; break;
@ -2154,7 +2154,7 @@ switch (DK_GET_FMT (uptr)) { /* case on format */
break; break;
case DKUF_F_RAW: /* RAW format */ case DKUF_F_RAW: /* RAW format */
container_size = sim_os_disk_size_raw (uptr->fileref); container_size = sim_os_disk_size_raw (uptr->fileref);
if ((container_size != (t_offset)-1) && (container_size > sizeof (*f)) && if ((container_size != (t_offset)-1) && (container_size > (t_offset)sizeof (*f)) &&
(sim_os_disk_read (uptr, container_size - sizeof (*f), (uint8 *)f, &bytesread, sizeof (*f)) == SCPE_OK) && (sim_os_disk_read (uptr, container_size - sizeof (*f), (uint8 *)f, &bytesread, sizeof (*f)) == SCPE_OK) &&
(bytesread == sizeof (*f))) (bytesread == sizeof (*f)))
break; break;
@ -3944,12 +3944,12 @@ while (bytestoread) {
if (bytesread < 0) { if (bytesread < 0) {
return SCPE_IOERR; return SCPE_IOERR;
} }
if (bytesread < bytestoread) { /* read zeros at/past EOF */ if ((size_t)bytesread < bytestoread) {/* read zeros at/past EOF */
memset (buf + bytesread, 0, bytestoread - bytesread); memset (buf + bytesread, 0, bytestoread - bytesread);
bytesread = bytestoread; bytesread = bytestoread;
} }
sectorbytes = (bytesread / ctx->sector_size) * ctx->sector_size; sectorbytes = (bytesread / ctx->sector_size) * ctx->sector_size;
if (bytesread > sectorbytes) if ((size_t)bytesread > sectorbytes)
sectorbytes += ctx->sector_size; sectorbytes += ctx->sector_size;
if (sectsread) if (sectsread)
*sectsread += sectorbytes / ctx->sector_size; *sectsread += sectorbytes / ctx->sector_size;
@ -6034,7 +6034,7 @@ if (info->flag) { /* zap type */
return; return;
} }
container_size = sim_fsize_ex (container); container_size = sim_fsize_ex (container);
if ((container_size != (t_offset)-1) && (container_size > sizeof (*f)) && if ((container_size != (t_offset)-1) && (container_size > (t_offset)sizeof (*f)) &&
(sim_fseeko (container, container_size - sizeof (*f), SEEK_SET) == 0) && (sim_fseeko (container, container_size - sizeof (*f), SEEK_SET) == 0) &&
(sizeof (*f) == sim_fread (f, 1, sizeof (*f), container))) { (sizeof (*f) == sim_fread (f, 1, sizeof (*f), container))) {
if ((memcmp (f->Signature, "simh", 4) == 0) && if ((memcmp (f->Signature, "simh", 4) == 0) &&

View file

@ -724,7 +724,7 @@ else {
struct stat statb; struct stat statb;
if ((fstat ((*shmem)->shm_fd, &statb)) || if ((fstat ((*shmem)->shm_fd, &statb)) ||
(statb.st_size != (*shmem)->shm_size)) { ((size_t)statb.st_size != (*shmem)->shm_size)) {
sim_shmem_close (*shmem); sim_shmem_close (*shmem);
*shmem = NULL; *shmem = NULL;
return sim_messagef (SCPE_OPENERR, "Shared Memory segment '%s' is %d bytes instead of %d\n", name, (int)(statb.st_size), (int)size); return sim_messagef (SCPE_OPENERR, "Shared Memory segment '%s' is %d bytes instead of %d\n", name, (int)(statb.st_size), (int)size);

View file

@ -4463,7 +4463,7 @@ static void ansi_fill_text_buffer (FILE *f, char *buf, size_t buf_size, size_t r
if (!fixed_text) { if (!fixed_text) {
if (rec_size >= record_skip_ending) if (rec_size >= record_skip_ending)
rec_size -= record_skip_ending; rec_size -= record_skip_ending;
if ((rec_size + 4) > (int)(buf_size - offset)) { /* room for record? */ if ((rec_size + 4) > (buf_size - offset)) { /* room for record? */
(void)fseek (f, start, SEEK_SET); (void)fseek (f, start, SEEK_SET);
break; break;
} }

View file

@ -5706,11 +5706,11 @@ return SCPE_OK;
static t_stat sim_tmxr_test_lnorder (TMXR *tmxr) static t_stat sim_tmxr_test_lnorder (TMXR *tmxr)
{ {
int i; uint32 i;
int32 *saved_lnorder = tmxr->lnorder; int32 *saved_lnorder = tmxr->lnorder;
int32 saved_lines = tmxr->lines; int32 saved_lines = tmxr->lines;
tmxr->lnorder = calloc (tmxr->lines, sizeof (*tmxr->lnorder)); tmxr->lnorder = (int32 *)calloc (tmxr->lines, sizeof (*tmxr->lnorder));
if (tmxr->lines >= 8) { if (tmxr->lines >= 8) {
tmxr->lines = 8; tmxr->lines = 8;
for (i = 0; i < (sizeof (lnorders)/sizeof (lnorders[0])); ++i) for (i = 0; i < (sizeof (lnorders)/sizeof (lnorders[0])); ++i)

View file

@ -118,7 +118,7 @@ static const char *key_names[] =
"KP_INSERT", "KP_DELETE", "KP_5", "KP_ENTER", "KP_MULTIPLY", "KP_DIVIDE" "KP_INSERT", "KP_DELETE", "KP_5", "KP_ENTER", "KP_MULTIPLY", "KP_DIVIDE"
}; };
const char *vid_key_name (int32 key) const char *vid_key_name (uint32 key)
{ {
static char tmp_key_name[40]; static char tmp_key_name[40];
@ -942,7 +942,7 @@ if (sim_deb) {
int bit = 7 - ((j + i*width) & 0x7); int bit = 7 - ((j + i*width) & 0x7);
static char mode[] = "TWIB"; static char mode[] = "TWIB";
sim_debug (SIM_VID_DBG_CURSOR, vptr->vid_dev, "%c", mode[(((data[byte]>>bit)&1)<<1)|(mask[byte]>>bit)&1]); sim_debug (SIM_VID_DBG_CURSOR, vptr->vid_dev, "%c", mode[(((data[byte]>>bit)&1)<<1)|((mask[byte]>>bit)&1)]);
} }
sim_debug (SIM_VID_DBG_CURSOR, vptr->vid_dev, "\n"); sim_debug (SIM_VID_DBG_CURSOR, vptr->vid_dev, "\n");
} }
@ -2794,7 +2794,7 @@ void vid_set_cursor_position_window (VID_DISPLAY *vptr, int32 x, int32 y)
return; return;
} }
const char *vid_key_name (int32 key) const char *vid_key_name (uint32 key)
{ {
return ""; return "";
} }

View file

@ -202,7 +202,7 @@ void vid_draw (int32 x, int32 y, int32 w, int32 h, uint32 *buf);
void vid_beep (void); void vid_beep (void);
void vid_refresh (void); void vid_refresh (void);
const char *vid_version (void); const char *vid_version (void);
const char *vid_key_name (int32 key); const char *vid_key_name (uint32 key);
t_stat vid_set_cursor (t_bool visible, uint32 width, uint32 height, uint8 *data, uint8 *mask, uint32 hot_x, uint32 hot_y); t_stat vid_set_cursor (t_bool visible, uint32 width, uint32 height, uint8 *data, uint8 *mask, uint32 hot_x, uint32 hot_y);
t_stat vid_set_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc); t_stat vid_set_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc);
t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc); t_stat vid_show_release_key (FILE* st, UNIT* uptr, int32 val, CONST void* desc);