From b7e0e663765da3cc95ceefdde172110c690b6ee6 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 13 Apr 2023 00:43:17 -0400 Subject: gzip: Split out return value constants --- (limited to 'src/gzip.c') diff --git a/src/gzip.c b/src/gzip.c index 328f33a..05d4065 100644 --- a/src/gzip.c +++ b/src/gzip.c @@ -19,6 +19,7 @@ #include #include +#include "defs.h" #include "gzip.h" #define OPKG_OPK_GZIP_BUFFER_SIZE 8192 @@ -36,9 +37,9 @@ _opkg_opk_gzip_init(struct opkg_opk_gzip_state *state) state->stream.zfree = Z_NULL; state->stream.opaque = Z_NULL; if (inflateInit(&state->stream) != Z_OK) { - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } - return OPKG_OPK_GZIP_OK; + return OPKG_OPK_OK; } int @@ -47,15 +48,15 @@ opkg_opk_gzip_init_from_file(struct opkg_opk_gzip_state *state, { state->input_file = fopen(file_name, "rb"); if (state->input_file == NULL) { - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } state->stream.next_in = Z_NULL; state->stream.avail_in = 0; - if (_opkg_opk_gzip_init(state) < OPKG_OPK_GZIP_OK) { + if (_opkg_opk_gzip_init(state) < OPKG_OPK_OK) { fclose(state->input_file); - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } - return OPKG_OPK_GZIP_OK; + return OPKG_OPK_OK; } int @@ -76,7 +77,7 @@ _opkg_opk_gzip_next_record_from_file(struct opkg_opk_gzip_state *state) fclose(state->input_file); state->input_file = NULL; inflateEnd(&state->stream); - return OPKG_OPK_GZIP_OK; + return OPKG_OPK_OK; } if (state->stream.avail_in == 0) { state->stream.avail_in = fread(state->input_buffer, @@ -86,12 +87,12 @@ _opkg_opk_gzip_next_record_from_file(struct opkg_opk_gzip_state *state) fclose(state->input_file); state->input_file = NULL; inflateEnd(&state->stream); - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } state->stream.next_in = state->input_buffer; } if (state->stream.avail_out == 0) { - return OPKG_OPK_GZIP_OK; + return OPKG_OPK_OK; } switch (inflate(&state->stream, Z_SYNC_FLUSH)) { case Z_OK: @@ -102,7 +103,7 @@ _opkg_opk_gzip_next_record_from_file(struct opkg_opk_gzip_state *state) fclose(state->input_file); state->input_file = NULL; inflateEnd(&state->stream); - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } } } @@ -112,12 +113,12 @@ _opkg_opk_gzip_next_record_from_memory(struct opkg_opk_gzip_state *state) { switch (inflate(&state->stream, Z_SYNC_FLUSH)) { case Z_OK: - return OPKG_OPK_GZIP_OK; + return OPKG_OPK_OK; case Z_STREAM_END: - return OPKG_OPK_GZIP_END; + return OPKG_OPK_END; default: inflateEnd(&state->stream); - return OPKG_OPK_GZIP_ERROR; + return OPKG_OPK_ERROR; } } -- cgit v0.9.1