summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2009-08-09 22:11:22 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2009-08-09 22:11:22 +0200
commitb8b136dc8b077d8ac3195528c99b856a5dc3970f (patch)
tree4588e9424bb231df4264f0f56877a27d28822f20
parentc892ac011494f41fdf43c00d1a940612aa7e1a45 (diff)
Fixing a few error messages.
-rw-r--r--mpq-file.c6
-rw-r--r--mpq-fs.c5
2 files changed, 10 insertions, 1 deletions
diff --git a/mpq-file.c b/mpq-file.c
index 608f42d..149f824 100644
--- a/mpq-file.c
+++ b/mpq-file.c
@@ -116,8 +116,12 @@ struct mpq_file_t * mpqlib_open_file(struct mpq_archive_t * mpq_a, int entry) {
struct mpq_file_t * mpqlib_open_filename(struct mpq_archive_t * mpq_a, const char * fname) {
int e;
- if ((e = mpqlib_find_hash_entry_by_name(mpq_a, fname, 0, 0)) < 0)
+ __mpqlib_errno = MPQLIB_ERROR_NO_ERROR;
+
+ if ((e = mpqlib_find_hash_entry_by_name(mpq_a, fname, 0, 0)) < 0) {
+ __mpqlib_errno = MPQLIB_ERROR_FILE_NOT_FOUND;
return NULL;
+ }
return mpqlib_open_file(mpq_a, e);
}
diff --git a/mpq-fs.c b/mpq-fs.c
index c2934f8..f608c24 100644
--- a/mpq-fs.c
+++ b/mpq-fs.c
@@ -5,6 +5,8 @@
#include "hashtab.h"
#include "mpq-fs.h"
#include "mpq-misc.h"
+#include "mpq-errors.h"
+#include "errors.h"
#include "stalloc.h"
#define MAX_FNAME 2048
@@ -122,12 +124,15 @@ struct mpq_file_t * mpqlib_fs_open(const char * _fname) {
hash_entry * entry;
entry = find_file(fname);
+ __mpqlib_errno = MPQLIB_ERROR_NO_ERROR;
free(fname);
if (entry) {
return mpqlib_open_file(entry->mpq_a, entry->entry);
}
+
+ __mpqlib_errno = MPQLIB_ERROR_FILE_NOT_FOUND;
return NULL;
}