demux/cache: fix -Wtype-limits warnings

warning: comparison of unsigned expression >= 0 is always true
warning: comparison is always false due to limited range of data type
This commit is contained in:
nanahi 2024-03-08 01:57:36 -05:00 committed by Kacper Michajłow
parent b2c1e55e5d
commit a3489c8a0f
1 changed files with 2 additions and 5 deletions

View File

@ -215,7 +215,7 @@ int64_t demux_cache_write(struct demux_cache *cache, struct demux_packet *dp)
}
assert(!dp->is_cached);
assert(dp->len >= 0 && dp->len <= INT32_MAX);
assert(dp->len <= INT32_MAX);
assert(dp->avpacket->flags >= 0 && dp->avpacket->flags <= INT32_MAX);
assert(dp->avpacket->side_data_elems >= 0 &&
dp->avpacket->side_data_elems <= INT32_MAX);
@ -261,7 +261,7 @@ int64_t demux_cache_write(struct demux_cache *cache, struct demux_packet *dp)
for (int n = 0; n < dp->avpacket->side_data_elems; n++) {
AVPacketSideData *sd = &dp->avpacket->side_data[n];
assert(sd->size >= 0 && sd->size <= INT32_MAX);
assert(sd->size <= INT32_MAX);
assert(sd->type >= 0 && sd->type <= INT32_MAX);
struct sd_header sd_hd = {
@ -294,9 +294,6 @@ struct demux_packet *demux_cache_read(struct demux_cache *cache, uint64_t pos)
if (!read_raw(cache, &hd, sizeof(hd)))
return NULL;
if (hd.data_len >= (size_t)-1)
return NULL;
struct demux_packet *dp = new_demux_packet(hd.data_len);
if (!dp)
goto fail;