File ppmtomd-1.2.dif of Package filters

--- Makefile
+++ Makefile	2005-07-26 15:41:20.000000000 +0200
@@ -13,14 +13,15 @@
 # CPVALINK = Y
 
 # where to install the binary
-BINDIR = /usr/local/bin
+BINDIR = $(DESTDIR)/usr/bin
 # where to install the man page
-MANDIR = /usr/local/share/man/man1
+MANDIR = $(DESTDIR)/usr/share/man/man1
 # extension of the man page
 MANEXT = 1
 
 # you do use gcc, don't you?
 CC = gcc
+CFLAGS=$(RPM_OPT_FLAGS) -O2 -Wall
 
 # NOTE: optimization is recommended, as this driver does a lot
 # of work. Switching on optimization *does* change the output
@@ -27,7 +27,7 @@
 # of work. Switching on optimization *does* change the output
 # slightly, probably owing to slight differences in floating point
 # calculations.
-CDEBUGFLAGS=-O2
+CDEBUGFLAGS=$(RPM_OPT_FLAGS)
 # if your ppm libraries are not in a standard place, uncomment
 # and change this. You may also need thing like -R, but if you're
 # on that sort of system you probably know it!
@@ -44,6 +45,8 @@
 	$(CC) $(CDEBUGFLAGS) $(DEFAULTMODEL) -W -Wall -Wstrict-prototypes -c ppmtomd.c 
 
 install: ppmtomd
+	mkdir -p $(BINDIR)
+	mkdir -p $(MANDIR)
 	$(BININSTALL) ppmtomd $(BINDIR)/ppmtomd
 	if [ "$(CPVALINK)" ] ; then ln -s ppmtomd $(BINDIR)/ppmtocpva ; fi
 	$(MANINSTALL) ppmtomd.man $(MANDIR)/ppmtomd.$(MANEXT)
--- ppmtomd.c
+++ ppmtomd.c	2005-07-26 15:53:59.000000000 +0200
@@ -1652,23 +1652,25 @@
 #define HT_Y_Y 4
 #define HT_Y_Z 5
 
+#define ABS(a)	((a) >= 0 ? (a) : -(a))
+
 htinfo kht =
 {
   {
     /* under colours shouldn't be halftoned, but just in case */
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_C_X, abs(HT_C_Y), HT_C_Z,(HT_C_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-    { 0, 0, 0, HT_M_X, abs(HT_M_Y), HT_M_Z,(HT_M_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_Y_X, abs(HT_Y_Y), HT_Y_Z,(HT_Y_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_C_X, ABS(HT_C_Y), HT_C_Z,(HT_C_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_M_X, ABS(HT_M_Y), HT_M_Z,(HT_M_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_Y_X, ABS(HT_Y_Y), HT_Y_Z,(HT_Y_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
     /* spot colours shouldn't be halftoned, but just in case */
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-    { 0, 0, 0, HT_K_X, abs(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0}
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0},
+    { 0, 0, 0, HT_K_X, ABS(HT_K_Y), HT_K_Z,(HT_K_Y < 0),  0,0,0,0,0,0,0,0,0,0,0,0,0,0}
   }
 };
 
@@ -2547,7 +2549,7 @@
 	      to fix that. */
 	   if ( i != firstcomp ) {
 	     sprintf(buffer,"\033*rC"); /* end raster graphics */
-	     page_info.out_function(page_info.comp_fds[i],buffer,4);
+	     page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,4);
 	   }
 	   /* set curl correction on or off. We always set it,
 	      even though the manual claims that curl
@@ -2557,20 +2559,20 @@
 	   curlco = ( !opt_curlcorrection  
 	     && ( i < firstinlast || opt_overlay || opt_nocurl ));
 	   sprintf(buffer,"\033\032%c%cC",curlco,0);
-	   page_info.out_function(page_info.comp_fds[i],buffer,5);
+	   page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,5);
 	   /* if overlay mode was requested, set multipage
 	      mode again */
 	   if ( opt_overlay ) {
 	     sprintf(buffer,"\033\032%c%cA",1,0);
-	     page_info.out_function(page_info.comp_fds[i],buffer,5);
+	     page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,5);
 	   }
 	   /* set the transfer mode again */
 	   sprintf(buffer,"\033*r%cU",
 	     page_info.print_mode[i]);
-	   page_info.out_function(page_info.comp_fds[i],buffer,5);
+	   page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,5);
 	   /* and start raster graphics again */
 	   sprintf(buffer,"\033*r%cA",0);
-	   page_info.out_function(page_info.comp_fds[i],buffer,5);
+	   page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,5);
 	 }
 	 if ( c >= 0 ) {
 	   /* Now send the colour selection command.
@@ -2587,7 +2589,7 @@
 	       ((i == lastcomp) && lastpass) ? 0x80 : 0 /* this is the last plane flag */,
 	       (page_info.print_mode[i] == cassettePlane) ?
 	       'c' : 'r');
-	     page_info.out_function(page_info.comp_fds[i],buffer,5);
+	     page_info.out_function(page_info.comp_fds[i],(unsigned char*)buffer,5);
 	   }
 	 }
        }
