aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-09-06 15:14:30 +0300
committerLasse Collin <lasse.collin@tukaani.org>2008-09-06 15:14:30 +0300
commit0a31ed9d5e3cde4feb094b66f3a8b2c074605d84 (patch)
tree571b741cc155767f3c5e0ee0a0a686995568b16a /tests
parentAdded support for raw encoding and decoding to the command (diff)
downloadxz-0a31ed9d5e3cde4feb094b66f3a8b2c074605d84.tar.xz
Some API cleanups
Diffstat (limited to 'tests')
-rw-r--r--tests/tests.h72
1 files changed, 19 insertions, 53 deletions
diff --git a/tests/tests.h b/tests/tests.h
index 3c59bb63..f00925da 100644
--- a/tests/tests.h
+++ b/tests/tests.h
@@ -38,59 +38,25 @@
static inline const char *
lzma_ret_sym(lzma_ret ret)
{
- const char *str = "";
-
- switch (ret) {
- case LZMA_OK:
- str = "LZMA_OK";
- break;
-
- case LZMA_STREAM_END:
- str = "LZMA_STREAM_END";
- break;
-
- case LZMA_PROG_ERROR:
- str = "LZMA_PROG_ERROR";
- break;
-
- case LZMA_DATA_ERROR:
- str = "LZMA_DATA_ERROR";
- break;
-
- case LZMA_MEM_ERROR:
- str = "LZMA_MEM_ERROR";
- break;
-
- case LZMA_BUF_ERROR:
- str = "LZMA_BUF_ERROR";
- break;
-
- case LZMA_HEADER_ERROR:
- str = "LZMA_HEADER_ERROR";
- break;
-
- case LZMA_NO_CHECK:
- str = "LZMA_NO_CHECK";
- break;
-
- case LZMA_UNSUPPORTED_CHECK:
- str = "LZMA_UNSUPPORTED_CHECK";
- break;
-
- case LZMA_SEE_CHECK:
- str = "LZMA_SEE_CHECK";
- break;
-
- case LZMA_FORMAT_ERROR:
- str = "LZMA_FORMAT_ERROR";
- break;
-
- case LZMA_MEMLIMIT_ERROR:
- str = "LZMA_MEMLIMIT_ERROR";
- break;
- }
-
- return str;
+ if ((unsigned)(ret) > LZMA_PROG_ERROR)
+ return "UNKNOWN_ERROR";
+
+ static const char *msgs[] = {
+ "LZMA_OK",
+ "LZMA_STREAM_END",
+ "LZMA_NO_CHECK",
+ "LZMA_UNSUPPORTED_CHECK",
+ "LZMA_GET_CHECK",
+ "LZMA_MEM_ERROR",
+ "LZMA_MEMLIMIT_ERROR",
+ "LZMA_FORMAT_ERROR",
+ "LZMA_HEADER_ERROR",
+ "LZMA_DATA_ERROR",
+ "LZMA_BUF_ERROR",
+ "LZMA_PROG_ERROR"
+ };
+
+ return msgs[ret];
}