summaryrefslogtreecommitdiff
path: root/stream
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-03-27 14:42:36 +0100
committerTor Andersson <tor@ghostscript.com>2008-03-27 14:42:36 +0100
commit3909e66a925d8981cce45f4fb64dffb43eb97549 (patch)
treecf5c9ef72eef151ea766ea7dfc1090e5dc07652b /stream
parent9d6fdc1b0616715498bb9dfbdb65a984a9191f8e (diff)
downloadmupdf-3909e66a925d8981cce45f4fb64dffb43eb97549.tar.xz
Chain error messages in more files.
Diffstat (limited to 'stream')
-rw-r--r--stream/obj_dict.c7
-rw-r--r--stream/obj_parse.c10
-rw-r--r--stream/stm_write.c12
3 files changed, 16 insertions, 13 deletions
diff --git a/stream/obj_dict.c b/stream/obj_dict.c
index a93ae1bd..a3366170 100644
--- a/stream/obj_dict.c
+++ b/stream/obj_dict.c
@@ -325,10 +325,13 @@ fz_dictputs(fz_obj *obj, char *key, fz_obj *val)
fz_error *error;
fz_obj *keyobj;
error = fz_newname(&keyobj, key);
- if (error) return error;
+ if (error)
+ return fz_rethrow(error, "cannot create dict key");
error = fz_dictput(obj, keyobj, val);
fz_dropobj(keyobj);
- return error;
+ if (error)
+ return fz_rethrow(error, "cannot insert dict entry");
+ return nil;
}
fz_error *
diff --git a/stream/obj_parse.c b/stream/obj_parse.c
index 316e8ad4..8f43a064 100644
--- a/stream/obj_parse.c
+++ b/stream/obj_parse.c
@@ -181,7 +181,7 @@ cleanup:
if (dict) fz_dropobj(dict);
*obj = nil;
*sp = s;
- return error;
+ return error; /* already rethrown */
}
static fz_error *parsearray(fz_obj **obj, char **sp, struct vap *v)
@@ -462,7 +462,7 @@ static fz_error *parseobj(fz_obj **obj, char **sp, struct vap *v)
error = fz_throw("syntax error: unknown byte 0x%d", *s);
*sp = s;
- return error;
+ return error; /* already rethrown */
}
fz_error *
@@ -476,12 +476,12 @@ fz_packobj(fz_obj **op, char *fmt, ...)
va_copy(v.ap, ap);
error = parseobj(op, &fmt, &v);
- if (error)
- error = fz_rethrow(error, "cannot parse object");
va_end(ap);
- return error;
+ if (error)
+ return fz_rethrow(error, "cannot parse object");
+ return nil;
}
fz_error *
diff --git a/stream/stm_write.c b/stream/stm_write.c
index 23b268d9..9f136292 100644
--- a/stream/stm_write.c
+++ b/stream/stm_write.c
@@ -266,10 +266,10 @@ fz_printobj(fz_stream *file, fz_obj *obj, int tight)
return fz_throw("outofmem: scratch buffer");
fz_sprintobj(ptr, n, obj, tight);
error = fz_write(file, ptr, n);
- if (error)
- error = fz_rethrow(error, "cannot write buffer");
fz_free(ptr);
- return error;
+ if (error)
+ return fz_rethrow(error, "cannot write buffer");
+ return fz_okay;
}
}
@@ -303,11 +303,11 @@ fz_print(fz_stream *stm, char *fmt, ...)
va_end(ap);
error = fz_write(stm, p, n);
- if (error)
- error = fz_rethrow(error, "cannot write buffer");
fz_free(p);
- return error;
+ if (error)
+ return fz_rethrow(error, "cannot write buffer");
+ return fz_okay;
}