mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-22 22:58:33 +00:00
QPDFJob: convert Under/Overlay to use shared pointers
This commit is contained in:
parent
88891a75a2
commit
d526d4c17f
@ -148,8 +148,6 @@ class QPDFJob
|
||||
{
|
||||
UnderOverlay(char const* which) :
|
||||
which(which),
|
||||
filename(0),
|
||||
password(0),
|
||||
to_nr("1-z"),
|
||||
from_nr("1-z"),
|
||||
repeat_nr("")
|
||||
@ -157,8 +155,8 @@ class QPDFJob
|
||||
}
|
||||
|
||||
std::string which;
|
||||
char const* filename;
|
||||
char const* password;
|
||||
std::string filename;
|
||||
std::shared_ptr<char> password;
|
||||
std::string to_nr;
|
||||
std::string from_nr;
|
||||
std::string repeat_nr;
|
||||
|
@ -1934,13 +1934,13 @@ QPDFJob::processInputSource(
|
||||
void
|
||||
QPDFJob::validateUnderOverlay(QPDF& pdf, QPDFJob::UnderOverlay* uo)
|
||||
{
|
||||
if (0 == uo->filename)
|
||||
if (uo->filename.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
QPDFPageDocumentHelper main_pdh(pdf);
|
||||
int main_npages = QIntC::to_int(main_pdh.getAllPages().size());
|
||||
uo->pdf = processFile(uo->filename, uo->password);
|
||||
uo->pdf = processFile(uo->filename.c_str(), uo->password.get());
|
||||
QPDFPageDocumentHelper uo_pdh(*(uo->pdf));
|
||||
int uo_npages = QIntC::to_int(uo_pdh.getAllPages().size());
|
||||
try
|
||||
|
@ -1135,7 +1135,7 @@ ArgParser::argEnd256BitEncryption()
|
||||
void
|
||||
ArgParser::argUOPositional(char* arg)
|
||||
{
|
||||
if (o.under_overlay->filename)
|
||||
if (! o.under_overlay->filename.empty())
|
||||
{
|
||||
usage(o.under_overlay->which + " file already specified");
|
||||
}
|
||||
@ -1175,13 +1175,13 @@ ArgParser::argUORepeat(char* parameter)
|
||||
void
|
||||
ArgParser::argUOPassword(char* parameter)
|
||||
{
|
||||
o.under_overlay->password = parameter;
|
||||
o.under_overlay->password = QUtil::make_shared_cstr(parameter);
|
||||
}
|
||||
|
||||
void
|
||||
ArgParser::argEndUnderlayOverlay()
|
||||
{
|
||||
if (0 == o.under_overlay->filename)
|
||||
if (o.under_overlay->filename.empty())
|
||||
{
|
||||
usage(o.under_overlay->which + " file not specified");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user