aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/lbxutil/lbx_zlib
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/lbxutil/lbx_zlib')
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/Imakefile22
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c543
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h136
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c275
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/reqstats.c503
-rw-r--r--nx-X11/lib/lbxutil/lbx_zlib/reqstats.h43
6 files changed, 0 insertions, 1522 deletions
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/Imakefile b/nx-X11/lib/lbxutil/lbx_zlib/Imakefile
deleted file mode 100644
index ddcecc6fd..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/Imakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:41 cpqbld Exp $
-XCOMM $XdotOrg: xc/lib/lbxutil/lbx_zlib/Imakefile,v 1.3 2004/10/10 17:13:11 herrb Exp $
-
-#include <Library.tmpl>
-
-SRCS = lbx_zlib.c lbx_zlib_io.c reqstats.c
-
-OBJS = lbx_zlib.o lbx_zlib_io.o reqstats.o
-
-#if !HasZlib
-ZLIB_INCLUDES= -I../../zlib
-#endif
-
-INCLUDES = -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/include \
- -I../../../include/extensions $(ZLIB_INCLUDES)
-
-SubdirLibraryRule($(OBJS))
-NormalLibraryObjectRule()
-NormalLintTarget($(SRCS))
-
-DependTarget()
-
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c
deleted file mode 100644
index e7105a0c7..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.c
+++ /dev/null
@@ -1,543 +0,0 @@
-/* $Xorg: lbx_zlib.c,v 1.6 2001/02/09 02:04:05 xorgcvs Exp $ */
-
-/*
-
-Copyright 1995, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/*
- * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.c,v 1.9 2001/08/27 19:01:07 dawes Exp $ */
-
-#ifdef WIN32
-#define _WILLWINSOCK_
-#endif
-#define _BSD_SOURCE
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#if !defined(WIN32) && !defined(Lynx)
-#include <sys/param.h>
-#endif
-#include <X11/extensions/lbxbufstr.h>
-#include "lbx_zlib.h"
-#include <X11/extensions/lbxzlib.h>
-
-unsigned long stream_out_compressed;
-unsigned long stream_out_uncompressed;
-unsigned long stream_out_plain;
-unsigned long stream_in_compressed;
-unsigned long stream_in_uncompressed;
-unsigned long stream_in_plain;
-#ifdef LBXREQSTATS
-unsigned long stream_in_packet_header_bytes = 0;
-extern int LbxWhoAmI;
-#endif
-
-struct ZlibInfo {
- struct compress_private compress_state;
- struct compress_private decompress_state;
- int fd;
- int compress_off;
- ZlibBuffer inbuf;
- ZlibBuffer outbuf;
- unsigned char header[ZLIB_PACKET_HDRLEN];
- struct iovec iovbuf[2];
-};
-
-static int
-init_compress(struct compress_private *priv,/* local pointer to private data */
- int level) /* compression level */
-{
- priv->cp_outputcount = 0;
-
- priv->cp_in_count = 0; /* length of input */
- priv->cp_bytes_out = 0; /* length of compressed output */
- priv->cp_inputbuf = priv->cp_inputbufend = NULL;
- priv->cp_packet = NULL;
-
- priv->stream.zalloc = (alloc_func) 0;
- priv->stream.zfree = (free_func) 0;
- priv->stream.next_in = NULL;
- priv->stream.next_out = NULL;
- priv->stream.avail_in = priv->stream.avail_out = 0;
-
- priv->z_err = deflateInit (&(priv->stream), level);
-
- return (priv->compress_inited = (priv->z_err == Z_OK) ? 1 : 0);
-}
-
-static int
-init_decompress(struct compress_private *priv)/* local pointer to private data */
-{
- priv->cp_outputcount = 0;
-
- priv->cp_in_count = 0; /* length of input */
- priv->cp_bytes_out = 0; /* length of compressed output */
- priv->cp_inputbuf = priv->cp_inputbufend = NULL;
- priv->cp_packet = NULL;
-
- priv->stream.zalloc = (alloc_func) 0;
- priv->stream.zfree = (free_func) 0;
- priv->stream.next_in = NULL;
- priv->stream.next_out = NULL;
- priv->stream.avail_in = priv->stream.avail_out = 0;
-
- priv->need_flush_decompress = 0;
-
- priv->z_err = inflateInit (&(priv->stream));
-
-#ifdef LBXREQSTATS
- priv->req_length = -1;
- priv->req_compbytes_read = 0;
- priv->req_uncompbytes_read = 0;
- priv->x_header_bytes_read = 0;
-#endif
-
- return (priv->decompress_inited = (priv->z_err == Z_OK) ? 1 : 0);
-}
-
-
-static void
-do_compress (struct compress_private *priv,
- int flush)
-
-{
- priv->stream.next_in = priv->cp_inputbuf;
- priv->stream.avail_in = priv->cp_inputbufend - priv->cp_inputbuf;
-
- priv->stream.next_out = priv->cp_outputbuf;
- priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf;
-
- priv->z_err = deflate (&(priv->stream), flush);
-
- priv->cp_inputbuf = priv->stream.next_in;
- priv->cp_outputbuf = priv->stream.next_out;
-}
-
-
-static void
-do_decompress (struct compress_private *priv)
-
-{
- priv->stream.next_in = priv->cp_inputbuf;
- priv->stream.avail_in = priv->cp_inputbufend - priv->cp_inputbuf;
-
- priv->stream.next_out = priv->cp_outputbuf;
- priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf;
-
- priv->z_err = inflate (&(priv->stream), Z_PARTIAL_FLUSH);
-
- priv->need_flush_decompress = (priv->stream.avail_out == 0);
-
- priv->cp_inputbuf = priv->stream.next_in;
- priv->cp_outputbuf = priv->stream.next_out;
-}
-
-static int
-GetNewPacket(struct ZlibInfo *comp)
-{
- register struct compress_private *priv = &comp->decompress_state;
- int len;
- int result;
-
- if (priv->cp_packet) {
- /* Free up previous packet in input buffer */
- FreeInput(&comp->inbuf, priv->cp_inputbufend - priv->cp_packet);
- priv->cp_packet = NULL;
- }
-
- if ((result = GetInputPtr(comp->fd,
- &comp->inbuf,
- ZLIB_PACKET_HDRLEN,
- &priv->cp_packet)) <= 0)
- return result;
- len = ZLIB_GET_DATALEN(priv->cp_packet);
- if ((result = GetInputPtr(comp->fd,
- &comp->inbuf,
- len + ZLIB_PACKET_HDRLEN,
- &priv->cp_packet)) <= 0) {
- priv->cp_packet = NULL;
- return result;
- }
-
- return len;
-}
-
-static int
-NewPacketAvail(struct ZlibInfo *comp)
-{
- register struct compress_private *priv = &comp->decompress_state;
- char *pkt;
- int len;
-
- if (priv->cp_packet) {
- /* Free up previous packet in input buffer */
- FreeInput(&comp->inbuf, priv->cp_inputbufend - priv->cp_packet);
- priv->cp_packet = NULL;
- }
-
- if ((pkt = BYTES_AVAIL(&comp->inbuf, ZLIB_PACKET_HDRLEN))) {
- len = ZLIB_GET_DATALEN(pkt);
- if (BYTES_AVAIL(&comp->inbuf, len + ZLIB_PACKET_HDRLEN))
- return TRUE;
- }
-
- return FALSE;
-}
-
-static int
-PlainWrite(struct ZlibInfo *comp,
- unsigned char *buffer,
- int buflen)
-{
- int retval;
- int lenleft = buflen;
-
- if ((retval = ZlibFlush(comp->fd)) == 0) {
- register struct iovec *iov = comp->iovbuf;
- while (lenleft) {
- int outlen, written;
- if ((outlen = iov[1].iov_len)) {
- iov[1].iov_base = (caddr_t) buffer;
- }
- else {
- outlen = MIN(lenleft, ZLIB_MAX_DATALEN);
- ZLIB_PUT_PKTHDR(comp->header, outlen, FALSE);
- iov[0].iov_base = (caddr_t) comp->header;
- iov[0].iov_len = ZLIB_PACKET_HDRLEN;
- iov[1].iov_base = (caddr_t) buffer;
- iov[1].iov_len = outlen;
- stream_out_uncompressed += ZLIB_PACKET_HDRLEN;
- }
- if ((retval = FlushIovBuf(comp->fd, iov)) < 0)
- break;
- written = outlen - retval;
- lenleft -= written;
- buffer += written;
- stream_out_plain += written;
- stream_out_uncompressed += written;
- if (retval)
- break;
- }
- if (lenleft == buflen)
- return retval;
- else
- return buflen - lenleft;
- }
-
- else if (retval > 0) {
- retval = -1;
- errno = EWOULDBLOCK;
- }
-
- return retval;
-}
-
-#define MAX_FDS 256
-
-static struct ZlibInfo *per_fd[MAX_FDS];
-
-/*
- * Initialize ZLIB compressor
- */
-void *
-ZlibInit(int fd,
- int level) /* compression level */
-{
- struct ZlibInfo *comp;
- int ret1, ret2;
-
- if ((comp = (struct ZlibInfo *)Xalloc(sizeof(struct ZlibInfo))) == NULL)
- return NULL;
-
- ret1 = InitZlibBuffer(&comp->inbuf, INBUFFER_SIZE);
- ret2 = InitZlibBuffer(&comp->outbuf, OUTBUFFER_SIZE);
- if (ret1 < 0 || ret2 < 0) {
- ZlibFree(comp);
- return NULL;
- }
- comp->compress_off = FALSE;
- comp->iovbuf[1].iov_len = 0;
- comp->fd = fd;
-
- if (!init_compress(&comp->compress_state, level) ||
- !init_decompress(&comp->decompress_state)) {
- ZlibFree(comp);
- return NULL;
- }
-
- per_fd[fd] = comp;
-
-#ifdef LBXREQSTATS
- InitLbxReqStats ();
-#endif
-
- return (void *)comp;
-}
-
-void
-ZlibFree(struct ZlibInfo *comp)
-{
- if (!comp)
- return;
- per_fd[comp->fd] = 0;
- FreeZlibBuffer(&comp->inbuf);
- FreeZlibBuffer(&comp->outbuf);
-
- if (comp->compress_state.compress_inited)
- deflateEnd (&(comp->compress_state.stream));
- else if (comp->decompress_state.decompress_inited)
- inflateEnd (&(comp->compress_state.stream));
-
- Xfree(comp);
-}
-
-int
-ZlibFlush(int fd)
-{
- struct ZlibInfo *comp = per_fd[fd];
- struct compress_private *priv = &comp->compress_state;
-
- if (priv->cp_in_count) {
- int len;
- do_compress (priv, Z_PARTIAL_FLUSH);
- len = priv->cp_outputbuf - (priv->cp_packet + ZLIB_PACKET_HDRLEN);
- ZLIB_PUT_PKTHDR(priv->cp_packet, len, TRUE);
- stream_out_compressed += (len + ZLIB_PACKET_HDRLEN);
-
- CommitOutBuf(&comp->outbuf, len + ZLIB_PACKET_HDRLEN);
- priv->cp_in_count = 0;
- }
-
- return FlushOutBuf(comp->fd, &comp->outbuf);
-}
-
-int
-ZlibStuffInput(int fd,
- unsigned char *buffer,
- int buflen)
-{
- struct ZlibInfo *comp = per_fd[fd];
-
- if (StuffInput (&comp->inbuf, buffer, buflen) != buflen)
- return 0;
- return 1;
-}
-
-void
-ZlibCompressOn(int fd)
-{
- per_fd[fd]->compress_off = FALSE;
-}
-
-void
-ZlibCompressOff(int fd)
-{
- per_fd[fd]->compress_off = TRUE;
-}
-
-int
-ZlibWriteV(int fd,
- struct iovec *iov,
- int iovcnt)
-{
- int i;
- int total = 0;
- int this_time;
-
- for (i = 0; i < iovcnt; i++)
- {
- 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)
- {
- if (total)
- return total;
- return this_time;
- }
- }
- return total;
-}
-
-int
-ZlibWrite(int fd,
- unsigned char *buffer,
- int buflen)
-{
- struct ZlibInfo *comp = per_fd[fd];
- struct compress_private *priv = &comp->compress_state;
- int len;
- int lenleft = buflen;
- unsigned char *p = buffer;
-
- if (comp->compress_off) {
- return PlainWrite(comp, buffer, buflen);
- }
-
- while (lenleft) {
- if (priv->cp_in_count == 0) {
- priv->cp_packet = (unsigned char *) ReserveOutBuf(&comp->outbuf,
- ZLIB_PACKET_HDRLEN + ZLIB_MAX_OUTLEN);
- if (!priv->cp_packet) {
- errno = EWOULDBLOCK;
- return -1;
- }
- priv->cp_outputbuf = priv->cp_packet + ZLIB_PACKET_HDRLEN;
- priv->cp_outputbufend = priv->cp_outputbuf + ZLIB_MAX_OUTLEN;
- }
-
- len = MIN(ZLIB_MAX_PLAIN - priv->cp_in_count, lenleft);
- stream_out_plain += len;
-
- priv->cp_inputbuf = p;
- priv->cp_inputbufend = p + len;
- do_compress(priv, Z_NO_FLUSH);
-
- p += len;
- lenleft -= len;
- if ((priv->cp_in_count += len) == ZLIB_MAX_PLAIN) {
- if (ZlibFlush(fd) < 0) {
- if (lenleft == buflen)
- return -1;
- return buflen - lenleft;
- }
- }
- }
-
- return buflen;
-}
-
-int
-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 = -1;
-
- /*
- * First check if there is any data Zlib decompressed already but
- * didn't have output buffer space to store it in.
- */
-
- if (priv->need_flush_decompress)
- {
- priv->cp_outputbuf = p;
- priv->cp_outputbufend = p + lenleft;
-
- do_decompress (priv);
-
- lenleft -= (priv->cp_outputbuf - p);
- p = priv->cp_outputbuf;
- }
-
-
- /*
- * Need to decompress some more data
- */
-
- priv->cp_outputbuf = p;
- priv->cp_outputbufend = p + lenleft;
- while (priv->cp_outputbuf != priv->cp_outputbufend) {
- if (priv->cp_inputbuf == priv->cp_inputbufend) {
- if ((retval = GetNewPacket(comp)) <= 0)
- break;
- priv->cp_inputbuf = priv->cp_packet + ZLIB_PACKET_HDRLEN;
- priv->cp_inputbufend = priv->cp_inputbuf + retval;
- if (ZLIB_COMPRESSED(priv->cp_packet))
- stream_in_compressed += (retval + ZLIB_PACKET_HDRLEN);
- else
- stream_in_uncompressed += (retval + ZLIB_PACKET_HDRLEN);
-#ifdef LBXREQSTATS
- stream_in_packet_header_bytes += ZLIB_PACKET_HDRLEN;
-#endif
- }
-
- if (ZLIB_COMPRESSED(priv->cp_packet))
-#ifdef LBXREQSTATS
- if (LbxWhoAmI == 1) /* only support request stats for now */
- do_decompress_with_stats(priv);
- else
-#endif
- do_decompress(priv);
-
- else {
- len = MIN(priv->cp_inputbufend - priv->cp_inputbuf,
- priv->cp_outputbufend - priv->cp_outputbuf);
- memmove(priv->cp_outputbuf, priv->cp_inputbuf, len);
- priv->cp_inputbuf += len;
- priv->cp_outputbuf += len;
- }
- }
-
- if ((len = priv->cp_outputbuf - buffer) == 0)
- return retval;
- else {
- stream_in_plain += len;
- return len;
- }
-}
-
-int
-ZlibInputAvail(int fd)
-{
- struct ZlibInfo *comp = per_fd[fd];
- struct compress_private *priv = &comp->decompress_state;
-
- return (
- priv->need_flush_decompress ||
- priv->cp_inputbuf != priv->cp_inputbufend ||
- NewPacketAvail(comp) > 0);
-}
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h
deleted file mode 100644
index 68b94f807..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* $Xorg: lbx_zlib.h,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */
-
-/*
-
-Copyright 1996 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-
-/*
- * Copyright 1988, 1989, 1990, 1994 Network Computing Devices, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and
- * its documentation for any purpose is hereby granted without fee, provided
- * that the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
- * software without specific, written prior permission.
- *
- * THIS SOFTWARE IS PROVIDED `AS-IS'. NETWORK COMPUTING DEVICES, INC.,
- * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
- * LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE, OR NONINFRINGEMENT. IN NO EVENT SHALL NETWORK
- * COMPUTING DEVICES, INC., BE LIABLE FOR ANY DAMAGES WHATSOEVER, INCLUDING
- * SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, INCLUDING LOSS OF USE, DATA,
- * OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND REGARDLESS OF
- * WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- */
-/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib.h,v 1.9 2001/08/27 19:01:07 dawes Exp $ */
-
-#include "zlib.h"
-#include <X11/Xfuncproto.h>
-
-struct compress_private {
- z_stream stream;
- char compress_inited;
- char decompress_inited;
- int z_err; /* error code for last stream operation */
- unsigned char *cp_inputbuf;
- unsigned char *cp_inputbufend;
- unsigned char *cp_outputbuf;
- unsigned char *cp_outputbufend;
- unsigned char *cp_packet;
- int cp_outputcount;
- long int cp_in_count; /* length of input */
- long int cp_bytes_out; /* length of compressed output */
- int need_flush_decompress;
-#ifdef LBXREQSTATS
- int x_req_code;
- int lbx_req_code;
- int x_header_bytes_read;
- char x_header_buf[4];
- int req_length;
- int req_compbytes_read;
- int req_uncompbytes_read;
-#endif
-};
-
-#ifndef MIN
-#define MIN(_a, _b) ( ((_a) < (_b)) ? (_a) : (_b))
-#endif
-
-
-/*
- * The following is taken from the xtrans code, it would be nice to share it
- */
-#if defined(WIN32) || (defined(USG) && !defined(CRAY) && !defined(umips) && !defined(MOTOROLA) && !defined(uniosu) && !defined(__sxg__))
-
-struct iovec {
- caddr_t iov_base;
- int iov_len;
-};
-
-#else
-#ifndef Lynx
-#include <sys/uio.h>
-#else
-#include <uio.h>
-#endif
-#endif
-
-#ifdef WIN32
-#define BOOL wBOOL
-#undef Status
-#define Status wStatus
-#include <winsock.h>
-#undef Status
-#define Status int
-#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 );
-
-/* Copied from xc/programs/Xserver/include/xorg/os.h */
-#ifndef _HAVE_XALLOC_DECLS
-#define _HAVE_XALLOC_DECLS
-#include <X11/Xdefs.h>
-
-extern pointer Xalloc(unsigned long /*amount*/);
-extern pointer Xcalloc(unsigned long /*amount*/);
-extern pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
-extern void Xfree(pointer /*ptr*/);
-#endif
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c b/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c
deleted file mode 100644
index 12b29a310..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/lbx_zlib_io.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* $Xorg: lbx_zlib_io.c,v 1.3 2000/08/17 19:46:41 cpqbld Exp $ */
-
-/*
- * Copyright 1993 Network Computing Devices
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of NCD. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. NCD. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * NCD. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NCD.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: Dale Tonogai, Network Computing Devices
- */
-/* $XFree86: xc/lib/lbxutil/lbx_zlib/lbx_zlib_io.c,v 1.11 2001/01/17 19:43:36 dawes Exp $ */
-
-#ifdef WIN32
-#define _WILLWINSOCK_
-#endif
-#include <X11/Xos.h>
-#include <X11/Xfuncs.h>
-#include <errno.h>
-#if !defined(WIN32) && !defined(Lynx)
-#include <sys/param.h>
-#endif
-#include <X11/extensions/lbxbufstr.h>
-#include "lbx_zlib.h"
-
-#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__)
-static int
-writev(int fildes, const struct iovec *iov, int iovcnt)
-{
- int i, len, total;
- char *base;
-
- ESET(0);
- for (i = 0, total = 0; i < iovcnt; i++, iov++) {
- len = iov->iov_len;
- base = iov->iov_base;
- while (len > 0) {
- register int nbytes;
- nbytes = write(fildes, base, len);
- if (nbytes < 0 && total == 0) return -1;
- if (nbytes <= 0) return total;
- ESET(0);
- len -= nbytes;
- total += nbytes;
- base += nbytes;
- }
- }
- return total;
-}
-#endif
-
-int
-InitZlibBuffer(b, size)
- ZlibBufferPtr b;
- int size;
-{
- if ((b->bufbase = (char *)Xalloc(size)) == NULL)
- return -1;
- b->bufend = b->bufbase + size;
- b->bufptr = b->bufbase;
- b->bufcnt = 0;
- return 0;
-}
-
-void
-FreeZlibBuffer(b)
- ZlibBufferPtr b;
-{
- if (b->bufbase) {
- Xfree(b->bufbase);
- b->bufbase = NULL;
- }
-}
-
-/*
- * Returns:
- * 1 if desired amount of data available in input buffer
- * 0 if eof
- * -1 if error
- */
-int
-GetInputPtr(fd, inbuf, reqlen, ppkt)
- int fd;
- ZlibBufferPtr inbuf;
- int reqlen;
- unsigned char **ppkt;
-{
- int readbytes;
- int gotbytes;
-
- if (inbuf->bufcnt == 0)
- inbuf->bufptr = inbuf->bufbase;
-
- if (reqlen <= inbuf->bufcnt) {
- *ppkt = (unsigned char *)inbuf->bufptr;
- return 1;
- }
-
- if (reqlen > inbuf->bufend - inbuf->bufptr) {
- memmove(inbuf->bufbase, inbuf->bufptr, inbuf->bufcnt);
- inbuf->bufptr = inbuf->bufbase;
- }
- readbytes = (inbuf->bufend - inbuf->bufptr) - inbuf->bufcnt;
- gotbytes = read(fd, inbuf->bufptr + inbuf->bufcnt, readbytes);
- if (gotbytes > 0) {
- if (reqlen <= (inbuf->bufcnt += gotbytes)) {
- *ppkt = (unsigned char *)inbuf->bufptr;
- return 1;
- }
- }
- else
- return gotbytes;
-
- errno = EWOULDBLOCK;
- return -1;
-}
-
-/*
- * When ZLIB is started, we may well have read some data off of the
- * wire somewhere. This sticks those bytes ahead of anything we might
- * read in the future
- */
-
-int
-StuffInput(inbuf, pkt, reqlen)
- ZlibBufferPtr inbuf;
- unsigned char *pkt;
- int reqlen;
-{
- int readbytes;
- char *last;
-
- last = inbuf->bufptr + inbuf->bufcnt;
- if (reqlen > inbuf->bufend - last)
- {
- memmove(inbuf->bufbase, inbuf->bufptr, inbuf->bufcnt);
- inbuf->bufptr = inbuf->bufbase;
- last = inbuf->bufptr + inbuf->bufcnt;
- }
- readbytes = MIN(reqlen, inbuf->bufend - last);
- memmove(last, pkt, readbytes);
- inbuf->bufcnt += readbytes;
- return readbytes;
-}
-
-void
-FreeInput(inbuf, len)
- ZlibBufferPtr inbuf;
- int len;
-{
- inbuf->bufptr += len;
- if ((inbuf->bufcnt -= len) == 0)
- inbuf->bufptr = inbuf->bufbase;
-}
-
-/*
- * Reserve outlen bytes in the output buffer.
- */
-char *
-ReserveOutBuf(outbuf, outlen)
- ZlibBufferPtr outbuf;
- int outlen;
-{
- int left;
-
- left = (outbuf->bufend - outbuf->bufptr) - outbuf->bufcnt;
- if (left < outlen)
- return NULL;
- else
- return outbuf->bufptr + outbuf->bufcnt;
-}
-
-/*
- * Commit previously reserved space as real output
- */
-void
-CommitOutBuf(outbuf, outlen)
- ZlibBufferPtr outbuf;
- int outlen;
-{
- outbuf->bufcnt += outlen;
-}
-
-/*
- * Write out as much as possible from the output buffer.
- * Returns: >= 0 - amount left in buffer
- * < 0 - write error
- */
-int
-FlushOutBuf(fd, outbuf)
- int fd;
- ZlibBufferPtr outbuf;
-{
- int bytes;
-
- if (outbuf->bufcnt == 0)
- return 0;
- bytes = write(fd, outbuf->bufptr, outbuf->bufcnt);
- if (bytes > 0) {
- outbuf->bufptr += bytes;
- if ((outbuf->bufcnt -= bytes) == 0)
- outbuf->bufptr = outbuf->bufbase;
- return outbuf->bufcnt;
- }
- else if (bytes == 0) {
- errno = EWOULDBLOCK;
- bytes = -1;
- }
- return bytes;
-}
-
-/*
- * Write out as much as possible from the iovec array (no more than
- * two entries allowed).
- * Returns: >= 0 - amount left in iovec[1]
- * < 0 - write error
- */
-int
-FlushIovBuf(fd, iovbuf)
- int fd;
- struct iovec *iovbuf;
-{
- int bytes;
- int niov = 2;
- struct iovec *iov = iovbuf;
-
- if (iov[0].iov_len == 0) {
- ++iov;
- --niov;
- }
- bytes = writev(fd, iov, niov);
- if (bytes > 0) {
- int i;
- int len;
- for (i = 0; i < niov; i++) {
- len = MIN(bytes, iov[i].iov_len);
- iov[i].iov_len -= len;
- /*
- * An explicit cast is necessary because silly SGI changed
- * iov_base from a caddr_t to a void* in IRIX 6.x, and strictly
- * speaking ANSI/ISO C doesn't allow the use of a cast in an
- * lvalue, i.e. such as: '((char*)(iov[i].iov_base)) += len;'
- */
- iov[i].iov_base = ((char*)(iov[i].iov_base)) + len;
- if ((bytes -= len) == 0)
- break;
- }
- return iovbuf[1].iov_len;
- }
- else if (bytes == 0) {
- errno = EWOULDBLOCK;
- bytes = -1;
- }
- return bytes;
-}
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c b/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c
deleted file mode 100644
index 50545b8f6..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.c
+++ /dev/null
@@ -1,503 +0,0 @@
-/* $Xorg: reqstats.c,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */
-
-/*
-
-Copyright 1996 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/* $XFree86: xc/lib/lbxutil/lbx_zlib/reqstats.c,v 1.5 2001/08/27 19:01:07 dawes Exp $ */
-
-#include "reqstats.h"
-
-#ifdef LBXREQSTATS
-
-#include <X11/Xfuncs.h>
-#include <X11/Xproto.h>
-#define _XLBX_SERVER_
-#include "XLbx.h"
-#include "lbx_zlib.h"
-#include <signal.h>
-#include <stdio.h>
-
-#define LBX_CODE 136 /* XXX - this should not be hardcoded - on todo list */
-
-extern unsigned long stream_in_compressed;
-extern unsigned long stream_in_plain;
-extern unsigned long stream_in_packet_header_bytes;
-extern unsigned long stream_in_uncompressed_bytes;
-
-unsigned long check_sum_in_compressed;
-unsigned long check_sum_in_plain;
-int unknown_extension_bytes = 0;
-
-struct ReqStats CoreRequestStats[128];
-struct ReqStats LbxRequestStats[LbxNumberReqs];
-
-static void LbxPrintReqStats (int);
-
-char *X_ReqNames[128] = {
- 0, /* 0 */
- "CreateWindow", /* 1 */
- "ChangeWindowAttributes", /* 2 */
- "GetWindowAttributes", /* 3 */
- "DestroyWindow", /* 4 */
- "DestroySubwindows", /* 5 */
- "ChangeSaveSet", /* 6 */
- "ReparentWindow", /* 7 */
- "MapWindow", /* 8 */
- "MapSubwindows", /* 9 */
- "UnmapWindow", /* 10 */
- "UnmapSubwindows", /* 11 */
- "ConfigureWindow", /* 12 */
- "CirculateWindow", /* 13 */
- "GetGeometry", /* 14 */
- "QueryTree", /* 15 */
- "InternAtom", /* 16 */
- "GetAtomName", /* 17 */
- "ChangeProperty", /* 18 */
- "DeleteProperty", /* 19 */
- "GetProperty", /* 20 */
- "ListProperties", /* 21 */
- "SetSelectionOwner", /* 22 */
- "GetSelectionOwner", /* 23 */
- "ConvertSelection", /* 24 */
- "SendEvent", /* 25 */
- "GrabPointer", /* 26 */
- "UngrabPointer", /* 27 */
- "GrabButton", /* 28 */
- "UngrabButton", /* 29 */
- "ChangeActivePointerGrab", /* 30 */
- "GrabKeyboard", /* 31 */
- "UngrabKeyboard", /* 32 */
- "GrabKey", /* 33 */
- "UngrabKey", /* 34 */
- "AllowEvents", /* 35 */
- "GrabServer", /* 36 */
- "UngrabServer", /* 37 */
- "QueryPointer", /* 38 */
- "GetMotionEvents", /* 39 */
- "TranslateCoords", /* 40 */
- "WarpPointer", /* 41 */
- "SetInputFocus", /* 42 */
- "GetInputFocus", /* 43 */
- "QueryKeymap", /* 44 */
- "OpenFont", /* 45 */
- "CloseFont", /* 46 */
- "QueryFont", /* 47 */
- "QueryTextExtents", /* 48 */
- "ListFonts", /* 49 */
- "ListFontsWithInfo", /* 50 */
- "SetFontPath", /* 51 */
- "GetFontPath", /* 52 */
- "CreatePixmap", /* 53 */
- "FreePixmap", /* 54 */
- "CreateGC", /* 55 */
- "ChangeGC", /* 56 */
- "CopyGC", /* 57 */
- "SetDashes", /* 58 */
- "SetClipRectangles", /* 59 */
- "FreeGC", /* 60 */
- "ClearArea", /* 61 */
- "CopyArea", /* 62 */
- "CopyPlane", /* 63 */
- "PolyPoint", /* 64 */
- "PolyLine", /* 65 */
- "PolySegment", /* 66 */
- "PolyRectangle", /* 67 */
- "PolyArc", /* 68 */
- "FillPoly", /* 69 */
- "PolyFillRectangle", /* 70 */
- "PolyFillArc", /* 71 */
- "PutImage", /* 72 */
- "GetImage", /* 73 */
- "PolyText8", /* 74 */
- "PolyText16", /* 75 */
- "ImageText8", /* 76 */
- "ImageText16", /* 77 */
- "CreateColormap", /* 78 */
- "FreeColormap", /* 79 */
- "CopyColormapAndFree", /* 80 */
- "InstallColormap", /* 81 */
- "UninstallColormap", /* 82 */
- "ListInstalledColormaps", /* 83 */
- "AllocColor", /* 84 */
- "AllocNamedColor", /* 85 */
- "AllocColorCells", /* 86 */
- "AllocColorPlanes", /* 87 */
- "FreeColors", /* 88 */
- "StoreColors", /* 89 */
- "StoreNamedColor", /* 90 */
- "QueryColors", /* 91 */
- "LookupColor", /* 92 */
- "CreateCursor", /* 93 */
- "CreateGlyphCursor", /* 94 */
- "FreeCursor", /* 95 */
- "RecolorCursor", /* 96 */
- "QueryBestSize", /* 97 */
- "QueryExtension", /* 98 */
- "ListExtensions", /* 99 */
- "ChangeKeyboardMapping", /* 100 */
- "GetKeyboardMapping", /* 101 */
- "ChangeKeyboardControl", /* 102 */
- "GetKeyboardControl", /* 103 */
- "Bell", /* 104 */
- "ChangePointerControl", /* 105 */
- "GetPointerControl", /* 106 */
- "SetScreenSaver", /* 107 */
- "GetScreenSaver", /* 108 */
- "ChangeHosts", /* 109 */
- "ListHosts", /* 110 */
- "SetAccessControl", /* 111 */
- "SetCloseDownMode", /* 112 */
- "KillClient", /* 113 */
- "RotateProperties", /* 114 */
- "ForceScreenSaver", /* 115 */
- "SetPointerMapping", /* 116 */
- "GetPointerMapping", /* 117 */
- "SetModifierMapping", /* 118 */
- "GetModifierMapping", /* 119 */
- 0, /* 120 */
- 0, /* 121 */
- 0, /* 122 */
- 0, /* 123 */
- 0, /* 124 */
- 0, /* 125 */
- 0, /* 126 */
- "NoOperation" /* 127 */
-};
-
-
-char *LBX_ReqNames[LbxNumberReqs] = {
-
- "LbxQueryVersion", /* 0 */
- "LbxStartProxy", /* 1 */
- "LbxStopProxy", /* 2 */
- "LbxSwitch", /* 3 */
- "LbxNewClient", /* 4 */
- "LbxCloseClient", /* 5 */
- "LbxModifySequence", /* 6 */
- "LbxAllowMotion", /* 7 */
- "LbxIncrementPixel", /* 8 */
- "LbxDelta", /* 9 */
- "LbxGetModifierMapping", /* 10 */
- "LbxQueryTag", /* 11 */
- "LbxInvalidateTag", /* 12 */
- "LbxPolyPoint", /* 13 */
- "LbxPolyLine", /* 14 */
- "LbxPolySegment", /* 15 */
- "LbxPolyRectangle", /* 16 */
- "LbxPolyArc", /* 17 */
- "LbxFillPoly", /* 18 */
- "LbxPolyFillRectangle", /* 19 */
- "LbxPolyFillArc", /* 20 */
- "LbxGetKeyboardMapping", /* 21 */
- "LbxQueryFont", /* 22 */
- "LbxChangeProperty", /* 23 */
- "LbxGetProperty", /* 24 */
- "LbxTagData", /* 25 */
- "LbxCopyArea", /* 26 */
- "LbxCopyPlane", /* 27 */
- "LbxPolyText8", /* 28 */
- "LbxPolyText16", /* 29 */
- "LbxImageText8", /* 30 */
- "LbxImageText16", /* 31 */
- "LbxQueryExtension", /* 32 */
- "LbxPutImage", /* 33 */
- "LbxGetImage", /* 34 */
- "LbxBeginLargeRequest", /* 35 */
- "LbxLargeRequestData", /* 36 */
- "LbxEndLargeRequest" /* 37 */
-};
-
-
-
-void
-InitLbxReqStats (void)
-
-{
- bzero (CoreRequestStats, 128 * sizeof (struct ReqStats));
- bzero (LbxRequestStats, LbxNumberReqs * sizeof (struct ReqStats));
-
- signal (SIGUSR1, LbxPrintReqStats);
-}
-
-
-static void
-PrintStatsTable (struct ReqStats *table,
- int count,
- char **reqNames)
-
-{
- int i;
-
- fprintf (stderr, "U = uncompressed bytes\n");
- fprintf (stderr, "C = compressed bytes\n");
- fprintf (stderr, "%%C = percent compression\n");
- fprintf (stderr, "%%T = percent of total bytes in stream\n");
- fprintf (stderr, "\n");
- fprintf (stderr, "%-25s\tCount\tU\tC\t%%C\t\t%%T\n", "Request");
- fprintf (stderr, "-------------------------------------------------------------------------------\n");
-
- for (i = 0; i < count; i++)
- {
- float compRatio, percentTot;
-
- if (table[i].uncomp_bytes == 0)
- compRatio = 0.0;
- else
- compRatio = 100.0 * (1.0 - ((float) table[i].comp_bytes /
- (float) table[i].uncomp_bytes));
-
- if (stream_in_compressed - stream_in_packet_header_bytes == 0)
- percentTot = 0.0;
- else
- percentTot = 100.0 * (float) table[i].comp_bytes /
- (float) (stream_in_compressed -
- stream_in_packet_header_bytes);
-
- if (reqNames[i])
- fprintf (stderr, "%-25s\t%d\t%d\t%d\t%.3f\t\t%.3f\n",
- reqNames[i],
- table[i].count,
- table[i].uncomp_bytes,
- table[i].comp_bytes,
- compRatio,
- percentTot);
-
- check_sum_in_plain += table[i].uncomp_bytes;
- check_sum_in_compressed += table[i].comp_bytes;
- }
-}
-
-static void
-PrintDeltaStats (struct ReqStats *table,
- int count,
- char **reqNames)
-
-{
- int i;
-
- for (i = 0; i < count; i++)
- {
- if (table[i].delta_count && reqNames[i])
- fprintf (stderr, "%-25s\t%d\t%d\t%d\n",
- reqNames[i],
- table[i].delta_count,
- table[i].pre_delta_bytes,
- table[i].post_delta_bytes);
- }
-}
-
-
-static void
-LbxPrintReqStats (int dummy)
-
-{
- unsigned long total;
-
- check_sum_in_plain = 0;
- check_sum_in_compressed = 0;
-
- fprintf (stderr, "\n\n");
- fprintf (stderr, "Core X requests\n\n");
- PrintStatsTable (CoreRequestStats, 128, X_ReqNames);
-
- fprintf (stderr, "\n\n");
- fprintf (stderr, "LBX requests\n\n");
- PrintStatsTable (LbxRequestStats, LbxNumberReqs, LBX_ReqNames);
-
- fprintf (stderr, "\n\n\n");
-
- fprintf (stderr, "The following requests were delta compressed:\n");
- fprintf (stderr, "\n");
- fprintf (stderr, "Pre = pre delta bytes\n");
- fprintf (stderr, "Post = post delta bytes\n");
- fprintf (stderr, "\n");
- fprintf (stderr, "%-25s\tCount\tPre\tPost\n", "Request");
- fprintf (stderr, "-------------------------------------------------------------------------------\n");
- PrintDeltaStats (CoreRequestStats, 128, X_ReqNames);
- PrintDeltaStats (LbxRequestStats, LbxNumberReqs, LBX_ReqNames);
-
- fprintf (stderr, "\n\n\n");
-
- fprintf (stderr, "overall stream compression = %f %%\n",
- (check_sum_in_plain == 0) ? 0.0 :
- (100.0 * (1.0 - ((float) check_sum_in_compressed /
- (float) check_sum_in_plain))));
-
- fprintf (stderr, "\n\n\n");
-
- total = check_sum_in_plain + unknown_extension_bytes +
- stream_in_uncompressed_bytes;
-
- if (total == stream_in_plain)
- fprintf (stderr, "Internal checksum succeeded!!!\n");
- else
- {
- fprintf (stderr, "Internal checksum failed!!!\n");
- fprintf (stderr, "actual checksum = %d\n", stream_in_plain);
- fprintf (stderr, "computed checksum = %d\n", total);
- }
-
- fprintf (stderr, "\n\n");
-}
-
-
-void
-do_decompress_with_stats (struct compress_private *priv)
-
-{
- int incount = priv->cp_inputbufend - priv->cp_inputbuf;
-
- priv->stream.next_in = priv->cp_inputbuf;
- priv->stream.next_out = priv->cp_outputbuf;
- priv->stream.avail_out = priv->cp_outputbufend - priv->cp_outputbuf;
-
- while (incount > 0)
- {
- char *save_out = (char *) priv->stream.next_out;
- int outcount, outconsumed;
-
- priv->stream.avail_in = 1;
- priv->z_err = inflate (&(priv->stream), Z_NO_FLUSH);
-
- priv->need_flush_decompress = (priv->stream.avail_out == 0 );
-
- priv->req_compbytes_read++;
-
- outcount = (char *) priv->stream.next_out - save_out;
-
- priv->req_uncompbytes_read += outcount;
-
- while (outcount > 0)
- {
- if (priv->req_length == -1 && priv->x_header_bytes_read < 4)
- {
- int have = MIN (outcount, (4 - priv->x_header_bytes_read));
- memcpy (priv->x_header_buf + priv->x_header_bytes_read,
- save_out, have);
- priv->x_header_bytes_read += have;
-
- if (priv->x_header_bytes_read < 4 && ((outcount - have) == 0))
- break;
- }
-
- if (priv->req_length == -1 && priv->x_header_bytes_read == 4)
- {
- xReq *req = (xReq *) priv->x_header_buf;
-
- priv->req_length = req->length << 2;
- priv->x_req_code = req->reqType;
-
- if (priv->x_req_code == LBX_CODE)
- priv->lbx_req_code = req->data;
- }
-
- if (priv->req_length != -1)
- {
- if (priv->req_uncompbytes_read < priv->req_length)
- break;
- else
- {
- if (priv->x_req_code == LBX_CODE)
- {
- struct ReqStats *reqStat =
- &LbxRequestStats[priv->lbx_req_code];
-
- reqStat->count++;
- reqStat->comp_bytes += priv->req_compbytes_read;
- reqStat->uncomp_bytes += priv->req_length;
-
-#ifdef LBXREQLOG
- fprintf (stderr,
- "LBX opcode = %d, real len = %d, comp len = %d\n",
- priv->lbx_req_code, priv->req_length,
- priv->req_compbytes_read);
-#endif
- }
- else if (priv->x_req_code < 128)
- {
- struct ReqStats *reqStat =
- &CoreRequestStats[priv->x_req_code];
-
- reqStat->count++;
- reqStat->comp_bytes += priv->req_compbytes_read;
- reqStat->uncomp_bytes += priv->req_length;
-
-#ifdef LBXREQLOG
- fprintf (stderr,
- "X opcode = %d, real len = %d, comp len = %d\n",
- priv->x_req_code, priv->req_length,
- priv->req_compbytes_read);
-#endif
- }
- else
- {
-#ifdef LBXREQLOG
- fprintf (stderr,
- "Unknown opcode = %d, real len = %d, comp len = %d\n",
- priv->x_req_code, priv->req_length,
- priv->req_compbytes_read);
-#endif
- unknown_extension_bytes += priv->req_length;
- }
-
- priv->req_uncompbytes_read -= priv->req_length;
-
- if (priv->req_uncompbytes_read > 0)
- {
- priv->req_compbytes_read = 1;
- save_out += (outcount - priv->req_uncompbytes_read);
- outcount = priv->req_uncompbytes_read;
- }
- else
- {
- priv->req_compbytes_read = 0;
- outcount = 0;
- }
-
- priv->req_length = -1;
- priv->x_header_bytes_read = 0;
- }
- }
- }
-
- incount--;
-
- if (priv->stream.avail_out == 0)
- break;
- }
-
- priv->cp_inputbuf = priv->stream.next_in;
- priv->cp_outputbuf = priv->stream.next_out;
-}
-
-#else
-
-void
-InitLbxReqStats()
-{}
-
-#endif /* LBXREQSTATS */
diff --git a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h b/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h
deleted file mode 100644
index eab64e94e..000000000
--- a/nx-X11/lib/lbxutil/lbx_zlib/reqstats.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* $Xorg: reqstats.h,v 1.4 2001/02/09 02:04:05 xorgcvs Exp $ */
-
-/*
-
-Copyright 1996 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall
-not be used in advertising or otherwise to promote the sale, use or
-other dealings in this Software without prior written authorization
-from The Open Group.
-
-*/
-/* $XFree86: xc/lib/lbxutil/lbx_zlib/reqstats.h,v 1.2 2001/08/27 19:01:07 dawes Exp $ */
-
-#ifdef LBXREQSTATS
-struct ReqStats {
- int count;
- unsigned long comp_bytes;
- unsigned long uncomp_bytes;
- int delta_count;
- unsigned long pre_delta_bytes;
- unsigned long post_delta_bytes;
-};
-#endif
-
-extern void InitLbxReqStats(void);