remove debugging in lzsc & lzsd

This commit is contained in:
Olaf Rempel 2007-05-01 20:52:27 +02:00
parent 5ed8c00d27
commit 62cab3ec68
2 changed files with 11 additions and 11 deletions

16
lzsc.c
View File

@ -49,14 +49,14 @@ static int put_bits(struct lzs_state *state, uint32_t bits, uint32_t len)
/* TODO: check dstsize */
static int put_literal_byte(struct lzs_state *state, uint8_t byte)
{
printf(" put_literal_byte: 0x%02x\n", byte);
// printf(" put_literal_byte: 0x%02x\n", byte);
return put_bits(state, (0 << 8) | byte, 1+8);
}
/* TODO: check dstsize */
static int put_compressed_string(struct lzs_state *state, uint32_t offset, uint32_t len)
{
printf(" put_compressed_string: offset=0x%03x len=0x%03x\n", offset, len);
// printf(" put_compressed_string: offset=0x%03x len=0x%03x\n", offset, len);
if (offset > 0x7ff || len > 0x800)
printf(" ERROR\n");
@ -113,7 +113,7 @@ static int put_blockend(struct lzs_state *state)
if (state->bitcnt)
put_bits(state, 0, 8 - state->bitcnt);
printf(" =============== BLOCK END =============== \n");
// printf(" =============== BLOCK END =============== \n");
return 0;
}
@ -125,7 +125,7 @@ static int put_zyxel_header(struct lzs_state *state)
/* remove own header size */
lenc -= 4;
printf("header of previous block: 0x%04x%04x\n", len, lenc);
// printf("header of previous block: 0x%04x%04x\n", len, lenc);
uint8_t *p = state->dstblkstart;
p[0] = (len >> 8) & 0xFF;
@ -234,8 +234,8 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
int key = hash_key_calc(state.src);
int maxlen = MIN(state.srcblkstart + 2048, srcbuf + srcsize) - state.src;
printf("searching for 0x%02x%02x abs=0x%04x key=0x%02x maxlen=%d\n",
state.src[0], state.src[1], state.src - srcbuf, key, maxlen);
// printf("searching for 0x%02x%02x abs=0x%04x key=0x%02x maxlen=%d\n",
// state.src[0], state.src[1], state.src - srcbuf, key, maxlen);
int bestmatchlen = 0;
struct lzs_hash_entry *search, *tmp, *bestmatch = NULL;
@ -249,7 +249,7 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
/* get length of match (min. 2, 0 if collision) */
int matchlen = getMatchLen(search->pos, state.src, maxlen);
printf(" testing pos=0x%03x has 0x%02x matching bytes\n", (state.src - search->pos), matchlen);
// printf(" testing pos=0x%03x has 0x%02x matching bytes\n", (state.src - search->pos), matchlen);
if (matchlen > bestmatchlen) {
bestmatchlen = matchlen;
@ -259,7 +259,7 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
/* found something? */
if (bestmatch != NULL) {
printf(" selected pos=0x%03x with 0x%02x matching bytes\n", (state.src - bestmatch->pos), bestmatchlen);
// printf(" selected pos=0x%03x with 0x%02x matching bytes\n", (state.src - bestmatch->pos), bestmatchlen);
put_compressed_string(&state, state.src - bestmatch->pos, bestmatchlen);
/* add bytes to history hash */
while (bestmatchlen--)

6
lzsd.c
View File

@ -88,7 +88,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
/* Uncompressed byte */
if (tag == 0) {
*(state.dst)++ = get_bits(&state, 8);
printf("uncompressed byte: 0x%02x\n", *(state.dst -1));
// printf("uncompressed byte: 0x%02x\n", *(state.dst -1));
/* Compressed string */
} else {
@ -102,7 +102,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
uint32_t cnt = state.bitcnt;
uint32_t tmp = get_bits(&state, cnt);
printf("=== BLOCK END (align=%d bits=0x%x) === \n", cnt, tmp);
// printf("=== BLOCK END (align=%d bits=0x%x) === \n", cnt, tmp);
get_zyxel_header(&state);
state.srcblkstart = state.src;
state.dstblkstart = state.dst;
@ -122,7 +122,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
}
uint32_t len = get_len(&state);
printf("compressed string, offset(%d)=0x%03x len=0x%04x\n", tag, offset, len);
// printf("compressed string, offset(%d)=0x%03x len=0x%04x\n", tag, offset, len);
while (len--)
*(state.dst)++ = *dict++;