mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
avcodec/pgxdec: Avoid always-false checks
We have already checked that there is data to be read. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
a7e8b0f360
commit
be6cd7dfd1
@ -32,9 +32,9 @@ static int pgx_get_number(AVCodecContext *avctx, GetByteContext *g, int *number)
|
|||||||
*number = 0;
|
*number = 0;
|
||||||
while (1) {
|
while (1) {
|
||||||
uint64_t temp;
|
uint64_t temp;
|
||||||
if (!bytestream2_get_bytes_left(g))
|
if (bytestream2_get_bytes_left(g) <= 0)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
digit = bytestream2_get_byte(g);
|
digit = bytestream2_get_byteu(g);
|
||||||
if (digit == ' ' || digit == 0xA || digit == 0xD)
|
if (digit == ' ' || digit == 0xA || digit == 0xD)
|
||||||
break;
|
break;
|
||||||
else if (digit < '0' || digit > '9')
|
else if (digit < '0' || digit > '9')
|
||||||
@ -59,22 +59,22 @@ static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g,
|
|||||||
if (bytestream2_get_bytes_left(g) < 12)
|
if (bytestream2_get_bytes_left(g) < 12)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
bytestream2_skip(g, 6);
|
bytestream2_skipu(g, 6);
|
||||||
|
|
||||||
// Is the component signed?
|
// Is the component signed?
|
||||||
byte = bytestream2_peek_byte(g);
|
byte = bytestream2_peek_byteu(g);
|
||||||
if (byte == '+') {
|
if (byte == '+') {
|
||||||
*sign = 0;
|
*sign = 0;
|
||||||
bytestream2_skip(g, 1);
|
bytestream2_skipu(g, 1);
|
||||||
} else if (byte == '-') {
|
} else if (byte == '-') {
|
||||||
*sign = 1;
|
*sign = 1;
|
||||||
bytestream2_skip(g, 1);
|
bytestream2_skipu(g, 1);
|
||||||
} else if (byte == 0)
|
} else if (byte == 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
byte = bytestream2_peek_byte(g);
|
byte = bytestream2_peek_byteu(g);
|
||||||
if (byte == ' ')
|
if (byte == ' ')
|
||||||
bytestream2_skip(g, 1);
|
bytestream2_skipu(g, 1);
|
||||||
else if (byte == 0)
|
else if (byte == 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
@ -104,9 +104,9 @@ error:
|
|||||||
for (j = 0; j < width; j++) { \
|
for (j = 0; j < width; j++) { \
|
||||||
unsigned val; \
|
unsigned val; \
|
||||||
if (sign) \
|
if (sign) \
|
||||||
val = (PIXEL)bytestream2_get_ ##suffix(g) + (1 << (depth - 1)); \
|
val = (PIXEL)bytestream2_get_ ##suffix##u(g) + (1 << (depth - 1)); \
|
||||||
else \
|
else \
|
||||||
val = bytestream2_get_ ##suffix(g); \
|
val = bytestream2_get_ ##suffix##u(g); \
|
||||||
val <<= (D - depth); \
|
val <<= (D - depth); \
|
||||||
*(line + j) = val; \
|
*(line + j) = val; \
|
||||||
} \
|
} \
|
||||||
|
Loading…
Reference in New Issue
Block a user