@@ -2607,7 +2609,7 @@
 	 if ( fd < 0 || fd == STDOUT ) continue;
 	 /* back feed the paper */
 	 sprintf(buffer,"\033\032%c%c\014",0,0);
-	 page_info.out_function(STDOUT,buffer,5);
+	 page_info.out_function(STDOUT,(unsigned char*)buffer,5);
 	 lseek(fd,0,SEEK_SET);
 	 while ( (n = read(fd,buf,1024)) > 0 ) {
 	   write(1,buf,n);
@@ -2636,7 +2638,7 @@
 
      if (page_info.output_type < ppmOut && !feof(ifd) ) {
        sprintf(buffer,"\014"); /* formfeed */
-       page_info.out_function(STDOUT,buffer,1);
+       page_info.out_function(STDOUT,(unsigned char*)buffer,1);
      }
    }
 
@@ -2649,7 +2651,7 @@
 	nothing else. */
      if ( ! lastpass ) {
        sprintf(buffer,"\033\032%c%c\014",0,0);
-       page_info.out_function(STDOUT,buffer,5);
+       page_info.out_function(STDOUT,(unsigned char*)buffer,5);
      } else {
        /* If the ffonly switch is set, then we will form-feed
 	  and stay in data transfer mode. Otherwise, we will
@@ -2657,17 +2659,17 @@
 	  exit RGL mode, and reset the printer */
        if ( !ffonly ) {
 	 sprintf(buffer,"\033*rC"); /* end raster graphics */
-	 page_info.out_function(STDOUT,buffer,4);
+	 page_info.out_function(STDOUT,(unsigned char*)buffer,4);
        }
        sprintf(buffer,"\014"); /* formfeed */
-       page_info.out_function(STDOUT,buffer,1);
+       page_info.out_function(STDOUT,(unsigned char*)buffer,1);
        /* end rgl mode */
        sprintf(buffer,"\033%%%cX",0);
-       page_info.out_function(STDOUT,buffer,4);
+       page_info.out_function(STDOUT,(unsigned char*)buffer,4);
        /* unless overlay or no reset, do a printer reset */
        if ( !opt_noreset && !opt_overlay ) {
 	 sprintf(buffer,"\033e"); /* full printer reset */
-	 page_info.out_function(STDOUT,buffer,2);
+	 page_info.out_function(STDOUT,(unsigned char*)buffer,2);
        }
      }
    }
@@ -2807,41 +2809,41 @@
 {
   char buffer[80]; /* buffer for printing */
 
-  page_info->out_function(fd,"\033%\200A",4); /* select RGL mode */     /* resolution defaults to 600 dpi */
+  page_info->out_function(fd,(unsigned char*)"\033%\200A",4); /* select RGL mode */     /* resolution defaults to 600 dpi */
   sprintf(buffer,"\033*t%cR",page_info->output_resolution);
-  page_info->out_function(fd,buffer,6);
+  page_info->out_function(fd,(unsigned char*)buffer,6);
   /* media type and fineness code */
   sprintf(buffer,"\033&l%c%cM",
     media_byte1[page_info->media_type],
     media_byte2[page_info->media_type]);
-  page_info->out_function(fd,buffer,6);
+  page_info->out_function(fd,(unsigned char*)buffer,6);
   sprintf(buffer,"\033&l%c%cA",page_info->paper_size,0); /* select paper size */
-  page_info->out_function(fd,buffer,6);
+  page_info->out_function(fd,(unsigned char*)buffer,6);
   /* page length, if set */
   if ( opt_pagelength ) {
     sprintf(buffer,"\033&l%c%cP",opt_pagelength%256,opt_pagelength/256);
-    page_info->out_function(fd,buffer,6);
+    page_info->out_function(fd,(unsigned char*)buffer,6);
   }
   /* page width, if given by user */
   if ( opt_pagewidth ) {
     sprintf(buffer,"\033&a%c%cM",opt_pagewidth%256,opt_pagewidth/256);
-    page_info->out_function(fd,buffer,6);
+    page_info->out_function(fd,(unsigned char*)buffer,6);
   }
   /* line feed adjustment */
   if ( page_info->lfadj != 0 ) { 
     sprintf(buffer,"\033\032%c%cL",(char) page_info->lfadj,0);
-    page_info->out_function(fd,buffer,5);
+    page_info->out_function(fd,(unsigned char*)buffer,5);
   }
   /* print head drive signal adjustment */
   if ( opt_phadj != 0 ) { 
     sprintf(buffer,"\033\032%c%cV",(char) opt_phadj,0); 
-    page_info->out_function(fd,buffer,5);
+    page_info->out_function(fd,(unsigned char*)buffer,5);
   }
   
   /* make ff mean tof in overlay mode */
   if ( opt_overlay ) {
     sprintf(buffer,"\033\032%c%cA",1,0);
-    page_info->out_function(fd,buffer,5);
+    page_info->out_function(fd,(unsigned char*)buffer,5);
   }
   
   /* on 5000 etc, specify cassettes to be used */
@@ -2861,25 +2863,25 @@
       num++;
     }
     buffer[3] = num;
