Browse Source

remove debugging in lzsc & lzsd

Olaf Rempel 11 years ago
parent
commit
62cab3ec68
2 changed files with 11 additions and 11 deletions
  1. 8
    8
      lzsc.c
  2. 3
    3
      lzsd.c

+ 8
- 8
lzsc.c View File

@@ -49,14 +49,14 @@ static int put_bits(struct lzs_state *state, uint32_t bits, uint32_t len)
49 49
 /* TODO: check dstsize */
50 50
 static int put_literal_byte(struct lzs_state *state, uint8_t byte)
51 51
 {
52
-	printf("    put_literal_byte: 0x%02x\n", byte);
52
+//	printf("    put_literal_byte: 0x%02x\n", byte);
53 53
 	return put_bits(state, (0 << 8) | byte, 1+8);
54 54
 }
55 55
 
56 56
 /* TODO: check dstsize */
57 57
 static int put_compressed_string(struct lzs_state *state, uint32_t offset, uint32_t len)
58 58
 {
59
-	printf("    put_compressed_string: offset=0x%03x len=0x%03x\n", offset, len);
59
+//	printf("    put_compressed_string: offset=0x%03x len=0x%03x\n", offset, len);
60 60
 
61 61
 	if (offset > 0x7ff || len > 0x800)
62 62
 		printf("      ERROR\n");
@@ -113,7 +113,7 @@ static int put_blockend(struct lzs_state *state)
113 113
 	if (state->bitcnt)
114 114
 		put_bits(state, 0, 8 - state->bitcnt);
115 115
 
116
-	printf(" =============== BLOCK END =============== \n");
116
+//	printf(" =============== BLOCK END =============== \n");
117 117
 	return 0;
118 118
 }
119 119
 
@@ -125,7 +125,7 @@ static int put_zyxel_header(struct lzs_state *state)
125 125
 	/* remove own header size */
126 126
 	lenc -= 4;
127 127
 
128
-	printf("header of previous block: 0x%04x%04x\n", len, lenc);
128
+//	printf("header of previous block: 0x%04x%04x\n", len, lenc);
129 129
 
130 130
 	uint8_t *p = state->dstblkstart;
131 131
 	p[0] = (len >> 8) & 0xFF;
@@ -234,8 +234,8 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
234 234
 		int key = hash_key_calc(state.src);
235 235
 		int maxlen = MIN(state.srcblkstart + 2048, srcbuf + srcsize) - state.src;
236 236
 
237
-		printf("searching for 0x%02x%02x abs=0x%04x key=0x%02x maxlen=%d\n",
238
-			state.src[0], state.src[1], state.src - srcbuf, key, maxlen);
237
+//		printf("searching for 0x%02x%02x abs=0x%04x key=0x%02x maxlen=%d\n",
238
+//			state.src[0], state.src[1], state.src - srcbuf, key, maxlen);
239 239
 
240 240
 		int bestmatchlen = 0;
241 241
 		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)
249 249
 
250 250
 			/* get length of match (min. 2, 0 if collision) */
251 251
 			int matchlen = getMatchLen(search->pos, state.src, maxlen);
252
-			printf("  testing pos=0x%03x has 0x%02x matching bytes\n", (state.src - search->pos), matchlen);
252
+//			printf("  testing pos=0x%03x has 0x%02x matching bytes\n", (state.src - search->pos), matchlen);
253 253
 
254 254
 			if (matchlen > bestmatchlen) {
255 255
 				bestmatchlen = matchlen;
@@ -259,7 +259,7 @@ int lzs_pack(uint8_t *srcbuf, int srcsize, uint8_t *dstbuf, int dstsize)
259 259
 
260 260
 		/* found something? */
261 261
 		if (bestmatch != NULL) {
262
-			printf("  selected pos=0x%03x with 0x%02x matching bytes\n", (state.src - bestmatch->pos), bestmatchlen);
262
+//			printf("  selected pos=0x%03x with 0x%02x matching bytes\n", (state.src - bestmatch->pos), bestmatchlen);
263 263
 			put_compressed_string(&state, state.src - bestmatch->pos, bestmatchlen);
264 264
 			/* add bytes to history hash */
265 265
 			while (bestmatchlen--)

+ 3
- 3
lzsd.c View File

@@ -88,7 +88,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
88 88
 		/* Uncompressed byte */
89 89
 		if (tag == 0) {
90 90
 			*(state.dst)++ = get_bits(&state, 8);
91
-			printf("uncompressed byte: 0x%02x\n", *(state.dst -1));
91
+//			printf("uncompressed byte: 0x%02x\n", *(state.dst -1));
92 92
 
93 93
 		/* Compressed string */
94 94
 		} else {
@@ -102,7 +102,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
102 102
 				uint32_t cnt = state.bitcnt;
103 103
 				uint32_t tmp = get_bits(&state, cnt);
104 104
 
105
-				printf("=== BLOCK END (align=%d bits=0x%x) === \n", cnt, tmp);
105
+//				printf("=== BLOCK END (align=%d bits=0x%x) === \n", cnt, tmp);
106 106
 				get_zyxel_header(&state);
107 107
 				state.srcblkstart = state.src;
108 108
 				state.dstblkstart = state.dst;
@@ -122,7 +122,7 @@ uint32_t lzs_unpack(uint8_t *srcbuf, uint32_t srcsize, uint8_t *dstbuf, uint32_t
122 122
 			}
123 123
 
124 124
 			uint32_t len = get_len(&state);
125
-			printf("compressed string, offset(%d)=0x%03x len=0x%04x\n", tag, offset, len);
125
+//			printf("compressed string, offset(%d)=0x%03x len=0x%04x\n", tag, offset, len);
126 126
 
127 127
 			while (len--)
128 128
 				*(state.dst)++ = *dict++;

Loading…
Cancel
Save