|
|
|
@@ -36,13 +36,15 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size) |
|
|
|
{ |
|
|
|
char *s; |
|
|
|
int c; |
|
|
|
uint8_t *bs = sc->bytestream; |
|
|
|
const uint8_t *end = sc->bytestream_end; |
|
|
|
|
|
|
|
/* skip spaces and comments */ |
|
|
|
while (sc->bytestream < sc->bytestream_end) { |
|
|
|
c = *sc->bytestream++; |
|
|
|
while (bs < end) { |
|
|
|
c = *bs++; |
|
|
|
if (c == '#') { |
|
|
|
while (c != '\n' && sc->bytestream < sc->bytestream_end) { |
|
|
|
c = *sc->bytestream++; |
|
|
|
while (c != '\n' && bs < end) { |
|
|
|
c = *bs++; |
|
|
|
} |
|
|
|
} else if (!pnm_space(c)) { |
|
|
|
break; |
|
|
|
@@ -50,12 +52,13 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size) |
|
|
|
} |
|
|
|
|
|
|
|
s = str; |
|
|
|
while (sc->bytestream < sc->bytestream_end && !pnm_space(c)) { |
|
|
|
while (bs < end && !pnm_space(c)) { |
|
|
|
if ((s - str) < buf_size - 1) |
|
|
|
*s++ = c; |
|
|
|
c = *sc->bytestream++; |
|
|
|
c = *bs++; |
|
|
|
} |
|
|
|
*s = '\0'; |
|
|
|
sc->bytestream = bs; |
|
|
|
} |
|
|
|
|
|
|
|
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s) |
|
|
|
|