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
This commit is contained in:
Urvang Joshi 2012-07-06 17:33:59 +05:30
parent 857650c8fc
commit a4b9b1c604
3 changed files with 9 additions and 13 deletions

View File

@ -117,13 +117,12 @@ static int CountOccurrences(const char* arglist[], int list_length,
} }
static const char* const kErrorMessages[] = { static const char* const kErrorMessages[] = {
"WEBP_MUX_ERROR", "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_BAD_DATA",
"WEBP_MUX_INVALID_PARAMETER", "WEBP_MUX_BAD_DATA", "WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_NOT_ENOUGH_DATA"
"WEBP_MUX_NOT_ENOUGH_DATA"
}; };
static const char* ErrorString(WebPMuxError err) { 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]; return kErrorMessages[-err];
} }

View File

@ -99,8 +99,7 @@ static WebPMuxError MuxAddChunk(WebPMux* const mux, uint32_t nth, uint32_t tag,
const WebPData chunk_data = { data, size }; const WebPData chunk_data = { data, size };
assert(mux != NULL); assert(mux != NULL);
assert(size <= MAX_CHUNK_PAYLOAD); assert(size <= MAX_CHUNK_PAYLOAD);
assert(idx != IDX_NIL);
if (idx == IDX_NIL) return WEBP_MUX_INVALID_PARAMETER;
return MuxSet(mux, idx, nth, &chunk_data, copy_data); return MuxSet(mux, idx, nth, &chunk_data, copy_data);
} }

View File

@ -56,13 +56,11 @@ extern "C" {
// Error codes // Error codes
typedef enum { typedef enum {
WEBP_MUX_OK = 1, WEBP_MUX_OK = 1,
WEBP_MUX_ERROR = 0, WEBP_MUX_NOT_FOUND = 0,
WEBP_MUX_NOT_FOUND = -1, WEBP_MUX_INVALID_ARGUMENT = -1,
WEBP_MUX_INVALID_ARGUMENT = -2, WEBP_MUX_BAD_DATA = -2,
WEBP_MUX_INVALID_PARAMETER = -3, WEBP_MUX_MEMORY_ERROR = -3,
WEBP_MUX_BAD_DATA = -4, WEBP_MUX_NOT_ENOUGH_DATA = -4
WEBP_MUX_MEMORY_ERROR = -5,
WEBP_MUX_NOT_ENOUGH_DATA = -6
} WebPMuxError; } WebPMuxError;
// Flag values for different features used in VP8X chunk. // Flag values for different features used in VP8X chunk.