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 /src/resources/imagewriter.cpp | |
parent | 65d1cadca2ad2d30019f8dd869485c29560b59b7 (diff) | |
download | manaverse-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.gz manaverse-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.bz2 manaverse-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.xz manaverse-ba21ad5b52d75c98d15a547a64d246e576c1afc2.zip |
Show asserts if any errors happened with fopen.
Diffstat (limited to 'src/resources/imagewriter.cpp')
-rw-r--r-- | src/resources/imagewriter.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
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; } |