diff --git a/lzw.c b/lzw.c index e1973e1951907abe5399ea426ca570846f9e443e..41ca8d4740c9a1c137fb3d8df01885e08eb8da5c 100644 --- a/lzw.c +++ b/lzw.c @@ -8,8 +8,6 @@ #include "lzw.h" -//FILE *debug; // DEBUG - #define BITLIMIT_9 (ctx->earlychange ? 511 : 512) #define BITLIMIT_10 (ctx->earlychange ? 1023 : 1024) #define BITLIMIT_11 (ctx->earlychange ? 2047 : 2048) @@ -107,9 +105,6 @@ act_clear(const HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; lzw_clear_table(ctx); - //fprintf(debug, "clear code: %lu, next: %u\n", p->ast->uint, ctx->next); // DEBUG - //fprintf(debug, "%lu ", p->ast->uint); // DEBUG - //fflush(debug); // DEBUG return H_MAKE_BYTES(NULL, 0); } @@ -117,10 +112,6 @@ static bool validate_code9(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; - //fprintf(debug, "9 bit code: %lu, next: %u\n", p->ast->uint, ctx->next); // DEBUG - //fflush(debug); // DEBUG - //if (ctx->next < BITLIMIT_9) // DEBUG - // assert(H_CAST_UINT(p->ast) <= ctx->next); // DEBUG return (ctx->next < BITLIMIT_9); } @@ -128,10 +119,6 @@ static bool validate_code10(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; - //fprintf(debug, "10 bit code: %lu, next: %u\n", p->ast->uint, ctx->next); // DEBUG - //fflush(debug); // DEBUG - //if (ctx->next >= BITLIMIT_9 && ctx->next < BITLIMIT_10) // DEBUG - // assert(H_CAST_UINT(p->ast) <= ctx->next); // DEBUG return (ctx->next >= BITLIMIT_9 && ctx->next < BITLIMIT_10); } @@ -139,10 +126,6 @@ static bool validate_code11(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; - //fprintf(debug, "11 bit code: %lu, next: %u\n", p->ast->uint, ctx->next); // DEBUG - //fflush(debug); // DEBUG - //if (ctx->next >= BITLIMIT_10 && ctx->next < BITLIMIT_11) // DEBUG - // assert(H_CAST_UINT(p->ast) <= ctx->next); // DEBUG return (ctx->next >= BITLIMIT_10 && ctx->next < BITLIMIT_11); } @@ -150,10 +133,6 @@ static bool validate_code12(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; - //fprintf(debug, "12 bit code: %lu, next: %u\n", p->ast->uint, ctx->next); // DEBUG - //fflush(debug); // DEBUG - //if (ctx->next >= BITLIMIT_11 && ctx->next < BITLIMIT_12) // DEBUG - // assert(H_CAST_UINT(p->ast) <= ctx->next); // DEBUG return (ctx->next >= BITLIMIT_11 && ctx->next < BITLIMIT_12); } @@ -186,10 +165,6 @@ act_output(const HParseResult *p, void *u) uint64_t code = H_CAST_UINT(p->ast); LZW_context_T * ctx = (LZW_context_T *) u; - //fprintf(debug, "code: %lu, next: %u\n", code, ctx->next); // DEBUG - //fprintf(debug, "%lu ", code); // DEBUG - //fflush(debug); // DEBUG - assert(ctx->next >= 258); assert(ctx->next <= 4096); assert(code < ctx->next); @@ -245,10 +220,6 @@ act_lzwblock(const HParseResult *p, void *u) } assert(cur == buf + sz); - //fprintf(debug, "\n\n"); // DEBUG - //fwrite(buf, 1, sz, debug); // DEBUG - //fflush(debug); // DEBUG - return H_MAKE_BYTES(buf, sz); } @@ -322,9 +293,7 @@ void init_LZW_parser() HParseResult* parse_LZW_data(const uint8_t* input, size_t length) { - //debug = fopen("lzw_debug.txt", "a"); // DEBUG HParseResult *res = h_parse(p_lzwdata, input, length); - //fclose(debug); // DEBUG return res; }