ensure amounts are in upper-case
This commit is contained in:
parent
5259ea0532
commit
4954963405
@ -72,9 +72,8 @@ TALER_string_to_amount (const char *str,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GNUNET_assert (TALER_CURRENCY_LEN > (colon - str));
|
GNUNET_assert (TALER_CURRENCY_LEN > (colon - str));
|
||||||
GNUNET_memcpy (amount->currency,
|
for (unsigned int i = 0; i<colon - str; i++)
|
||||||
str,
|
amount->currency[i] = toupper (str[i]);
|
||||||
colon - str);
|
|
||||||
/* 0-terminate *and* normalize buffer by setting everything to '\0' */
|
/* 0-terminate *and* normalize buffer by setting everything to '\0' */
|
||||||
memset (&amount->currency [colon - str],
|
memset (&amount->currency [colon - str],
|
||||||
0,
|
0,
|
||||||
@ -193,9 +192,8 @@ TALER_amount_hton (struct TALER_AmountNBO *res,
|
|||||||
TALER_amount_is_valid (d));
|
TALER_amount_is_valid (d));
|
||||||
res->value = GNUNET_htonll (d->value);
|
res->value = GNUNET_htonll (d->value);
|
||||||
res->fraction = htonl (d->fraction);
|
res->fraction = htonl (d->fraction);
|
||||||
GNUNET_memcpy (res->currency,
|
for (unsigned int i = 0; i<TALER_CURRENCY_LEN; i++)
|
||||||
d->currency,
|
res->currency[i] = toupper (d->currency[i]);
|
||||||
TALER_CURRENCY_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -225,9 +223,8 @@ TALER_amount_set_zero (const char *cur,
|
|||||||
memset (amount,
|
memset (amount,
|
||||||
0,
|
0,
|
||||||
sizeof (struct TALER_Amount));
|
sizeof (struct TALER_Amount));
|
||||||
GNUNET_memcpy (amount->currency,
|
for (unsigned int i = 0; i<slen; i++)
|
||||||
cur,
|
amount->currency[i] = toupper (cur[i]);
|
||||||
slen);
|
|
||||||
return GNUNET_OK;
|
return GNUNET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user