1
0
mirror of https://git.zap.org.au/git/trader.git synced 2024-07-21 16:14:14 -04:00

Pedantically type-cast integer comparisons

The latest versions of the GNU Compiler Collection complain about signed
and unsigned integer comparisons when run with the "-Wextra" flag.  Keep
those compilers happy.
This commit is contained in:
John Zaitseff 2018-07-27 18:33:14 +10:00
parent 9e3f7c7713
commit f45986e88d
4 changed files with 4 additions and 4 deletions

View File

@ -210,7 +210,7 @@ void exchange_stock (void)
}
for (i = 0, found = false; keycode_company[i] != L'\0'; i++) {
if (keycode_company[i] == key) {
if (keycode_company[i] == (wchar_t) key) {
found = true;
if (company[i].on_map) {
selection = i;

View File

@ -1268,7 +1268,7 @@ void mkchstr_conv (chtype *restrict chbuf, int chbufsize,
// Yes, we want to convert a wide NUL, too!
n = xwcrtomb(convbuf, *wcbuf, &mbstate);
if (chbufsize > endsize + n) {
if (chbufsize > (int) endsize + (int) n) {
for (p = convbuf; n > 0; n--, p++, chbuf++, chbufsize--) {
if (*p == '\0' || *p == '\n') {
/* This code assumes '\n' can never appear in a

View File

@ -292,7 +292,7 @@ selection_t get_move (void)
}
for (i = 0, found = false; keycode_game_move[i] != L'\0'; i++) {
if (keycode_game_move[i] == key) {
if (keycode_game_move[i] == (wchar_t) key) {
found = true;
selection = i;

View File

@ -747,7 +747,7 @@ char *unscramble (char *restrict dest, const char *restrict src,
apply_xor(dest, midxor, xorlen - SCRAMBLE_CRC_LEN, key);
// Convert the output to a C string
assert(size >= xorlen - SCRAMBLE_CRC_LEN + 1);
assert(size >= (size_t) xorlen - SCRAMBLE_CRC_LEN + 1);
dest[xorlen - SCRAMBLE_CRC_LEN] = '\0';
free(xorbuf);