mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-11 07:30:57 +00:00
QPDFJob: allocate QPDFArgParser on stack
The previous commits have removed all references to memory from QPDFArgParser from QPDFJob. This commit removes the constraint that QPDFArgParser remain in scope. This is a prerequisite to allowing JSON as an alternative way to initialize QPDFJob and to initialize it directly using a public API.
This commit is contained in:
parent
d526d4c17f
commit
b9cd693a5b
@ -26,7 +26,6 @@
|
|||||||
#include <qpdf/Constants.h>
|
#include <qpdf/Constants.h>
|
||||||
#include <qpdf/QPDF.hh>
|
#include <qpdf/QPDF.hh>
|
||||||
#include <qpdf/QPDFPageObjectHelper.hh>
|
#include <qpdf/QPDFPageObjectHelper.hh>
|
||||||
#include <qpdf/QPDFArgParser.hh>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -387,7 +386,6 @@ class QPDFJob
|
|||||||
std::ostream* cout;
|
std::ostream* cout;
|
||||||
std::ostream* cerr;
|
std::ostream* cerr;
|
||||||
unsigned long encryption_status;
|
unsigned long encryption_status;
|
||||||
std::shared_ptr<QPDFArgParser> ap;
|
|
||||||
};
|
};
|
||||||
std::shared_ptr<Members> m;
|
std::shared_ptr<Members> m;
|
||||||
};
|
};
|
||||||
|
@ -1529,11 +1529,8 @@ QPDFJob::initializeFromArgv(int argc, char* argv[], char const* progname_env)
|
|||||||
{
|
{
|
||||||
progname_env = "QPDF_EXECUTABLE";
|
progname_env = "QPDF_EXECUTABLE";
|
||||||
}
|
}
|
||||||
// QPDFArgParser must stay in scope for the life of the QPDFJob
|
QPDFArgParser qap(argc, argv, progname_env);
|
||||||
// object since it holds dynamic memory used for argv, which is
|
setMessagePrefix(qap.getProgname());
|
||||||
// pointed to by other member variables.
|
ArgParser ap(qap, *this);
|
||||||
this->m->ap = std::make_shared<QPDFArgParser>(argc, argv, progname_env);
|
|
||||||
setMessagePrefix(this->m->ap->getProgname());
|
|
||||||
ArgParser ap(*this->m->ap, *this);
|
|
||||||
ap.parseOptions();
|
ap.parseOptions();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include <qpdf/QPDFJob.hh>
|
#include <qpdf/QPDFJob.hh>
|
||||||
#include <qpdf/QTC.hh>
|
#include <qpdf/QTC.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
#include <qpdf/QPDFArgParser.hh>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
Loading…
Reference in New Issue
Block a user