-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
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;

View File

@ -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,

View File

@ -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;
}

View File

@ -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 ret;
{
enum GNUNET_GenericReturnValue res;
res = TALER_MHD_parse_json_data (connection,
ret = TALER_MHD_parse_json_data (connection,
root,
spec);
if (GNUNET_SYSERR == res)
if (GNUNET_SYSERR == ret)
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
if (GNUNET_NO == ret)
return MHD_YES; /* failure */
}
qs = TEH_DB_run_transaction (connection,
ret = TEH_DB_run_transaction (connection,
"add auditor denom sig",
&res,
&add_auditor_denom_sig,
&awc);
if (qs < 0)
if (GNUNET_SYSERR == ret)
return res;
return TALER_MHD_reply_static (
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 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

View File

@ -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 ret;
{
enum GNUNET_GenericReturnValue res;
res = TALER_MHD_parse_json_data (connection,
ret = TALER_MHD_parse_json_data (connection,
root,
spec);
if (GNUNET_SYSERR == res)
if (GNUNET_SYSERR == ret)
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
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,
ret = TEH_DB_run_transaction (connection,
"add auditor",
&res,
&add_auditor,
&aac);
if (qs < 0)
if (GNUNET_SYSERR == ret)
return res;
return TALER_MHD_reply_static (
connection,

View File

@ -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 ret;
{
enum GNUNET_GenericReturnValue res;
res = TALER_MHD_parse_json_data (connection,
ret = TALER_MHD_parse_json_data (connection,
root,
spec);
if (GNUNET_SYSERR == res)
if (GNUNET_SYSERR == ret)
return MHD_NO; /* hard failure */
if (GNUNET_NO == res)
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,
ret = TEH_DB_run_transaction (connection,
"del auditor",
&res,
&del_auditor,
&dac);
if (qs < 0)
if (GNUNET_SYSERR == ret)
return res;
return TALER_MHD_reply_static (
connection,

View File

@ -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,7 +443,10 @@ 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,
{
enum GNUNET_GenericReturnValue res;
res = TEH_DB_run_transaction (connection,
"add keys",
&ret,
&add_keys,
@ -452,8 +454,9 @@ TEH_handler_management_post_keys (
GNUNET_free (akc.d_sigs);
GNUNET_free (akc.s_sigs);
GNUNET_JSON_parse_free (spec);
if (qs < 0)
if (GNUNET_SYSERR == res)
return ret;
}
TEH_keys_update_states ();
return TALER_MHD_reply_static (
connection,

View File

@ -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,
{
enum GNUNET_GenericReturnValue res;
MHD_RESULT ret;
res = TEH_DB_run_transaction (connection,
"add wire",
&ret,
&add_wire,
&awc);
if (qs < 0)
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state ();
return TALER_MHD_reply_static (
connection,

View File

@ -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,
{
enum GNUNET_GenericReturnValue res;
MHD_RESULT ret;
res = TEH_DB_run_transaction (connection,
"del wire",
&ret,
&del_wire,
&awc);
if (qs < 0)
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state ();
return TALER_MHD_reply_static (
connection,

View File

@ -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,
{
enum GNUNET_GenericReturnValue res;
MHD_RESULT ret;
res = TEH_DB_run_transaction (connection,
"add wire fee",
&ret,
&add_fee,
&afc);
if (qs < 0)
if (GNUNET_SYSERR == res)
return ret;
}
TEH_wire_update_state ();
return TALER_MHD_reply_static (
connection,

View File

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