summaryrefslogtreecommitdiff
path: root/src/resources/imagewriter.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-06 22:55:19 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-06 22:55:19 +0300
commitba21ad5b52d75c98d15a547a64d246e576c1afc2 (patch)
treefc32afddaf47c8d014ffd61259509b29bb04ce05 /src/resources/imagewriter.cpp
parent65d1cadca2ad2d30019f8dd869485c29560b59b7 (diff)
downloadplus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.gz
plus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.bz2
plus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.tar.xz
plus-ba21ad5b52d75c98d15a547a64d246e576c1afc2.zip
Show asserts if any errors happened with fopen.
Diffstat (limited to 'src/resources/imagewriter.cpp')
-rw-r--r--src/resources/imagewriter.cpp11
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;
}