mirror of
https://github.com/open-simh/simh.git
synced 2026-01-13 23:37:13 +00:00
CARD: Avoid potential truncation warnings when allocating the deck buffer
Card decks will never be excessively large (> uint32) since there never was a computer room big enough to hold that many cards. :-) Hopper counts and size are all of type t_addr since they are referenced relative to uptr->pos which tracks the hopper position. That state is managed so position is properly managed across a SAVE/RESTORE. On some systems that use sim_card, t_addr is 64bits, hence
This commit is contained in:
parent
0970c067a8
commit
9bc5014787
@ -931,9 +931,9 @@ _sim_read_deck(UNIT * uptr, int eof)
|
||||
if (data->hopper_cards >= data->hopper_size) {
|
||||
data->hopper_size += DECK_SIZE;
|
||||
data->images = (uint16 (*)[1][80])realloc(data->images,
|
||||
data->hopper_size * sizeof(*(data->images)));
|
||||
(size_t)data->hopper_size * sizeof(*(data->images)));
|
||||
memset(&data->images[data->hopper_cards], 0,
|
||||
(data->hopper_size - data->hopper_cards) *
|
||||
(size_t)(data->hopper_size - data->hopper_cards) *
|
||||
sizeof(*(data->images)));
|
||||
}
|
||||
|
||||
@ -961,9 +961,9 @@ _sim_read_deck(UNIT * uptr, int eof)
|
||||
if (data->hopper_cards >= data->hopper_size) {
|
||||
data->hopper_size += DECK_SIZE;
|
||||
data->images = (uint16 (*)[1][80])realloc(data->images,
|
||||
data->hopper_size * sizeof(*(data->images)));
|
||||
(size_t)data->hopper_size * sizeof(*(data->images)));
|
||||
memset(&data->images[data->hopper_cards], 0,
|
||||
(data->hopper_size - data->hopper_cards) *
|
||||
(size_t)(data->hopper_size - data->hopper_cards) *
|
||||
sizeof(*(data->images)));
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user