summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorSune Vuorela <sune@vuorela.dk>2023-03-17 14:08:42 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2023-03-18 11:02:48 +0000
commit8787103a43732440e1994c6c72d99a4717af8b95 (patch)
tree19aa8074e8877e24503cf321c67e8ca26737dbd5 /utils
parentb39c8cd2bc7757b3c1c4756de345702f852a4706 (diff)
Switch some const char* to std string
Also move the weirdness (empty password is nullptr) close to usage, rather than have it as far away as possible.
Diffstat (limited to 'utils')
-rw-r--r--utils/pdfsig.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/utils/pdfsig.cc b/utils/pdfsig.cc
index ee6d9881..c090f1dc 100644
--- a/utils/pdfsig.cc
+++ b/utils/pdfsig.cc
@@ -355,7 +355,6 @@ int main(int argc, char *argv[])
return 2;
}
- const char *pw = (strlen(password) == 0) ? nullptr : password;
const auto rs = std::unique_ptr<GooString>(reason.toStr().empty() ? nullptr : utf8ToUtf16WithBom(reason.toStr()));
if (newSignatureFieldName.getLength() == 0) {
@@ -371,7 +370,7 @@ int main(int argc, char *argv[])
}
// We don't provide a way to customize the UI from pdfsig for now
- const bool success = doc->sign(argv[2], certNickname, pw, newSignatureFieldName.copy(), /*page*/ 1,
+ const bool success = doc->sign(std::string { argv[2] }, std::string { certNickname }, std::string { password }, newSignatureFieldName.copy(), /*page*/ 1,
/*rect */ { 0, 0, 0, 0 }, /*signatureText*/ {}, /*signatureTextLeft*/ {}, /*fontSize */ 0, /*leftFontSize*/ 0,
/*fontColor*/ {}, /*borderWidth*/ 0, /*borderColor*/ {}, /*backgroundColor*/ {}, rs.get(), /* location */ nullptr, /* image path */ "", ownerPW, userPW);
return success ? 0 : 3;