From b60d205c290e843e05009cc709f2d3d1c1cd4aea Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sun, 2 Mar 2025 18:38:02 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- liblss16_decode_strerror.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 liblss16_decode_strerror.c (limited to 'liblss16_decode_strerror.c') diff --git a/liblss16_decode_strerror.c b/liblss16_decode_strerror.c new file mode 100644 index 0000000..3bd3c5a --- /dev/null +++ b/liblss16_decode_strerror.c @@ -0,0 +1,36 @@ +/* See LICENSE file for copyright and license details. */ +#include "liblss16.h" + + +const char * +liblss16_decode_strerror(enum liblss16_decode_error error) +{ + switch (error) { + case LIBLSS16_DECODE_TRUNCATED_MAGIC: + return "Short file: magic number truncated"; + + case LIBLSS16_DECODE_BAD_MAGIC: + return "Invalid LSS16 file: bad magic number"; + + case LIBLSS16_DECODE_TRUNCATED_HEADER: + return "Short file: image header truncated"; + + case LIBLSS16_DECODE_BAD_IMAGE_SIZE: + return "Invalid LSS16 file: invalid image size"; + + case LIBLSS16_DECODE_BAD_COLOUR: + return "Invalid LSS16 file: invalid colour map"; + + case LIBLSS16_DECODE_BAD_ROW_PADDING: + return "Invalid LSS16 file: invalid row padding"; + + case LIBLSS16_DECODE_EXCESSIVE_RUN_LENGTH: + return "Invalid LSS16 file: invalid run-length encoding"; + + case LIBLSS16_DECODE_TRUNCATED_IMAGE: + return "Short file: image truncated"; + + default: + return "Unrecognised error"; + } +} -- cgit v1.2.3-70-g09d2