From 649b19688132dd315e361c0f5b63ba6d8f45996d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 3 Dec 2018 10:40:52 +0100 Subject: doc: Minor comment cleanups. -- Signed-off-by: Werner Koch --- doc/gpgme.texi | 6 +++--- lang/python/doc/rst/gpgme-python-howto.rst | 12 +++--------- src/gpgme.c | 2 ++ 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 7d410f83..e04c301a 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -2461,9 +2461,9 @@ the context @var{ctx} to @var{proto}. All crypto operations will be performed by the crypto engine configured for that protocol. @xref{Protocols and Engines}. -Setting the protocol with @code{gpgme_set_protocol} does not check if -the crypto engine for that protocol is available and installed -correctly. @xref{Engine Version Check}. +Setting the protocol with @code{gpgme_set_protocol} does intentionally +not check if the crypto engine for that protocol is available and +installed correctly. @xref{Engine Version Check}. The function returns the error code @code{GPG_ERR_NO_ERROR} if the protocol could be set successfully, and @code{GPG_ERR_INV_VALUE} if diff --git a/lang/python/doc/rst/gpgme-python-howto.rst b/lang/python/doc/rst/gpgme-python-howto.rst index d1cb3fd3..71dd72a9 100644 --- a/lang/python/doc/rst/gpgme-python-howto.rst +++ b/lang/python/doc/rst/gpgme-python-howto.rst @@ -8,16 +8,10 @@ Introduction +-----------------------------------+-----------------------------------+ | GPGME Version: | 1.12.1 | +-----------------------------------+-----------------------------------+ -| Author: | `Ben | -| | McGinnes `__ | -| | | +| Author: | Ben McGinnes | +-----------------------------------+-----------------------------------+ -| Author GPG Key: | `DB4724E6FA4286C92B4E55C4321E4E23 | -| | 73590E5D `__ | +| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E23 | +| | 73590E5D | +-----------------------------------+-----------------------------------+ | Language: | Australian English, British | | | English | diff --git a/src/gpgme.c b/src/gpgme.c index a0a6c6bc..65a2e309 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -320,6 +320,8 @@ _gpgme_release_result (gpgme_ctx_t ctx) } +/* Note that setting the protocol will intentionally not fail if the + * engine is not available. */ gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t protocol) { -- cgit v1.2.3 From 1d31420650bfa7ca1d1503cc7431b3360e86022c Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Mon, 3 Dec 2018 12:20:33 +0100 Subject: qt,cpp: Consistently use nullptr and override * lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am (AM_CPPFLAGS): Add suggest-override and zero-as-null-pointer-constant warnings. * lang/cpp/src/*, lang/qt/src/*: Consistenly use nullptr and override. -- This was especially important for the headers so that downstream users of GpgME++ or QGpgME do not get flooded by warnings if they have these warnings enabled. It also improves compiler errors/warnings in case of accidental mistakes. --- lang/cpp/src/Makefile.am | 3 +- lang/cpp/src/callbacks.cpp | 2 +- lang/cpp/src/configuration.cpp | 56 +++++----- lang/cpp/src/configuration.h | 4 +- lang/cpp/src/context.cpp | 139 ++++++++++++------------ lang/cpp/src/context.h | 4 +- lang/cpp/src/context_p.h | 2 +- lang/cpp/src/context_vanilla.cpp | 4 +- lang/cpp/src/data.cpp | 30 ++--- lang/cpp/src/data_p.h | 2 +- lang/cpp/src/decryptionresult.cpp | 18 +-- lang/cpp/src/defaultassuantransaction.h | 6 +- lang/cpp/src/editinteractor.cpp | 2 +- lang/cpp/src/encryptionresult.cpp | 6 +- lang/cpp/src/engineinfo.cpp | 12 +- lang/cpp/src/eventloopinteractor.cpp | 10 +- lang/cpp/src/global.h | 2 +- lang/cpp/src/gpgadduserideditinteractor.cpp | 4 +- lang/cpp/src/gpgadduserideditinteractor.h | 4 +- lang/cpp/src/gpgagentgetinfoassuantransaction.h | 8 +- lang/cpp/src/gpggencardkeyinteractor.cpp | 4 +- lang/cpp/src/gpggencardkeyinteractor.h | 4 +- lang/cpp/src/gpgsetexpirytimeeditinteractor.cpp | 4 +- lang/cpp/src/gpgsetexpirytimeeditinteractor.h | 4 +- lang/cpp/src/gpgsetownertrusteditinteractor.cpp | 4 +- lang/cpp/src/gpgsetownertrusteditinteractor.h | 4 +- lang/cpp/src/gpgsignkeyeditinteractor.cpp | 4 +- lang/cpp/src/gpgsignkeyeditinteractor.h | 4 +- lang/cpp/src/importresult.cpp | 8 +- lang/cpp/src/key.cpp | 58 +++++----- lang/cpp/src/keygenerationresult.cpp | 4 +- lang/cpp/src/scdgetinfoassuantransaction.h | 8 +- lang/cpp/src/signingresult.cpp | 12 +- lang/cpp/src/trustitem.cpp | 10 +- lang/cpp/src/trustitem.h | 2 +- lang/cpp/src/verificationresult.cpp | 46 ++++---- lang/cpp/src/vfsmountresult.cpp | 4 +- lang/qt/src/Makefile.am | 3 +- lang/qt/src/cryptoconfig.h | 4 +- lang/qt/src/dataprovider.h | 20 ++-- lang/qt/src/dn.cpp | 2 +- lang/qt/src/multideletejob.cpp | 6 +- lang/qt/src/protocol_p.h | 74 ++++++------- lang/qt/src/qgpgmebackend.cpp | 16 +-- lang/qt/src/qgpgmedecryptjob.cpp | 2 +- lang/qt/src/qgpgmedecryptverifyjob.cpp | 2 +- lang/qt/src/qgpgmeencryptjob.cpp | 2 +- lang/qt/src/qgpgmekeylistjob.cpp | 2 +- lang/qt/src/qgpgmelistallkeysjob.cpp | 4 +- lang/qt/src/qgpgmerefreshkeysjob.cpp | 6 +- lang/qt/src/qgpgmesecretkeyexportjob.cpp | 6 +- lang/qt/src/qgpgmesignencryptjob.cpp | 2 +- lang/qt/src/qgpgmesignjob.cpp | 2 +- lang/qt/src/qgpgmeverifyopaquejob.cpp | 2 +- lang/qt/src/threadedjobmixin.cpp | 10 +- lang/qt/src/threadedjobmixin.h | 2 +- 56 files changed, 336 insertions(+), 333 deletions(-) diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index 1e6bdc28..1b1de327 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -66,7 +66,8 @@ libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \ $(interface_headers) $(private_gpgmepp_headers) AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ - -DBUILDING_GPGMEPP + -DBUILDING_GPGMEPP -Wsuggest-override \ + -Wzero-as-null-pointer-constant libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@ libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ diff --git a/lang/cpp/src/callbacks.cpp b/lang/cpp/src/callbacks.cpp index f7692a03..21c2a813 100644 --- a/lang/cpp/src/callbacks.cpp +++ b/lang/cpp/src/callbacks.cpp @@ -76,7 +76,7 @@ gpgme_error_t passphrase_callback(void *opaque, const char *uid_hint, const char PassphraseProvider *provider = static_cast(opaque); bool canceled = false; gpgme_error_t err = GPG_ERR_NO_ERROR; - char *passphrase = provider ? provider->getPassphrase(uid_hint, desc, prev_was_bad, canceled) : 0 ; + char *passphrase = provider ? provider->getPassphrase(uid_hint, desc, prev_was_bad, canceled) : nullptr ; if (canceled) { err = make_error(GPG_ERR_CANCELED); } else { diff --git a/lang/cpp/src/configuration.cpp b/lang/cpp/src/configuration.cpp index 8ccc05e9..33c812f7 100644 --- a/lang/cpp/src/configuration.cpp +++ b/lang/cpp/src/configuration.cpp @@ -64,7 +64,7 @@ std::vector Component::load(Error &returnedError) // // 1. get a context: // - gpgme_ctx_t ctx_native = 0; + gpgme_ctx_t ctx_native = nullptr; if (const gpgme_error_t err = gpgme_new(&ctx_native)) { returnedError = Error(err); return std::vector(); @@ -74,7 +74,7 @@ std::vector Component::load(Error &returnedError) // // 2. load the config: // - gpgme_conf_comp_t conf_list_native = 0; + gpgme_conf_comp_t conf_list_native = nullptr; if (const gpgme_error_t err = gpgme_op_conf_load(ctx_native, &conf_list_native)) { returnedError = Error(err); return std::vector(); @@ -94,7 +94,7 @@ std::vector Component::load(Error &returnedError) } // now prevent double-free of next.get() and following: - head->next = 0; + head->next = nullptr; // now add a new Component to 'result' (may throw): result.resize(result.size() + 1); @@ -115,7 +115,7 @@ Error Component::save() const // // 1. get a context: // - gpgme_ctx_t ctx_native = 0; + gpgme_ctx_t ctx_native = nullptr; if (const gpgme_error_t err = gpgme_new(&ctx_native)) { return Error(err); } @@ -129,22 +129,22 @@ Error Component::save() const const char *Component::name() const { - return comp ? comp->name : 0 ; + return comp ? comp->name : nullptr; } const char *Component::description() const { - return comp ? comp->description : 0 ; + return comp ? comp->description : nullptr ; } const char *Component::programName() const { - return comp ? comp->program_name : 0 ; + return comp ? comp->program_name : nullptr ; } Option Component::option(unsigned int idx) const { - gpgme_conf_opt_t opt = 0; + gpgme_conf_opt_t opt = nullptr; if (comp) { opt = comp->options; } @@ -160,7 +160,7 @@ Option Component::option(unsigned int idx) const Option Component::option(const char *name) const { - gpgme_conf_opt_t opt = 0; + gpgme_conf_opt_t opt = nullptr; if (comp) { opt = comp->options; } @@ -177,7 +177,7 @@ Option Component::option(const char *name) const unsigned int Component::numOptions() const { unsigned int result = 0; - for (gpgme_conf_opt_t opt = comp ? comp->options : 0 ; opt ; opt = opt->next) { + for (gpgme_conf_opt_t opt = comp ? comp->options : nullptr ; opt ; opt = opt->next) { ++result; } return result; @@ -186,7 +186,7 @@ unsigned int Component::numOptions() const std::vector