File stylewriter.dif of Package filters

--- Makefile
+++ Makefile	2005-07-26 15:55:42.000000000 +0200
@@ -0,0 +1,15 @@
+# Makefile for compiling not with AppleTalk support in lpstyl.
+
+# Change /usr/local/include to the directory containing the 'atalk' includes
+# directory, and /usr/local/lib to the directory containing libatalk.a.
+
+CFLAGS= -g -Wall $(RPM_OPT_FLAGS)
+LINKFLAGS=-s
+
+lpstyl: lpstyl.o
+	$(CC) $(CFLAGS) lpstyl.o $(LINKFLAGS) -o lpstyl
+
+
+install: lpstyl
+	mkdir -p $(DESTDIR)/usr/bin
+	install -m 0755 lpstyl $(DESTDIR)/usr/bin/
--- lpstyl.c
+++ lpstyl.c	2005-07-26 16:05:42.000000000 +0200
@@ -655,7 +655,7 @@
 		if(curRow < height)
 		{
 			/* read a scanline */
-			result = readFileScanline(bufK, bufC, bufM, bufY);
+			result = readFileScanline((char*)bufK, (char*)bufC, (char*)bufM, (char*)bufY);
 	
 			/* check for input problems */
 			if(result != rowbytes)
@@ -678,7 +678,7 @@
 		{
 		case KIND_SW1:
 			/* encode the scanline into the buffer */
-			curMark += appendEncode(printwidth, bufK + LEFT_MARGIN_BYTES, nil, curMark);
+			curMark += appendEncode(printwidth, (char*)(bufK + LEFT_MARGIN_BYTES), nil, (char*)curMark);
 		break;
 
 		case KIND_SW1500:
@@ -687,13 +687,13 @@
 		case KIND_SW2500:
 			if(fileIsColor && canPrintColor)
 			{
-				curMark += appendEncode(printwidth, bufC + LEFT_MARGIN_BYTES, lastC + LEFT_MARGIN_BYTES, curMark);
-				curMark += appendEncode(printwidth, bufM + LEFT_MARGIN_BYTES, lastM + LEFT_MARGIN_BYTES, curMark);
-				curMark += appendEncode(printwidth, bufY + LEFT_MARGIN_BYTES, lastY + LEFT_MARGIN_BYTES, curMark);
+				curMark += appendEncode(printwidth, (char*)(bufC + LEFT_MARGIN_BYTES), (char*)(lastC + LEFT_MARGIN_BYTES), (char*)curMark);
+				curMark += appendEncode(printwidth, (char*)(bufM + LEFT_MARGIN_BYTES), (char*)(lastM + LEFT_MARGIN_BYTES), (char*)curMark);
+				curMark += appendEncode(printwidth, (char*)(bufY + LEFT_MARGIN_BYTES), (char*)(lastY + LEFT_MARGIN_BYTES), (char*)curMark);
 			}
 		/* FALLTHROUGH */
 		default: 
-			curMark += appendEncode(printwidth, bufK + LEFT_MARGIN_BYTES, lastK + LEFT_MARGIN_BYTES, curMark);
+			curMark += appendEncode(printwidth, (char*)(bufK + LEFT_MARGIN_BYTES), (char*)(lastK + LEFT_MARGIN_BYTES), (char*)curMark);
 		break;
 		}
 
@@ -782,13 +782,13 @@
 				case KIND_SW2500:
 					if(fileIsColor && canPrintColor)
 					{
-						curMark += appendEncode(printwidth, lastC + LEFT_MARGIN_BYTES, nil, curMark);
-						curMark += appendEncode(printwidth, lastM + LEFT_MARGIN_BYTES, nil, curMark);
-						curMark += appendEncode(printwidth, lastY + LEFT_MARGIN_BYTES, nil, curMark);
+						curMark += appendEncode(printwidth, (char*)(lastC + LEFT_MARGIN_BYTES), nil, (char*)curMark);
+						curMark += appendEncode(printwidth, (char*)(lastM + LEFT_MARGIN_BYTES), nil, (char*)curMark);
+						curMark += appendEncode(printwidth, (char*)(lastY + LEFT_MARGIN_BYTES), nil, (char*)curMark);
 					}	
 				/* FALLTHROUGH */
 				default:
-					curMark += appendEncode(printwidth, lastK + LEFT_MARGIN_BYTES, nil, curMark);
+					curMark += appendEncode(printwidth, (char*)(lastK + LEFT_MARGIN_BYTES), nil, (char*)curMark);
 					lastRow = curRow-1;
 				break;
 				}
