summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/stream.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/include/mupdf/fitz/stream.h b/include/mupdf/fitz/stream.h
index cd26be903..790a0a83d 100644
--- a/include/mupdf/fitz/stream.h
+++ b/include/mupdf/fitz/stream.h
@@ -335,10 +335,11 @@ static inline size_t fz_available(fz_context *ctx, fz_stream *stm, size_t max)
335 335
336 if (len) 336 if (len)
337 return len; 337 return len;
338 if (stm->eof)
339 return 0;
340
338 fz_try(ctx) 341 fz_try(ctx)
339 {
340 c = stm->next(ctx, stm, max); 342 c = stm->next(ctx, stm, max);
341 }
342 fz_catch(ctx) 343 fz_catch(ctx)
343 { 344 {
344 fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); 345 fz_rethrow_if(ctx, FZ_ERROR_TRYLATER);
@@ -369,10 +370,10 @@ static inline int fz_read_byte(fz_context *ctx, fz_stream *stm)
369 370
370 if (stm->rp != stm->wp) 371 if (stm->rp != stm->wp)
371 return *stm->rp++; 372 return *stm->rp++;
373 if (stm->eof)
374 return EOF;
372 fz_try(ctx) 375 fz_try(ctx)
373 {
374 c = stm->next(ctx, stm, 1); 376 c = stm->next(ctx, stm, 1);
375 }
376 fz_catch(ctx) 377 fz_catch(ctx)
377 { 378 {
378 fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); 379 fz_rethrow_if(ctx, FZ_ERROR_TRYLATER);
@@ -398,6 +399,8 @@ static inline int fz_peek_byte(fz_context *ctx, fz_stream *stm)
398 399
399 if (stm->rp != stm->wp) 400 if (stm->rp != stm->wp)
400 return *stm->rp; 401 return *stm->rp;
402 if (stm->eof)
403 return EOF;
401 404
402 fz_try(ctx) 405 fz_try(ctx)
403 { 406 {