diff options
author | Jay Berkenbilt <ejb@ql.org> | 2011-08-11 17:56:37 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2011-08-11 17:57:37 +0200 |
commit | 76b1659177327a64037bf36d7f3e15a73d86bbed (patch) | |
tree | 22623001bb99a6fe33943416877a3d5836b550d8 /qpdf/qpdf-ctest.c | |
parent | 14fe2e6de3ae3b91436ccb4948fca75c29565440 (diff) | |
download | qpdf-76b1659177327a64037bf36d7f3e15a73d86bbed.tar.zst |
enhance PointerHolder so that it can explicitly be told to use delete [] instead of delete, thus making it useful to run valgrind over qpdf during its test suite
Diffstat (limited to 'qpdf/qpdf-ctest.c')
-rw-r--r-- | qpdf/qpdf-ctest.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c index aa61b9a1..ffb1fff8 100644 --- a/qpdf/qpdf-ctest.c +++ b/qpdf/qpdf-ctest.c @@ -337,6 +337,10 @@ static void test16(char const* infile, char const* outfile, char const* outfile2) { + unsigned long buflen = 0L; + unsigned char const* buf = 0; + FILE* f = 0; + qpdf_read(qpdf, infile, password); print_info("/Author"); print_info("/Producer"); @@ -347,11 +351,22 @@ static void test16(char const* infile, print_info("/Author"); print_info("/Producer"); print_info("/Creator"); - qpdf_init_write(qpdf, outfile); + qpdf_init_write_memory(qpdf); qpdf_set_static_ID(qpdf, QPDF_TRUE); qpdf_set_static_aes_IV(qpdf, QPDF_TRUE); qpdf_set_stream_data_mode(qpdf, qpdf_s_uncompress); qpdf_write(qpdf); + f = fopen(outfile, "wb"); + if (f == NULL) + { + fprintf(stderr, "%s: unable to open %s: %s\n", + whoami, outfile, strerror(errno)); + exit(2); + } + buflen = qpdf_get_buffer_length(qpdf); + buf = qpdf_get_buffer(qpdf); + fwrite(buf, 1, buflen, f); + fclose(f); report_errors(); } |