diff --git a/lzw.c b/lzw.c index 1bab004012b46a6e92e163f99331cd8caeaaf722..3d9692a0b1177ec667131b558444ef602a3fb4ae 100644 --- a/lzw.c +++ b/lzw.c @@ -19,7 +19,8 @@ #define BITLIMIT_12 4096 -void LZW_clear_table(LZW_context_T *ctx) +static void +LZW_clear_table(LZW_context_T *ctx) { /* * Optimizations: since we leave the entries 0-257 fixed or empty, we don't need to free() them explicitly. @@ -44,7 +45,8 @@ void LZW_clear_table(LZW_context_T *ctx) * Creates a HBytes from an array of bytes and its length, and inserts it into the lzw dictionary in ctx. * Also increments ctx->next. The HBytes will keep the token pointer, to be freed later in lzw_clear_table or init_lzw_context. */ -void lzw_table_insert(LZW_context_T *ctx, uint8_t *token, size_t token_len) +static void +lzw_table_insert(LZW_context_T *ctx, uint8_t *token, size_t token_len) { HBytes * next_entry = malloc(sizeof(HBytes)); next_entry->token = token; @@ -54,9 +56,9 @@ void lzw_table_insert(LZW_context_T *ctx, uint8_t *token, size_t token_len) } HParser *p_lzwdata; -LZW_context_T * context; +static LZW_context_T *context; -HParsedToken* +static HParsedToken* act_LZW_clear(const HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; @@ -68,7 +70,7 @@ act_LZW_clear(const HParseResult *p, void *u) return H_MAKE_BYTES(NULL, 0); } -bool +static bool validate_LZW_9bitcodeword(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; @@ -79,7 +81,7 @@ validate_LZW_9bitcodeword(HParseResult *p, void *u) return (ctx->next < BITLIMIT_9); } -bool +static bool validate_LZW_10bitcodeword(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; @@ -90,7 +92,7 @@ validate_LZW_10bitcodeword(HParseResult *p, void *u) return (ctx->next >= BITLIMIT_9 && ctx->next < BITLIMIT_10); } -bool +static bool validate_LZW_11bitcodeword(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; @@ -101,7 +103,7 @@ validate_LZW_11bitcodeword(HParseResult *p, void *u) return (ctx->next >= BITLIMIT_10 && ctx->next < BITLIMIT_11); } -bool +static bool validate_LZW_12bitcodeword(HParseResult *p, void *u) { LZW_context_T * ctx = (LZW_context_T *) u; @@ -112,21 +114,21 @@ validate_LZW_12bitcodeword(HParseResult *p, void *u) return (ctx->next >= BITLIMIT_11 && ctx->next < BITLIMIT_12); } -bool +static bool validate_LZW_clear(HParseResult *p, void *u) { uint64_t code = H_CAST_UINT(p->ast); return (code == 256); } -bool +static bool validate_LZW_eod(HParseResult *p, void *u) { uint64_t code = H_CAST_UINT(p->ast); return (code == 257); } -bool +static bool validate_LZW_output(HParseResult *p, void *u) { uint64_t code = H_CAST_UINT(p->ast); @@ -135,7 +137,7 @@ validate_LZW_output(HParseResult *p, void *u) return (code != 256 && code != 257 && code < ctx->next); } -HParsedToken* +static HParsedToken* act_LZW_output(const HParseResult *p, void *u) { HBytes * code_str; @@ -198,7 +200,7 @@ act_LZW_output(const HParseResult *p, void *u) return H_MAKE_BYTES(output_token, code_str->len); } -HParsedToken* +static HParsedToken* act_LZW_body(const HParseResult *p, void *u) { size_t index = 0; @@ -230,7 +232,7 @@ act_LZW_body(const HParseResult *p, void *u) } -HParsedToken* +static HParsedToken* act_LZW_data(const HParseResult *p, void *u) { /* The AST this semantic action receives is a sequence that looks something like this: