summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-01 19:49:11 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-01 19:50:58 +0100
commit42bff9f4584362f2084033795896c2e891274631 (patch)
tree4c317d9db160535848b036f47dd646884e1d6ab0 /include
parenta0d9d9923ce397d46680a9b180f253b39135ece2 (diff)
downloadqpdf-42bff9f4584362f2084033795896c2e891274631.tar.zst
QPDFJob: let initializeFromArgv just take argv, not argc
Let argv be a null-terminated array. There is already code that assumes this, and it makes it easier to construct the arguments.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFJob.hh41
-rw-r--r--include/qpdf/qpdfjob-c.h10
2 files changed, 26 insertions, 25 deletions
diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh
index 44ec723c..df51828b 100644
--- a/include/qpdf/QPDFJob.hh
+++ b/include/qpdf/QPDFJob.hh
@@ -57,27 +57,28 @@ class QPDFJob
// SETUP FUNCTIONS
- // Initialize a QPDFJob object from argv. The progname_env
- // argument is the name of an environment variable which, if set,
- // overrides the name of the executable for purposes of generating
- // the --completion options. See QPDFArgParser for details. If a
- // null pointer is passed in, the default value of
- // "QPDF_EXECUTABLE" is used. This is used by the QPDF cli, which
- // just initializes a QPDFJob from argv, calls run(), and handles
- // errors and exit status issues. You can perform much of the cli
- // functionality programmatically in this way rather than using
- // the regular API. This is exposed in the C API, which makes it
- // easier to get certain high-level qpdf functionality from other
- // languages. If there are any command-line errors, this method
- // will throw QPDFUsage which is derived from std::runtime_error.
- // Other exceptions may be thrown in some cases. Note that argc,
- // and argv should be UTF-8 encoded. If you are calling this from
- // a Windows Unicode-aware main (wmain), see
- // QUtil::call_main_from_wmain for information about converting
- // arguments to UTF-8. This method will mutate arguments that are
- // passed to it.
+ // Initialize a QPDFJob object from argv, which must be a
+ // null-terminated array of null-terminated UTF-8-encoded C
+ // strings. The progname_env argument is the name of an
+ // environment variable which, if set, overrides the name of the
+ // executable for purposes of generating the --completion options.
+ // See QPDFArgParser for details. If a null pointer is passed in,
+ // the default value of "QPDF_EXECUTABLE" is used. This is used by
+ // the QPDF cli, which just initializes a QPDFJob from argv, calls
+ // run(), and handles errors and exit status issues. You can
+ // perform much of the cli functionality programmatically in this
+ // way rather than using the regular API. This is exposed in the C
+ // API, which makes it easier to get certain high-level qpdf
+ // functionality from other languages. If there are any
+ // command-line errors, this method will throw QPDFUsage which is
+ // derived from std::runtime_error. Other exceptions may be thrown
+ // in some cases. Note that argc, and argv should be UTF-8
+ // encoded. If you are calling this from a Windows Unicode-aware
+ // main (wmain), see QUtil::call_main_from_wmain for information
+ // about converting arguments to UTF-8. This method will mutate
+ // arguments that are passed to it.
QPDF_DLL
- void initializeFromArgv(int argc, char const* const argv[],
+ void initializeFromArgv(char const* const argv[],
char const* progname_env = nullptr);
// Initialize a QPDFJob from json. Passing partial = true prevents
diff --git a/include/qpdf/qpdfjob-c.h b/include/qpdf/qpdfjob-c.h
index 3fc3ec30..0a390877 100644
--- a/include/qpdf/qpdfjob-c.h
+++ b/include/qpdf/qpdfjob-c.h
@@ -47,12 +47,12 @@ extern "C" {
#endif
/* This function does the equivalent of running the qpdf
* command-line with the given arguments and returns the exit code
- * that qpdf would use. Note that arguments must be UTF8-encoded.
- * If calling this from wmain on Windows, use
- * qpdfjob_run_from_wide_argv instead.
+ * that qpdf would use. argv must be a null-terminated array of
+ * null-terminated UTF8-encoded strings. If calling this from
+ * wmain on Windows, use qpdfjob_run_from_wide_argv instead.
*/
QPDF_DLL
- int qpdfjob_run_from_argv(int argc, char const* const argv[]);
+ int qpdfjob_run_from_argv(char const* const argv[]);
#ifndef QPDF_NO_WCHAR_T
/* This function is the same as qpdfjob_run_from_argv except argv
@@ -60,7 +60,7 @@ extern "C" {
* calling from a Windows wmain function.
*/
QPDF_DLL
- int qpdfjob_run_from_wide_argv(int argc, wchar_t const* const argv[]);
+ int qpdfjob_run_from_wide_argv(wchar_t const* const argv[]);
#endif /* QPDF_NO_WCHAR_T */
/* This function runs QPDFJob from a job JSON file. See the "QPDF