From d208be26537db558edb70236ae517cea31b7ebab Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 4 Oct 2011 18:44:19 +0100 Subject: Move to exception handling rather than error passing throughout. This frees us from passing errors back everywhere, and hence enables us to pass results back as return values. Rather than having to explicitly check for errors everywhere and bubble them, we now allow exception handling to do the work for us; the downside to this is that we no longer emit as much debugging information as we did before (though this could be put back in). For now, the debugging information we have lost has been retained in comments with 'RJW:' at the start. This code needs fuller testing, but is being committed as a work in progress. --- scripts/cmapdump.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c index b245fd48..7f031b5f 100644 --- a/scripts/cmapdump.c +++ b/scripts/cmapdump.c @@ -89,8 +89,11 @@ main(int argc, char **argv) if (!fi) fz_error_make("cmapdump: could not open input file '%s'\n", argv[i]); - error = pdf_parse_cmap(&cmap, fi); - if (error) + fz_try(ctx) + { + cmap = pdf_parse_cmap(fi); + } + fz_catch(ctx) { fz_error_handle(error, "cmapdump: could not parse input cmap '%s'\n", argv[i]); return 1; -- cgit v1.2.3