diff options
author | Jay Berkenbilt <ejb@ql.org> | 2013-02-28 22:45:11 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2013-03-05 19:35:46 +0100 |
commit | ac4deac1873ca1bb570ffd479ed2cc1010762f89 (patch) | |
tree | e83f1d756f161b799483926676446241fc8ffeed /libtests/png_filter.cc | |
parent | 7ccc9bd9d5463d29f3fc19a7f7718842e3b68be8 (diff) | |
download | qpdf-ac4deac1873ca1bb570ffd479ed2cc1010762f89.tar.zst |
Call QUtil::safe_fopen in place of fopen
fopen was previuosly called wrapped by QUtil::fopen_wrapper, but
QUtil::safe_fopen does this itself, which is less cumbersome.
Diffstat (limited to 'libtests/png_filter.cc')
-rw-r--r-- | libtests/png_filter.cc | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/libtests/png_filter.cc b/libtests/png_filter.cc index 68f50aee..c3d4f646 100644 --- a/libtests/png_filter.cc +++ b/libtests/png_filter.cc @@ -1,5 +1,6 @@ #include <qpdf/Pl_PNGFilter.hh> #include <qpdf/Pl_StdioFile.hh> +#include <qpdf/QUtil.hh> #include <iostream> #include <errno.h> @@ -7,23 +8,11 @@ #include <string.h> #include <stdlib.h> -FILE* safe_fopen(char const* filename, char const* mode) -{ - FILE* result = fopen(filename, mode); // XXXX - if (result == 0) - { - std::cerr << "fopen " << filename << " failed: " << strerror(errno) // XXXX - << std::endl; - exit(2); - } - return result; -} - void run(char const* filename, bool encode, unsigned int columns) { // Decode the file - FILE* in = safe_fopen(filename, "rb"); - FILE* o1 = safe_fopen("out", "wb"); + FILE* in = QUtil::safe_fopen(filename, "rb"); + FILE* o1 = QUtil::safe_fopen("out", "wb"); Pipeline* out = new Pl_StdioFile("out", o1); Pipeline* pl = new Pl_PNGFilter( "png", out, |