aboutsummaryrefslogtreecommitdiff
path: root/src/bitmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bitmap.c')
-rw-r--r--src/bitmap.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/bitmap.c b/src/bitmap.c
index 6d72cb0..31256e8 100644
--- a/src/bitmap.c
+++ b/src/bitmap.c
@@ -6,6 +6,15 @@
#include "bitmap.h"
+static const int bitmap_errors_cnt = 5;
+static const char* bitmap_errors[] = {
+ "OK.",
+ "Error opening file.", // Use errno instead
+ "Invalid or corrupted file.",
+ "Unsupported bit depth.",
+ "Compression not supported."
+};
+
static struct bitmap_file_header bitmap_read_file_header(FILE *_file);
static struct bitmap_image bitmap_read_pixel_data(FILE *_file, struct bitmap_file_header _header);
@@ -265,3 +274,10 @@ static uint8_t bitmap_rgb_luminance(uint8_t R, uint8_t G, uint8_t B) {
return ret;
}
+
+char* bitmap_strerror( int _error ) {
+ if ( _error >= bitmap_errors_cnt || _error < 0)
+ return "Unknown Error.";
+
+ return (char*) bitmap_errors[_error];
+}