From 9228e223fae44d81db4bca2ebc55076a3aabcd66 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 6 May 2014 23:42:57 +0900 Subject: [PATCH] Remove NGHTTP2_ERR_GZIP error code --- lib/includes/nghttp2/nghttp2.h | 4 ---- lib/nghttp2_helper.c | 2 -- src/nghttp2_gzip.c | 8 ++++---- src/nghttp2_gzip.h | 14 ++------------ 4 files changed, 6 insertions(+), 22 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 79801520..b370df8e 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -284,10 +284,6 @@ typedef enum { * requested operation. */ NGHTTP2_ERR_INVALID_STATE = -519, - /** - * The gzip error. - */ - NGHTTP2_ERR_GZIP = -520, /** * The user callback function failed due to the temporal error. */ diff --git a/lib/nghttp2_helper.c b/lib/nghttp2_helper.c index ed177336..51781f28 100644 --- a/lib/nghttp2_helper.c +++ b/lib/nghttp2_helper.c @@ -201,8 +201,6 @@ const char* nghttp2_strerror(int error_code) return "Invalid header block"; case NGHTTP2_ERR_INVALID_STATE: return "Invalid state"; - case NGHTTP2_ERR_GZIP: - return "Gzip error"; case NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE: return "The user callback function failed due to the temporal error"; case NGHTTP2_ERR_FRAME_SIZE_ERROR: diff --git a/src/nghttp2_gzip.c b/src/nghttp2_gzip.c index 9cb8f9a6..d7fc13e0 100644 --- a/src/nghttp2_gzip.c +++ b/src/nghttp2_gzip.c @@ -31,7 +31,7 @@ int nghttp2_gzip_inflate_new(nghttp2_gzip **inflater_ptr) int rv; *inflater_ptr = malloc(sizeof(nghttp2_gzip)); if(*inflater_ptr == NULL) { - return NGHTTP2_ERR_NOMEM; + return -1; } (*inflater_ptr)->finished = 0; (*inflater_ptr)->zst.next_in = Z_NULL; @@ -42,7 +42,7 @@ int nghttp2_gzip_inflate_new(nghttp2_gzip **inflater_ptr) rv = inflateInit2(&(*inflater_ptr)->zst, 47); if(rv != Z_OK) { free(*inflater_ptr); - return NGHTTP2_ERR_GZIP; + return -1; } return 0; } @@ -61,7 +61,7 @@ int nghttp2_gzip_inflate(nghttp2_gzip *inflater, { int rv; if(inflater->finished) { - return NGHTTP2_ERR_GZIP; + return -1; } inflater->zst.avail_in = *inlen_ptr; inflater->zst.next_in = (unsigned char*)in; @@ -82,7 +82,7 @@ int nghttp2_gzip_inflate(nghttp2_gzip *inflater, case Z_STREAM_ERROR: case Z_NEED_DICT: case Z_MEM_ERROR: - return NGHTTP2_ERR_GZIP; + return -1; default: assert(0); /* We need this for some compilers */ diff --git a/src/nghttp2_gzip.h b/src/nghttp2_gzip.h index 26b92d94..9eea35ac 100644 --- a/src/nghttp2_gzip.h +++ b/src/nghttp2_gzip.h @@ -51,13 +51,7 @@ typedef struct { * A helper function to set up a per request gzip stream to inflate * data. * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * :enum:`NGHTTP2_ERR_GZIP` - * The initialization of gzip stream failed. - * :enum:`NGHTTP2_ERR_NOMEM` - * Out of memory. + * This function returns 0 if it succeeds, or -1. */ int nghttp2_gzip_inflate_new(nghttp2_gzip **inflater_ptr); @@ -77,11 +71,7 @@ void nghttp2_gzip_inflate_del(nghttp2_gzip *inflater); * the number of data written in |out|. Similarly, |*inlen_ptr| is * updated to represent the number of input bytes processed. * - * This function returns 0 if it succeeds, or one of the following - * negative error codes: - * - * :enum:`NGHTTP2_ERR_GZIP` - * The inflation of gzip stream failed. + * This function returns 0 if it succeeds, or -1. * * The example follows:: *