From 34c971b594bad41fa6c2ad4a9798e5a18de129b5 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 8 Dec 2011 15:32:03 +0100 Subject: Throw exceptions for read errors. --- fitz/stm_open.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'fitz/stm_open.c') diff --git a/fitz/stm_open.c b/fitz/stm_open.c index aa99451b..9f657f27 100644 --- a/fitz/stm_open.c +++ b/fitz/stm_open.c @@ -58,7 +58,7 @@ static int read_file(fz_stream *stm, unsigned char *buf, int len) { int n = read(*(int*)stm->state, buf, len); if (n < 0) - return fz_error_make("read error: %s", strerror(errno)); + fz_throw(stm->ctx, "read error: %s", strerror(errno)); return n; } @@ -66,7 +66,7 @@ static void seek_file(fz_stream *stm, int offset, int whence) { int n = lseek(*(int*)stm->state, offset, whence); if (n < 0) - fz_warn(stm->ctx, "cannot lseek: %s", strerror(errno)); + fz_throw(stm->ctx, "cannot lseek: %s", strerror(errno)); stm->pos = n; stm->rp = stm->bp; stm->wp = stm->bp; @@ -100,7 +100,7 @@ fz_open_file(fz_context *ctx, const char *name) { int fd = open(name, O_BINARY | O_RDONLY, 0); if (fd == -1) - fz_throw(ctx, "Failed to open %s", name); + fz_throw(ctx, "cannot open %s", name); return fz_open_fd(ctx, fd); } -- cgit v1.2.3