diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-03-17 04:39:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-03-17 04:39:30 +0300 |
commit | 350c0ab96146402e05a527ad08f5e0fea2c9ff6c (patch) | |
tree | 7f9d7c827c9d424a0032f1de9b02a8bd58cc21af | |
parent | e9fa8a0b173c72c5051e2c76de2639034e8c7bab (diff) | |
download | manaplus-350c0ab96146402e05a527ad08f5e0fea2c9ff6c.tar.gz manaplus-350c0ab96146402e05a527ad08f5e0fea2c9ff6c.tar.bz2 manaplus-350c0ab96146402e05a527ad08f5e0fea2c9ff6c.tar.xz manaplus-350c0ab96146402e05a527ad08f5e0fea2c9ff6c.zip |
Improve rwops creation error messages.
-rw-r--r-- | src/fs/virtfs/rwops.cpp | 19 | ||||
-rw-r--r-- | src/fs/virtfs/rwops.h | 3 |
2 files changed, 15 insertions, 7 deletions
diff --git a/src/fs/virtfs/rwops.cpp b/src/fs/virtfs/rwops.cpp index a5d81ed1f..7c35c336d 100644 --- a/src/fs/virtfs/rwops.cpp +++ b/src/fs/virtfs/rwops.cpp @@ -50,6 +50,7 @@ #include "fs/virtfs/fs.h" #include "fs/virtfs/fsfuncs.h" +#include "utils/checkutils.h" #include "utils/fuzzer.h" PRAGMA48(GCC diagnostic push) @@ -62,13 +63,15 @@ PRAGMA48(GCC diagnostic pop) namespace VirtFs { -SDL_RWops *create_rwops(File *const file) +SDL_RWops *create_rwops(File *const file, + const std::string &restrict fname) { SDL_RWops *retval = nullptr; if (file == nullptr) { - logger->assertLog("VirtFs::rwops_seek: create rwops error."); + reportAlways("VirtFs::rwops_seek: create rwops error: %s", + fname.c_str()); } else { @@ -114,13 +117,15 @@ SDL_RWops *rwopsOpenRead(const std::string &restrict fname) #endif // USE_FUZZER #ifdef USE_PROFILER - SDL_RWops *const ret = create_rwops(openRead(fname)); + SDL_RWops *const ret = create_rwops(openRead(fname), + fname); BLOCK_END("RWopsopenRead") return ret; #else // USE_PROFILER - return create_rwops(openRead(fname)); + return create_rwops(openRead(fname), + fname); #endif // USE_PROFILER } /* RWopsopenRead */ @@ -131,7 +136,8 @@ SDL_RWops *rwopsOpenWrite(const std::string &restrict fname) return nullptr; #endif // __APPLE__ - return create_rwops(openWrite(fname)); + return create_rwops(openWrite(fname), + fname); } /* RWopsopenWrite */ SDL_RWops *rwopsOpenAppend(const std::string &restrict fname) @@ -141,7 +147,8 @@ SDL_RWops *rwopsOpenAppend(const std::string &restrict fname) return nullptr; #endif // __APPLE__ - return create_rwops(openAppend(fname)); + return create_rwops(openAppend(fname), + fname); } /* RWopsopenAppend */ } // namespace VirtFs diff --git a/src/fs/virtfs/rwops.h b/src/fs/virtfs/rwops.h index aa75b6ec3..1efd2ac1a 100644 --- a/src/fs/virtfs/rwops.h +++ b/src/fs/virtfs/rwops.h @@ -55,7 +55,8 @@ namespace VirtFs { struct File; - SDL_RWops *create_rwops(File *const file); + SDL_RWops *create_rwops(File *const file, + const std::string &restrict fname); SDL_RWops *rwopsOpenRead(const std::string &restrict fname); SDL_RWops *rwopsOpenWrite(const std::string &restrict fname) A_WARN_UNUSED; |