Annotations, pass 0.

CVS patchset: 5205
CVS date: 2001/11/21 22:01:55
This commit is contained in:
jbj 2001-11-21 22:01:55 +00:00
parent 2b8138a6fe
commit d77eeb993d
8 changed files with 96 additions and 67 deletions

View File

@ -1,7 +1,8 @@
-I. -I.. -I../build -I../rpmdb -I../rpmio -I../beecrypt -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE
-I. -DHAVE_CONFIG_H -D_GNU_SOURCE
+partial
#+forcehints
+forcehints
-warnunixlib
-warnposix
@ -14,39 +15,32 @@
-includenest 16 # getting deep, sigh
# --- not yet
#-loopswitchbreak
#-casebreak
#-switchswitchbreak
#-looploopbreak
#-looploopcontinue
#-unreachable
-oldstyle # painful
-retvalint # painful
-nullret
-retalias
-modunconnomods
-noeffectuncon
-evalorderuncon
-infloopsuncon
-modobserveruncon
-modnomods
-noparams
-oldstyle
-castfcnptr
-sizeoftype
-modunconnomods
-retvalint
-modnomods
-globs
-statictrans
-retalias
-globstate
-redef
-nullret
-nullpass
-unqualifiedtrans
-internalglobs
-modfilesys
-compdef
-abstract
-dependenttrans
-noeffectuncon
-branchstate
-compmempass
-whileempty
-infloopsuncon
-formatconst
-observertrans
-readonlytrans
-nullstate
@ -55,18 +49,12 @@
-usereleased
-staticinittrans
-nullassign
-evalorderuncon
-immediatetrans
-evalorder
-type
-unsignedcompare
-nullderef
-exportheader
-modobserveruncon
-sysunrecog
-unrecog
-retvalother
-nullptrarith
-noeffect

View File

@ -3,7 +3,7 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id: crc32.c,v 1.1.1.1 2001/11/21 19:43:12 jbj Exp $ */
/* @(#) $Id: crc32.c,v 1.2 2001/11/21 20:47:36 jbj Exp $ */
#include "zlib.h"
@ -136,12 +136,16 @@ const uLongf * ZEXPORT get_crc_table()
uLong partial_crc32_copy(uLong crc, const Bytef *buf, uInt len, Bytef *dst)
{
/*@-sysunrecog@*/
return __partial_crc32(crc, buf, len, 1, dst);
/*@=sysunrecog@*/
}
extern uLong partial_crc32(uLong crc, const Bytef *buf, uInt len)
{
/*@-sysunrecog@*/
return __partial_crc32(crc, buf, len, 0, 0);
/*@=sysunrecog@*/
}
uLong ZEXPORT crc32(crc, buf, len)
@ -150,7 +154,9 @@ uLong ZEXPORT crc32(crc, buf, len)
uInt len;
{
if (buf != Z_NULL)
/*@-sysunrecog@*/
return __partial_crc32(crc ^ 0xffffffffL, buf, len, 0, 0) ^ 0xffffffffL;
/*@=sysunrecog@*/
return 0L;
}

View File

