libtiff: Further improvements by Richard Nolde.

https://github.com/libsdl-org/libtiff/commit/2eb8ffff484d46e36c49f5d17d7b32898211db24

From 2eb8ffff484d46e36c49f5d17d7b32898211db24 Mon Sep 17 00:00:00 2001
From: Lee Howard <[EMAIL REDACTED]>
Date: Fri, 26 Nov 2010 22:43:46 +0000
Subject: [PATCH] Further improvements by Richard Nolde.

---
 tools/tiff2ps.c | 212 +++++++++++++++++++++++++++---------------------
 1 file changed, 120 insertions(+), 92 deletions(-)

diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
index 7a5c2bb8..3e55470f 100644
--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c
@@ -1,4 +1,4 @@
-/* $Id: tiff2ps.c,v 1.35.2.5 2010-09-26 04:13:57 faxguy Exp $ */
+/* $Id: tiff2ps.c,v 1.35.2.6 2010-11-26 22:43:46 faxguy Exp $ */
 
 /*
  * Copyright (c) 1988-1997 Sam Leffler
@@ -36,11 +36,16 @@
 # include <unistd.h>
 #endif
 
+#ifdef NEED_LIBPORT
+# include "libport.h"
+#endif
+
 #include "tiffio.h"
 
 /*
  * Revision history
- * 2010-Sep-07
+ *
+ * 2010-Sep-17
  *    Richard Nolde: Reinstate code from Feb 2009 that never got
  *    accepted into CVS with major modifications to handle -H and -W
  *    options. Replaced original PlaceImage function with several
@@ -166,9 +171,6 @@
 #define	FALSE	0
 #endif
 
-#define HORIZONTAL 1
-#define VERTICAL   2
-
 int	ascii85 = FALSE;		/* use ASCII85 encoding */
 int	interpolate = TRUE;		/* interpolate level2 image */
 int	level2 = FALSE;			/* generate PostScript level 2 */
@@ -214,7 +216,7 @@ void	PSTail(FILE*, int);
 int     psStart(FILE *, int, int, int *, double *, double, double, double,
                 double, double, double, double, double, double, double);
 int     psPageSize(FILE *, int, double, double, double, double, double, double);
-int     psRotateImage(FILE *, int, double, double);
+int     psRotateImage(FILE *, int, double, double, double, double);
 int     psMaskImage(FILE *, TIFF *, int, int, int *, double, double,
 		    double, double, double, double, double, double, double);
 int     psScaleImage(FILE *, double, int, int, double, double, double, double,
@@ -224,7 +226,7 @@ int     exportMaskedImage(FILE *, double, double, double, double, int, int,
 			  double, double, double, int, int);
 
 #if	defined( EXP_ASCII85ENCODER)
-int Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l );
+tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, tsize_t raw_l );
 #endif
 
 static	void usage(int);
