aboutsummaryrefslogtreecommitdiffstats
path: root/libtests/rc4.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2013-02-28 22:45:11 +0100
committerJay Berkenbilt <ejb@ql.org>2013-03-05 19:35:46 +0100
commitac4deac1873ca1bb570ffd479ed2cc1010762f89 (patch)
treee83f1d756f161b799483926676446241fc8ffeed /libtests/rc4.cc
parent7ccc9bd9d5463d29f3fc19a7f7718842e3b68be8 (diff)
downloadqpdf-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/rc4.cc')
-rw-r--r--libtests/rc4.cc16
1 files changed, 3 insertions, 13 deletions
diff --git a/libtests/rc4.cc b/libtests/rc4.cc
index e71e0d01..7a4d8bd9 100644
--- a/libtests/rc4.cc
+++ b/libtests/rc4.cc
@@ -1,5 +1,6 @@
#include <qpdf/Pl_RC4.hh>
#include <qpdf/Pl_StdioFile.hh>
+#include <qpdf/QUtil.hh>
#include <stdio.h>
#include <string.h>
@@ -22,13 +23,7 @@ int main(int argc, char* argv[])
unsigned char* key = new unsigned char[keylen + 1];
key[keylen] = '\0';
- FILE* infile = fopen(infilename, "rb"); // XXXX
- if (infile == 0)
- {
- std::cerr << "can't open " << infilename << std::endl;
- exit(2);
- }
-
+ FILE* infile = QUtil::safe_fopen(infilename, "rb");
for (unsigned int i = 0; i < strlen(hexkey); i += 2)
{
char t[3];
@@ -40,12 +35,7 @@ int main(int argc, char* argv[])
key[i/2] = static_cast<unsigned char>(val);
}
- FILE* outfile = fopen(outfilename, "wb"); // XXXX
- if (outfile == 0)
- {
- std::cerr << "can't open " << outfilename << std::endl;
- exit(2);
- }
+ FILE* outfile = QUtil::safe_fopen(outfilename, "wb");
Pl_StdioFile* out = new Pl_StdioFile("stdout", outfile);
// Use a small buffer size (64) for testing
Pl_RC4* rc4 = new Pl_RC4("rc4", out, key, keylen, 64);