$OpenBSD: patch-pbmtools_jbgtopbm_c,v 1.2 2013/04/13 08:53:10 ajacoutot Exp $
--- pbmtools/jbgtopbm.c.orig	Wed Aug 27 22:37:45 2008
+++ pbmtools/jbgtopbm.c	Fri Apr 12 15:05:35 2013
@@ -110,7 +110,7 @@ void fprint_bytes(FILE *f, unsigned char *p, size_t le
   for (i = 0; i < len && i < max; i++)
     fprintf(f, "%02x ", p[i]);
   if (len > i)
-    fprintf(f, "... %d bytes total", len);
+    fprintf(f, "... %zd bytes total", len);
   fprintf(f, "\n");
 }
 
@@ -134,7 +134,7 @@ void diagnose_bie(FILE *fin)
   /* read BIH */
   read_file(&bie, &buflen, &len, fin);
   if (len < 20) {
-    fprintf(f, "Error: Input file is %d < 20 bytes long and therefore "
+    fprintf(f, "Error: Input file is %zd < 20 bytes long and therefore "
 	    "does not contain an intact BIE header!\n", len);
     return;
   }
@@ -188,18 +188,18 @@ void diagnose_bie(FILE *fin)
       == (JBG_DPON | JBG_DPPRIV))
     p += 1728;  /* skip DPTABLE */
   if (p > bie + len) {
-    fprintf(f, "Error: Input file is %d < 20+1728 bytes long and therefore "
+    fprintf(f, "Error: Input file is %zd < 20+1728 bytes long and therefore "
 	    "does not contain an intact BIE header with DPTABLE!\n", len);
     return;
   }
   while (p != bie + len) {
     if (p > bie + len - 2) {
-      fprintf(f, "%06x: Error: single byte 0x%02x left\n", p - bie, *p);
+      fprintf(f, "%06tx: Error: single byte 0x%02x left\n", p - bie, *p);
       return;
     }
     pnext = jbg_next_pscdms(p, len - (p - bie));
     if (p[0] != MARKER_ESC || p[1] == MARKER_STUFF) {
-      fprintf(f, "%06x: PSCD: ", p - bie);
+      fprintf(f, "%06tx: PSCD: ", p - bie);
       fprint_bytes(f, p, pnext ? (size_t) (pnext - p) : len - (p - bie), 60);
       if (!pnext) {
 	fprintf(f, "Error: PSCD not terminated by SDNORM or SDRST marker\n");
@@ -209,7 +209,7 @@ void diagnose_bie(FILE *fin)
       switch (p[1]) {
       case MARKER_SDNORM:
       case MARKER_SDRST:
-	fprintf(f, "%06x: ESC %s, ending SDE #%lu", p - bie,
+	fprintf(f, "%06tx: ESC %s, ending SDE #%lu", p - bie,
 		(p[1] == MARKER_SDNORM) ? "SDNORM" : "SDRST", ++sde);
 	if (sde == sdes)
 	  fprintf(f, " (final SDE)");
@@ -219,10 +219,10 @@ void diagnose_bie(FILE *fin)
 	fprintf(f, "\n");
 	break;
       case MARKER_ABORT:
-	fprintf(f, "%06x: ESC ABORT\n", p - bie);
+	fprintf(f, "%06tx: ESC ABORT\n", p - bie);
 	break;
       case MARKER_NEWLEN:
-	fprintf(f, "%06x: ESC NEWLEN ", p - bie);
+	fprintf(f, "%06tx: ESC NEWLEN ", p - bie);
 	if (p + 5 < bie + len) {
 	  fprintf(f, "YD = %lu\n",
 		  yd = (((long) p[2] << 24) | ((long) p[3] << 16) |
@@ -242,7 +242,7 @@ void diagnose_bie(FILE *fin)
 	  fprintf(f, "unexpected EOF\n");
 	break;
       case MARKER_ATMOVE:
-	fprintf(f, "%06x: ESC ATMOVE ", p - bie);
+	fprintf(f, "%06tx: ESC ATMOVE ", p - bie);
 	if (p + 7 < bie + len)
 	  fprintf(f, "YAT = %lu, tX = %d, tY = %d\n",
 		  (((long) p[2] << 24) | ((long) p[3] << 16) |
@@ -251,7 +251,7 @@ void diagnose_bie(FILE *fin)
 	  fprintf(f, "unexpected EOF\n");
 	break;
       case MARKER_COMMENT:
-	fprintf(f, "%06x: ESC COMMENT ", p - bie);
+	fprintf(f, "%06tx: ESC COMMENT ", p - bie);
 	if (p + 5 < bie + len)
 	  fprintf(f, "LC = %lu\n",
 		  (((long) p[2] << 24) | ((long) p[3] << 16) |
@@ -260,7 +260,7 @@ void diagnose_bie(FILE *fin)
 	  fprintf(f, "unexpected EOF\n");
 	break;
       default:
-	fprintf(f, "%06x: ESC 0x%02x\n", p - bie, p[1]);
+	fprintf(f, "%06tx: ESC 0x%02x\n", p - bie, p[1]);
       }
     if (!pnext) {
       fprintf(f, "Error encountered!\n");
@@ -372,7 +372,7 @@ int main (int argc, char **argv)
   /* read BIH first to check VLENGTH */
   len = fread(buffer, 1, 20, fin);
   if (len < 20) {
-    fprintf(stderr, "Input file '%s' (%d bytes) must be at least "
+    fprintf(stderr, "Input file '%s' (%zd bytes) must be at least "
 	    "20 bytes long\n", fnin, len);
     if (fout != stdout) {
       fclose(fout);
