]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
auth: Fix 'value is never actually read' warnings from clang++ 10
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2020 12:32:33 +0000 (14:32 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Apr 2020 12:32:33 +0000 (14:32 +0200)
modules/gmysqlbackend/smysql.cc
pdns/misc.cc
pdns/pkcs11signers.cc

index 74087425e262d9462638628033df0ff56c18e238..152c987739907f72f7ae1b6c80ba2c72e5f42b4c 100644 (file)
@@ -181,8 +181,6 @@ public:
   }
 
   SSqlStatement* execute() {
-    int err;
-
     prepareStatement();
 
     if (!d_stmt) return this;
@@ -192,20 +190,20 @@ public:
       d_dtime.set();
     }
 
-    if ((err = mysql_stmt_bind_param(d_stmt, d_req_bind))) {
+    if (mysql_stmt_bind_param(d_stmt, d_req_bind) != 0) {
       string error(mysql_stmt_error(d_stmt));
       releaseStatement();
       throw SSqlException("Could not bind mysql statement: " + d_query + string(": ") + error);
     }
 
-    if ((err = mysql_stmt_execute(d_stmt))) {
+    if (mysql_stmt_execute(d_stmt) != 0) {
       string error(mysql_stmt_error(d_stmt));
       releaseStatement();
       throw SSqlException("Could not execute mysql statement: " + d_query + string(": ") + error);
     }
 
     // MySQL documentation says you can call this safely for all queries
-    if ((err = mysql_stmt_store_result(d_stmt))) {
+    if (mysql_stmt_store_result(d_stmt) != 0) {
       string error(mysql_stmt_error(d_stmt));
       releaseStatement();
       throw SSqlException("Could not store mysql statement: " + d_query + string(": ") + error);
@@ -241,7 +239,7 @@ public:
          stmt->bind_result_done to false, causing the second to reset the existing binding),
          and we can't bind it right after the call to mysql_stmt_store_result() if it returned
          no rows, because then the statement 'contains no metadata' */
-      if (d_res_bind != nullptr && (err = mysql_stmt_bind_result(d_stmt, d_res_bind))) {
+      if (d_res_bind != nullptr && mysql_stmt_bind_result(d_stmt, d_res_bind) != 0) {
         string error(mysql_stmt_error(d_stmt));
         releaseStatement();
         throw SSqlException("Could not bind parameters to mysql statement: " + d_query + string(": ") + error);
@@ -295,7 +293,7 @@ public:
     if (d_residx >= d_resnum) {
       mysql_stmt_free_result(d_stmt);
       while(!mysql_stmt_next_result(d_stmt)) {
-        if ((err = mysql_stmt_store_result(d_stmt))) {
+        if (mysql_stmt_store_result(d_stmt) != 0) {
           string error(mysql_stmt_error(d_stmt));
           releaseStatement();
           throw SSqlException("Could not store mysql statement while processing additional sets: " + d_query + string(": ") + error);
@@ -304,7 +302,7 @@ public:
         // XXX: For some reason mysql_stmt_result_metadata returns NULL here, so we cannot
         // ensure row field count matches first result set.
         if (d_resnum > 0) { // ignore empty result set
-          if (d_res_bind != nullptr && (err = mysql_stmt_bind_result(d_stmt, d_res_bind))) {
+          if (d_res_bind != nullptr && mysql_stmt_bind_result(d_stmt, d_res_bind) != 0) {
             string error(mysql_stmt_error(d_stmt));
             releaseStatement();
             throw SSqlException("Could not bind parameters to mysql statement: " + d_query + string(": ") + error);
@@ -367,8 +365,6 @@ public:
 private:
 
   void prepareStatement() {
-    int err;
-
     if (d_prepared) return;
     if (d_query.empty()) {
       d_prepared = true;
@@ -378,7 +374,7 @@ private:
     if ((d_stmt = mysql_stmt_init(d_db))==NULL)
       throw SSqlException("Could not initialize mysql statement, out of memory: " + d_query);
 
-    if ((err = mysql_stmt_prepare(d_stmt, d_query.c_str(), d_query.size()))) {
+    if (mysql_stmt_prepare(d_stmt, d_query.c_str(), d_query.size()) != 0) {
       string error(mysql_stmt_error(d_stmt));
       releaseStatement();
       throw SSqlException("Could not prepare statement: " + d_query + string(": ") + error);
index af33b56e3eb0f5009c728623872d695bdadd6d5c..2d22f380898708c0ad2a78a3fb1b14e84468c8b4 100644 (file)
@@ -777,9 +777,8 @@ int makeIPv6sockaddr(const std::string& addr, struct sockaddr_in6* ret)
     hints.ai_family = AF_INET6;
     hints.ai_flags = AI_NUMERICHOST;
 
-    int error;
     // getaddrinfo has anomalous return codes, anything nonzero is an error, positive or negative
-    if((error=getaddrinfo(ourAddr.c_str(), 0, &hints, &res))) {
+    if (getaddrinfo(ourAddr.c_str(), 0, &hints, &res) != 0) {
       return -1;
     }
 
index 1d3c5ffb627802c76abc4a985d314030703dc4b7..c999a573934de6c0d40acba6c401713b9c5ca8d6 100644 (file)
@@ -784,7 +784,6 @@ void PKCS11DNSCryptoKeyEngine::create(unsigned int bits) {
   std::vector<P11KitAttribute> privAttr;
   CK_MECHANISM mech;
   CK_OBJECT_HANDLE pubKey, privKey;
-  CK_RV rv;
   std::shared_ptr<Pkcs11Token> d_slot;
   d_slot = Pkcs11Token::GetToken(d_module, d_slot_id, d_label, d_pub_label);
   if (d_slot->LoggedIn() == false)
@@ -819,7 +818,7 @@ void PKCS11DNSCryptoKeyEngine::create(unsigned int bits) {
   mech.pParameter = NULL;
   mech.ulParameterLen = 0;
 
-  if ((rv = d_slot->GenerateKeyPair(&mech, pubAttr, privAttr, &pubKey, &privKey))) {
+  if (d_slot->GenerateKeyPair(&mech, pubAttr, privAttr, &pubKey, &privKey)) {
     throw PDNSException("Keypair generation failed");
   }
 };