summaryrefslogtreecommitdiff
path: root/mpq-errors.c
diff options
context:
space:
mode:
authorpixel <pixel>2007-07-05 18:05:43 +0000
committerpixel <pixel>2007-07-05 18:05:43 +0000
commite12fcb08a14de1f5738e0162bba50cdbf87dee47 (patch)
tree48ed11b4e908a1760d0bd0ddce96c05d2a896e13 /mpq-errors.c
First import...
Diffstat (limited to 'mpq-errors.c')
-rw-r--r--mpq-errors.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mpq-errors.c b/mpq-errors.c
new file mode 100644
index 0000000..e0b8655
--- /dev/null
+++ b/mpq-errors.c
@@ -0,0 +1,22 @@
+#include "mpq-errors.h"
+#include "errors.h"
+
+static const char * error_strings[] = {
+ "No error.",
+ "Error opening file.",
+ "File specified isn't an MPQ archive.",
+ "Not enough memory.",
+ "File read error.",
+};
+
+static const char * wrong_errno = "Invalid error number - internal error.";
+
+int mpqlib_errno() {
+ return __mpqlib_errno;
+}
+
+const char * mpqlib_error() {
+ if ((__mpqlib_errno < 0) || (__mpqlib_errno >= MPQLIB_ERRORS_MAX))
+ return wrong_errno;
+ return error_strings[__mpqlib_errno];
+}