gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -fix misc enum confusions and ot


From: gnunet
Subject: [taler-exchange] branch master updated: -fix misc enum confusions and other compiler warnings
Date: Fri, 30 Jul 2021 13:32:05 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new d821db36 -fix misc enum confusions and other compiler warnings
d821db36 is described below

commit d821db366a9d2554c59e6450b352cddacd73b398
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jul 30 13:31:58 2021 +0200

    -fix misc enum confusions and other compiler warnings
---
 src/auditor/taler-auditor-sync.c                   |  2 +-
 src/auditor/taler-helper-auditor-wire.c            |  4 +--
 src/benchmark/taler-exchange-benchmark.c           |  2 +-
 src/exchange/taler-exchange-httpd_auditors.c       | 35 ++++++++++------------
 src/exchange/taler-exchange-httpd_db.h             |  2 +-
 .../taler-exchange-httpd_management_auditors.c     | 34 ++++++++++-----------
 ...exchange-httpd_management_auditors_AP_disable.c | 34 ++++++++++-----------
 .../taler-exchange-httpd_management_post_keys.c    | 25 +++++++++-------
 .../taler-exchange-httpd_management_wire.c         | 21 +++++++------
 .../taler-exchange-httpd_management_wire_disable.c | 22 ++++++++------
 .../taler-exchange-httpd_management_wire_fees.c    | 21 +++++++------
 src/mhd/mhd_responses.c                            |  2 +-
 12 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/src/auditor/taler-auditor-sync.c b/src/auditor/taler-auditor-sync.c
index 5f9111ce..ad55d7cc 100644
--- a/src/auditor/taler-auditor-sync.c
+++ b/src/auditor/taler-auditor-sync.c
@@ -327,7 +327,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
 static void
 do_sync (void *cls)
 {
-  struct GNUNET_TIME_Relative delay;
+  static struct GNUNET_TIME_Relative delay;
   struct TALER_EXCHANGEDB_Session *ss;
   struct TALER_EXCHANGEDB_Session *ds;
 
diff --git a/src/auditor/taler-helper-auditor-wire.c 
b/src/auditor/taler-helper-auditor-wire.c
index f98975c6..93834f46 100644
--- a/src/auditor/taler-helper-auditor-wire.c
+++ b/src/auditor/taler-helper-auditor-wire.c
@@ -1942,14 +1942,14 @@ begin_transaction (void)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to initialize exchange database session.\n");
-    return GNUNET_SYSERR;
+    return GNUNET_DB_STATUS_HARD_ERROR;
   }
   TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
   if (NULL == TALER_ARL_asession)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to initialize auditor database session.\n");
-    return GNUNET_SYSERR;
+    return GNUNET_DB_STATUS_HARD_ERROR;
   }
   if (GNUNET_OK !=
       TALER_ARL_adb->start (TALER_ARL_adb->cls,
diff --git a/src/benchmark/taler-exchange-benchmark.c 
b/src/benchmark/taler-exchange-benchmark.c
index bee66ff0..ee56805c 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -297,7 +297,7 @@ eval_probability (float probability)
 
   random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
                                      UINT64_MAX);
-  random_01 = (double) random / UINT64_MAX;
+  random_01 = (double) random / (double) UINT64_MAX;
   return (random_01 <= probability) ? GNUNET_OK : GNUNET_NO;
 }
 
diff --git a/src/exchange/taler-exchange-httpd_auditors.c 
b/src/exchange/taler-exchange-httpd_auditors.c
index 62bfc304..f3c061e3 100644
--- a/src/exchange/taler-exchange-httpd_auditors.c
+++ b/src/exchange/taler-exchange-httpd_auditors.c
@@ -209,27 +209,22 @@ TEH_handler_auditors (
                                  &awc.auditor_sig),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
   MHD_RESULT res;
-
-  {
-    enum GNUNET_GenericReturnValue res;
-
-    res = TALER_MHD_parse_json_data (connection,
-                                     root,
-                                     spec);
-    if (GNUNET_SYSERR == res)
-      return MHD_NO; /* hard failure */
-    if (GNUNET_NO == res)
-      return MHD_YES; /* failure */
-  }
-
-  qs = TEH_DB_run_transaction (connection,
-                               "add auditor denom sig",
-                               &res,
-                               &add_auditor_denom_sig,
-                               &awc);
-  if (qs < 0)
+  enum GNUNET_GenericReturnValue ret;
+
+  ret = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
+  if (GNUNET_SYSERR == ret)
+    return MHD_NO;   /* hard failure */
+  if (GNUNET_NO == ret)
+    return MHD_YES;   /* failure */
+  ret = TEH_DB_run_transaction (connection,
+                                "add auditor denom sig",
+                                &res,
+                                &add_auditor_denom_sig,
+                                &awc);
+  if (GNUNET_SYSERR == ret)
     return res;
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_db.h 
b/src/exchange/taler-exchange-httpd_db.h
index bc127b27..7e73340b 100644
--- a/src/exchange/taler-exchange-httpd_db.h
+++ b/src/exchange/taler-exchange-httpd_db.h
@@ -73,7 +73,7 @@ typedef enum GNUNET_DB_QueryStatus
  *
  * @param connection MHD connection to run @a cb for, can be NULL
  * @param name name of the transaction (for debugging)