@ -5,7 +5,7 @@
* Compile this file with -DNO_DEFLATE to avoid the compression code.
*/
/* @(#) $Id: gzio.c,v 1.1.1.1 2001/11/21 19:43:12 jbj Exp $ */
/* @(#) $Id: gzio.c,v 1.2 2001/11/21 20:47:36 jbj Exp $ */
#include <sys/stat.h>
#include <unistd.h>
@ -106,8 +106,10 @@ local gzFile gz_open (path, mode, fd)
s->file = NULL;
s->z_err = Z_OK;
s->z_eof = 0;
/*@-unrecog@*/
s->stream.crc = /*crc32(0L, Z_NULL, 0)*/0;
partial_crc32_prep(&s->stream.crc);
/*@=unrecog@*/
s->msg = NULL;
s->transparent = 0;
s->mmap_mode = 0;
@ -177,7 +179,7 @@ local gzFile gz_open (path, mode, fd)
munmap(test, Z_BUFSIZE);
pos = lseek(fd, 0, SEEK_CUR);
s->mmap_end = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
(void) lseek(fd, 0, SEEK_SET);
s->mmap_pos = pos & ~(off_t)(Z_BUFSIZE - 1);
s->inbuf = mmap(0, Z_BUFSIZE, PROT_READ, MAP_SHARED, fd, s->mmap_pos);
@ -193,7 +195,9 @@ local gzFile gz_open (path, mode, fd)
}
if (!s->mmap_mode) {
/*@-abstract@*/
s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
/*@=abstract@*/
if (s->file == NULL) {
return destroy(s), (gzFile)Z_NULL;
@ -373,13 +377,13 @@ local void check_header(s)
len = (uInt)get_byte(s);
len += ((uInt)get_byte(s))<<8;
/* len is garbage if EOF but the loop below will quit anyway */
while (len-- != 0 && get_byte(s) != EOF) ;
while (len-- != 0 && get_byte(s) != EOF) {};
}
if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
while ((c = get_byte(s)) != 0 && c != EOF) ;
while ((c = get_byte(s)) != 0 && c != EOF) {};
}
if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
while ((c = get_byte(s)) != 0 && c != EOF) ;
while ((c = get_byte(s)) != 0 && c != EOF) {};
}
if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
for (len = 0; len < 2; len++) (void)get_byte(s);
@ -494,6 +498,7 @@ again:
/* Check CRC and original size */
start = s->stream.next_out;
/*@-unrecog@*/
if (getLong(s) != get_crc_from_partial(&s->stream.crc)) {
s->z_err = Z_DATA_ERROR;
} else {
@ -514,6 +519,7 @@ again:
partial_crc32_prep(&s->stream.crc);
}
}
/*@=unrecog@*/
}
if (s->z_err != Z_OK || s->z_eof) break;
}
@ -552,7 +558,7 @@ char * ZEXPORT gzgets(file, buf, len)
char *b = buf;
if (buf == Z_NULL || len <= 0) return Z_NULL;
while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') {};
*buf = '\0';
return b == buf && len > 0 ? Z_NULL : b;
}
@ -632,6 +638,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
char buf[Z_PRINTF_BUFSIZE];
int len;
/*@-formatconst@*/
#ifdef HAS_snprintf
snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
@ -639,6 +646,7 @@ int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#endif
/*@=formatconst@*/
len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
if (len <= 0) return 0;

View File

