summaryrefslogtreecommitdiff
path: root/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-23 11:20:16 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-23 11:20:16 +0000
commitcc4dd0f8358d3de1594cc530b8f2691bccf194f0 (patch)
treed1bb840ff369382d6a89553ceb3b23464c806af3 /pdf
parent3145e49a9ce16d45bf4d6bb01c64646f41d70e8f (diff)
downloadmupdf-cc4dd0f8358d3de1594cc530b8f2691bccf194f0.tar.xz
Add some fz_vars to fix exception behaviour.
gcc 4.4.5 gives helpful warnings about variables that can become unset due to setjmp/longjmp usage. Fix that here. Thanks to Sebras.
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdf_cmap_load.c5
-rw-r--r--pdf/pdf_image.c3
-rw-r--r--pdf/pdf_repair.c4
-rw-r--r--pdf/pdf_shade.c6
-rw-r--r--pdf/pdf_type3.c7
-rw-r--r--pdf/pdf_xref.c10
6 files changed, 25 insertions, 10 deletions
diff --git a/pdf/pdf_cmap_load.c b/pdf/pdf_cmap_load.c
index 5cf70d9e..bcfc61ae 100644
--- a/pdf/pdf_cmap_load.c
+++ b/pdf/pdf_cmap_load.c
@@ -22,11 +22,14 @@ pdf_load_embedded_cmap(pdf_xref *xref, fz_obj *stmobj)
pdf_cmap *cmap = NULL;
pdf_cmap *usecmap;
fz_obj *wmode;
- fz_obj *obj;
+ fz_obj *obj = NULL;
fz_context *ctx = xref->ctx;
int phase = 0;
fz_var(phase);
+ fz_var(obj);
+ fz_var(file);
+ fz_var(cmap);
if ((cmap = fz_find_item(ctx, pdf_free_cmap_imp, stmobj)))
{
diff --git a/pdf/pdf_image.c b/pdf/pdf_image.c
index db2c6cc4..dd2a5a87 100644
--- a/pdf/pdf_image.c
+++ b/pdf/pdf_image.c
@@ -302,10 +302,11 @@ pdf_load_jpx_image(pdf_xref *xref, fz_obj *dict)
{
fz_buffer *buf = NULL;
fz_colorspace *colorspace = NULL;
- fz_pixmap *img;
+ fz_pixmap *img = NULL;
fz_obj *obj;
fz_context *ctx = xref->ctx;
+ fz_var(img);
fz_var(buf);
fz_var(colorspace);
diff --git a/pdf/pdf_repair.c b/pdf/pdf_repair.c
index 26e446c3..dead9d44 100644
--- a/pdf/pdf_repair.c
+++ b/pdf/pdf_repair.c
@@ -141,12 +141,14 @@ static void
pdf_repair_obj_stm(pdf_xref *xref, int num, int gen)
{
fz_obj *obj;
- fz_stream *stm;
+ fz_stream *stm = NULL;
int tok;
int i, n, count;
char buf[256];
fz_context *ctx = xref->ctx;
+ fz_var(stm);
+
fz_try(ctx)
{
obj = pdf_load_object(xref, num, gen);
diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c
index 6b26d6b1..0432383d 100644
--- a/pdf/pdf_shade.c
+++ b/pdf/pdf_shade.c
@@ -964,14 +964,16 @@ pdf_load_shading_dict(pdf_xref *xref, fz_obj *dict, fz_matrix transform)
pdf_function *func[FZ_MAX_COLORS] = { NULL };
fz_stream *stream = NULL;
fz_obj *obj;
- int funcs;
- int type;
+ int funcs = 0;
+ int type = 0;
int i;
fz_context *ctx = xref->ctx;
fz_var(shade);
fz_var(func);
+ fz_var(funcs);
fz_var(stream);
+ fz_var(type);
fz_try(ctx)
{
diff --git a/pdf/pdf_type3.c b/pdf/pdf_type3.c
index c63a2642..730a2754 100644
--- a/pdf/pdf_type3.c
+++ b/pdf/pdf_type3.c
@@ -12,7 +12,7 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict)
{
char buf[256];
char *estrings[256];
- pdf_font_desc *fontdesc;
+ pdf_font_desc *fontdesc = NULL;
fz_obj *encoding;
fz_obj *widths;
fz_obj *charprocs;
@@ -23,6 +23,8 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict)
fz_matrix matrix;
fz_context *ctx = xref->ctx;
+ fz_var(fontdesc);
+
fz_try(ctx)
{
obj = fz_dict_gets(dict, "Name");
@@ -148,7 +150,8 @@ pdf_load_type3_font(pdf_xref *xref, fz_obj *rdb, fz_obj *dict)
}
fz_catch(ctx)
{
- fz_drop_font(ctx, fontdesc->font);
+ if (fontdesc)
+ fz_drop_font(ctx, fontdesc->font);
fz_free(ctx, fontdesc);
fz_throw(ctx, "cannot load type3 font (%d %d R)", fz_to_num(dict), fz_to_gen(dict));
}
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index d47524b6..55d7ce96 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -296,7 +296,7 @@ pdf_read_new_xref_section(pdf_xref *xref, fz_stream *stm, int i0, int i1, int w0
static fz_obj *
pdf_read_new_xref(pdf_xref *xref, char *buf, int cap)
{
- fz_stream *stm;
+ fz_stream *stm = NULL;
fz_obj *trailer = NULL;
fz_obj *index = NULL;
fz_obj *obj = NULL;
@@ -306,6 +306,7 @@ pdf_read_new_xref(pdf_xref *xref, char *buf, int cap)
fz_context *ctx = xref->ctx;
fz_var(trailer);
+ fz_var(stm);
fz_try(ctx)
{
@@ -846,8 +847,8 @@ pdf_debug_xref(pdf_xref *xref)
static void
pdf_load_obj_stm(pdf_xref *xref, int num, int gen, char *buf, int cap)
{
- fz_stream *stm;
- fz_obj *objstm;
+ fz_stream *stm = NULL;
+ fz_obj *objstm = NULL;
int *numbuf = NULL;
int *ofsbuf = NULL;
@@ -860,6 +861,9 @@ pdf_load_obj_stm(pdf_xref *xref, int num, int gen, char *buf, int cap)
fz_var(numbuf);
fz_var(ofsbuf);
+ fz_var(objstm);
+ fz_var(stm);
+
fz_try(ctx)
{
objstm = pdf_load_object(xref, num, gen);