diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:42 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:42 +0000 |
commit | 8b10a2ded643db068ef4d08259322e6383909670 (patch) | |
tree | 767ecacdd4d686c7853dcf97ba4ab9bbf6b61538 | |
parent | c16c03b7f3122a65027dd5ac06fee18455dcdee9 (diff) |
merge XFree86 4.3.0.1 to -CURRENTXORG-RELEASE-1-BASEXEVIE-MERGEXEVIE-BASEXINERAMA_2XEVIE
-rw-r--r-- | src/delta/lbxdelta.c | 78 | ||||
-rw-r--r-- | src/image/dfaxg42d.c | 56 | ||||
-rw-r--r-- | src/image/dpackbits.c | 20 | ||||
-rw-r--r-- | src/image/efaxg42d.c | 60 | ||||
-rw-r--r-- | src/image/epackbits.c | 29 | ||||
-rw-r--r-- | src/image/lbxbwcodes.h | 11 | ||||
-rw-r--r-- | src/image/lbxfax.h | 11 | ||||
-rw-r--r-- | src/image/misc.c | 29 | ||||
-rw-r--r-- | src/image/mkg3states.c | 113 | ||||
-rw-r--r-- | src/lbx_zlib/lbx_zlib.c | 94 | ||||
-rw-r--r-- | src/lbx_zlib/lbx_zlib.h | 16 | ||||
-rw-r--r-- | src/lbx_zlib/lbx_zlib_io.c | 21 | ||||
-rw-r--r-- | src/lbx_zlib/reqstats.c | 49 | ||||
-rw-r--r-- | src/lbx_zlib/reqstats.h | 3 |
14 files changed, 279 insertions, 311 deletions
diff --git a/src/delta/lbxdelta.c b/src/delta/lbxdelta.c index 583e617..29e6999 100644 --- a/src/delta/lbxdelta.c +++ b/src/delta/lbxdelta.c @@ -1,5 +1,5 @@ /* - * $NCDId: @(#)lbxdelta.c,v 1.2 1994/01/22 02:23:40 dct Exp $ + * $NCDXorg: @(#)lbxdelta.c,v 1.2 1994/01/22 02:23:40 dct Exp $ * $Xorg: lbxdelta.c,v 1.5 2000/08/17 19:46:40 cpqbld Exp $ * Copyright 1993 Network Computing Devices * @@ -22,6 +22,7 @@ * * Author: Dale Tonogai, Network Computing Devices */ +/* $XFree86: xc/lib/lbxutil/delta/lbxdelta.c,v 1.8 2001/08/27 19:01:07 dawes Exp $ */ #include "X.h" #include "Xproto.h" @@ -30,9 +31,7 @@ #include "lbxstr.h" #include "lbxdeltastr.h" -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> #ifdef LBXREQSTATS #include "../lbx_zlib/reqstats.h" @@ -47,10 +46,9 @@ extern struct ReqStats LbxRequestStats[LbxNumberReqs]; * Allocate data structures needed for doing Delta compaction */ int -LBXInitDeltaCache(pcache, nDeltas, maxDeltasize) - LBXDeltasPtr pcache; - int nDeltas; - int maxDeltasize; +LBXInitDeltaCache(LBXDeltasPtr pcache, + int nDeltas, + int maxDeltasize) { int i; unsigned char *mem; @@ -81,20 +79,18 @@ LBXInitDeltaCache(pcache, nDeltas, maxDeltasize) * Free data structures used for doing Delta compaction */ void -LBXFreeDeltaCache(pcache) - LBXDeltasPtr pcache; +LBXFreeDeltaCache(LBXDeltasPtr pcache) { if (pcache->nDeltas && pcache->deltas) xfree(pcache->deltas); } static int -BytesDiff(ptr1, ptr2, n, maxn) - register char *ptr1, *ptr2; - register int n; - register int maxn; +BytesDiff(unsigned char *ptr1, unsigned char *ptr2, + int n, + int maxn) { - register int result = 0; + int result = 0; while (n--) if (*(ptr1++) != *(ptr2++)) @@ -109,14 +105,13 @@ BytesDiff(ptr1, ptr2, n, maxn) * messages have greater than maxdiff differences, return -1. */ int -LBXDeltaMinDiffs(pcache, inmsg, inmsglen, maxdiff, pindex) - LBXDeltasPtr pcache; - unsigned char *inmsg; - int inmsglen; - int maxdiff; - int *pindex; +LBXDeltaMinDiffs(LBXDeltasPtr pcache, + unsigned char *inmsg, + int inmsglen, + int maxdiff, + int *pindex) { - int i, j, k, l = maxdiff + 1; + int i, j, k = 0, l = maxdiff + 1; int m; LBXDeltaElemPtr dm; @@ -148,14 +143,14 @@ LBXDeltaMinDiffs(pcache, inmsg, inmsglen, maxdiff, pindex) /* * Delta compact a given message */ -LBXEncodeDelta(pcache, inmsg, ndiff, index, buf) - LBXDeltasPtr pcache; - unsigned char *inmsg; - int ndiff; - int index; - unsigned char *buf; +void +LBXEncodeDelta(LBXDeltasPtr pcache, + unsigned char *inmsg, + int ndiff, + int index, + unsigned char *buf) { - register int i, off, diff; + int i, off, diff; xLbxDiffItem *deltas = (xLbxDiffItem *)buf; for (off = i = 0; i < ndiff; off++) { @@ -170,12 +165,11 @@ LBXEncodeDelta(pcache, inmsg, ndiff, index, buf) * Uncompact a message */ int -LBXDecodeDelta(pcache, deltas, ndiff, index, buf) - LBXDeltasPtr pcache; - xLbxDiffItem *deltas; - int ndiff; - int index; - unsigned char **buf; +LBXDecodeDelta(LBXDeltasPtr pcache, + xLbxDiffItem *deltas, + int ndiff, + int index, + unsigned char **buf) { int i; int newindex = pcache->nextDelta; @@ -223,10 +217,9 @@ LBXDecodeDelta(pcache, deltas, ndiff, index, buf) * Add a message to the outgoing delta cache */ void -LBXAddDeltaOut(pcache, inmsg, inmsglen) - LBXDeltasPtr pcache; - unsigned char *inmsg; - int inmsglen; +LBXAddDeltaOut(LBXDeltasPtr pcache, + unsigned char *inmsg, + int inmsglen) { memcpy(pcache->deltas[pcache->nextDelta].buf, inmsg, inmsglen); pcache->deltas[pcache->nextDelta].length = inmsglen; @@ -239,10 +232,9 @@ LBXAddDeltaOut(pcache, inmsg, inmsglen) * Add a message to the incoming delta cache */ void -LBXAddDeltaIn(pcache, inmsg, inmsglen) - LBXDeltasPtr pcache; - unsigned char *inmsg; - int inmsglen; +LBXAddDeltaIn(LBXDeltasPtr pcache, + unsigned char *inmsg, + int inmsglen) { memcpy(pcache->deltas[pcache->nextDelta].buf, inmsg, inmsglen); pcache->deltas[pcache->nextDelta].length = inmsglen; diff --git a/src/image/dfaxg42d.c b/src/image/dfaxg42d.c index 6e2e8dd..adeaa25 100644 --- a/src/image/dfaxg42d.c +++ b/src/image/dfaxg42d.c @@ -22,9 +22,12 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/dfaxg42d.c,v 1.6 2001/04/23 20:31:05 dawes Exp $ */ +#include <X11/Xos.h> #include <X11/Xfuncproto.h> #include <X11/Xfuncs.h> +#include <stdlib.h> #include "g3states.h" #include "lbxfax.h" #include "lbximage.h" @@ -43,9 +46,7 @@ static short sp_data, sp_bit; */ static unsigned char -fetchByte (inbuf) - -unsigned char **inbuf; +fetchByte (unsigned char **inbuf) { unsigned char byte = **inbuf; @@ -59,9 +60,7 @@ unsigned char **inbuf; */ static int -decode_white_run (inbuf) - -unsigned char **inbuf; +decode_white_run (unsigned char **inbuf) { short state = sp_bit; @@ -98,9 +97,7 @@ unsigned char **inbuf; */ static int -decode_black_run (inbuf) - -unsigned char **inbuf; +decode_black_run (unsigned char **inbuf) { short state = sp_bit + 8; @@ -138,9 +135,7 @@ unsigned char **inbuf; */ static int -decode_uncomp_code (inbuf) - -unsigned char **inbuf; +decode_uncomp_code (unsigned char **inbuf) { short code; @@ -162,10 +157,8 @@ unsigned char **inbuf; */ static void -fillspan (cp, x, count) - -register char *cp; -register int x, count; +fillspan (char *cp, + int x, int count) { static unsigned char masks[] = @@ -191,7 +184,7 @@ register int x, count; while (count >= 8) { - *cp++ = 0xff; + *cp++ = (char)0xff; count -= 8; } @@ -206,9 +199,7 @@ register int x, count; */ static int -nextbit (inbuf) - -unsigned char **inbuf; +nextbit (unsigned char **inbuf) { static unsigned char bitMask[8] = @@ -228,12 +219,10 @@ unsigned char **inbuf; static int -DecodeFaxG42D (inbuf, refline, pixels_per_line, outbuf) - -unsigned char **inbuf; -unsigned char *refline; -int pixels_per_line; -unsigned char *outbuf; +DecodeFaxG42D (unsigned char **inbuf, + unsigned char *refline, + int pixels_per_line, + unsigned char *outbuf) { int a0 = -1; @@ -386,15 +375,12 @@ bad: int -LbxImageDecodeFaxG42D (inbuf, outbuf, image_bytes, pixels_per_line, - padded_bytes_per_scanline, reverse_bits) - -unsigned char *inbuf; -unsigned char *outbuf; -int image_bytes; -int pixels_per_line; -int padded_bytes_per_scanline; -int reverse_bits; +LbxImageDecodeFaxG42D (unsigned char *inbuf, + unsigned char *outbuf, + int image_bytes, + int pixels_per_line, + int padded_bytes_per_scanline, + int reverse_bits) { int bytes_per_scanline = ROUNDUP8 (pixels_per_line); diff --git a/src/image/dpackbits.c b/src/image/dpackbits.c index 95a064a..e070dd0 100644 --- a/src/image/dpackbits.c +++ b/src/image/dpackbits.c @@ -22,7 +22,9 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/dpackbits.c,v 1.4 2001/01/17 19:43:35 dawes Exp $ */ +#include <X11/Xos.h> #include <X11/Xfuncproto.h> #include "lbximage.h" @@ -33,11 +35,9 @@ */ static void -DecodePackBits (inbuf, numPixels, outbuf) - -char **inbuf; -int numPixels; -char *outbuf; +DecodePackBits (char **inbuf, + int numPixels, + char *outbuf) { register char *inptr = *inbuf; @@ -79,12 +79,10 @@ char *outbuf; int -LbxImageDecodePackBits (inbuf, outbuf, num_scan_lines, scan_line_size) - -char *inbuf; -char *outbuf; -int num_scan_lines; -int scan_line_size; +LbxImageDecodePackBits (char *inbuf, + char *outbuf, + int num_scan_lines, + int scan_line_size) { char *outbuf_start = outbuf; diff --git a/src/image/efaxg42d.c b/src/image/efaxg42d.c index 362e82d..3dd115a 100644 --- a/src/image/efaxg42d.c +++ b/src/image/efaxg42d.c @@ -22,8 +22,11 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/efaxg42d.c,v 1.5 2001/04/23 20:31:05 dawes Exp $ */ +#include <X11/Xos.h> #include <X11/Xfuncproto.h> +#include <stdlib.h> #include "lbxfax.h" #include "lbximage.h" #include "lbxbwcodes.h" @@ -66,9 +69,7 @@ typedef struct { */ static int -flushbits (outbuf) - -Buffer *outbuf; +flushbits (Buffer *outbuf) { if (outbuf->bytesLeft > 0) @@ -92,11 +93,9 @@ Buffer *outbuf; */ static int -putbits (bits, length, outbuf) - -unsigned int bits; -unsigned int length; -Buffer *outbuf; +putbits (unsigned int bits, + unsigned int length, + Buffer *outbuf) { static int mask[9] = @@ -128,10 +127,8 @@ Buffer *outbuf; */ static int -putcode (te, outbuf) - -tableentry *te; -Buffer *outbuf; +putcode (tableentry *te, + Buffer *outbuf) { return (putbits (te->code, te->length, outbuf)); @@ -145,12 +142,10 @@ Buffer *outbuf; */ static int -putspan (span, tab, outbuf) - -int span; -tableentry *tab; -Buffer *outbuf; - +putspan (int span, + tableentry *tab, + Buffer *outbuf) + { while (span >= 2624) { @@ -179,12 +174,10 @@ Buffer *outbuf; #define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1) static int -EncodeFaxG42D (inbuf, refline, bits, outbuf) - -unsigned char *inbuf; -unsigned char *refline; -int bits; -Buffer *outbuf; +EncodeFaxG42D (unsigned char *inbuf, + unsigned char *refline, + int bits, + Buffer *outbuf) { short white = 1; @@ -257,17 +250,14 @@ Buffer *outbuf; int -LbxImageEncodeFaxG42D (inbuf, outbuf, outbufSize, image_bytes, pixels_per_line, - padded_bytes_per_scanline, reverse_bits, bytesCompressed) - -unsigned char *inbuf; -unsigned char *outbuf; -int outbufSize; -int image_bytes; -int pixels_per_line; -int padded_bytes_per_scanline; -int reverse_bits; -int *bytesCompressed; +LbxImageEncodeFaxG42D (unsigned char *inbuf, + unsigned char *outbuf, + int outbufSize, + int image_bytes, + int pixels_per_line, + int padded_bytes_per_scanline, + int reverse_bits, + int *bytesCompressed) { int bytes_per_scanline = ROUNDUP8 (pixels_per_line); diff --git a/src/image/epackbits.c b/src/image/epackbits.c index 1ceed56..7e15c2b 100644 --- a/src/image/epackbits.c +++ b/src/image/epackbits.c @@ -44,12 +44,10 @@ static int -EncodePackBits (inbuf, numPixels, outbuf, bytesLeft) - -char *inbuf; -int numPixels; -char **outbuf; -int *bytesLeft; +EncodePackBits (char *inbuf, + int numPixels, + char **outbuf, + int *bytesLeft) { register int pixelsLeft = numPixels; @@ -175,17 +173,14 @@ int *bytesLeft; int -LbxImageEncodePackBits (inbuf, outbuf, outbufSize, format, depth, - num_scan_lines, scan_line_size, bytesCompressed) - -char *inbuf; -char *outbuf; -int outbufSize; -int format; -int depth; -int num_scan_lines; -int scan_line_size; -int *bytesCompressed; +LbxImageEncodePackBits (char *inbuf, + char *outbuf, + int outbufSize, + int format, + int depth, + int num_scan_lines, + int scan_line_size, + int *bytesCompressed) { char *outbuf_start = outbuf; diff --git a/src/image/lbxbwcodes.h b/src/image/lbxbwcodes.h index 6e8418f..c4b7c50 100644 --- a/src/image/lbxbwcodes.h +++ b/src/image/lbxbwcodes.h @@ -23,6 +23,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/lbxbwcodes.h,v 1.3 2001/03/05 01:05:12 tsi Exp $ */ /* * Note that these tables are ordered such that the @@ -33,6 +34,11 @@ * during state generation (see mkg3states.c). */ +#ifdef __DARWIN__ +#ifndef TIFFaxWhiteCodes +#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes +#endif +#endif tableentry TIFFFaxWhiteCodes[] = { { 8, 0x35, 0 }, /* 0011 0101 */ { 6, 0x7, 1 }, /* 0001 11 */ @@ -145,6 +151,11 @@ tableentry TIFFFaxWhiteCodes[] = { { 12, 0x0, G3CODE_INVALID }, /* 0000 0000 0000 */ }; +#ifdef __DARWIN__ +#ifndef TIFFaxBlackCodes +#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes +#endif +#endif tableentry TIFFFaxBlackCodes[] = { { 10, 0x37, 0 }, /* 0000 1101 11 */ { 3, 0x2, 1 }, /* 010 */ diff --git a/src/image/lbxfax.h b/src/image/lbxfax.h index 304b7c7..b2a72cb 100644 --- a/src/image/lbxfax.h +++ b/src/image/lbxfax.h @@ -22,6 +22,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/lbxfax.h,v 1.5 2001/03/05 01:05:12 tsi Exp $ */ /* * This header file contains various constants and tables needed @@ -45,5 +46,15 @@ typedef struct tableentry { #define ROUNDUP8(x) ((x + 7) >> 3) +#ifdef __DARWIN__ +#ifndef TIFFaxWhiteCodes +#define TIFFFaxWhiteCodes Darwin_X_TIFFFaxWhiteCodes +#define TIFFFaxBlackCodes Darwin_X_TIFFFaxBlackCodes +#endif +#endif extern tableentry TIFFFaxWhiteCodes[]; extern tableentry TIFFFaxBlackCodes[]; + +/* misc.c */ +extern int LbxImageFindDiff ( unsigned char *cp, int bs, int be, int color ); +extern void LbxReverseBits ( unsigned char *cp, int n ); diff --git a/src/image/misc.c b/src/image/misc.c index cb2d354..fd22862 100644 --- a/src/image/misc.c +++ b/src/image/misc.c @@ -28,6 +28,8 @@ * by the LBX server and proxy. */ +#include "lbxfax.h" + static unsigned char zeroruns[256] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0f */ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1f */ @@ -111,16 +113,14 @@ static unsigned char BitRevTable[256] = { */ static int -findspan (bpp, bs, be, tab) - -unsigned char **bpp; -int bs, be; -register unsigned char *tab; +findspan (unsigned char **bpp, + int bs, int be, + unsigned char *tab) { - register unsigned char *bp = *bpp; - register int bits = be - bs; - register int n, span; + unsigned char *bp = *bpp; + int bits = be - bs; + int n, span; /* * Check partial byte on lhs. @@ -179,10 +179,8 @@ done: */ int -LbxImageFindDiff (cp, bs, be, color) - -unsigned char *cp; -int bs, be, color; +LbxImageFindDiff (unsigned char *cp, + int bs, int be, int color) { cp += bs >> 3; /* adjust byte offset */ @@ -192,10 +190,9 @@ int bs, be, color; -LbxReverseBits (cp, n) - -register unsigned char *cp; -register int n; +void +LbxReverseBits (unsigned char *cp, + int n) { for (; n > 8; n -= 8) diff --git a/src/image/mkg3states.c b/src/image/mkg3states.c index f19179b..c9c4b7f 100644 --- a/src/image/mkg3states.c +++ b/src/image/mkg3states.c @@ -22,6 +22,7 @@ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE * OF THIS SOFTWARE. */ +/* $XFree86: xc/lib/lbxutil/image/mkg3states.c,v 1.4 2001/01/17 19:43:35 dawes Exp $ */ /* * Program to construct Group 3 & Group 4 decoding tables. @@ -63,6 +64,8 @@ * END (from the original source) */ #include <stdio.h> +#include <string.h> +#include <stdlib.h> #ifndef TRUE #define TRUE 1 @@ -92,14 +95,15 @@ #define MODE_ERROR 11 #define MODE_ERROR_1 12 -unsigned long append_0 (prefix) -unsigned long prefix; +unsigned long append_0 ( unsigned long prefix ); +unsigned long append_1 ( unsigned long prefix ); + +unsigned long append_0 (unsigned long prefix) { return (prefix + (1L<<16)); } -unsigned long append_1 (prefix) -unsigned long prefix; +unsigned long append_1 (unsigned long prefix) { static unsigned short prefix_bit[16] = { 0x8000, 0x4000, 0x2000, 0x1000, @@ -115,10 +119,25 @@ unsigned long prefix; #include "lbxfax.h" #include "lbxbwcodes.h" -short search_table (prefix, tab, n) -unsigned long prefix; -tableentry *tab; -int n; +short search_table ( unsigned long prefix, tableentry *tab, int n ); +short white_run_length ( unsigned long prefix ); +short black_run_length ( unsigned long prefix ); +short horiz_mode_code_black ( short runlen ); +short horiz_mode_code_white ( short runlen ); +void write_define ( FILE *fd, char *name, int value, char *comment ); +void write_preamble ( FILE *fd ); +void extern_table ( FILE *fd, char *name ); +void write_tables ( FILE *fd ); +short find_null_mode_prefix ( long prefix ); +short find_horiz_mode_prefix ( long prefix, int color ); +short find_uncomp_mode_prefix ( long prefix ); +short null_mode_type ( long prefix ); +short uncomp_mode_type ( long prefix ); +void build_null_mode_tables ( void ); +void build_horiz_mode_tables ( void ); +void build_uncomp_mode_tables ( void ); + +short search_table (unsigned long prefix, tableentry *tab, int n) { unsigned short len = (prefix >> 16) & 0xf; unsigned short code = (prefix & 0xffff) >> (16 - len); @@ -132,14 +151,12 @@ int n; } #define NCODES(a) (sizeof (a) / sizeof (a[0])) -short white_run_length (prefix) -unsigned long prefix; +short white_run_length (unsigned long prefix) { return (search_table(prefix, TIFFFaxWhiteCodes, NCODES(TIFFFaxWhiteCodes))); } -short black_run_length (prefix) -unsigned long prefix; +short black_run_length (unsigned long prefix) { return (search_table(prefix, TIFFFaxBlackCodes, NCODES(TIFFFaxBlackCodes))); } @@ -157,6 +174,9 @@ NullModeTable null_mode_next_state; /* next row of decoding tables to use */ /* number of prefixes or rows in the G4 decoding tables */ short null_mode_prefix_count = 0; +void write_null_mode_table ( FILE *fd, NullModeTable table, char *name ); +void write_horiz_mode_table ( FILE *fd, HorizModeTable table, char *name ); + /* * 2D uncompressed mode codes. Note * that two groups of codes are arranged @@ -201,14 +221,12 @@ short uncomp_mode_prefix_count = 0; #define ACT_EOL 210 /* end-of-line code */ HorizModeTable horiz_mode; -short horiz_mode_code_black (runlen) -short runlen; +short horiz_mode_code_black (short runlen) { return (runlen < 64 ? runlen + ACT_BRUNT : (runlen / 64) + ACT_BRUN); } -short horiz_mode_code_white (runlen) -short runlen; +short horiz_mode_code_white (short runlen) { return (runlen < 64 ? runlen + ACT_WRUNT : (runlen / 64) + ACT_WRUN); } @@ -229,22 +247,12 @@ short horiz_mode_prefix_count = 0; static unsigned char bit_mask[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; -void build_null_mode_tables(); -short find_horiz_mode_prefix(); -short find_null_mode_prefix(); -short null_mode_type(); -void build_horiz_mode_tables(); -short horiz_mode_code_black(); -short horiz_mode_code_white(); -void build_uncomp_mode_tables(); -void write_tables(); int verbose = FALSE; char *storage_class = ""; -void main (argc, argv) -int argc; -char** argv; +int +main (int argc, char *argv[]) { while (argc > 1 && argv[1][0] == '-') { if (strcmp(argv[1], "-v") == 0) { @@ -304,10 +312,8 @@ char *name; fprintf(fd, "\n};\n"); } -void write_horiz_mode_table (fd, table, name) -FILE *fd; -HorizModeTable table; -char *name; +void +write_horiz_mode_table (FILE *fd, HorizModeTable table, char *name) { int i, j; char* outersep; @@ -334,11 +340,7 @@ char *name; } void -write_define(fd, name, value, comment) - FILE *fd; - char *name; - int value; - char *comment; +write_define(FILE *fd, char *name, int value, char *comment) { fprintf(fd, "#define\t%s\t%d", name, value); if (comment) @@ -347,8 +349,7 @@ write_define(fd, name, value, comment) } void -write_preamble(fd) - FILE *fd; +write_preamble(FILE *fd) { fprintf(fd, "%s\n", "/* DO NOT EDIT THIS FILE, IT WAS AUTOMATICALLY CREATED BY mkg3state */"); @@ -402,16 +403,13 @@ write_preamble(fd) } void -extern_table(fd, name) - FILE* fd; - char* name; +extern_table(FILE *fd, char *name) { fprintf(fd, "extern\t%sunsigned char %s[][256];\n", storage_class, name); } void -write_tables(fd) - FILE* fd; +write_tables(FILE *fd) { write_preamble(fd); write_null_mode_table(fd, null_mode, "TIFFFax2DMode"); @@ -422,8 +420,8 @@ write_tables(fd) write_horiz_mode_table(fd, horiz_mode_next_state, "TIFFFax1DNextState"); } -short find_null_mode_prefix (prefix) -long prefix; +short +find_null_mode_prefix (long prefix) { short j1; @@ -443,9 +441,8 @@ long prefix; return (null_mode_prefix_count-1); } -short find_horiz_mode_prefix (prefix, color) -long prefix; -char color; +short +find_horiz_mode_prefix (long prefix, int color) { short j1; @@ -469,8 +466,8 @@ char color; return (horiz_mode_prefix_count - 1); } -short find_uncomp_mode_prefix (prefix) -long prefix; +short +find_uncomp_mode_prefix (long prefix) { short j1; @@ -490,8 +487,8 @@ long prefix; return (uncomp_mode_prefix_count-1); } -short null_mode_type (prefix) -long prefix; +short +null_mode_type (long prefix) { switch (prefix) { case 0x18000L: return (MODE_VERT_V0); /* 1 */ @@ -517,8 +514,8 @@ long prefix; return (-1); } -short uncomp_mode_type (prefix) -long prefix; +short +uncomp_mode_type (long prefix) { short code; short len; @@ -543,7 +540,7 @@ long prefix; #define BASESTATE(b) ((unsigned char) ((b) & 0x7)) void -build_null_mode_tables() +build_null_mode_tables(void) { short prefix; @@ -612,7 +609,7 @@ build_null_mode_tables() } void -build_horiz_mode_tables() +build_horiz_mode_tables(void) { unsigned short byte; short prefix; @@ -706,7 +703,7 @@ build_horiz_mode_tables() } void -build_uncomp_mode_tables() +build_uncomp_mode_tables(void) { short prefix; diff --git a/src/lbx_zlib/lbx_zlib.c b/src/lbx_zlib/lbx_zlib.c index f2f17e0..95ae326 100644 --- a/src/lbx_zlib/lbx_zlib.c +++ b/src/lbx_zlib/lbx_zlib.c @@ -50,6 +50,7 @@ from The Open Group. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.c,v 1.10 2001/12/14 19:56:59 dawes Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ @@ -58,18 +59,14 @@ from The Open Group. #include <X11/Xfuncs.h> #include <stdio.h> #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif -#include "lbxzlib.h" #include <sys/types.h> -#ifndef WIN32 +#if !defined(WIN32) && !defined(Lynx) #include <sys/param.h> #endif #include "lbxbufstr.h" #include "lbx_zlib.h" - -void ZlibFree(); +#include "os.h" +#include "lbxzlib.h" unsigned long stream_out_compressed; unsigned long stream_out_uncompressed; @@ -94,9 +91,8 @@ struct ZlibInfo { }; static int -init_compress(priv, level) - struct compress_private *priv; /* local pointer to private data */ - int level; /* compression level */ +init_compress(struct compress_private *priv,/* local pointer to private data */ + int level) /* compression level */ { priv->cp_outputcount = 0; @@ -117,8 +113,7 @@ init_compress(priv, level) } static int -init_decompress(priv) - struct compress_private *priv; /* local pointer to private data */ +init_decompress(struct compress_private *priv)/* local pointer to private data */ { priv->cp_outputcount = 0; @@ -149,10 +144,8 @@ init_decompress(priv) static void -do_compress (priv, flush) - -struct compress_private *priv; -int flush; +do_compress (struct compress_private *priv, + int flush) { priv->stream.next_in = priv->cp_inputbuf; @@ -169,9 +162,7 @@ int flush; static void -do_decompress (priv) - -struct compress_private *priv; +do_decompress (struct compress_private *priv) { priv->stream.next_in = priv->cp_inputbuf; @@ -189,8 +180,7 @@ struct compress_private *priv; } static int -GetNewPacket(comp) - struct ZlibInfo *comp; +GetNewPacket(struct ZlibInfo *comp) { register struct compress_private *priv = &comp->decompress_state; int len; @@ -220,8 +210,7 @@ GetNewPacket(comp) } static int -NewPacketAvail(comp) - struct ZlibInfo *comp; +NewPacketAvail(struct ZlibInfo *comp) { register struct compress_private *priv = &comp->decompress_state; char *pkt; @@ -243,10 +232,9 @@ NewPacketAvail(comp) } static int -PlainWrite(comp, buffer, buflen) - struct ZlibInfo *comp; - unsigned char *buffer; - int buflen; +PlainWrite(struct ZlibInfo *comp, + unsigned char *buffer, + int buflen) { int retval; int lenleft = buflen; @@ -299,9 +287,8 @@ static struct ZlibInfo *per_fd[MAX_FDS]; * Initialize ZLIB compressor */ void * -ZlibInit(fd, level) - int fd; - int level; /* compression level */ +ZlibInit(int fd, + int level) /* compression level */ { struct ZlibInfo *comp; int ret1, ret2; @@ -335,8 +322,7 @@ ZlibInit(fd, level) } void -ZlibFree(comp) - struct ZlibInfo *comp; +ZlibFree(struct ZlibInfo *comp) { if (!comp) return; @@ -353,7 +339,7 @@ ZlibFree(comp) } int -ZlibFlush(fd) +ZlibFlush(int fd) { struct ZlibInfo *comp = per_fd[fd]; struct compress_private *priv = &comp->compress_state; @@ -373,10 +359,9 @@ ZlibFlush(fd) } int -ZlibStuffInput(fd,buffer,buflen) - int fd; - unsigned char *buffer; - int buflen; +ZlibStuffInput(int fd, + unsigned char *buffer, + int buflen) { struct ZlibInfo *comp = per_fd[fd]; @@ -386,24 +371,21 @@ ZlibStuffInput(fd,buffer,buflen) } void -ZlibCompressOn(fd) - int fd; +ZlibCompressOn(int fd) { per_fd[fd]->compress_off = FALSE; } void -ZlibCompressOff(fd) - int fd; +ZlibCompressOff(int fd) { per_fd[fd]->compress_off = TRUE; } int -ZlibWriteV(fd, iov, iovcnt) - int fd; - struct iovec *iov; - int iovcnt; +ZlibWriteV(int fd, + struct iovec *iov, + int iovcnt) { int i; int total = 0; @@ -411,7 +393,8 @@ ZlibWriteV(fd, iov, iovcnt) for (i = 0; i < iovcnt; i++) { - this_time = ZlibWrite(fd, iov[i].iov_base, iov[i].iov_len); + this_time = ZlibWrite(fd, (unsigned char *)iov[i].iov_base, + iov[i].iov_len); if (this_time > 0) total += this_time; if (this_time != iov[i].iov_len) @@ -425,10 +408,9 @@ ZlibWriteV(fd, iov, iovcnt) } int -ZlibWrite(fd, buffer, buflen) - int fd; - unsigned char *buffer; - int buflen; +ZlibWrite(int fd, + unsigned char *buffer, + int buflen) { struct ZlibInfo *comp = per_fd[fd]; struct compress_private *priv = &comp->compress_state; @@ -474,17 +456,16 @@ ZlibWrite(fd, buffer, buflen) } int -ZlibRead(fd, buffer, buflen) - int fd; - unsigned char *buffer; - int buflen; +ZlibRead(int fd, + unsigned char *buffer, + int buflen) { struct ZlibInfo *comp = per_fd[fd]; struct compress_private *priv = &comp->decompress_state; unsigned char *p = buffer; int lenleft = buflen; int len; - int retval; + int retval = -1; /* * First check if there is any data Zlib decompressed already but @@ -550,8 +531,7 @@ ZlibRead(fd, buffer, buflen) } int -ZlibInputAvail(fd) - int fd; +ZlibInputAvail(int fd) { struct ZlibInfo *comp = per_fd[fd]; struct compress_private *priv = &comp->decompress_state; diff --git a/src/lbx_zlib/lbx_zlib.h b/src/lbx_zlib/lbx_zlib.h index 04b1364..029fd29 100644 --- a/src/lbx_zlib/lbx_zlib.h +++ b/src/lbx_zlib/lbx_zlib.h @@ -50,8 +50,10 @@ from The Open Group. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ +/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.h,v 1.10 2001/12/14 19:57:00 dawes Exp $ */ #include "zlib.h" +#include "Xfuncproto.h" struct compress_private { z_stream stream; @@ -94,7 +96,11 @@ struct iovec { }; #else +#ifndef Lynx #include <sys/uio.h> +#else +#include <uio.h> +#endif #endif #ifdef WIN32 @@ -107,3 +113,13 @@ struct iovec { #undef BOOL #define EWOULDBLOCK WSAEWOULDBLOCK #endif + + +/* lbx_zlib_io.c */ +extern int GetInputPtr ( int fd, ZlibBufferPtr inbuf, int reqlen, + unsigned char **ppkt ); +extern int StuffInput ( ZlibBufferPtr inbuf, unsigned char *pkt, int reqlen ); +extern void FreeInput ( ZlibBufferPtr inbuf, int len ); +extern void CommitOutBuf ( ZlibBufferPtr outbuf, int outlen ); +extern int FlushOutBuf ( int fd, ZlibBufferPtr outbuf ); +extern int FlushIovBuf ( int fd, struct iovec *iovbuf ); diff --git a/src/lbx_zlib/lbx_zlib_io.c b/src/lbx_zlib/lbx_zlib_io.c index cb389b7..b6677ce 100644 --- a/src/lbx_zlib/lbx_zlib_io.c +++ b/src/lbx_zlib/lbx_zlib_io.c @@ -22,6 +22,7 @@ * * Author: Dale Tonogai, Network Computing Devices */ +/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib_io.c,v 1.12 2001/07/25 15:04:57 dawes Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ @@ -29,25 +30,21 @@ #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <errno.h> -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif -#ifndef WIN32 +#if !defined(WIN32) && !defined(Lynx) #include <sys/param.h> #endif #include "lbxbufstr.h" #include "lbx_zlib.h" +#include "os.h" -#ifndef NULL -#define NULL 0 -#endif +#include <stddef.h> /* * The following is taken from the xtrans code, almost as is, * it would be nice to share it... */ -#if defined(WIN32) || defined(__sxg__) || defined(SCO) +#if defined(WIN32) || defined(__sxg__) || (defined(SCO) && !defined(SVR4) && !defined(SCO325)) static int writev(int fildes, const struct iovec *iov, int iovcnt) { @@ -107,7 +104,7 @@ GetInputPtr(fd, inbuf, reqlen, ppkt) int fd; ZlibBufferPtr inbuf; int reqlen; - char **ppkt; + unsigned char **ppkt; { int readbytes; int gotbytes; @@ -116,7 +113,7 @@ GetInputPtr(fd, inbuf, reqlen, ppkt) inbuf->bufptr = inbuf->bufbase; if (reqlen <= inbuf->bufcnt) { - *ppkt = inbuf->bufptr; + *ppkt = (unsigned char *)inbuf->bufptr; return 1; } @@ -128,7 +125,7 @@ GetInputPtr(fd, inbuf, reqlen, ppkt) gotbytes = read(fd, inbuf->bufptr + inbuf->bufcnt, readbytes); if (gotbytes > 0) { if (reqlen <= (inbuf->bufcnt += gotbytes)) { - *ppkt = inbuf->bufptr; + *ppkt = (unsigned char *)inbuf->bufptr; return 1; } } @@ -148,7 +145,7 @@ GetInputPtr(fd, inbuf, reqlen, ppkt) int StuffInput(inbuf, pkt, reqlen) ZlibBufferPtr inbuf; - char *pkt; + unsigned char *pkt; int reqlen; { int readbytes; diff --git a/src/lbx_zlib/reqstats.c b/src/lbx_zlib/reqstats.c index 8d73ee6..b0d0180 100644 --- a/src/lbx_zlib/reqstats.c +++ b/src/lbx_zlib/reqstats.c @@ -27,6 +27,9 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/lbxutil/lbx_zlib/reqstats.c,v 1.6 2001/12/14 19:57:01 dawes Exp $ */ + +#include "reqstats.h" #ifdef LBXREQSTATS @@ -35,7 +38,6 @@ from The Open Group. #define _XLBX_SERVER_ #include "XLbx.h" #include "lbx_zlib.h" -#include "reqstats.h" #include <signal.h> #include <stdio.h> @@ -53,7 +55,7 @@ int unknown_extension_bytes = 0; struct ReqStats CoreRequestStats[128]; struct ReqStats LbxRequestStats[LbxNumberReqs]; -void LbxPrintReqStats (); +static void LbxPrintReqStats (int); char *X_ReqNames[128] = { 0, /* 0 */ @@ -231,7 +233,8 @@ char *LBX_ReqNames[LbxNumberReqs] = { -InitLbxReqStats () +void +InitLbxReqStats (void) { bzero (CoreRequestStats, 128 * sizeof (struct ReqStats)); @@ -241,11 +244,10 @@ InitLbxReqStats () } -PrintStatsTable (table, count, reqNames) - -struct ReqStats *table; -int count; -char **reqNames; +static void +PrintStatsTable (struct ReqStats *table, + int count, + char **reqNames) { int i; @@ -289,12 +291,10 @@ char **reqNames; } } - -PrintDeltaStats (table, count, reqNames) - -struct ReqStats *table; -int count; -char **reqNames; +static void +PrintDeltaStats (struct ReqStats *table, + int count, + char **reqNames) { int i; @@ -311,10 +311,8 @@ char **reqNames; } -void -LbxPrintReqStats (dummy) - -int dummy; +static void +LbxPrintReqStats (int dummy) { unsigned long total; @@ -367,9 +365,8 @@ int dummy; } -do_decompress_with_stats (priv) - -struct compress_private *priv; +void +do_decompress_with_stats (struct compress_private *priv) { int incount = priv->cp_inputbufend - priv->cp_inputbuf; @@ -497,12 +494,10 @@ struct compress_private *priv; priv->cp_outputbuf = priv->stream.next_out; } -#else /* LBXREQSTATS */ - -_LbxEmptyFunction () +#else -{ - ; -} +void +InitLbxReqStats() +{} #endif /* LBXREQSTATS */ diff --git a/src/lbx_zlib/reqstats.h b/src/lbx_zlib/reqstats.h index f956205..d22e4e7 100644 --- a/src/lbx_zlib/reqstats.h +++ b/src/lbx_zlib/reqstats.h @@ -27,6 +27,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/lbxutil/lbx_zlib/reqstats.h,v 1.3 2001/12/14 19:57:01 dawes Exp $ */ #ifdef LBXREQSTATS struct ReqStats { @@ -38,3 +39,5 @@ struct ReqStats { unsigned long post_delta_bytes; }; #endif + +extern void InitLbxReqStats(void); |