@ -153,7 +153,7 @@ int r;
t = k & 7; /* go to byte boundary */
DUMPBITS(t)
s->mode = LENS; /* get length of stored block */
break;
/*@innerbreak@*/ break;
case 1: /* fixed */
Tracev((stderr, "inflate: fixed codes block%s\n",
s->last ? " (last)" : ""));
@ -171,13 +171,13 @@ int r;
}
DUMPBITS(3)
s->mode = CODES;
break;
/*@innerbreak@*/ break;
case 2: /* dynamic */
Tracev((stderr, "inflate: dynamic codes block%s\n",
s->last ? " (last)" : ""));
DUMPBITS(3)
s->mode = TABLE;
break;
/*@innerbreak@*/ break;
case 3: /* illegal */
DUMPBITS(3)
s->mode = BAD;
@ -185,7 +185,7 @@ int r;
r = Z_DATA_ERROR;
goto leave;
}
break;
/*@switchbreak@*/ break;
case LENS:
NEEDBITS(32)
if ((((~b) >> 16) & 0xffff) != (b & 0xffff))
@ -199,7 +199,7 @@ int r;
b = k = 0; /* dump bits */
Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE);
break;
/*@switchbreak@*/ break;
case STORED:
if (n == 0)
goto leave;
@ -211,12 +211,12 @@ int r;
p += t; n -= t;
q += t; m -= t;
if ((s->sub.left -= t) != 0)
break;
/*@switchbreak@*/ break;
Tracev((stderr, "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;
break;
/*@switchbreak@*/ break;
case TABLE:
NEEDBITS(14)
s->sub.trees.table = t = (uInt)b & 0x3fff;
@ -239,6 +239,7 @@ int r;
s->sub.trees.index = 0;
Tracev((stderr, "inflate: table sizes ok\n"));
s->mode = BTREE;
/*@fallthrough@*/
case BTREE:
while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
{
@ -262,6 +263,7 @@ int r;
s->sub.trees.index = 0;
Tracev((stderr, "inflate: bits tree ok\n"));
s->mode = DTREE;
/*@fallthrough@*/
case DTREE:
while (t = s->sub.trees.table,
s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f))
@ -334,6 +336,7 @@ int r;
s->sub.decode.codes = c;
}
s->mode = CODES;
/*@fallthrough@*/
case CODES:
UPDATE
if ((r = inflate_codes(s, z, r)) != Z_STREAM_END)
@ -347,14 +350,16 @@ int r;
if (!s->last)
{
s->mode = TYPE;
break;
/*@switchbreak@*/ break;
}
s->mode = DRY;
/*@fallthrough@*/
case DRY:
FLUSH
if (s->read != s->write)
goto leave;
s->mode = DONE;
/*@fallthrough@*/
case DONE:
r = Z_STREAM_END;
goto leave;
@ -472,13 +477,14 @@ int r;
if (r != Z_OK)
{
c->mode = r == Z_STREAM_END ? WASH : BADCODE;
break;
/*@switchbreak@*/ break;
}
}
#endif /* !SLOW */
c->sub.code.need = c->lbits;
c->sub.code.tree = c->ltree;
c->mode = LEN;
/*@fallthrough@*/
case LEN: /* i: get length/literal/eob next */
j = c->sub.code.need;
NEEDBITS(j)
@ -492,26 +498,26 @@ int r;
"inflate: literal '%c'\n" :
"inflate: literal 0x%02x\n", t->base));
c->mode = LIT;
break;
/*@switchbreak@*/ break;
}
if (e & 16) /* length */
{
c->sub.copy.get = e & 15;
c->len = t->base;
c->mode = LENEXT;
break;
/*@switchbreak@*/ break;
}
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
c->sub.code.tree = t + t->base;
break;
/*@switchbreak@*/ break;
}
if (e & 32) /* end of block */
{
Tracevv((stderr, "inflate: end of block\n"));
c->mode = WASH;
break;
/*@switchbreak@*/ break;
}
c->mode = BADCODE; /* invalid code */
z->msg = (char*)"invalid literal/length code";
@ -526,6 +532,7 @@ int r;
c->sub.code.tree = c->dtree;
Tracevv((stderr, "inflate: length %u\n", c->len));
c->mode = DIST;
/*@fallthrough@*/
case DIST: /* i: get distance next */
j = c->sub.code.need;
NEEDBITS(j)
@ -537,13 +544,13 @@ int r;
c->sub.copy.get = e & 15;
c->sub.copy.dist = t->base;
c->mode = DISTEXT;
break;
/*@switchbreak@*/ break;
}
if ((e & 64) == 0) /* next table */
{
c->sub.code.need = e;
c->sub.code.tree = t + t->base;
break;
/*@switchbreak@*/ break;
}
c->mode = BADCODE; /* invalid code */
z->msg = (char*)"invalid distance code";
@ -556,6 +563,7 @@ int r;
DUMPBITS(j)
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
/*@fallthrough@*/
case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */
f = (uInt)(q - s->window) < c->sub.copy.dist ?
@ -575,12 +583,12 @@ int r;
c->len--;
}
c->mode = START;
break;
/*@switchbreak@*/ break;
case LIT: /* o: got literal, waiting for output space */
NEEDOUT
OUTBYTE(c->sub.lit)
c->mode = START;
break;
/*@switchbreak@*/ break;
case WASH: /* o: got eob, possibly more output */
if (k > 7) /* return unused byte, if any */
{
@ -593,6 +601,7 @@ int r;
if (s->read != s->write)
goto leave;
c->mode = END;
/*@fallthrough@*/
case END:
r = Z_STREAM_END;
goto leave;

View File

@ -57,8 +57,10 @@ int ret;
/* load input, output, bit values */
LOAD
/*@-unrecog@*/
PREFETCH(p);
PREFETCH(p+32);
/*@=unrecog@*/
/* initialize masks */
ml = inflate_mask[bl];
md = inflate_mask[bd];
@ -66,7 +68,9 @@ int ret;
/* do until not enough input or output space for fast loop */
do { /* assume called with m >= 258 && n >= 10 */
/* get literal/length code */
/*@-unrecog@*/
PREFETCH(p+64);
/*@=unrecog@*/
GRABBITS(20) /* max bits for literal/length code */
if ((e = (t = tl + ((uInt)b & ml))->exop) == 0)
{
@ -103,7 +107,7 @@ int ret;
/* do the copy */
m -= c;
#if 1
#if 1 /* { */
if ((uInt)(q - s->window) >= d) /* offset before dest */
{ /* just copy */
r = q - d;
@ -148,32 +152,34 @@ rest:
do { /* copy all or what's left */
*q++ = *r++;
} while (--c);
#endif
break;
#endif /* } */
/*@innerbreak@*/ break;
}
else if ((e & 64) == 0)
{
t += t->base;
e = (t += ((uInt)b & inflate_mask[e]))->exop;
continue;
/*@innercontinue@*/ continue;
}
else
goto inv_dist_code;
} while (1);
break;
/*@-unreachable@*/
/*@innerbreak@*/ break;
/*@=unreachable@*/
}
if (!(e & 64)) {
t += t->base;
if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) != 0)
continue;
/*@innercontinue@*/ continue;
DUMPBITS(t->bits)
Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ?
"inflate: * literal '%c'\n" :
"inflate: * literal 0x%02x\n", t->base));
*q++ = (Byte)t->base;
m--;
break;
/*@innerbreak@*/ break;
} else
{ uInt temp = e & 96;
if (temp == 96)

View File

@ -168,16 +168,17 @@ int f;
z->state->mode = BAD;
z->msg = (char*)"unknown compression method";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
/*@switchbreak@*/ break;
}
if ((z->state->sub.method >> 4) + 8 > z->state->wbits)
{
z->state->mode = BAD;
z->msg = (char*)"invalid window size";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
/*@switchbreak@*/ break;
}
z->state->mode = FLAG;
/*@fallthrough@*/
case FLAG:
NEEDBYTE
b = NEXTBYTE;
@ -186,27 +187,31 @@ int f;
z->state->mode = BAD;
z->msg = (char*)"incorrect header check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
/*@switchbreak@*/ break;
}
Tracev((stderr, "inflate: zlib header ok\n"));
if (!(b & PRESET_DICT))
{
z->state->mode = BLOCKS;
break;
/*@switchbreak@*/ break;
}
z->state->mode = DICT4;
/*@fallthrough@*/
case DICT4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = DICT3;
/*@fallthrough@*/
case DICT3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = DICT2;
/*@fallthrough@*/
case DICT2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = DICT1;
/*@fallthrough@*/
case DICT1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
@ -224,7 +229,7 @@ int f;
{
z->state->mode = BAD;
z->state->sub.marker = 0; /* can try inflateSync */
break;
/*@switchbreak@*/ break;
}
if (r == Z_OK)
r = f;
@ -235,21 +240,25 @@ int f;
if (z->state->nowrap)
{
z->state->mode = DONE;
break;
/*@switchbreak@*/ break;
}
z->state->mode = CHECK4;
/*@fallthrough@*/
case CHECK4:
NEEDBYTE
z->state->sub.check.need = (uLong)NEXTBYTE << 24;
z->state->mode = CHECK3;
/*@fallthrough@*/
case CHECK3:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 16;
z->state->mode = CHECK2;
/*@fallthrough@*/
case CHECK2:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE << 8;
z->state->mode = CHECK1;
/*@fallthrough@*/
case CHECK1:
NEEDBYTE
z->state->sub.check.need += (uLong)NEXTBYTE;
@ -259,10 +268,11 @@ int f;
z->state->mode = BAD;
z->msg = (char*)"incorrect data check";
z->state->sub.marker = 5; /* can't try inflateSync */
break;
/*@switchbreak@*/ break;
}
Tracev((stderr, "inflate: zlib check ok\n"));
z->state->mode = DONE;
/*@fallthrough@*/
case DONE:
return Z_STREAM_END;
case BAD:

