misc bugfixes

This commit is contained in:
Christian Grothoff 2015-05-15 14:36:08 +02:00
parent 6c774a1f03
commit 955054bf25
4 changed files with 29 additions and 19 deletions

View File

@ -297,7 +297,7 @@ struct TALER_PQ_ResultSpec
* @param dst point to where to store the result, type fits expected result size
* @return array entry for the result specification to use
*/
#define TALER_PQ_RESULT_SPEC(name, dst) { TALER_PQ_RF_VARSIZE_BLOB, (void *) dst, sizeof (*(dst)), name, NULL }
#define TALER_PQ_RESULT_SPEC(name, dst) { TALER_PQ_RF_FIXED_BLOB, (void *) (dst), sizeof (*(dst)), name, NULL }
/**

View File

@ -225,25 +225,34 @@ TALER_PQ_cleanup_result (struct TALER_PQ_ResultSpec *rs)
switch (rs[i].format)
{
case TALER_PQ_RF_VARSIZE_BLOB:
if (NULL != rs[i].dst)
{
GNUNET_free (rs[i].dst);
rs[i].dst = NULL;
void **dst = rs[i].dst;
if (NULL != *dst)
{
GNUNET_free (*dst);
*dst = NULL;
*rs[i].result_size = 0;
}
break;
}
case TALER_PQ_RF_RSA_PUBLIC_KEY:
if (NULL != rs[i].dst)
{
GNUNET_CRYPTO_rsa_public_key_free (rs[i].dst);
rs[i].dst = NULL;
void **dst = rs[i].dst;
if (NULL != *dst)
{
GNUNET_CRYPTO_rsa_public_key_free (*dst);
*dst = NULL;
}
break;
}
case TALER_PQ_RF_RSA_SIGNATURE:
if (NULL != rs[i].dst)
{
GNUNET_CRYPTO_rsa_signature_free (rs[i].dst);
rs[i].dst = NULL;
void **dst = rs[i].dst;
if (NULL != *dst)
{
GNUNET_CRYPTO_rsa_signature_free (*dst);
*dst = NULL;
}
}
break;
default:

View File

@ -121,7 +121,7 @@ TALER_PQ_RESULT_SPEC_VAR (const char *name,
size_t *sptr)
{
struct TALER_PQ_ResultSpec res =
{ TALER_PQ_RF_VARSIZE_BLOB, (void *) (dst), 0, (name), sptr };
{ TALER_PQ_RF_VARSIZE_BLOB, (void *) (dst), 0, name, sptr };
return res;
}
@ -138,7 +138,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT_NBO (const char *name,
struct TALER_AmountNBO *amount)
{
struct TALER_PQ_ResultSpec res =
{TALER_PQ_RF_AMOUNT_NBO, (void *) (&amount), sizeof (*amount), (name), NULL };
{TALER_PQ_RF_AMOUNT_NBO, (void *) amount, sizeof (*amount), name, NULL };
return res;
}
@ -155,7 +155,7 @@ TALER_PQ_RESULT_SPEC_AMOUNT (const char *name,
struct TALER_Amount *amount)
{
struct TALER_PQ_ResultSpec res =
{TALER_PQ_RF_AMOUNT, (void *) (&amount), sizeof (*amount), (name), NULL };
{TALER_PQ_RF_AMOUNT, (void *) amount, sizeof (*amount), name, NULL };
return res;
}
@ -172,7 +172,7 @@ TALER_PQ_RESULT_SPEC_RSA_PUBLIC_KEY (const char *name,
struct GNUNET_CRYPTO_rsa_PublicKey **rsa)
{
struct TALER_PQ_ResultSpec res =
{TALER_PQ_RF_RSA_PUBLIC_KEY, (void *) &(rsa), 0, (name), NULL };
{TALER_PQ_RF_RSA_PUBLIC_KEY, (void *) rsa, 0, name, NULL };
return res;
}
@ -189,7 +189,7 @@ TALER_PQ_RESULT_SPEC_RSA_SIGNATURE (const char *name,
struct GNUNET_CRYPTO_rsa_Signature **sig)
{
struct TALER_PQ_ResultSpec res =
{TALER_PQ_RF_RSA_SIGNATURE, (void *) &(sig), 0, (name), NULL };
{TALER_PQ_RF_RSA_SIGNATURE, (void *) sig, 0, (name), NULL };
return res;
}
@ -206,7 +206,7 @@ TALER_PQ_RESULT_SPEC_ABSOLUTE_TIME (const char *name,
struct GNUNET_TIME_Absolute *at)
{
struct TALER_PQ_ResultSpec res =
{TALER_PQ_RF_TIME_ABSOLUTE, (void *) (&at), sizeof (at), (name), NULL };
{TALER_PQ_RF_TIME_ABSOLUTE, (void *) at, sizeof (*at), (name), NULL };
return res;
}

View File

@ -124,6 +124,7 @@ run_queries (PGconn *conn)
&hamount);
TALER_string_to_amount ("EUR:4.4",
&hamount);
/* FIXME: test TALER_PQ_RESULT_SPEC_VAR */
{
struct TALER_PQ_QueryParam params_insert[] = {
TALER_PQ_QUERY_PARAM_RSA_PUBLIC_KEY (pub),