check return value from TALER_amount_get_zero

This commit is contained in:
Christian Grothoff 2017-10-06 20:54:42 +02:00
parent 2f715c27f8
commit dbab0c6587
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
7 changed files with 39 additions and 31 deletions

View File

@ -42,7 +42,6 @@ TALER_EXCHANGE_verify_coin_history (const char *currency,
struct TALER_Amount *total)
{
size_t len;
size_t off;
int add;
struct TALER_Amount rtotal;
@ -57,11 +56,13 @@ TALER_EXCHANGE_verify_coin_history (const char *currency,
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
total);
total));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
&rtotal);
for (off=0;off<len;off++)
&rtotal));
for (size_t off=0;off<len;off++)
{
json_t *transaction;
struct TALER_Amount amount;

View File

@ -104,10 +104,12 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
struct TALER_Amount total_out;
size_t off;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
&total_in);
&total_in));
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (currency,
&total_out);
&total_out));
uuid_off = 0;
for (off=0;off<history_length;off++)
{

View File

@ -1006,8 +1006,9 @@ expired_reserve_cb (void *cls,
/* Closing fee higher than remaining balance, close
without wire transfer. */
closing_fee = left;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (left->currency,
&amount_without_fee);
&amount_without_fee));
}
/* NOTE: sizeof (*reserve_pub) == sizeof (wtid) right now, but to

View File

@ -132,8 +132,9 @@ TEH_DB_calculate_transaction_list_totals (struct TALER_EXCHANGEDB_TransactionLis
struct TALER_EXCHANGEDB_TransactionList *pos;
struct TALER_Amount refunded;
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (spent.currency,
&refunded);
&refunded));
for (pos = tl; NULL != pos; pos = pos->next)
{
switch (pos->type)

View File

@ -214,8 +214,9 @@ payback_transaction (void *cls,
}
return qs;
}
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (pc->value.currency,
&spent);
&spent));
if (GNUNET_OK !=
TEH_DB_calculate_transaction_list_totals (tl,
&spent,

View File

@ -309,8 +309,9 @@ withdraw_transaction (void *cls,
if (0 == (res & 2))
{
/* did not encounter any withdraw operations, set to zero */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (deposit_total.currency,
&withdraw_total);
&withdraw_total));
}
/* All reserve balances should be non-negative */
if (GNUNET_SYSERR ==

View File

@ -879,8 +879,9 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
if (0 == (2 & ret))
{
/* did not encounter any withdraw operations, set to zero */
GNUNET_assert (GNUNET_OK ==
TALER_amount_get_zero (deposit_total.currency,
&withdraw_total);
&withdraw_total));
}
if (GNUNET_SYSERR ==
TALER_amount_subtract (balance,