diff options
author | Michael Drake <michael.drake@codethink.co.uk> | 2017-04-03 10:07:23 +0100 |
---|---|---|
committer | Michael Drake <michael.drake@codethink.co.uk> | 2017-04-04 09:36:04 +0100 |
commit | 960c3b6d2229dcc7cc4a4ef60838329b78880e66 (patch) | |
tree | a5e3bc2913107b61e138daafdc58f85ffc3bb3f8 /src/lzw.c | |
parent | 8c42f9f934005ba40645ba326b74c8f8b0675df2 (diff) | |
download | libnsgif-960c3b6d2229dcc7cc4a4ef60838329b78880e66.tar.gz libnsgif-960c3b6d2229dcc7cc4a4ef60838329b78880e66.tar.bz2 |
New LZW decoder: Add client calls to create/destroy LZW contexts.
Diffstat (limited to 'src/lzw.c')
-rw-r--r-- | src/lzw.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -41,6 +41,34 @@ struct lzw_read_ctx { uint32_t sb_bit_count; /**< Bit count in sub-block */ }; +/** + * LZW decompression context. + */ +struct lzw_ctx { + /** Input reading context */ + struct lzw_read_ctx input; +}; + + +/* Exported function, documented in lzw.h */ +lzw_result lzw_context_create(struct lzw_ctx **ctx) +{ + struct lzw_ctx *c = malloc(sizeof(*c)); + if (c == NULL) { + return LZW_NO_MEM; + } + + *ctx = c; + return LZW_OK; +} + + +/* Exported function, documented in lzw.h */ +void lzw_context_destroy(struct lzw_ctx *ctx) +{ + free(ctx); +} + /** * Advance the context to the next sub-block in the input data. |