- * @param[out] mhd_ret set to MHD response code, if transaction failed;
+ * @param[out] mhd_ret set to MHD response code, if transaction failed 
(returned #GNUNET_SYSERR);
  *             NULL if we are not running with a @a connection and thus
  *             must not queue MHD replies
  * @param cb callback implementing transaction logic
diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c 
b/src/exchange/taler-exchange-httpd_management_auditors.c
index f69580ec..77e7d865 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors.c
@@ -164,20 +164,16 @@ TEH_handler_management_auditors (
                                    &aac.validity_start),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
   MHD_RESULT res;
-
-  {
-    enum GNUNET_GenericReturnValue res;
-
-    res = TALER_MHD_parse_json_data (connection,
-                                     root,
-                                     spec);
-    if (GNUNET_SYSERR == res)
-      return MHD_NO; /* hard failure */
-    if (GNUNET_NO == res)
-      return MHD_YES; /* failure */
-  }
+  enum GNUNET_GenericReturnValue ret;
+
+  ret = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
+  if (GNUNET_SYSERR == ret)
+    return MHD_NO;   /* hard failure */
+  if (GNUNET_NO == ret)
+    return MHD_YES;   /* failure */
   if (GNUNET_OK !=
       TALER_exchange_offline_auditor_add_verify (
         &aac.auditor_pub,
@@ -194,12 +190,12 @@ TEH_handler_management_auditors (
       NULL);
   }
 
-  qs = TEH_DB_run_transaction (connection,
-                               "add auditor",
-                               &res,
-                               &add_auditor,
-                               &aac);
-  if (qs < 0)
+  ret = TEH_DB_run_transaction (connection,
+                                "add auditor",
+                                &res,
+                                &add_auditor,
+                                &aac);
+  if (GNUNET_SYSERR == ret)
     return res;
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c 
b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
index 7fb02283..382b0f6b 100644
--- a/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c
@@ -153,20 +153,16 @@ TEH_handler_management_auditors_AP_disable (
                                    &dac.validity_end),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
   MHD_RESULT res;
-
-  {
-    enum GNUNET_GenericReturnValue res;
-
-    res = TALER_MHD_parse_json_data (connection,
-                                     root,
-                                     spec);
-    if (GNUNET_SYSERR == res)
-      return MHD_NO; /* hard failure */
-    if (GNUNET_NO == res)
-      return MHD_YES; /* failure */
-  }
+  enum GNUNET_GenericReturnValue ret;
+
+  ret = TALER_MHD_parse_json_data (connection,
+                                   root,
+                                   spec);
+  if (GNUNET_SYSERR == ret)
+    return MHD_NO;   /* hard failure */
+  if (GNUNET_NO == ret)
+    return MHD_YES;   /* failure */
   if (GNUNET_OK !=
       TALER_exchange_offline_auditor_del_verify (
         auditor_pub,
@@ -182,12 +178,12 @@ TEH_handler_management_auditors_AP_disable (
       NULL);
   }
 
-  qs = TEH_DB_run_transaction (connection,
-                               "del auditor",
-                               &res,
-                               &del_auditor,
-                               &dac);
-  if (qs < 0)
+  ret = TEH_DB_run_transaction (connection,
+                                "del auditor",
+                                &res,
+                                &del_auditor,
+                                &dac);
+  if (GNUNET_SYSERR == ret)
     return res;
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c 
b/src/exchange/taler-exchange-httpd_management_post_keys.c
index 4fb65d41..0e4eb989 100644
--- a/src/exchange/taler-exchange-httpd_management_post_keys.c
+++ b/src/exchange/taler-exchange-httpd_management_post_keys.c
@@ -336,7 +336,6 @@ TEH_handler_management_post_keys (
                            &signkey_sigs),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
   bool ok;
   MHD_RESULT ret;
 
@@ -444,16 +443,20 @@ TEH_handler_management_post_keys (
               "Received %u denomination and %u signing key signatures\n",
               akc.nd_sigs,
               akc.ns_sigs);
-  qs = TEH_DB_run_transaction (connection,
-                               "add keys",
-                               &ret,
-                               &add_keys,
-                               &akc);
-  GNUNET_free (akc.d_sigs);
-  GNUNET_free (akc.s_sigs);
-  GNUNET_JSON_parse_free (spec);
-  if (qs < 0)
-    return ret;
+  {
+    enum GNUNET_GenericReturnValue res;
+
+    res = TEH_DB_run_transaction (connection,
+                                  "add keys",
+                                  &ret,
+                                  &add_keys,
+                                  &akc);
+    GNUNET_free (akc.d_sigs);
+    GNUNET_free (akc.s_sigs);
+    GNUNET_JSON_parse_free (spec);
+    if (GNUNET_SYSERR == res)
+      return ret;
+  }
   TEH_keys_update_states ();
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_management_wire.c 
b/src/exchange/taler-exchange-httpd_management_wire.c
index 83c3bbed..e3a31c1e 100644
--- a/src/exchange/taler-exchange-httpd_management_wire.c
+++ b/src/exchange/taler-exchange-httpd_management_wire.c
@@ -156,8 +156,6 @@ TEH_handler_management_denominations_wire (
                                    &awc.validity_start),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
-  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -213,13 +211,18 @@ TEH_handler_management_denominations_wire (
     GNUNET_free (wire_method);
   }
 
-  qs = TEH_DB_run_transaction (connection,
-                               "add wire",
-                               &ret,
-                               &add_wire,
-                               &awc);
-  if (qs < 0)
-    return ret;
+  {
+    enum GNUNET_GenericReturnValue res;
+    MHD_RESULT ret;
+
+    res = TEH_DB_run_transaction (connection,
+                                  "add wire",
+                                  &ret,
+                                  &add_wire,
+                                  &awc);
+    if (GNUNET_SYSERR == res)
+      return ret;
+  }
   TEH_wire_update_state ();
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c 
b/src/exchange/taler-exchange-httpd_management_wire_disable.c
index 67cf3015..0d446bca 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_disable.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c
@@ -148,8 +148,6 @@ TEH_handler_management_denominations_wire_disable (
                                    &awc.validity_end),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
-  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -176,13 +174,19 @@ TEH_handler_management_denominations_wire_disable (
       TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID,
       NULL);
   }
-  qs = TEH_DB_run_transaction (connection,
-                               "del wire",
-                               &ret,
-                               &del_wire,
-                               &awc);
-  if (qs < 0)
-    return ret;
+
+  {
+    enum GNUNET_GenericReturnValue res;
+    MHD_RESULT ret;
+
+    res = TEH_DB_run_transaction (connection,
+                                  "del wire",
+                                  &ret,
+                                  &del_wire,
+                                  &awc);
+    if (GNUNET_SYSERR == res)
+      return ret;
+  }
   TEH_wire_update_state ();
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/exchange/taler-exchange-httpd_management_wire_fees.c 
b/src/exchange/taler-exchange-httpd_management_wire_fees.c
index 0a8bf4d1..5486ff33 100644
--- a/src/exchange/taler-exchange-httpd_management_wire_fees.c
+++ b/src/exchange/taler-exchange-httpd_management_wire_fees.c
@@ -187,8 +187,6 @@ TEH_handler_management_post_wire_fees (
                             &afc.wire_fee),
     GNUNET_JSON_spec_end ()
   };
-  enum GNUNET_DB_QueryStatus qs;
-  MHD_RESULT ret;
 
   {
     enum GNUNET_GenericReturnValue res;
@@ -221,13 +219,18 @@ TEH_handler_management_post_wire_fees (
       NULL);
   }
 
-  qs = TEH_DB_run_transaction (connection,
-                               "add wire fee",
-                               &ret,
-                               &add_fee,
-                               &afc);
-  if (qs < 0)
-    return ret;
+  {
+    enum GNUNET_GenericReturnValue res;
+    MHD_RESULT ret;
+
+    res = TEH_DB_run_transaction (connection,
+                                  "add wire fee",
+                                  &ret,
+                                  &add_fee,
+                                  &afc);
+    if (GNUNET_SYSERR == res)
+      return ret;
+  }
   TEH_wire_update_state ();
   return TALER_MHD_reply_static (
     connection,
diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c
index befd5631..6b96de55 100644
--- a/src/mhd/mhd_responses.c
+++ b/src/mhd/mhd_responses.c
@@ -323,7 +323,7 @@ TALER_MHD_make_json_pack (const char *fmt,
                 fmt,
                 jerror.text);
     GNUNET_break (0);
-    return MHD_NO;
+    return NULL;
   }
 
   {

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]