cpp: Avoid missing returns in non-void functions
authorAndreas Stieger <astieger@suse.com>
Wed, 21 Sep 2016 12:28:23 +0000 (14:28 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Wed, 21 Sep 2016 14:46:06 +0000 (16:46 +0200)
* lang/cpp/src/context.cpp
  (Context::signaturePolicyURL): return nullptr on default
  (to_tofu_policy_t): add default case for unknown
* lang/cpp/src/key.cpp
  (Key::primaryFingerprint): return nullptr on default
* lang/cpp/src/tofuinfo.cpp
  (GpgME::TofuInfo::policy): add default case for unknown

Signed-off-by: Andreas Stieger <astieger@suse.com>
Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
lang/cpp/src/context.cpp
lang/cpp/src/key.cpp
lang/cpp/src/tofuinfo.cpp

index 00f397b..43a73b1 100644 (file)
@@ -1051,6 +1051,7 @@ const char *Context::signaturePolicyURL() const
             return n->value;
         }
     }
+    return nullptr;
 }
 
 Notation Context::signatureNotation(unsigned int idx) const
@@ -1344,6 +1345,7 @@ static gpgme_tofu_policy_t to_tofu_policy_t(unsigned int policy)
         case TofuInfo::PolicyAsk:
             return GPGME_TOFU_POLICY_ASK;
         case TofuInfo::PolicyUnknown:
+        default:
             return GPGME_TOFU_POLICY_UNKNOWN;
     }
 }
index cfa1ba3..a56f77c 100644 (file)
@@ -273,6 +273,7 @@ const char *Key::primaryFingerprint() const
         /* Return the first subkeys fingerprint */
         return key->subkeys->fpr;
     }
+    return nullptr;
 }
 
 unsigned int Key::keyListMode() const
index bb67fc8..e661b3b 100644 (file)
@@ -109,6 +109,7 @@ GpgME::TofuInfo::Policy GpgME::TofuInfo::policy() const
         case GPGME_TOFU_POLICY_ASK:
             return PolicyAsk;
         case GPGME_TOFU_POLICY_UNKNOWN:
+        default:
             return PolicyUnknown;
     }
 }