summaryrefslogtreecommitdiff
path: root/fitz/stm_read.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-09-11 19:29:42 -0500
committerRobin Watts <robin.watts@artifex.com>2011-09-14 17:44:13 +0100
commit89ae81f651bfa112b8e07317eb6983beaf7cb212 (patch)
tree3f99dad1253b795629e66d45b915c1d72043242b /fitz/stm_read.c
parentcefb81f1886685580a40b17b5e495a8a8a1ebeaf (diff)
downloadmupdf-89ae81f651bfa112b8e07317eb6983beaf7cb212.tar.xz
Initial import of exception handling code
Import exception handling code from WSS, modified to fit into the fitz world. With this code we have 'real' fz_try/fz_catch/fz_rethrow functions, handling a fz_except type. We therefore rename the existing fz_throw/ fz_catch/fz_rethrow to be fz_error_make/fz_error_handle/fz_error_note. We don't actually use fz_try/fz_catch/fz_rethrow yet...
Diffstat (limited to 'fitz/stm_read.c')
-rw-r--r--fitz/stm_read.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fitz/stm_read.c b/fitz/stm_read.c
index 59f06433..89811333 100644
--- a/fitz/stm_read.c
+++ b/fitz/stm_read.c
@@ -23,7 +23,7 @@ fz_read(fz_stream *stm, unsigned char *buf, int len)
if (n < 0)
{
stm->error = 1;
- return fz_rethrow(n, "read error");
+ return fz_error_note(n, "read error");
}
else if (n == 0)
{
@@ -50,7 +50,7 @@ fz_read(fz_stream *stm, unsigned char *buf, int len)
if (n < 0)
{
stm->error = 1;
- return fz_rethrow(n, "read error");
+ return fz_error_note(n, "read error");
}
else if (n == 0)
{
@@ -80,7 +80,7 @@ fz_fill_buffer(fz_stream *stm)
if (n < 0)
{
stm->error = 1;
- fz_catch(n, "read error; treating as end of file");
+ fz_error_handle(n, "read error; treating as end of file");
}
else if (n == 0)
{
@@ -113,14 +113,14 @@ fz_read_all(fz_buffer **bufp, fz_stream *stm, int initial)
if (buf->len / 200 > initial)
{
fz_drop_buffer(buf);
- return fz_throw("compression bomb detected");
+ return fz_error_make("compression bomb detected");
}
n = fz_read(stm, buf->data + buf->len, buf->cap - buf->len);
if (n < 0)
{
fz_drop_buffer(buf);
- return fz_rethrow(n, "read error");
+ return fz_error_note(n, "read error");
}
if (n == 0)
break;