View File

@ -223,7 +223,7 @@ uIntf *v; /* working area: values in order of bit length */
while (++j < z) /* try smaller tables up to z bits */
{
if ((f <<= 1) <= *++xp)
break; /* enough codes to use up j bits */
/*@innerbreak@*/ break; /* enough codes to use up j bits */
f -= *xp; /* else deduct codes from patterns */
}
}

View File

@ -29,7 +29,7 @@
* Addison-Wesley, 1983. ISBN 0-201-06672-6.
*/
/* @(#) $Id$ */
/* @(#) $Id: trees.c,v 1.1.1.1 2001/11/21 19:43:12 jbj Exp $ */
/* #define GEN_TREES_H */
@ -555,7 +555,7 @@ local void gen_bitlen(s, desc)
n = s->bl_count[bits];
while (n != 0) {
m = s->heap[--h];
if (m > max_code) continue;
if (m > max_code) /*@innercontinue@*/ continue;
if (tree[m].Len != (unsigned) bits) {
Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
s->opt_len += ((long)bits - (long)tree[m].Len)
@ -676,7 +676,9 @@ local void build_tree(s, desc)
/* Create a new node father of n and m */
tree[node].Freq = tree[n].Freq + tree[m].Freq;
s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1);
/*@-evalorder@*/
tree[n].Dad = tree[m].Dad = (ush)node;
/*@=evalorder@*/
#ifdef DUMP_BL_TREE
if (tree == s->bl_tree) {
fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",