Use ClosedFileInputSource when merging files (fixes #154)

This commit is contained in:
Jay Berkenbilt 2018-06-22 12:17:36 -04:00
parent 4ccc8b1a44
commit 99593e0eef
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2018-06-22 Jay Berkenbilt <ejb@ql.org>
* Don't leave files open when merging. This makes it possible
merge more files at once than the operating system's open file
limit. Fixes #154.
* Add ClosedFileInputSource class, and input source that keeps its
input file closed when not reading it. At the expense of some
performance, this allows you to operate on many files without

View File

@ -7,6 +7,7 @@
#include <qpdf/QUtil.hh>
#include <qpdf/QTC.hh>
#include <qpdf/ClosedFileInputSource.hh>
#include <qpdf/Pl_StdioFile.hh>
#include <qpdf/Pl_Discard.hh>
#include <qpdf/PointerHolder.hh>
@ -2083,8 +2084,9 @@ static void handle_page_specs(QPDF& pdf, Options& o,
QTC::TC("qpdf", "qpdf pages encryption password");
password = o.encryption_file_password;
}
qpdf->processFile(
page_spec.filename.c_str(), password);
qpdf->processInputSource(
new ClosedFileInputSource(
page_spec.filename.c_str()), password);
page_spec_qpdfs[page_spec.filename] = qpdf;
}