Edward O'Callaghan (eocallaghan@alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5489
-gerrit
commit bd53d77c6c93502b0efa64cfc54748c3bf4147f8 Author: Edward O'Callaghan eocallaghan@alterapraxis.com Date: Sat Apr 12 15:10:36 2014 +1000
util/cbfstool: enum'ify return error codes
NOTFORMERGE
work on `standardising` error return values with enum's.
Change-Id: Iec74a766a3706bc45a0d7580c0f60227426a4c85 Signed-off-by: Edward O'Callaghan eocallaghan@alterapraxis.com --- util/cbfstool/lzma/C/LzmaDec.c | 2 +- util/cbfstool/lzma/C/Types.h | 39 ++++++++++++++++++++++----------------- 2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/util/cbfstool/lzma/C/LzmaDec.c b/util/cbfstool/lzma/C/LzmaDec.c index e208877..4393478 100644 --- a/util/cbfstool/lzma/C/LzmaDec.c +++ b/util/cbfstool/lzma/C/LzmaDec.c @@ -122,7 +122,7 @@ Out: = kMatchSpecLenStart + 2 : State Init Marker */
-static int LzmaDec_DecodeReal(struct CLzmaDec *p, size_t limit_parm, const uint8_t *bufLimit) +static sz_error_t LzmaDec_DecodeReal(struct CLzmaDec *p, size_t limit_parm, const uint8_t *bufLimit) { CLzmaProb *probs = p->probs;
diff --git a/util/cbfstool/lzma/C/Types.h b/util/cbfstool/lzma/C/Types.h index ce98ab5..89f85de 100644 --- a/util/cbfstool/lzma/C/Types.h +++ b/util/cbfstool/lzma/C/Types.h @@ -8,24 +8,29 @@ #include <stdint.h> #include <stdbool.h>
+typedef enum +{ + SZ_OK = 0, + SZ_ERROR_DATA, + SZ_ERROR_MEM, + SZ_ERROR_CRC, + SZ_ERROR_UNSUPPORTED, + SZ_ERROR_PARAM, + SZ_ERROR_INPUT_EOF, + SZ_ERROR_OUTPUT_EOF, + SZ_ERROR_READ, + SZ_ERROR_WRITE, + SZ_ERROR_PROGRESS, + SZ_ERROR_FAIL, + SZ_ERROR_THREAD, + + SZ_ERROR_ARCHIVE = 16, + SZ_ERROR_NO_ARCHIVE, + + /* terminating elm to loop over enum */ + SZ_LAST_ERROR +} sz_error_t;
-#define SZ_OK 0 - -#define SZ_ERROR_DATA 1 -#define SZ_ERROR_MEM 2 -#define SZ_ERROR_CRC 3 -#define SZ_ERROR_UNSUPPORTED 4 -#define SZ_ERROR_PARAM 5 -#define SZ_ERROR_INPUT_EOF 6 -#define SZ_ERROR_OUTPUT_EOF 7 -#define SZ_ERROR_READ 8 -#define SZ_ERROR_WRITE 9 -#define SZ_ERROR_PROGRESS 10 -#define SZ_ERROR_FAIL 11 -#define SZ_ERROR_THREAD 12 - -#define SZ_ERROR_ARCHIVE 16 -#define SZ_ERROR_NO_ARCHIVE 17
typedef int SRes; typedef int WRes; /* This was DWORD for _WIN32. That's uint32_t */