-    page_info->out_function(fd,buffer,num+6);
+    page_info->out_function(fd,(unsigned char*)buffer,num+6);
   }
   
   /* now the x and y offsets (if positive; if negative, we have
      to deal with them) */
   if (page_info->x_shift > 0 ) {
     sprintf(buffer,"\033&a%c%cL", page_info->x_shift%256, page_info->x_shift/256);
-    page_info->out_function(fd,buffer,6);
+    page_info->out_function(fd,(unsigned char*)buffer,6);
   }
   if ( page_info->y_shift > 0 ) {
     sprintf(buffer,"\033&l%c%cE", page_info->y_shift%256,page_info->y_shift/256);
-    page_info->out_function(fd,buffer,6);
+    page_info->out_function(fd,(unsigned char*)buffer,6);
   }
   
   
   /* if glossy finish, request it ... */
   if ( opt_glossy ) {
     sprintf(buffer,"\033\032%c%cO",0,0);
-    page_info->out_function(fd,buffer,5);
+    page_info->out_function(fd,(unsigned char*)buffer,5);
   }
   
 }
@@ -3535,7 +3537,7 @@
     }
      
     if ( ppmout ) {
-      prn_out(STDOUT,(char *)(pixels),cols);
+      prn_out(STDOUT,(unsigned char *)(pixels),cols);
     } else {
       int j;
       /* now we need to pack the bytes and pass them to the 
@@ -3562,7 +3564,7 @@
 	  if ( page_info->nybble_mode[i] ) {
 	    n = packnybbles(outbytes[i][0],cols,outu);
 	  } else {
-	    n = packbits(outbytes[i][0],cols,outu,outc);
+	    n = packbits((char*)outbytes[i][0],cols,(char*)outu,(char*)outc);
 	  }
 	} else {
 	  /* if we are in a multiplane raster mode, we
@@ -3599,28 +3601,28 @@
 	  if ( n >= 0 ) {
 	    if ( compression[tag] != 0 ) {
 	      /* select uncompressed */
-	      sprintf(buffer,"\033*b%c%cM",0,0);
+	      sprintf((char*)buffer,"\033*b%c%cM",0,0);
 	      prn_out(fd,buffer,6);
 	      compression[tag] = 0;
 	    }
 	  } else {
 	    if ( compression[tag] != 1 ) {
 	      /* select compressed */
-	      sprintf(buffer,"\033*b%c%cM",2,0);
+	      sprintf((char*)buffer,"\033*b%c%cM",2,0);
 	      prn_out(fd,buffer,6);
 	      compression[tag] = 1;
 	    }
 	  }
 	  /* do we have some rows to skip ? */
 	  if ( rowstoskip[i] ) {
-	    sprintf(buffer,"\033*b%c%cY",rowstoskip[i]%256,rowstoskip[i]/256);
+	    sprintf((char*)buffer,"\033*b%c%cY",rowstoskip[i]%256,rowstoskip[i]/256);
 	    prn_out(fd,buffer,6);
 	    rowstoskip[i] = 0;
 	  }
 	  /* if we are in 4-color raster mode, we have to select
 	     the cassette for every row transferred. Sigh. */
 	  if ( page_info->print_mode[i] == cassetteRaster ) {
-	    sprintf(buffer,"\033\032%c%cc",page_info->comp_colours[i],0);
+	    sprintf((char*)buffer,"\033\032%c%cc",page_info->comp_colours[i],0);
 	    prn_out(fd,buffer,5);
 	  }
 	  /* Another horrible hack for -usemulti. We are printing
@@ -3628,11 +3630,11 @@
 	     have to print a null row for K to the CMY component before
 	     we print C */
 	  if ( opt_usemulti && i == compC ) {
-	    sprintf(buffer,"\033*b%c%cV",0,0);
+	    sprintf((char*)buffer,"\033*b%c%cV",0,0);
 	    prn_out(fd,buffer,6);
 	  }
 	  /* create the printer command */
-	  sprintf(buffer,"\033*b%c%c%c",
+	  sprintf((char*)buffer,"\033*b%c%c%c",
 		  (n>=0 ? n : -n)%256,(n>=0 ? n : -n)/256,
 		  /* do we advance the raster pointer? 
 		     We don't if it's the last row; and we
openSUSE Build Service is sponsored by