summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1999-02-14 19:47:38 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1999-02-14 19:47:38 +0000
commit0bc96222c206ba8dbc13dd4c549a56e44bbbe2a6 (patch)
treee2dc73aba88b04dd68f34ce4bdc938b343d2d2c2
parentf1605e823982b5ad049c62d5be3b338e00cef171 (diff)
fix -DDEBUG case, ie remove L-user-and stuff such as fprintf and stderr.
another obvious fix would be porting stdio file functions into stand library, so code would go smooth from -lz, but former seems to be a minimal-change-compliant approach.
-rw-r--r--sys/lib/libz/infblock.c27
-rw-r--r--sys/lib/libz/infcodes.c12
-rw-r--r--sys/lib/libz/inffast.c10
-rw-r--r--sys/lib/libz/inflate.c10
-rw-r--r--sys/lib/libz/zutil.h13
5 files changed, 34 insertions, 38 deletions
diff --git a/sys/lib/libz/infblock.c b/sys/lib/libz/infblock.c
index f4920faa5ea..d3d3bb8e347 100644
--- a/sys/lib/libz/infblock.c
+++ b/sys/lib/libz/infblock.c
@@ -82,7 +82,7 @@ uLongf *c;
s->read = s->write = s->window;
if (s->checkfn != Z_NULL)
z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0);
- Tracev((stderr, "inflate: blocks reset\n"));
+ Tracev(("inflate: blocks reset\n"));
}
@@ -111,7 +111,7 @@ uInt w;
s->end = s->window + w;
s->checkfn = c;
s->mode = TYPE;
- Tracev((stderr, "inflate: blocks allocated\n"));
+ Tracev(("inflate: blocks allocated\n"));
inflate_blocks_reset(s, z, Z_NULL);
return s;
}
@@ -143,16 +143,14 @@ int r;
switch (t >> 1)
{
case 0: /* stored */
- Tracev((stderr, "inflate: stored block%s\n",
- s->last ? " (last)" : ""));
+ Tracev(("inflate: stored block%s\n", s->last ? " (last)" : ""));
DUMPBITS(3)
t = k & 7; /* go to byte boundary */
DUMPBITS(t)
s->mode = LENS; /* get length of stored block */
break;
case 1: /* fixed */
- Tracev((stderr, "inflate: fixed codes block%s\n",
- s->last ? " (last)" : ""));
+ Tracev(("inflate: fixed codes block%s\n", s->last?" (last)":""));
{
uInt bl, bd;
inflate_huft *tl, *td;
@@ -169,8 +167,7 @@ int r;
s->mode = CODES;
break;
case 2: /* dynamic */
- Tracev((stderr, "inflate: dynamic codes block%s\n",
- s->last ? " (last)" : ""));
+ Tracev(("inflate: dynamic codes block%s\n", s->last?" (last)":""));
DUMPBITS(3)
s->mode = TABLE;
break;
@@ -193,7 +190,7 @@ int r;
}
s->sub.left = (uInt)b & 0xffff;
b = k = 0; /* dump bits */
- Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
+ Tracev(("inflate: stored length %u\n", s->sub.left));
s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
break;
case STORED:
@@ -208,7 +205,7 @@ int r;
q += t; m -= t;
if ((s->sub.left -= t) != 0)
break;
- Tracev((stderr, "inflate: stored end, %lu total out\n",
+ Tracev(("inflate: stored end, %lu total out\n",
z->total_out + (q >= s->read ? q - s->read :
(s->end - s->read) + (q - s->window))));
s->mode = s->last ? DRY : TYPE;
@@ -233,7 +230,7 @@ int r;
}
DUMPBITS(14)
s->sub.trees.index = 0;
- Tracev((stderr, "inflate: table sizes ok\n"));
+ Tracev(("inflate: table sizes ok\n"));
s->mode = BTREE;
case BTREE:
while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
@@ -256,7 +253,7 @@ int r;
LEAVE
}
s->sub.trees.index = 0;
- Tracev((stderr, "inflate: bits tree ok\n"));
+ Tracev(("inflate: bits tree ok\n"));
s->mode = DTREE;
case DTREE:
while (t = s->sub.trees.table,
@@ -321,7 +318,7 @@ int r;
r = t;
LEAVE
}
- Tracev((stderr, "inflate: trees ok\n"));
+ Tracev(("inflate: trees ok\n"));
if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL)
{
r = Z_MEM_ERROR;
@@ -337,7 +334,7 @@ int r;
r = Z_OK;
inflate_codes_free(s->sub.decode.codes, z);
LOAD
- Tracev((stderr, "inflate: codes end, %lu total out\n",
+ Tracev(("inflate: codes end, %lu total out\n",
z->total_out + (q >= s->read ? q - s->read :
(s->end - s->read) + (q - s->window))));
if (!s->last)
@@ -372,7 +369,7 @@ z_streamp z;
ZFREE(z, s->window);
ZFREE(z, s->hufts);
ZFREE(z, s);
- Tracev((stderr, "inflate: blocks freed\n"));
+ Tracev(("inflate: blocks freed\n"));
return Z_OK;
}
diff --git a/sys/lib/libz/infcodes.c b/sys/lib/libz/infcodes.c
index d4e5ee9a554..b472fba3226 100644
--- a/sys/lib/libz/infcodes.c
+++ b/sys/lib/libz/infcodes.c
@@ -72,7 +72,7 @@ z_streamp z;
c->dbits = (Byte)bd;
c->ltree = tl;
c->dtree = td;
- Tracev((stderr, "inflate: codes new\n"));
+ Tracev(("inflate: codes new\n"));
}
return c;
}
@@ -127,7 +127,7 @@ int r;
if (e == 0) /* literal */
{
c->sub.lit = t->base;
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ Tracevv((t->base >= 0x20 && t->base < 0x7f ?
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", t->base));
c->mode = LIT;
@@ -148,7 +148,7 @@ int r;
}
if (e & 32) /* end of block */
{
- Tracevv((stderr, "inflate: end of block\n"));
+ Tracevv(("inflate: end of block\n"));
c->mode = WASH;
break;
}
@@ -163,7 +163,7 @@ int r;
DUMPBITS(j)
c->sub.code.need = c->dbits;
c->sub.code.tree = c->dtree;
- Tracevv((stderr, "inflate: length %u\n", c->len));
+ Tracevv(("inflate: length %u\n", c->len));
c->mode = DIST;
case DIST: /* i: get distance next */
j = c->sub.code.need;
@@ -193,7 +193,7 @@ int r;
NEEDBITS(j)
c->sub.copy.dist += (uInt)b & inflate_mask[j];
DUMPBITS(j)
- Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
+ Tracevv(("inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */
@@ -253,5 +253,5 @@ inflate_codes_statef *c;
z_streamp z;
{
ZFREE(z, c);
- Tracev((stderr, "inflate: codes free\n"));
+ Tracev(("inflate: codes free\n"));
}
diff --git a/sys/lib/libz/inffast.c b/sys/lib/libz/inffast.c
index 61a78ee933f..72228af9184 100644
--- a/sys/lib/libz/inffast.c
+++ b/sys/lib/libz/inffast.c
@@ -60,7 +60,7 @@ z_streamp z;
if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
{
DUMPBITS(t->bits)
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ Tracevv((t->base >= 0x20 && t->base < 0x7f ?
"inflate: * literal '%c'\n" :
"inflate: * literal 0x%02x\n", t->base));
*q++ = (Byte)t->base;
@@ -75,7 +75,7 @@ z_streamp z;
e &= 15;
c = t->base + ((uInt)b & inflate_mask[e]);
DUMPBITS(e)
- Tracevv((stderr, "inflate: * length %u\n", c));
+ Tracevv(("inflate: * length %u\n", c));
/* decode distance base of block to copy */
GRABBITS(15); /* max bits for distance code */
@@ -89,7 +89,7 @@ z_streamp z;
GRABBITS(e) /* get extra bits (up to 13) */
d = t->base + ((uInt)b & inflate_mask[e]);
DUMPBITS(e)
- Tracevv((stderr, "inflate: * distance %u\n", d));
+ Tracevv(("inflate: * distance %u\n", d));
/* do the copy */
m -= c;
@@ -138,7 +138,7 @@ z_streamp z;
if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0)
{
DUMPBITS(t->bits)
- Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
+ Tracevv((t->base >= 0x20 && t->base < 0x7f ?
"inflate: * literal '%c'\n" :
"inflate: * literal 0x%02x\n", t->base));
*q++ = (Byte)t->base;
@@ -148,7 +148,7 @@ z_streamp z;
}
else if (e & 32)
{
- Tracevv((stderr, "inflate: * end of block\n"));
+ Tracevv(("inflate: * end of block\n"));
UNGRAB
UPDATE
return Z_STREAM_END;
diff --git a/sys/lib/libz/inflate.c b/sys/lib/libz/inflate.c
index 32e9b8de679..cb1804452fd 100644
--- a/sys/lib/libz/inflate.c
+++ b/sys/lib/libz/inflate.c
@@ -59,7 +59,7 @@ z_streamp z;
z->msg = Z_NULL;
z->state->mode = z->state->nowrap ? BLOCKS : METHOD;
inflate_blocks_reset(z->state->blocks, z, Z_NULL);
- Tracev((stderr, "inflate: reset\n"));
+ Tracev(("inflate: reset\n"));
return Z_OK;
}
@@ -73,7 +73,7 @@ z_streamp z;
inflate_blocks_free(z->state->blocks, z);
ZFREE(z, z->state);
z->state = Z_NULL;
- Tracev((stderr, "inflate: end\n"));
+ Tracev(("inflate: end\n"));
return Z_OK;
}
@@ -127,7 +127,7 @@ int stream_size;
inflateEnd(z);
return Z_MEM_ERROR;
}
- Tracev((stderr, "inflate: allocated\n"));
+ Tracev(("inflate: allocated\n"));
/* reset state */
inflateReset(z);
@@ -187,7 +187,7 @@ int f;
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
- Tracev((stderr, "inflate: zlib header ok\n"));
+ Tracev(("inflate: zlib header ok\n"));
if (!(b & PRESET_DICT))
{
z->state->mode = BLOCKS;
@@ -260,7 +260,7 @@ int f;
z->state->sub.marker = 5; /* can't try inflateSync */
break;
}
- Tracev((stderr, "inflate: zlib check ok\n"));
+ Tracev(("inflate: zlib check ok\n"));
z->state->mode = DONE;
case DONE:
return Z_STREAM_END;
diff --git a/sys/lib/libz/zutil.h b/sys/lib/libz/zutil.h
index c63543f7116..af4c9c3db3c 100644
--- a/sys/lib/libz/zutil.h
+++ b/sys/lib/libz/zutil.h
@@ -8,7 +8,7 @@
subject to change. Applications should only use zlib.h.
*/
-/* @(#) $Id: zutil.h,v 1.7 1998/09/08 04:07:49 millert Exp $ */
+/* @(#) $Id: zutil.h,v 1.8 1999/02/14 19:47:37 mickey Exp $ */
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
@@ -192,15 +192,14 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
/* Diagnostic functions */
#ifdef DEBUG
-# include <stdio.h>
extern int z_verbose;
extern void z_error OF((char *m));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
-# define Trace(x) {if (z_verbose>=0) fprintf x ;}
-# define Tracev(x) {if (z_verbose>0) fprintf x ;}
-# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
-# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
-# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
+# define Trace(x) {if (z_verbose>=0) printf x ;}
+# define Tracev(x) {if (z_verbose>0) printf x ;}
+# define Tracevv(x) {if (z_verbose>1) printf x ;}
+# define Tracec(c,x) {if (z_verbose>0 && (c)) printf x ;}
+# define Tracecv(c,x) {if (z_verbose>1 && (c)) printf x ;}
#else
# define Assert(cond,msg)
# define Trace(x)