@@ -1037,10 +1037,14 @@
 					if((i & 0x03) == 0)
 					{
 						/* write the output */
-						*((unsigned char *)bufK)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-						*((unsigned char *)bufY)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-						*((unsigned char *)bufM)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-						*((unsigned char *)bufC)++ = cmyk & 0x000000FF;
+						*((unsigned char *)bufK) = cmyk & 0x000000FF;		cmyk >>= 8;
+						bufK++;
+						*((unsigned char *)bufY) = cmyk & 0x000000FF;		cmyk >>= 8;
+						bufY++;	
+						*((unsigned char *)bufM) = cmyk & 0x000000FF;		cmyk >>= 8;
+						bufM++;
+						*((unsigned char *)bufC) = cmyk & 0x000000FF;
+						bufC++;
 						cmyk = 0;
 					}
 				}
@@ -1053,10 +1057,17 @@
 				}
 				
 				/* write the final part */
-				*((unsigned char *)bufK)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-				*((unsigned char *)bufY)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-				*((unsigned char *)bufM)++ = cmyk & 0x000000FF;		cmyk >>= 8;
-				*((unsigned char *)bufC)++ = cmyk & 0x000000FF;
+				*bufK = (char)(cmyk & 0x000000FF);		
+				bufK++;
+				cmyk >>= 8;
+				*bufY = (char)(cmyk & 0x000000FF);		
+				bufY++;
+				cmyk >>= 8;
+				*bufM = (char)(cmyk & 0x000000FF);		
+				bufM++;
+				cmyk >>= 8;
+				*bufC = (char)(cmyk & 0x000000FF);
+				bufC++;
 			}
 			else
 			{
@@ -1102,25 +1113,25 @@
 
 size_t appendEncode(size_t length, char *in, char *last, char *out)
 {
-	static char delta[1024];	/* bigger than we'll ever need */
+	static unsigned char delta[1024];	/* bigger than we'll ever need */
 	size_t result = 0;
 	
 	if(last)
 	{
 		/* XOR the input with the last scanline */
-		unsigned char *src1 = in, *src2 = last, *dst = delta;
+		unsigned char *src1 = (unsigned char*)in, *src2 = (unsigned char*)last, *dst = delta;
 		size_t size = length;
 
 		for(;size > 0; size--)
 			*dst++ = (*src1++) ^ (*src2++);
 
 		/* encode the difference into the buffer */
-		result = encodescanline(delta, length, out);
+		result = encodescanline(delta, length, (unsigned char*)out);
 	}
 	else	
 	{
 		/* encode the scanline into the buffer */
-		result = encodescanline(in, length, out);
+		result = encodescanline((unsigned char*)in, length, (unsigned char*)out);
 	}
 	
 	return(result);
@@ -1349,7 +1360,7 @@
 
 	if(verbose)
 	{
-		fprintf(stderr, "%s: Sending encoded data (0x%x bytes).\n", 
+		fprintf(stderr, "%s: Sending encoded data (0x%lx bytes).\n",
 				ProcName, size);
 	}	
 	begin[0] = 'G';
@@ -1720,7 +1731,7 @@
 
 int comm_printer_getc_block(void)
 {
-	int result;
+	int result = -1;
 	int i;
 
 	/* wait up to about ten seconds... */