@@ -290,16 +292,16 @@ main(int argc, char* argv[])
 		case 'o':
 		        switch (optarg[0])
                           {
-                          case 0:
-                          case 1:
-                          case 2:
-                          case 3:
-                          case 4:
-                          case 5:
-                          case 6:
-                          case 7:
-                          case 8:
-                          case 9: diroff = (uint32) strtoul(optarg, NULL, 0);
+                          case '0':
+                          case '1':
+                          case '2':
+                          case '3':
+                          case '4':
+                          case '5':
+                          case '6':
+                          case '7':
+                          case '8':
+                          case '9': diroff = (uint32) strtoul(optarg, NULL, 0);
 			          break;
                           default: TIFFError ("-o", "Offset must be a numeric value.");
 			    exit (1);
@@ -422,10 +424,8 @@ main(int argc, char* argv[])
         if (auto_rotate == TRUE)
           {
 	  if ((pageWidth == 0) || (pageHeight == 0))
-            {
-	    TIFFError ("-r auto", " requires page height and width specified with -h and -w");
-            exit (1);
-            }
+	    TIFFWarning ("-r auto", " requires page height and width specified with -h and -w");
+
           if ((maxPageWidth > 0) || (maxPageHeight > 0))
             {
 	    TIFFError ("-r auto", " is incompatible with maximum page width/height specified by -H or -W");
@@ -645,9 +645,9 @@ setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
                 break;
     default: /* Last ditch guess for unspecified RESUNIT case
 	      * check that the resolution is not inches before scaling it.
-                Moved to end of function with additional check, RJN, 08-31-2010
-		if (xres != PS_UNIT_SIZE || yres != PS_UNIT_SIZE)
-			xres *= PS_UNIT_SIZE, yres *= PS_UNIT_SIZE;
+              * Moved to end of function with additional check, RJN, 08-31-2010
+	      * if (xres != PS_UNIT_SIZE || yres != PS_UNIT_SIZE)
+	      *	  xres *= PS_UNIT_SIZE, yres *= PS_UNIT_SIZE;
 	      */
 		break;
     }
@@ -662,7 +662,6 @@ setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
     *pprh = PSUNITS(*ph, yres);
   else
     *pprh = PSUNITS(*ph, PS_UNIT_SIZE);
-
   }
 
 static int
@@ -720,15 +719,15 @@ int get_subimage_count(double pagewidth,  double pageheight,
 		if (imageheight > splitheight) /* More than one vertical image segment */
 		  { 
 		  if (pagewidth)
-		    *ximages = ceil((scale * imagewidth)  / (pagewidth - overlap));  
+		    *ximages = (int)ceil((scale * imagewidth)  / (pagewidth - overlap));  
                   else
 		    *ximages = 1;
-		  *yimages = ceil((scale * imageheight) / (splitheight - overlap)); /* Max vert pages needed */
+		  *yimages = (int)ceil((scale * imageheight) / (splitheight - overlap)); /* Max vert pages needed */
 		  }
                 else
 		  {
 		  if (pagewidth)
-		    *ximages = ceil((scale * imagewidth) / (pagewidth - overlap));    /* Max horz pages needed */
+		    *ximages = (int)ceil((scale * imagewidth) / (pagewidth - overlap));    /* Max horz pages needed */
                   else
 		    *ximages = 1;
 		  *yimages = 1;                                                     /* Max vert pages needed */
@@ -740,9 +739,9 @@ int get_subimage_count(double pagewidth,  double pageheight,
 		  {
 	          if (imagewidth >splitwidth) 
 		    {
-		    *ximages = ceil((scale * imagewidth)  / (splitwidth - overlap));   /* Max horz pages needed */
+		    *ximages = (int)ceil((scale * imagewidth)  / (splitwidth - overlap));   /* Max horz pages needed */
                     if (pageheight)
-		      *yimages = ceil((scale * imageheight) / (pageheight - overlap)); /* Max vert pages needed */
+		      *yimages = (int)ceil((scale * imageheight) / (pageheight - overlap)); /* Max vert pages needed */
                     else
 		      *yimages = 1;
 		    }
@@ -750,7 +749,7 @@ int get_subimage_count(double pagewidth,  double pageheight,
 		    {
 		    *ximages = 1;                                                     /* Max vert pages needed */
                     if (pageheight)
-		      *yimages = ceil((scale * imageheight) / (pageheight - overlap)); /* Max vert pages needed */
+		      *yimages = (int)ceil((scale * imageheight) / (pageheight - overlap)); /* Max vert pages needed */
                     else
 		      *yimages = 1;
 		    }
@@ -767,9 +766,9 @@ int get_subimage_count(double pagewidth,  double pageheight,
                 {
 		if (imagewidth > splitheight) /* More than one vertical image segment */
 		  {
-		  *yimages = ceil((scale * imagewidth) / (splitheight - overlap)); /* Max vert pages needed */
+		  *yimages = (int)ceil((scale * imagewidth) / (splitheight - overlap)); /* Max vert pages needed */
                   if (pagewidth)
-  		    *ximages = ceil((scale * imageheight) / (pagewidth - overlap));   /* Max horz pages needed */
+  		    *ximages = (int)ceil((scale * imageheight) / (pagewidth - overlap));   /* Max horz pages needed */
                   else
 		    *ximages = 1;
 		  }
@@ -777,7 +776,7 @@ int get_subimage_count(double pagewidth,  double pageheight,
 		  {
 		  *yimages = 1;                                                     /* Max vert pages needed */
                   if (pagewidth)
-		    *ximages = ceil((scale * imageheight) / (pagewidth - overlap));    /* Max horz pages needed */
+		    *ximages = (int)ceil((scale * imageheight) / (pagewidth - overlap));    /* Max horz pages needed */
                   else
 		    *ximages = 1;
 		  }
@@ -789,15 +788,15 @@ int get_subimage_count(double pagewidth,  double pageheight,
 	          if (imageheight > splitwidth) 
 		    { 
 		    if (pageheight)
-		      *yimages = ceil((scale * imagewidth) / (pageheight - overlap)); /* Max vert pages needed */
+		      *yimages = (int)ceil((scale * imagewidth) / (pageheight - overlap)); /* Max vert pages needed */
                     else
 		      *yimages = 1;
-		    *ximages = ceil((scale * imageheight)  / (splitwidth - overlap));   /* Max horz pages needed */
+		    *ximages = (int)ceil((scale * imageheight)  / (splitwidth - overlap));   /* Max horz pages needed */
 		    }
                   else
 		    {
 		    if (pageheight)
-		      *yimages = ceil((scale * imagewidth) / (pageheight - overlap));  /* Max horz pages needed */
+		      *yimages = (int)ceil((scale * imagewidth) / (pageheight - overlap));  /* Max horz pages needed */
                     else
 		      *yimages = 1;
 		    *ximages = 1;                                                     /* Max vert pages needed */
@@ -965,11 +964,14 @@ int exportMaskedImage(FILE *fp, double pagewidth, double pageheight,
   return (0);
   } 
 
-
 /* Rotate an image without scaling or clipping */
-int  psRotateImage (FILE * fd, int rotation, double pswidth, double psheight) 
+int  psRotateImage (FILE * fd, int rotation, double pswidth, double psheight, 
+                    double left_offset, double bottom_offset) 
   {
-  /* Exchange Width and height for 90/270 rotations */
+  if ((left_offset != 0.0) || (bottom_offset != 0))
+    fprintf (fd, "%f %f translate\n", left_offset, bottom_offset);
+
+  /* Exchange width and height for 90/270 rotations */
   switch (rotation)
     {
     case   0: fprintf (fd, "%f %f scale\n", pswidth, psheight);
@@ -999,39 +1001,55 @@ int psScaleImage(FILE * fd, double scale, int rotation, int center,
     {
     switch (rotation)
       {
-      case   90:
+      case   90: vcenter = (reqheight - pswidth * scale) / 2;
+	         hcenter = (reqwidth - psheight * scale) / 2;
+                 fprintf (fd, "%f %f translate\n", hcenter, vcenter);
+                 fprintf (fd, "%f %f scale\n1 0 translate 90 rotate\n", psheight * scale, pswidth * scale);
+                 break;
+      case  180: hcenter = (reqwidth - pswidth * scale) / 2;
+	         vcenter = (reqheight - psheight * scale) / 2;
+                 fprintf (fd, "%f %f translate\n", hcenter, vcenter);
+                 fprintf (fd, "%f %f scale\n1 1 translate 180 rotate\n", pswidth * scale, psheight * scale);
+                 break;
       case  270: vcenter = (reqheight - pswidth * scale) / 2;
 	         hcenter = (reqwidth - psheight * scale) / 2;
+                 fprintf (fd, "%f %f translate\n", hcenter, vcenter);
+                 fprintf (fd, "%f %f scale\n0 1 translate 270 rotate\n", psheight * scale, pswidth * scale);
                  break;
       case    0:
-      case  180:
       default:   hcenter = (reqwidth - pswidth * scale) / 2;
 	         vcenter = (reqheight - psheight * scale) / 2;
+                 fprintf (fd, "%f %f translate\n", hcenter, vcenter);
+                 fprintf (fd, "%f %f scale\n", pswidth * scale, psheight * scale);
                  break;
       }
-    fprintf (fd, "%f %f translate\n", hcenter, vcenter);
     }
   else  /* Not centered */ 
     {
-    hcenter = 0.0, vcenter = 0.0;
-    if (left_offset != 0.0 && bottom_offset != 0.0)
-      fprintf (fd, "%f %f translate\n", left_offset, bottom_offset);
+    switch (rotation)
+      {
+      case 0:   fprintf (fd, "%f %f translate\n", left_offset ? left_offset : 0.0, 
+                         bottom_offset ? bottom_offset : reqheight - (psheight * scale));
+                fprintf (fd, "%f %f scale\n", pswidth * scale, psheight * scale);
+                break;
+      case 90:  fprintf (fd, "%f %f translate\n", left_offset ? left_offset : 0.0,  
+                         bottom_offset ? bottom_offset : reqheight - (pswidth * scale));
+                fprintf (fd, "%f %f scale\n1 0 translate 90 rotate\n", psheight * scale, pswidth * scale);
+                break;
+      case 180: fprintf (fd, "%f %f translate\n", left_offset ? left_offset : 0.0,  
+                         bottom_offset ? bottom_offset : reqheight - (psheight * scale));
+                fprintf (fd, "%f %f scale\n1 1 translate 180 rotate\n", pswidth * scale, psheight * scale);
+                break;
+      case 270: fprintf (fd, "%f %f translate\n", left_offset ? left_offset : 0.0,  
+                         bottom_offset ? bottom_offset : reqheight - (pswidth * scale));
+                fprintf (fd, "%f %f scale\n0 1 translate 270 rotate\n", psheight * scale, pswidth * scale);
+                break;
+      default:  TIFFError ("psScaleImage", "Unsupported rotation  %d", rotation);
+ 	        fprintf (fd, "%f %f scale\n", pswidth * scale, psheight * scale);
+                return (1);
+      }
     }
 
-  switch (rotation)
-    {
-    case 0:   fprintf (fd, "%f %f scale\n", pswidth * scale, psheight * scale);
-              break;
-    case 90:  fprintf (fd, "%f %f scale\n1 0 translate 90 rotate\n", psheight * scale, pswidth * scale);
-              break;
-    case 180: fprintf (fd, "%f %f scale\n1 1 translate 180 rotate\n", pswidth * scale, psheight * scale);
-	      break;
-    case 270: fprintf (fd, "%f %f scale\n0 1 translate 270 rotate\n", psheight * scale, pswidth * scale);
-	      break;
-    default:  TIFFError ("psScaleImage", "Unsupported rotation  %d", rotation);
-	      fprintf (fd, "%f %f scale\n", pswidth * scale, psheight * scale);
-              return (1);
-    }
   return (0);
   }
 
@@ -1378,16 +1396,19 @@ int get_viewport (double pgwidth, double pgheight, double pswidth, double psheig
   if (maxPageHeight != 0)   /* Clip the viewport to maxPageHeight on each page */
     {
     *view_height = maxPageHeight * PS_UNIT_SIZE;
-    if (res_unit == RESUNIT_CENTIMETER)
-      *view_height *= 2.54F;
+    /*
+     * if (res_unit == RESUNIT_CENTIMETER)
+     * *view_height /= 2.54F;
+     */
     }
   else 
     {
     if (pgheight != 0) /* User has set PageHeight with -h flag */
       {
       *view_height = pgheight * PS_UNIT_SIZE; /* Postscript size for Page Height in inches */
-      if (res_unit == RESUNIT_CENTIMETER)
-        *view_height *= 2.54F;
+      /* if (res_unit == RESUNIT_CENTIMETER)
+       *  *view_height /= 2.54F;
+       */
       }
     else /* If no width or height are specified, use the original size from image */
       switch (rotation)
@@ -1405,16 +1426,18 @@ int get_viewport (double pgwidth, double pgheight, double pswidth, double psheig
   if (maxPageWidth != 0)   /* Clip the viewport to maxPageWidth on each page */
     {
     *view_width = maxPageWidth * PS_UNIT_SIZE;
-    if (res_unit == RESUNIT_CENTIMETER)
-       *view_width *= 2.54F;
+    /* if (res_unit == RESUNIT_CENTIMETER)
+     *  *view_width /= 2.54F;
+     */
     }
   else
     {
     if (pgwidth != 0)  /* User has set PageWidth with -w flag */
       {
       *view_width = pgwidth * PS_UNIT_SIZE; /* Postscript size for Page Width in inches */
-      if (res_unit == RESUNIT_CENTIMETER)
-        *view_width *= 2.54F;
+      /* if (res_unit == RESUNIT_CENTIMETER)
+       * *view_width /= 2.54F;
+       */
       }
     else  /* If no width or height are specified, use the original size from image */
       switch (rotation)
@@ -1546,7 +1569,7 @@ int TIFF2PS(FILE* fd, TIFF* tif, double pgwidth, double pgheight, double lm, dou
 	     }
 	   }
 	 }
-       else  /* Simple rotation: user did not use -H or -h or -w */
+       else  /* Simple rotation: user did not use -H, -W, -h or -w */
          {
          npages++;
          fprintf(fd, "%%%%Page: %d %d\n", npages, npages);
@@ -1560,7 +1583,7 @@ int TIFF2PS(FILE* fd, TIFF* tif, double pgwidth, double pgheight, double lm, dou
          }
          fprintf(fd, "gsave\n");
          fprintf(fd, "100 dict begin\n");
- 	 if (psRotateImage(fd, rotation, pswidth, psheight))
+ 	 if (psRotateImage(fd, rotation, pswidth, psheight, left_offset, bottom_offset))
            return (-1);
 
          PSpage(fd, tif, pixwidth, pixheight);
@@ -2077,7 +2100,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 
 /* Flip the byte order of buffers with 16 bit samples */
 static void
-PS_FlipBytes(unsigned char* buf, int count)
+PS_FlipBytes(unsigned char* buf, tsize_t count)
 {
 	int i;
 	unsigned char temp;
@@ -2102,12 +2125,13 @@ PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 {
 	uint16 fillorder;
 	int use_rawdata, tiled_image, breaklen = MAXLINE;
-	uint32 chunk_no, num_chunks, *bc;
+	uint32 chunk_no, num_chunks;
+        uint32 *bc;
 	unsigned char *buf_data, *cp;
 	tsize_t chunk_size, byte_count;
 
 #if defined( EXP_ASCII85ENCODER )
-	int			ascii85_l;	/* Length, in bytes, of ascii85_p[] data */
+	tsize_t			ascii85_l;	/* Length, in bytes, of ascii85_p[] data */
 	uint8		*	ascii85_p = 0;	/* Holds ASCII85 encoded data */
 #endif
 
@@ -2142,8 +2166,8 @@ PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 	}
 	buf_data = (unsigned char *)_TIFFmalloc(chunk_size);
 	if (!buf_data) {
-		TIFFError(filename, "Can't alloc %u bytes for %s.",
-			chunk_size, tiled_image ? "tiles" : "strips");
+		TIFFError(filename, "Can't alloc %lu bytes for %s.",
+			(unsigned long) chunk_size, tiled_image ? "tiles" : "strips");
 		return(FALSE);
 	}
 
@@ -2391,7 +2415,8 @@ void
 PSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
 {
 	uint32 row;
-	int breaklen = MAXLINE, cc, es = samplesperpixel - nc;
+	int breaklen = MAXLINE, es = samplesperpixel - nc;
+	tsize_t cc;
 	unsigned char *tf_buf;
 	unsigned char *cp, c;
 
@@ -2453,7 +2478,8 @@ void
 PSDataColorSeparate(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
 {
 	uint32 row;
-	int breaklen = MAXLINE, cc;
+	int breaklen = MAXLINE;
+	tsize_t cc;
 	tsample_t s, maxs;
 	unsigned char *tf_buf;
 	unsigned char *cp, c;
@@ -2487,7 +2513,8 @@ PSDataPalette(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 {
 	uint16 *rmap, *gmap, *bmap;
 	uint32 row;
-	int breaklen = MAXLINE, cc, nc;
+	int breaklen = MAXLINE, nc;
+	tsize_t cc;
 	unsigned char *tf_buf;
 	unsigned char *cp, c;
 
@@ -2564,7 +2591,7 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 	tstrip_t s;
 
 #if defined( EXP_ASCII85ENCODER )
-	int	ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
+	tsize_t	ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
 	uint8	*ascii85_p = 0;		/* Holds ASCII85 encoded data */
 #endif
 
@@ -2602,7 +2629,7 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 		Ascii85Init();
 
 	for (s = 0; s < TIFFNumberOfStrips(tif); s++) {
-		int cc = TIFFReadEncodedStrip(tif, s, tf_buf, stripsize);
+		tsize_t cc = TIFFReadEncodedStrip(tif, s, tf_buf, stripsize);
 		if (cc < 0) {
 			TIFFError(filename, "Can't read strip");
 			break;
@@ -2687,14 +2714,15 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 {
 	uint32 *bc;
 	uint32 bufsize;
-	int breaklen = MAXLINE, cc;
+	int breaklen = MAXLINE;
+	tsize_t cc;
 	uint16 fillorder;
 	unsigned char *tf_buf;
 	unsigned char *cp, c;
 	tstrip_t s;
 
 #if defined( EXP_ASCII85ENCODER )
-	int			ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
+	tsize_t			ascii85_l;		/* Length, in bytes, of ascii85_p[] data */
 	uint8		*	ascii85_p = 0;		/* Holds ASCII85 encoded data */
 #endif
 
@@ -2706,11 +2734,11 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 	 * Find largest strip:
 	 */
 
-	bufsize = bc[0];
+	bufsize = (uint32) bc[0];
 
 	for ( s = 0; ++s < (tstrip_t)tf_numberstrips; ) {
-		if ( bc[s] > bufsize )
-			bufsize = bc[s];
+	  if ( bc[s] > bufsize )
+	    bufsize = (uint32) bc[s];
 	}
 
 	tf_buf = (unsigned char*) _TIFFmalloc(bufsize);
@@ -2742,7 +2770,7 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
 #endif
 
 	for (s = 0; s < (tstrip_t) tf_numberstrips; s++) {
-		cc = TIFFReadRawStrip(tif, s, tf_buf, bc[s]);
+		cc = TIFFReadRawStrip(tif, s, tf_buf, (tsize_t) bc[s]);
 		if (cc < 0) {
 			TIFFError(filename, "Can't read strip");
 			break;
@@ -2892,11 +2920,11 @@ Ascii85Flush(FILE* fd)
 *
 *****************************************************************************/
 
-int Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, int raw_l )
+tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, tsize_t raw_l )
 
 {
     char                        ascii85[5];     /* Encoded 5 tuple */
-    int                         ascii85_l;      /* Number of bytes written to ascii85_p[] */
+    tsize_t                     ascii85_l;      /* Number of bytes written to ascii85_p[] */
     int                         rc;             /* Return code */
     uint32                      val32;          /* Unencoded 4 tuple */
 
@@ -2953,7 +2981,7 @@ int Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p,
     
         if ( raw_l > 0 )
         {
-            int             len;                /* Output this many bytes */
+            tsize_t             len;                /* Output this many bytes */
     
             len = raw_l + 1;
             val32 = *++raw_p << 24;             /* Prime the pump */
@@ -3005,11 +3033,11 @@ char* stuff[] = {
 " -a            convert all directories in file (default is first), Not EPS",
 " -b #          set the bottom margin to # inches",
 " -c            center image (-b and -l still add to this)",
-" -d #          set initial image to # counting from zero",
+" -d #          set initial directory to # counting from zero",
 " -D            enable duplex printing (two pages per sheet of paper)",
 " -e            generate Encapsulated PostScript (EPS) (implies -z)",
-" -h #          set printed page height to # inches (default 11)",
-" -w #          set printed page width to # inches (default 8.5)",
+" -h #          set printed page height to # inches (no default)",
+" -w #          set printed page width to # inches (no default)",
 " -H #          split image if height is more than # inches",
 " -P L or P     set optional PageOrientation DSC comment to Landscape or Portrait",
 " -W #          split image if width is more than # inches",