Skip to content

Commit f7b4af8

Browse files
Merge pull request #17713 from pstef/silence-warnings
Silence warnings
2 parents 9fe9cb0 + 17a05ea commit f7b4af8

4 files changed

Lines changed: 22 additions & 17 deletions

File tree

deps/7zip/LzmaEnc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2828,12 +2828,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
28282828

28292829
nowPos64 = p->nowPos64;
28302830
RangeEnc_Init(&p->rc);
2831-
p->rc.outStream = &outStream.vt;
28322831

28332832
if (desiredPackSize == 0)
28342833
return SZ_ERROR_OUTPUT_EOF;
28352834

2835+
p->rc.outStream = &outStream.vt;
28362836
res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
2837+
p->rc.outStream = NULL;
28372838

28382839
*unpackSize = (uint32_t)(p->nowPos64 - nowPos64);
28392840
*destLen -= outStream.rem;

libretro-common/formats/jpeg/rjpeg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ static void rjpeg_build_fast_ac(int16_t *fast_ac, rjpeg_huffman *h)
330330
int k = ((i << len) & ((1 << FAST_BITS) - 1)) >> (FAST_BITS - magbits);
331331
int m = 1 << (magbits - 1);
332332
if (k < m)
333-
k += (-1 << magbits) + 1;
333+
k += (~0U << magbits) + 1;
334334

335335
/* if the result is small enough, we can fit it in fast_ac table */
336336
if (k >= -128 && k <= 127)

libretro-common/formats/tga/rtga.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,7 @@ static uint8_t *rtga_tga_load(rtga_context *s,
265265
int RLE_repeating = 0;
266266
int RLE_count = 0;
267267
int read_next_pixel = 1;
268-
/* Needs to be at least 33 bytes to silence a GCC warning,
269-
* only 4 are actually used */
270-
unsigned char raw_data[33] = {0};
268+
unsigned char raw_data[4] = {0};
271269
unsigned char *tga_palette = NULL;
272270

273271
/* Do I need to load a palette? */
@@ -337,8 +335,14 @@ static uint8_t *rtga_tga_load(rtga_context *s,
337335
else
338336
{
339337
/* read in the data raw */
340-
for (j = 0; j*8 < tga_bits_per_pixel; ++j)
341-
raw_data[j] = rtga_get8(s);
338+
/* manually unroll, probably GCC bug 92955 */
339+
j = 0;
340+
switch (tga_bits_per_pixel) {
341+
case 32: raw_data[j++] = rtga_get8(s); /* fallthrough */
342+
case 24: raw_data[j++] = rtga_get8(s); /* fallthrough */
343+
case 16: raw_data[j++] = rtga_get8(s); /* fallthrough */
344+
case 8: raw_data[j++] = rtga_get8(s);
345+
}
342346
}
343347

344348
/* clear the reading flag for the next pixel */

tasks/task_database.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ static int intfstream_get_serial(intfstream_t *fd, char *s, size_t len, const ch
269269
}
270270

271271
static bool intfstream_file_get_serial(const char *name,
272-
uint64_t offset, size_t size, char *s, size_t len)
272+
uint64_t offset, int64_t size, char *s, size_t len)
273273
{
274274
int rv;
275275
uint8_t *data = NULL;
@@ -291,7 +291,7 @@ static bool intfstream_file_get_serial(const char *name,
291291
if (file_size < 0)
292292
goto error;
293293

294-
if (offset != 0 || size < (size_t) file_size)
294+
if (offset != 0 || size < file_size)
295295
{
296296
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
297297
goto error;
@@ -364,7 +364,7 @@ static int task_database_gdi_get_serial(const char *name, char *s, size_t len)
364364
return 0;
365365
}
366366

367-
return intfstream_file_get_serial(track_path, 0, SIZE_MAX, s, len);
367+
return intfstream_file_get_serial(track_path, 0, INT64_MAX, s, len);
368368
}
369369

370370
static int task_database_chd_get_serial(const char *name, char *serial, size_t len)
@@ -385,7 +385,7 @@ static int task_database_chd_get_serial(const char *name, char *serial, size_t l
385385
}
386386

387387
static bool intfstream_file_get_crc(const char *name,
388-
uint64_t offset, size_t len, uint32_t *crc)
388+
uint64_t offset, int64_t len, uint32_t *crc)
389389
{
390390
bool rv;
391391
intfstream_t *fd = intfstream_open_file(name,
@@ -407,7 +407,7 @@ static bool intfstream_file_get_crc(const char *name,
407407
if (file_size < 0)
408408
goto error;
409409

410-
if (offset != 0 || len < (uint64_t) file_size)
410+
if (offset != 0 || len < file_size)
411411
{
412412
if (intfstream_seek(fd, (int64_t)offset, SEEK_SET) == -1)
413413
goto error;
@@ -480,7 +480,7 @@ static int task_database_gdi_get_crc(const char *name, uint32_t *crc)
480480
return 0;
481481
}
482482

483-
return intfstream_file_get_crc(track_path, 0, SIZE_MAX, crc);
483+
return intfstream_file_get_crc(track_path, 0, INT64_MAX, crc);
484484
}
485485

486486
static bool task_database_chd_get_crc(const char *name, uint32_t *crc)
@@ -624,7 +624,7 @@ static int task_database_iterate_playlist(
624624
db->type = DATABASE_TYPE_CRC_LOOKUP;
625625
/* first check crc of archive itself */
626626
return intfstream_file_get_crc(name,
627-
0, SIZE_MAX, &db_state->archive_crc);
627+
0, INT64_MAX, &db_state->archive_crc);
628628
#else
629629
break;
630630
#endif
@@ -656,7 +656,7 @@ static int task_database_iterate_playlist(
656656
case FILE_TYPE_WIA:
657657
case FILE_TYPE_ISO:
658658
db_state->serial[0] = '\0';
659-
intfstream_file_get_serial(name, 0, SIZE_MAX, db_state->serial, sizeof(db_state->serial));
659+
intfstream_file_get_serial(name, 0, INT64_MAX, db_state->serial, sizeof(db_state->serial));
660660
db->type = DATABASE_TYPE_SERIAL_LOOKUP;
661661
break;
662662
case FILE_TYPE_CHD:
@@ -675,7 +675,7 @@ static int task_database_iterate_playlist(
675675
default:
676676
db_state->serial[0] = '\0';
677677
db->type = DATABASE_TYPE_CRC_LOOKUP;
678-
return intfstream_file_get_crc(name, 0, SIZE_MAX, &db_state->crc);
678+
return intfstream_file_get_crc(name, 0, INT64_MAX, &db_state->crc);
679679
}
680680

681681
return 1;
@@ -1136,7 +1136,7 @@ static int task_database_iterate_serial_lookup(
11361136
if (task_database_check_serial_and_crc(db_state))
11371137
{
11381138
if (db_state->crc == 0)
1139-
intfstream_file_get_crc(name, 0, SIZE_MAX, &db_state->crc);
1139+
intfstream_file_get_crc(name, 0, INT64_MAX, &db_state->crc);
11401140
if (db_state->crc == db_info_entry->crc32)
11411141
return database_info_list_iterate_found_match(_db,
11421142
db_state, db, NULL);

0 commit comments

Comments
 (0)