From aefe6a511b3cb901034e5995fd882e334e40f2bb Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 13 Sep 2013 15:47:58 +0100 Subject: Fix various compile warnings spotted by the cluster. --- source/pdf/pdf-appearance.c | 2 +- source/pdf/pdf-colorspace.c | 2 +- source/pdf/pdf-crypt.c | 3 ++- source/pdf/pdf-font.c | 2 +- source/pdf/pdf-image.c | 2 +- source/pdf/pdf-parse.c | 2 +- source/pdf/pdf-repair.c | 4 +++- source/pdf/pdf-write.c | 8 ++++---- 8 files changed, 14 insertions(+), 11 deletions(-) (limited to 'source/pdf') diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index f143fc65..0b1a290a 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -80,7 +80,7 @@ static void da_check_stack(float *stack, int *top) void pdf_parse_da(fz_context *ctx, char *da, pdf_da_info *di) { - float stack[32]; + float stack[32] = { 0.0f }; int top = 0; pdf_token tok; char *name = NULL; diff --git a/source/pdf/pdf-colorspace.c b/source/pdf/pdf-colorspace.c index de138f90..9ade1a71 100644 --- a/source/pdf/pdf-colorspace.c +++ b/source/pdf/pdf-colorspace.c @@ -206,7 +206,7 @@ load_indexed(pdf_document *doc, pdf_obj *array) fz_try(ctx) { file = pdf_open_stream(doc, pdf_to_num(lookupobj), pdf_to_gen(lookupobj)); - i = fz_read(file, lookup, n); + (void)fz_read(file, lookup, n); } fz_always(ctx) { diff --git a/source/pdf/pdf-crypt.c b/source/pdf/pdf-crypt.c index c1a4a52c..850ab942 100644 --- a/source/pdf/pdf-crypt.c +++ b/source/pdf/pdf-crypt.c @@ -477,7 +477,8 @@ pdf_compute_hardened_hash_r6(fz_context *ctx, unsigned char *password, int pwlen /* Step 2: repeat password and data block 64 times */ memcpy(data, password, pwlen); memcpy(data + pwlen, block, block_size); - memcpy(data + pwlen + block_size, ownerkey, ownerkey ? 48 : 0); + if (ownerkey) + memcpy(data + pwlen + block_size, ownerkey, 48); data_len = pwlen + block_size + (ownerkey ? 48 : 0); for (j = 1; j < 64; j++) memcpy(data + j * data_len, data, data_len); diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index aee22e51..f79a0769 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -466,7 +466,7 @@ pdf_load_simple_font_by_name(pdf_document *doc, pdf_obj *dict, char *basefont) fontdesc->to_ttf_cmap = pdf_load_system_cmap(ctx, "Adobe-GB1-UCS2"); face = fontdesc->font->ft_face; - kind = ft_kind(face); + /* kind = ft_kind(face); */ goto skip_encoding; } } diff --git a/source/pdf/pdf-image.c b/source/pdf/pdf-image.c index ef93d96b..f3f63d65 100644 --- a/source/pdf/pdf-image.c +++ b/source/pdf/pdf-image.c @@ -222,7 +222,7 @@ pdf_load_jpx(pdf_document *doc, pdf_obj *dict, int forcemask) img = fz_load_jpx(ctx, buf->data, buf->len, colorspace, indexed); - if (img && colorspace == NULL) + if (colorspace == NULL) colorspace = fz_keep_colorspace(ctx, img->colorspace); fz_drop_buffer(ctx, buf); diff --git a/source/pdf/pdf-parse.c b/source/pdf/pdf-parse.c index cf2bdc20..aaa45c0d 100644 --- a/source/pdf/pdf-parse.c +++ b/source/pdf/pdf-parse.c @@ -235,7 +235,7 @@ pdf_parse_array(pdf_document *doc, fz_stream *file, pdf_lexbuf *buf) int a = 0, b = 0, n = 0; pdf_token tok; fz_context *ctx = file->ctx; - pdf_obj *op; + pdf_obj *op = NULL; fz_var(obj); diff --git a/source/pdf/pdf-repair.c b/source/pdf/pdf-repair.c index fc603d1d..8fedbeff 100644 --- a/source/pdf/pdf-repair.c +++ b/source/pdf/pdf-repair.c @@ -257,7 +257,7 @@ pdf_repair_xref(pdf_document *doc, pdf_lexbuf *buf) int num = 0; int gen = 0; int tmpofs, numofs = 0, genofs = 0; - int stm_len, stm_ofs = 0; + int stm_len, stm_ofs; pdf_token tok; int next; int i, n, c; @@ -339,6 +339,8 @@ pdf_repair_xref(pdf_document *doc, pdf_lexbuf *buf) { fz_try(ctx) { + stm_len = 0; + stm_ofs = 0; tok = pdf_repair_obj(doc, buf, &stm_ofs, &stm_len, &encrypt, &id, NULL, &tmpofs); } fz_catch(ctx) diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index cfd14715..3ae6796e 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -1708,11 +1708,11 @@ static void writeobject(pdf_document *doc, pdf_write_options *opts, int num, int dontexpand = !(opts->do_expand & fz_expand_fonts); if (o = pdf_dict_gets(obj, "Type"), !strcmp(pdf_to_name(o), "FontDescriptor")) dontexpand = !(opts->do_expand & fz_expand_fonts); - if ((o = pdf_dict_gets(obj, "Length1")) != NULL) + if (pdf_dict_gets(obj, "Length1") != NULL) dontexpand = !(opts->do_expand & fz_expand_fonts); - if ((o = pdf_dict_gets(obj, "Length2")) != NULL) + if (pdf_dict_gets(obj, "Length2") != NULL) dontexpand = !(opts->do_expand & fz_expand_fonts); - if ((o = pdf_dict_gets(obj, "Length3")) != NULL) + if (pdf_dict_gets(obj, "Length3") != NULL) dontexpand = !(opts->do_expand & fz_expand_fonts); if (o = pdf_dict_gets(obj, "Subtype"), !strcmp(pdf_to_name(o), "Type1C")) dontexpand = !(opts->do_expand & fz_expand_fonts); @@ -2104,7 +2104,7 @@ make_page_offset_hints(pdf_document *doc, pdf_write_options *opts, fz_buffer *bu int min_page_length, max_page_length; int objs_per_page_bits; int min_shared_object, max_shared_object; - int max_shared_object_refs; + int max_shared_object_refs = 0; int min_shared_length, max_shared_length; page_objects **pop = &opts->page_object_lists->page[0]; int page_len_bits, shared_object_bits, shared_object_id_bits; -- cgit v1.2.3