summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-repair.c
diff options
context:
space:
mode:
authorSimon Bünzli <zeniko@gmail.com>2013-09-13 20:52:15 +0200
committerSimon Bünzli <zeniko@gmail.com>2013-09-27 16:24:26 +0200
commite6ad4dbd07ecffdb764a58977a013c862263355b (patch)
tree9e9a5489a9166995e0f988897c4034d953ae6058 /source/pdf/pdf-repair.c
parent2c615e5aa18c7a34118605774de70b6b65f04b19 (diff)
downloadmupdf-e6ad4dbd07ecffdb764a58977a013c862263355b.tar.xz
stop checking if the result of fz_read is negative
fz_read used to return a negative value on errors. With the introduction of fz_try/fz_catch, it throws an error instead and always returns non-negative values. This removes the pointless checks.
Diffstat (limited to 'source/pdf/pdf-repair.c')
-rw-r--r--source/pdf/pdf-repair.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/source/pdf/pdf-repair.c b/source/pdf/pdf-repair.c
index 8fedbeff..c742714d 100644
--- a/source/pdf/pdf-repair.c
+++ b/source/pdf/pdf-repair.c
@@ -19,7 +19,6 @@ pdf_repair_obj(pdf_document *doc, pdf_lexbuf *buf, int *stmofsp, int *stmlenp, p
{
pdf_token tok;
int stm_len;
- int n;
fz_stream *file = doc->file;
fz_context *ctx = file->ctx;
@@ -134,9 +133,7 @@ pdf_repair_obj(pdf_document *doc, pdf_lexbuf *buf, int *stmofsp, int *stmlenp, p
fz_seek(file, *stmofsp, 0);
}
- n = fz_read(file, (unsigned char *) buf->scratch, 9);
- if (n < 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot read from file");
+ (void)fz_read(file, (unsigned char *) buf->scratch, 9);
while (memcmp(buf->scratch, "endstream", 9) != 0)
{
@@ -285,8 +282,6 @@ pdf_repair_xref(pdf_document *doc, pdf_lexbuf *buf)
/* look for '%PDF' version marker within first kilobyte of file */
n = fz_read(doc->file, (unsigned char *)buf->scratch, fz_mini(buf->size, 1024));
- if (n < 0)
- fz_throw(ctx, FZ_ERROR_GENERIC, "cannot read from file");
fz_seek(doc->file, 0, 0);
for (i = 0; i < n - 4; i++)