aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-06-22 18:17:36 +0200
committerJay Berkenbilt <ejb@ql.org>2018-06-22 18:53:41 +0200
commit99593e0eef6204e0fcf0ddcae937c81cac8a1745 (patch)
treea873f7d2289a5b095fd5fc5455fa58cc7a47ac78
parent4ccc8b1a44109a913c87f31029c9c17db30ecc43 (diff)
downloadqpdf-99593e0eef6204e0fcf0ddcae937c81cac8a1745.tar.zst
Use ClosedFileInputSource when merging files (fixes #154)
-rw-r--r--ChangeLog4
-rw-r--r--qpdf/qpdf.cc6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 66966f7b..2463c250 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 49271c68..783548ef 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -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;
}