summaryrefslogtreecommitdiff
path: root/fitz/stm_open.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-12-08 15:32:03 +0100
committerTor Andersson <tor.andersson@artifex.com>2011-12-08 21:46:55 +0100
commit34c971b594bad41fa6c2ad4a9798e5a18de129b5 (patch)
tree0c3956c35f827d1649e0520abf18974a4e0ec8e2 /fitz/stm_open.c
parente64a57b1e9c2ba6c6f54eff73c414be9e78dafbe (diff)
downloadmupdf-34c971b594bad41fa6c2ad4a9798e5a18de129b5.tar.xz
Throw exceptions for read errors.
Diffstat (limited to 'fitz/stm_open.c')
-rw-r--r--fitz/stm_open.c6
1 files changed, 3 insertions, 3 deletions
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);
}