We have already checked that there is data to be read.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -32,9 +32,9 @@ static int pgx_get_number(AVCodecContext *avctx, GetByteContext *g, int *number) · 31 unmodified lines | ||
| 32 | 32 | *number = 0; |
| 33 | 33 | while (1) { |
| 34 | 34 | uint64_t temp; |
| 35 | − if (!bytestream2_get_bytes_left(g)) | |
| 35 | + if (bytestream2_get_bytes_left(g) <= 0) | |
| 36 | 36 | return AVERROR_INVALIDDATA; |
| 37 | − digit = bytestream2_get_byte(g); | |
| 37 | + digit = bytestream2_get_byteu(g); | |
| 38 | 38 | if (digit == ' ' || digit == 0xA || digit == 0xD) |
| 39 | 39 | break; |
| 40 | 40 | else if (digit < '0' || digit > '9') |
| @@ -59,22 +59,22 @@ static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g, · 18 unmodified lines | ||
| 59 | 59 | if (bytestream2_get_bytes_left(g) < 12) |
| 60 | 60 | return AVERROR_INVALIDDATA; |
| 61 | 61 | |
| 62 | − bytestream2_skip(g, 6); | |
| 62 | + bytestream2_skipu(g, 6); | |
| 63 | 63 | |
| 64 | 64 | // Is the component signed? |
| 65 | − byte = bytestream2_peek_byte(g); | |
| 65 | + byte = bytestream2_peek_byteu(g); | |
| 66 | 66 | if (byte == '+') { |
| 67 | 67 | *sign = 0; |
| 68 | − bytestream2_skip(g, 1); | |
| 68 | + bytestream2_skipu(g, 1); | |
| 69 | 69 | } else if (byte == '-') { |
| 70 | 70 | *sign = 1; |
| 71 | − bytestream2_skip(g, 1); | |
| 71 | + bytestream2_skipu(g, 1); | |
| 72 | 72 | } else if (byte == 0) |
| 73 | 73 | goto error; |
| 74 | 74 | |
| 75 | − byte = bytestream2_peek_byte(g); | |
| 75 | + byte = bytestream2_peek_byteu(g); | |
| 76 | 76 | if (byte == ' ') |
| 77 | − bytestream2_skip(g, 1); | |
| 77 | + bytestream2_skipu(g, 1); | |
| 78 | 78 | else if (byte == 0) |
| 79 | 79 | goto error; |
| 80 | 80 | |
| @@ -104,9 +104,9 @@ error: · 23 unmodified lines | ||
| 104 | 104 | for (j = 0; j < width; j++) { \ |
| 105 | 105 | unsigned val; \ |
| 106 | 106 | if (sign) \ |
| 107 | − val = (PIXEL)bytestream2_get_ ##suffix(g) + (1 << (depth - 1)); \ | |
| 107 | + val = (PIXEL)bytestream2_get_ ##suffix##u(g) + (1 << (depth - 1)); \ | |
| 108 | 108 | else \ |
| 109 | − val = bytestream2_get_ ##suffix(g); \ | |
| 109 | + val = bytestream2_get_ ##suffix##u(g); \ | |
| 110 | 110 | val <<= (D - depth); \ |
| 111 | 111 | *(line + j) = val; \ |
| 112 | 112 | } \ |