From 0b747b1b39e5d6fceb44497752bf60f62683526b Mon Sep 17 00:00:00 2001 From: skal Date: Mon, 21 Jul 2014 15:44:43 +0200 Subject: [PATCH] use explicit size of kErrorMessages[] arrays Change-Id: If02864e3a07ae37814bf379bf347862cd2871bf4 --- examples/cwebp.c | 2 +- examples/example_util.c | 2 +- examples/gif2webp.c | 2 +- examples/webpmux.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cwebp.c b/examples/cwebp.c index f8dbe142..d789c031 100644 --- a/examples/cwebp.c +++ b/examples/cwebp.c @@ -643,7 +643,7 @@ static void HelpLong(void) { //------------------------------------------------------------------------------ // Error messages -static const char* const kErrorMessages[] = { +static const char* const kErrorMessages[VP8_ENC_ERROR_LAST] = { "OK", "OUT_OF_MEMORY: Out of memory allocating objects", "BITSTREAM_OUT_OF_MEMORY: Out of memory re-allocating byte buffer", diff --git a/examples/example_util.c b/examples/example_util.c index ecede97e..b77b816a 100644 --- a/examples/example_util.c +++ b/examples/example_util.c @@ -113,7 +113,7 @@ int ExUtilWriteFile(const char* const file_name, //------------------------------------------------------------------------------ // WebP decoding -static const char* const kStatusMessages[] = { +static const char* const kStatusMessages[VP8_STATUS_NOT_ENOUGH_DATA + 1] = { "OK", "OUT_OF_MEMORY", "INVALID_PARAM", "BITSTREAM_ERROR", "UNSUPPORTED_FEATURE", "SUSPENDED", "USER_ABORT", "NOT_ENOUGH_DATA" }; diff --git a/examples/gif2webp.c b/examples/gif2webp.c index 060e466d..340102b9 100644 --- a/examples/gif2webp.c +++ b/examples/gif2webp.c @@ -194,7 +194,7 @@ static void DisplayGifError(const GifFileType* const gif, int gif_error) { #endif } -static const char* const kErrorMessages[] = { +static const char* const kErrorMessages[-WEBP_MUX_NOT_ENOUGH_DATA + 1] = { "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_BAD_DATA", "WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_NOT_ENOUGH_DATA" }; diff --git a/examples/webpmux.c b/examples/webpmux.c index abe34c34..f314cef8 100644 --- a/examples/webpmux.c +++ b/examples/webpmux.c @@ -130,7 +130,7 @@ static int CountOccurrences(const char* arglist[], int list_length, return num_occurences; } -static const char* const kErrorMessages[] = { +static const char* const kErrorMessages[-WEBP_MUX_NOT_ENOUGH_DATA + 1] = { "WEBP_MUX_NOT_FOUND", "WEBP_MUX_INVALID_ARGUMENT", "WEBP_MUX_BAD_DATA", "WEBP_MUX_MEMORY_ERROR", "WEBP_MUX_NOT_ENOUGH_DATA" };