-fix misc enum confusions and other compiler warnings

This commit is contained in:
Christian Grothoff 2021-07-30 13:31:58 +02:00
parent 05bc00b5f2
commit d821db366a
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
12 changed files with 99 additions and 99 deletions

View File

@ -327,7 +327,7 @@ transact (struct TALER_EXCHANGEDB_Session *ss,
static void static void
do_sync (void *cls) do_sync (void *cls)
{ {
struct GNUNET_TIME_Relative delay; static struct GNUNET_TIME_Relative delay;
struct TALER_EXCHANGEDB_Session *ss; struct TALER_EXCHANGEDB_Session *ss;
struct TALER_EXCHANGEDB_Session *ds; struct TALER_EXCHANGEDB_Session *ds;

View File

@ -1942,14 +1942,14 @@ begin_transaction (void)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize exchange database session.\n"); "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); TALER_ARL_asession = TALER_ARL_adb->get_session (TALER_ARL_adb->cls);
if (NULL == TALER_ARL_asession) if (NULL == TALER_ARL_asession)
{ {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to initialize auditor database session.\n"); "Failed to initialize auditor database session.\n");
return GNUNET_SYSERR; return GNUNET_DB_STATUS_HARD_ERROR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_ARL_adb->start (TALER_ARL_adb->cls, TALER_ARL_adb->start (TALER_ARL_adb->cls,

View File

@ -297,7 +297,7 @@ eval_probability (float probability)
random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, random = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK,
UINT64_MAX); UINT64_MAX);
random_01 = (double) random / UINT64_MAX; random_01 = (double) random / (double) UINT64_MAX;
return (random_01 <= probability) ? GNUNET_OK : GNUNET_NO; return (random_01 <= probability) ? GNUNET_OK : GNUNET_NO;
} }

View File

@ -209,27 +209,22 @@ TEH_handler_auditors (
&awc.auditor_sig), &awc.auditor_sig),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT res; MHD_RESULT res;
enum GNUNET_GenericReturnValue ret;
{ ret = TALER_MHD_parse_json_data (connection,
enum GNUNET_GenericReturnValue res; root,
spec);
res = TALER_MHD_parse_json_data (connection, if (GNUNET_SYSERR == ret)
root, return MHD_NO; /* hard failure */
spec); if (GNUNET_NO == ret)
if (GNUNET_SYSERR == res) return MHD_YES; /* failure */
return MHD_NO; /* hard failure */ ret = TEH_DB_run_transaction (connection,
if (GNUNET_NO == res) "add auditor denom sig",
return MHD_YES; /* failure */ &res,
} &add_auditor_denom_sig,
&awc);
qs = TEH_DB_run_transaction (connection, if (GNUNET_SYSERR == ret)
"add auditor denom sig",
&res,
&add_auditor_denom_sig,
&awc);
if (qs < 0)
return res; return res;
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -73,7 +73,7 @@ typedef enum GNUNET_DB_QueryStatus
* *
* @param connection MHD connection to run @a cb for, can be NULL * @param connection MHD connection to run @a cb for, can be NULL
* @param name name of the transaction (for debugging) * @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 * NULL if we are not running with a @a connection and thus
* must not queue MHD replies * must not queue MHD replies
* @param cb callback implementing transaction logic * @param cb callback implementing transaction logic

View File

@ -164,20 +164,16 @@ TEH_handler_management_auditors (
&aac.validity_start), &aac.validity_start),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT res; MHD_RESULT res;
enum GNUNET_GenericReturnValue ret;
{ ret = TALER_MHD_parse_json_data (connection,
enum GNUNET_GenericReturnValue res; root,
spec);
res = TALER_MHD_parse_json_data (connection, if (GNUNET_SYSERR == ret)
root, return MHD_NO; /* hard failure */
spec); if (GNUNET_NO == ret)
if (GNUNET_SYSERR == res) return MHD_YES; /* failure */
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
return MHD_YES; /* failure */
}
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_offline_auditor_add_verify ( TALER_exchange_offline_auditor_add_verify (
&aac.auditor_pub, &aac.auditor_pub,
@ -194,12 +190,12 @@ TEH_handler_management_auditors (
NULL); NULL);
} }
qs = TEH_DB_run_transaction (connection, ret = TEH_DB_run_transaction (connection,
"add auditor", "add auditor",
&res, &res,
&add_auditor, &add_auditor,
&aac); &aac);
if (qs < 0) if (GNUNET_SYSERR == ret)
return res; return res;
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -153,20 +153,16 @@ TEH_handler_management_auditors_AP_disable (
&dac.validity_end), &dac.validity_end),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT res; MHD_RESULT res;
enum GNUNET_GenericReturnValue ret;
{ ret = TALER_MHD_parse_json_data (connection,
enum GNUNET_GenericReturnValue res; root,
spec);
res = TALER_MHD_parse_json_data (connection, if (GNUNET_SYSERR == ret)
root, return MHD_NO; /* hard failure */
spec); if (GNUNET_NO == ret)
if (GNUNET_SYSERR == res) return MHD_YES; /* failure */
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
return MHD_YES; /* failure */
}
if (GNUNET_OK != if (GNUNET_OK !=
TALER_exchange_offline_auditor_del_verify ( TALER_exchange_offline_auditor_del_verify (
auditor_pub, auditor_pub,
@ -182,12 +178,12 @@ TEH_handler_management_auditors_AP_disable (
NULL); NULL);
} }
qs = TEH_DB_run_transaction (connection, ret = TEH_DB_run_transaction (connection,
"del auditor", "del auditor",
&res, &res,
&del_auditor, &del_auditor,
&dac); &dac);
if (qs < 0) if (GNUNET_SYSERR == ret)
return res; return res;
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -336,7 +336,6 @@ TEH_handler_management_post_keys (
&signkey_sigs), &signkey_sigs),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
bool ok; bool ok;
MHD_RESULT ret; MHD_RESULT ret;
@ -444,16 +443,20 @@ TEH_handler_management_post_keys (
"Received %u denomination and %u signing key signatures\n", "Received %u denomination and %u signing key signatures\n",
akc.nd_sigs, akc.nd_sigs,
akc.ns_sigs); akc.ns_sigs);
qs = TEH_DB_run_transaction (connection, {
"add keys", enum GNUNET_GenericReturnValue res;
&ret,
&add_keys, res = TEH_DB_run_transaction (connection,
&akc); "add keys",
GNUNET_free (akc.d_sigs); &ret,
GNUNET_free (akc.s_sigs); &add_keys,
GNUNET_JSON_parse_free (spec); &akc);
if (qs < 0) GNUNET_free (akc.d_sigs);
return ret; GNUNET_free (akc.s_sigs);
GNUNET_JSON_parse_free (spec);
if (GNUNET_SYSERR == res)
return ret;
}
TEH_keys_update_states (); TEH_keys_update_states ();
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -156,8 +156,6 @@ TEH_handler_management_denominations_wire (
&awc.validity_start), &awc.validity_start),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT ret;
{ {
enum GNUNET_GenericReturnValue res; enum GNUNET_GenericReturnValue res;
@ -213,13 +211,18 @@ TEH_handler_management_denominations_wire (
GNUNET_free (wire_method); GNUNET_free (wire_method);
} }
qs = TEH_DB_run_transaction (connection, {
"add wire", enum GNUNET_GenericReturnValue res;
&ret, MHD_RESULT ret;
&add_wire,
&awc); res = TEH_DB_run_transaction (connection,
if (qs < 0) "add wire",
return ret; &ret,
&add_wire,
&awc);
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state (); TEH_wire_update_state ();
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -148,8 +148,6 @@ TEH_handler_management_denominations_wire_disable (
&awc.validity_end), &awc.validity_end),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT ret;
{ {
enum GNUNET_GenericReturnValue res; enum GNUNET_GenericReturnValue res;
@ -176,13 +174,19 @@ TEH_handler_management_denominations_wire_disable (
TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID, TALER_EC_EXCHANGE_MANAGEMENT_WIRE_DEL_SIGNATURE_INVALID,
NULL); NULL);
} }
qs = TEH_DB_run_transaction (connection,
"del wire", {
&ret, enum GNUNET_GenericReturnValue res;
&del_wire, MHD_RESULT ret;
&awc);
if (qs < 0) res = TEH_DB_run_transaction (connection,
return ret; "del wire",
&ret,
&del_wire,
&awc);
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state (); TEH_wire_update_state ();
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -187,8 +187,6 @@ TEH_handler_management_post_wire_fees (
&afc.wire_fee), &afc.wire_fee),
GNUNET_JSON_spec_end () GNUNET_JSON_spec_end ()
}; };
enum GNUNET_DB_QueryStatus qs;
MHD_RESULT ret;
{ {
enum GNUNET_GenericReturnValue res; enum GNUNET_GenericReturnValue res;
@ -221,13 +219,18 @@ TEH_handler_management_post_wire_fees (
NULL); NULL);
} }
qs = TEH_DB_run_transaction (connection, {
"add wire fee", enum GNUNET_GenericReturnValue res;
&ret, MHD_RESULT ret;
&add_fee,
&afc); res = TEH_DB_run_transaction (connection,
if (qs < 0) "add wire fee",
return ret; &ret,
&add_fee,
&afc);
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state (); TEH_wire_update_state ();
return TALER_MHD_reply_static ( return TALER_MHD_reply_static (
connection, connection,

View File

@ -323,7 +323,7 @@ TALER_MHD_make_json_pack (const char *fmt,
fmt, fmt,
jerror.text); jerror.text);
GNUNET_break (0); GNUNET_break (0);
return MHD_NO; return NULL;
} }
{ {