From 0d5fc770d339f261b4d6c779bb4bc87a61f404b6 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Sun, 23 Jul 2006 15:19:20 +0000 Subject: [PATCH] Output some debug messages only if DEBUG_ZIP is #define'd. --- src/ngircd/conn-zip.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/ngircd/conn-zip.c b/src/ngircd/conn-zip.c index ad397e00..2421e107 100644 --- a/src/ngircd/conn-zip.c +++ b/src/ngircd/conn-zip.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) + * Copyright (c)2001-2006 Alexander Barton (alex@barton.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,10 @@ #ifdef ZLIB -static char UNUSED id[] = "$Id: conn-zip.c,v 1.10 2006/05/10 21:24:01 alex Exp $"; +/* enable more zlib related debug messages: */ +/* #define DEBUG_ZLIB */ + +static char UNUSED id[] = "$Id: conn-zip.c,v 1.11 2006/07/23 15:19:20 alex Exp $"; #include "imp.h" #include @@ -124,7 +127,10 @@ Zip_Flush( CONN_ID Idx ) out->next_out = zipbuf; out->avail_out = (uInt)sizeof zipbuf; - Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d", out->avail_in, out->avail_out); +#ifdef DEBUG_ZIP + Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d", + out->avail_in, out->avail_out); +#endif result = deflate( out, Z_SYNC_FLUSH ); if(( result != Z_OK ) || ( out->avail_in > 0 )) { @@ -135,7 +141,9 @@ Zip_Flush( CONN_ID Idx ) assert(out->avail_out <= WRITEBUFFER_LEN); zipbuf_used = WRITEBUFFER_LEN - out->avail_out; +#ifdef DEBUG_ZIP Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used); +#endif if (!array_catb(&My_Connections[Idx].wbuf, (char *)zipbuf, (size_t) zipbuf_used)) return false; @@ -179,7 +187,10 @@ Unzip_Buffer( CONN_ID Idx ) in->next_out = unzipbuf; in->avail_out = (uInt)sizeof unzipbuf; - Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d", in->avail_in, in->avail_out); +#ifdef DEBUG_ZIP + Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d", + in->avail_in, in->avail_out); +#endif result = inflate( in, Z_SYNC_FLUSH ); if( result != Z_OK ) { @@ -191,7 +202,10 @@ Unzip_Buffer( CONN_ID Idx ) assert(z_rdatalen >= in->avail_in); in_len = z_rdatalen - in->avail_in; unzipbuf_used = READBUFFER_LEN - in->avail_out; - Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN, in->avail_out, unzipbuf_used); +#ifdef DEBUG_ZIP + Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN, + in->avail_out, unzipbuf_used); +#endif assert(unzipbuf_used <= READBUFFER_LEN); if (!array_catb(&My_Connections[Idx].rbuf, (char*) unzipbuf, (size_t)unzipbuf_used)) -- 2.39.2