summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-30 13:31:58 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-30 13:32:03 +0200
commitd821db366a9d2554c59e6450b352cddacd73b398 (patch)
tree73793e12119025b604050f7a637c18c17c473125 /src
parent05bc00b5f226e6e6695ef00609a02549284c8f55 (diff)
downloadexchange-d821db366a9d2554c59e6450b352cddacd73b398.tar.gz
exchange-d821db366a9d2554c59e6450b352cddacd73b398.tar.bz2
exchange-d821db366a9d2554c59e6450b352cddacd73b398.zip
-fix misc enum confusions and other compiler warnings
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-auditor-sync.c2
-rw-r--r--src/auditor/taler-helper-auditor-wire.c4
-rw-r--r--src/benchmark/taler-exchange-benchmark.c2
-rw-r--r--src/exchange/taler-exchange-httpd_auditors.c35
-rw-r--r--src/exchange/taler-exchange-httpd_db.h2
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors.c34
-rw-r--r--src/exchange/taler-exchange-httpd_management_auditors_AP_disable.c34
-rw-r--r--src/exchange/taler-exchange-httpd_management_post_keys.c25
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire.c21
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_disable.c22
-rw-r--r--src/exchange/taler-exchange-httpd_management_wire_fees.c21
-rw-r--r--src/mhd/mhd_responses.c2
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;
}
{