From 21b9290785fb03477784cf6312f57cfb96dbe53d Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Mon, 31 Jan 2022 18:15:10 -0500 Subject: QPDFJob json: make bare arguments expect the empty string Changing from bool requiring true to string requiring the empty string is more consistent with the CLI and makes it possible to add an optional parameter or choices later without breaking compatibility. --- libqpdf/QPDFJob_config.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libqpdf/QPDFJob_config.cc') diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc index 2066e608..ed8943f6 100644 --- a/libqpdf/QPDFJob_config.cc +++ b/libqpdf/QPDFJob_config.cc @@ -108,7 +108,7 @@ QPDFJob::Config::coalesceContents() QPDFJob::Config* QPDFJob::Config::collate(char const* parameter) { - auto n = ((parameter == 0) ? 1 : + auto n = (((parameter == 0) || (strlen(parameter) == 0)) ? 1 : QUtil::string_to_uint(parameter)); o.m->collate = QIntC::to_size(n); return this; @@ -519,7 +519,7 @@ QPDFJob::Config::showXref() QPDFJob::Config* QPDFJob::Config::splitPages(char const* parameter) { - int n = ((parameter == 0) ? 1 : + int n = (((parameter == 0) || (strlen(parameter) == 0)) ? 1 : QUtil::string_to_int(parameter)); o.m->split_pages = n; return this; -- cgit v1.2.3-54-g00ecf