From 767b08e66fef57327b9a2af023207b97300d42e2 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Fri, 22 Jun 2012 01:29:17 +0200 Subject: Warning fixes and various clean ups: Remove unused variable, silencing compiler warning. No need to initialize variables twice. Remove initialization of unread variable. Remove unnecessary check for NULL. Close output file upon error in cmapdump. --- fitz/base_hash.c | 2 +- pdf/pdf_annot.c | 13 +++++-------- pdf/pdf_interpret.c | 8 ++++---- pdf/pdf_write.c | 2 -- scripts/cmapdump.c | 5 +++++ 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/fitz/base_hash.c b/fitz/base_hash.c index 4ba02f4d..ccdffe63 100644 --- a/fitz/base_hash.c +++ b/fitz/base_hash.c @@ -138,7 +138,7 @@ static void fz_resize_hash(fz_context *ctx, fz_hash_table *table, int newsize) { fz_hash_entry *oldents = table->ents; - fz_hash_entry *newents = table->ents; + fz_hash_entry *newents; int oldsize = table->size; int oldload = table->load; int i; diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c index 3864c62e..f6c70f90 100644 --- a/pdf/pdf_annot.c +++ b/pdf/pdf_annot.c @@ -399,15 +399,12 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots) pdf_transform_annot(annot); - if (annot) + if (!head) + head = tail = annot; + else { - if (!head) - head = tail = annot; - else - { - tail->next = annot; - tail = annot; - } + tail->next = annot; + tail = annot; } } } diff --git a/pdf/pdf_interpret.c b/pdf/pdf_interpret.c index a2fdacb9..854de300 100644 --- a/pdf/pdf_interpret.c +++ b/pdf/pdf_interpret.c @@ -556,10 +556,10 @@ pdf_flush_text(pdf_csi *csi) { pdf_gstate *gstate = csi->gstate + csi->gtop; fz_text *text; - int dofill = 0; - int dostroke = 0; - int doclip = 0; - int doinvisible = 0; + int dofill; + int dostroke; + int doclip; + int doinvisible; fz_context *ctx = csi->dev->ctx; if (!csi->text) diff --git a/pdf/pdf_write.c b/pdf/pdf_write.c index 8d32febe..8334e92a 100644 --- a/pdf/pdf_write.c +++ b/pdf/pdf_write.c @@ -151,7 +151,6 @@ static void page_objects_insert(fz_context *ctx, page_objects **ppo, int i) { page_objects *po; - int j; /* Make a page_objects if we don't have one */ if (*ppo == NULL) @@ -165,7 +164,6 @@ page_objects_insert(fz_context *ctx, page_objects **ppo, int i) po->cap *= 2; *ppo = po; } - j = po->len; po->object[po->len++] = i; } diff --git a/scripts/cmapdump.c b/scripts/cmapdump.c index 53247339..2a83533e 100644 --- a/scripts/cmapdump.c +++ b/scripts/cmapdump.c @@ -78,6 +78,11 @@ main(int argc, char **argv) if (strlen(realname) > (sizeof name - 1)) { fprintf(stderr, "cmapdump: file name too long\n"); + if (fclose(fo)) + { + fprintf(stderr, "cmapdump: could not close output file '%s'\n", argv[1]); + return 1; + } return 1; } -- cgit v1.2.3