diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/ClosedFileInputSource.cc | 4 | ||||
-rw-r--r-- | libqpdf/FileInputSource.cc | 13 | ||||
-rw-r--r-- | libqpdf/QPDF.cc | 6 | ||||
-rw-r--r-- | libqpdf/QPDFJob.cc | 4 |
4 files changed, 19 insertions, 8 deletions
diff --git a/libqpdf/ClosedFileInputSource.cc b/libqpdf/ClosedFileInputSource.cc index 7c4e5dbe..7d49bf70 100644 --- a/libqpdf/ClosedFileInputSource.cc +++ b/libqpdf/ClosedFileInputSource.cc @@ -24,8 +24,8 @@ void ClosedFileInputSource::before() { if (0 == this->m->fis.get()) { - this->m->fis = std::make_shared<FileInputSource>(); - this->m->fis->setFilename(this->m->filename.c_str()); + this->m->fis = + std::make_shared<FileInputSource>(this->m->filename.c_str()); this->m->fis->seek(this->m->offset, SEEK_SET); this->m->fis->setLastOffset(this->last_offset); } diff --git a/libqpdf/FileInputSource.cc b/libqpdf/FileInputSource.cc index 9b467821..08b35056 100644 --- a/libqpdf/FileInputSource.cc +++ b/libqpdf/FileInputSource.cc @@ -23,6 +23,19 @@ FileInputSource::FileInputSource() : { } +FileInputSource::FileInputSource(char const* filename) : + m(new Members(false)) +{ + setFilename(filename); +} + +FileInputSource::FileInputSource( + char const* description, FILE* filep, bool close_file) : + m(new Members(false)) +{ + setFile(description, filep, close_file); +} + void FileInputSource::setFilename(char const* filename) { diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index aa99942c..8b8dd59e 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -270,8 +270,7 @@ QPDF::~QPDF() void QPDF::processFile(char const* filename, char const* password) { - FileInputSource* fi = new FileInputSource(); - fi->setFilename(filename); + FileInputSource* fi = new FileInputSource(filename); processInputSource(std::shared_ptr<InputSource>(fi), password); } @@ -279,8 +278,7 @@ void QPDF::processFile( char const* description, FILE* filep, bool close_file, char const* password) { - FileInputSource* fi = new FileInputSource(); - fi->setFile(description, filep, close_file); + FileInputSource* fi = new FileInputSource(description, filep, close_file); processInputSource(std::shared_ptr<InputSource>(fi), password); } diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index ca56b8d5..63312f27 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -2445,9 +2445,9 @@ QPDFJob::handlePageSpecs( cis->stayOpen(true); } else { QTC::TC("qpdf", "QPDFJob keep files open y"); - FileInputSource* fis = new FileInputSource(); + FileInputSource* fis = + new FileInputSource(page_spec.filename.c_str()); is = std::shared_ptr<InputSource>(fis); - fis->setFilename(page_spec.filename.c_str()); } std::shared_ptr<QPDF> qpdf_ph = processInputSource(is, password, true); |