From a4b9b1c604ca872ea6fe67d8ad9522f79012bf13 Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Fri, 6 Jul 2012 17:33:59 +0530 Subject: [PATCH] Remove some unused enum values. - WEBP_MUX_INVALID_PARAMETER: was used only at one place, and that too should actually be an assert(). - WEBP_MUX_ERROR: was never used. Change-Id: I8883cb4dfae7a7918507501f21fced0c04dda36a --- examples/webpmux.c | 7 +++---- src/mux/muxedit.c | 3 +-- src/webp/mux.h | 12 +++++------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/examples/webpmux.c b/examples/webpmux.c index a33a86db..51333b06 100644 --- a/examples/webpmux.c +++ b/examples/webpmux.c @@ -117,13 +117,12 @@ static int CountOccurrences(const char* arglist[], int list_length, } static const char* const kErrorMessages[] = { - "WEBP_MUX_ERROR", "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", - "WEBP_MUX_INVALID_PARAMETER", "WEBP_MUX_BAD_DATA", "WEBP_MUX_MEMORY_ERROR", - "WEBP_MUX_NOT_ENOUGH_DATA" + "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_BAD_DATA", + "WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_NOT_ENOUGH_DATA" }; static const char* ErrorString(WebPMuxError err) { - assert(err <= WEBP_MUX_ERROR && err >= WEBP_MUX_NOT_ENOUGH_DATA); + assert(err <= WEBP_MUX_NOT_FOUND && err >= WEBP_MUX_NOT_ENOUGH_DATA); return kErrorMessages[-err]; } diff --git a/src/mux/muxedit.c b/src/mux/muxedit.c index 882ae708..86069022 100644 --- a/src/mux/muxedit.c +++ b/src/mux/muxedit.c @@ -99,8 +99,7 @@ static WebPMuxError MuxAddChunk(WebPMux* const mux, uint32_t nth, uint32_t tag, const WebPData chunk_data = { data, size }; assert(mux != NULL); assert(size <= MAX_CHUNK_PAYLOAD); - - if (idx == IDX_NIL) return WEBP_MUX_INVALID_PARAMETER; + assert(idx != IDX_NIL); return MuxSet(mux, idx, nth, &chunk_data, copy_data); } diff --git a/src/webp/mux.h b/src/webp/mux.h index 40a86756..4e0310c0 100644 --- a/src/webp/mux.h +++ b/src/webp/mux.h @@ -56,13 +56,11 @@ extern "C" { // Error codes typedef enum { WEBP_MUX_OK = 1, - WEBP_MUX_ERROR = 0, - WEBP_MUX_NOT_FOUND = -1, - WEBP_MUX_INVALID_ARGUMENT = -2, - WEBP_MUX_INVALID_PARAMETER = -3, - WEBP_MUX_BAD_DATA = -4, - WEBP_MUX_MEMORY_ERROR = -5, - WEBP_MUX_NOT_ENOUGH_DATA = -6 + WEBP_MUX_NOT_FOUND = 0, + WEBP_MUX_INVALID_ARGUMENT = -1, + WEBP_MUX_BAD_DATA = -2, + WEBP_MUX_MEMORY_ERROR = -3, + WEBP_MUX_NOT_ENOUGH_DATA = -4 } WebPMuxError; // Flag values for different features used in VP8X chunk.