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/configuration.cpp | 56 +++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'lang/cpp/src/configuration.cpp') 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