Browse code

Fix distcheck warnings.

Török Edvin authored on 2010/05/11 19:33:07
Showing 1 changed files
... ...
@@ -56,9 +56,8 @@ static	char	const	rcsid[] = "$Id: pdf.c,v 1.61 2007/02/12 20:46:09 njh Exp $";
56 56
  *Save the file being worked on in tmp */
57 57
 #endif
58 58
 
59
-static	int	try_flatedecode(unsigned char *buf, off_t real_len, off_t calculated_len, int fout, cli_ctx *ctx);
60
-static	int	flatedecode(unsigned char *buf, off_t len, int fout, cli_ctx *ctx);
61 59
 static	int	asciihexdecode(const char *buf, off_t len, unsigned char *output);
60
+static	int	ascii85decode(const char *buf, off_t len, unsigned char *output);
62 61
 static	const	char	*pdf_nextlinestart(const char *ptr, size_t len);
63 62
 static	const	char	*pdf_nextobject(const char *ptr, size_t len);
64 63
 
... ...
@@ -79,7 +78,7 @@ enum pdf_flag {
79 79
 static int xrefCheck(const char *xref, const char *eof)
80 80
 {
81 81
     const char *q;
82
-    while (xref < eof && *xref == ' ' || *xref == '\n' || *xref == '\r')
82
+    while (xref < eof && (*xref == ' ' || *xref == '\n' || *xref == '\r'))
83 83
 	xref++;
84 84
     if (xref + 4 >= eof)
85 85
 	return -1;
... ...
@@ -172,7 +171,7 @@ static int pdf_findobj(struct pdf_struct *pdf)
172 172
     pdf->nobjs++;
173 173
     pdf->objs = cli_realloc2(pdf->objs, sizeof(*pdf->objs)*pdf->nobjs);
174 174
     if (!pdf->objs) {
175
-	cli_warnmsg("cli_pdf: out of memory parsing objects (%ld)\n", pdf->nobjs);
175
+	cli_warnmsg("cli_pdf: out of memory parsing objects (%u)\n", pdf->nobjs);
176 176
 	return -1;
177 177
     }
178 178
     obj = &pdf->objs[pdf->nobjs-1];
... ...
@@ -229,7 +228,7 @@ static int filter_writen(struct pdf_struct *pdf, struct pdf_obj *obj,
229 229
 static int filter_flatedecode(struct pdf_struct *pdf, struct pdf_obj *obj,
230 230
 			      const unsigned char *buf, off_t len, int fout, off_t *sum)
231 231
 {
232
-    int zstat, ret;
232
+    int zstat;
233 233
     z_stream stream;
234 234
     off_t nbytes;
235 235
     unsigned char output[BUFSIZ];
... ...
@@ -297,11 +296,14 @@ static int filter_flatedecode(struct pdf_struct *pdf, struct pdf_obj *obj,
297 297
 static struct pdf_obj *find_obj(struct pdf_struct *pdf,
298 298
 				struct pdf_obj *obj, uint32_t objid)
299 299
 {
300
-    int j;
301
-    int i = obj - pdf->objs;
302
-    /* search starting at previous obj */
303
-    if (i > 0)
304
-	i--;
300
+    unsigned j;
301
+    unsigned i;
302
+
303
+    /* search starting at previous obj (if exists) */
304
+    if (obj != pdf->objs)
305
+	i = obj - pdf->objs;
306
+    else
307
+	i = 0;
305 308
     for (j=i;j<pdf->nobjs;j++) {
306 309
 	obj = &pdf->objs[j];
307 310
 	if (obj->id == objid)
... ...
@@ -361,7 +363,7 @@ static int find_length(struct pdf_struct *pdf,
361 361
 
362 362
 static int obj_size(struct pdf_struct *pdf, struct pdf_obj *obj)
363 363
 {
364
-    int i = obj - pdf->objs;
364
+    unsigned i = obj - pdf->objs;
365 365
     i++;
366 366
     if (i < pdf->nobjs) {
367 367
 	int s = pdf->objs[i].start - obj->start - 4;
... ...
@@ -371,7 +373,6 @@ static int obj_size(struct pdf_struct *pdf, struct pdf_obj *obj)
371 371
     return pdf->size - obj->start;
372 372
 }
373 373
 
374
-static	int	ascii85decode(const char *buf, off_t len, unsigned char *output);
375 374
 static int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj)
376 375
 {
377 376
     char fullname[NAME_MAX + 1];
... ...
@@ -419,7 +420,7 @@ static int pdf_extract_obj(struct pdf_struct *pdf, struct pdf_obj *obj)
419 419
 		} else if (*q == '\r') {
420 420
 		    length--;
421 421
 		}
422
-		cli_dbgmsg("cli_pdf: calculated length %d\n", length);
422
+		cli_dbgmsg("cli_pdf: calculated length %ld\n", length);
423 423
 	    }
424 424
 	    if (!length)
425 425
 		length = size;
... ...
@@ -535,6 +536,7 @@ static void pdfobj_flag(struct pdf_struct *pdf, struct pdf_obj *obj, enum pdf_fl
535 535
 	case BAD_STREAM_FILTERS:
536 536
 	    s = "duplicate stream filters";
537 537
 	    break;
538
+	default:
538 539
 	case BAD_PDF_VERSION:
539 540
 	case BAD_PDF_HEADERPOS:
540 541
 	case BAD_PDF_TRAILER:
... ...
@@ -690,7 +692,6 @@ static void pdf_parseobj(struct pdf_struct *pdf, struct pdf_obj *obj)
690 690
 
691 691
 	handle_pdfname(pdf, obj, pdfname, escapes, q, &objstate);
692 692
 	if (objstate == STATE_JAVASCRIPT) {
693
-	    const char *q2;
694 693
 	    q2 = pdf_nextobject(q, dict_length);
695 694
 	    if (q2 && isdigit(*q2)) {
696 695
 		uint32_t objid = atoi(q2) << 8;
... ...
@@ -753,7 +754,7 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
753 753
     }
754 754
     if (pdfver != start || offset) {
755 755
 	pdf.flags |= 1 << BAD_PDF_HEADERPOS;
756
-	cli_dbgmsg("cli_pdf: PDF header is not at position 0: %d\n",pdfver-start+offset);
756
+	cli_dbgmsg("cli_pdf: PDF header is not at position 0: %ld\n",pdfver-start+offset);
757 757
     }
758 758
     offset += pdfver - start;
759 759
 
... ...
@@ -836,6 +837,8 @@ int cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
836 836
 }
837 837
 
838 838
 #else
839
+static	int	try_flatedecode(unsigned char *buf, off_t real_len, off_t calculated_len, int fout, cli_ctx *ctx);
840
+static	int	flatedecode(unsigned char *buf, off_t len, int fout, cli_ctx *ctx);
839 841
 int
840 842
 cli_pdf(const char *dir, cli_ctx *ctx, off_t offset)
841 843
 {