diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-06 22:55:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-06 22:55:19 +0300 |
commit | ba21ad5b52d75c98d15a547a64d246e576c1afc2 (patch) | |
tree | fc32afddaf47c8d014ffd61259509b29bb04ce05 | |
parent | 65d1cadca2ad2d30019f8dd869485c29560b59b7 (diff) | |
download | manaplus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.gz manaplus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.bz2 manaplus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.xz manaplus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.zip |
Show asserts if any errors happened with fopen.
-rw-r--r-- | src/configmanager.cpp | 8 | ||||
-rw-r--r-- | src/configuration.cpp | 5 | ||||
-rw-r--r-- | src/resources/imagewriter.cpp | 11 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/configmanager.cpp b/src/configmanager.cpp index bd19d7307..e79753a66 100644 --- a/src/configmanager.cpp +++ b/src/configmanager.cpp @@ -34,6 +34,7 @@ #include "fs/mkdir.h" #include "fs/paths.h" +#include "utils/checkutils.h" #include "utils/gettext.h" #include "render/renderers.h" @@ -76,6 +77,11 @@ void ConfigManager::initServerConfig(const std::string &serverName) serverConfig.setDefaultValues(getConfigDefaults()); logger->log("serverConfigPath: " + configPath); } + else + { + reportAlways("Error creating server config: %s", + configPath.c_str()); + } const bool val = client->isTmw(); setDefaultOption("enableManaMarketBot", val); @@ -135,7 +141,7 @@ void ConfigManager::initConfiguration() } if (!configFile) { - logger->log("Can't create %s. Using defaults.", + reportAlways("Can't create %s. Using defaults.", configPath.c_str()); } else diff --git a/src/configuration.cpp b/src/configuration.cpp index 0778d2101..f78bd4e50 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -29,6 +29,7 @@ #include "listeners/configlistener.h" +#include "utils/checkutils.h" #include "utils/delete2.h" #ifdef DEBUG_CONFIG #include "utils/stringmap.h" @@ -859,8 +860,8 @@ void Configuration::write() FILE *const testFile = fopen(mConfigPath.c_str(), "w"); if (!testFile) { - logger->log("Configuration::write() couldn't open %s for writing", - mConfigPath.c_str()); + reportAlways("Configuration::write() couldn't open %s for writing", + mConfigPath.c_str()); BLOCK_END("Configuration::write") return; } diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 4c43e19f3..756cfd6f3 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -24,6 +24,8 @@ #include "logger.h" +#include "utils/checkutils.h" + #include <png.h> #include <SDL_video.h> @@ -43,7 +45,7 @@ bool ImageWriter::writePNG(SDL_Surface *const surface, nullptr, nullptr, nullptr); if (!png_ptr) { - logger->log1("Had trouble creating png_structp"); + reportAlways("Had trouble creating png_structp"); return false; } @@ -51,21 +53,22 @@ bool ImageWriter::writePNG(SDL_Surface *const surface, if (!info_ptr) { png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(nullptr)); - logger->log1("Could not create png_info"); + reportAlways("Could not create png_info"); return false; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct(&png_ptr, static_cast<png_infopp>(nullptr)); - logger->log("problem writing to %s", filename.c_str()); + reportAlways("problem writing to %s", filename.c_str()); return false; } FILE *const fp = fopen(filename.c_str(), "wb"); if (!fp) { - logger->log("could not open file %s for writing", filename.c_str()); + reportAlways("could not open file %s for writing", + filename.c_str()); return false; } |