Fix compiler warnings.

This reverts changes made in b0d00823eb.  The warnings
are fixed by changing the functions signatures, instead of casting
their pointers.
This commit is contained in:
Marcello Stanisci 2018-10-22 16:59:09 +02:00
parent e83964badb
commit 60c533562c
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
14 changed files with 129 additions and 120 deletions

View File

@ -70,16 +70,17 @@ struct TALER_BANK_AdminAddIncomingHandle
* *
* @param cls the `struct TALER_BANK_AdminAddIncomingHandle` * @param cls the `struct TALER_BANK_AdminAddIncomingHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_admin_add_incoming_finished (void *cls, handle_admin_add_incoming_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_BANK_AdminAddIncomingHandle *aai = cls; struct TALER_BANK_AdminAddIncomingHandle *aai = cls;
uint64_t row_id = UINT64_MAX; uint64_t row_id = UINT64_MAX;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
const json_t *j = response;
aai->job = NULL; aai->job = NULL;
switch (response_code) switch (response_code)
@ -96,7 +97,7 @@ handle_admin_add_incoming_finished (void *cls,
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (j,
spec, spec,
NULL, NULL)) NULL, NULL))
{ {
@ -111,27 +112,27 @@ handle_admin_add_incoming_finished (void *cls,
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the bank is buggy /* This should never happen, either us or the bank is buggy
(or API version conflict); just pass JSON reply to the application */ (or API version conflict); just pass JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
/* Access denied */ /* Access denied */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_UNAUTHORIZED: case MHD_HTTP_UNAUTHORIZED:
/* Nothing really to verify, bank says one of the signatures is /* Nothing really to verify, bank says one of the signatures is
invalid; as we checked them, this should never happen, we invalid; as we checked them, this should never happen, we
should pass the JSON reply to the application */ should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_NOT_FOUND: case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, this should never /* Nothing really to verify, this should never
happen, we should pass the JSON reply to the application */ happen, we should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_INTERNAL_SERVER_ERROR: case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API /* Server had an internal issue; we should retry, but this API
leaves this to the application */ leaves this to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
@ -139,7 +140,7 @@ handle_admin_add_incoming_finished (void *cls,
"Unexpected response code %u\n", "Unexpected response code %u\n",
(unsigned int) response_code); (unsigned int) response_code);
GNUNET_break (0); GNUNET_break (0);
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
response_code = 0; response_code = 0;
break; break;
} }
@ -147,7 +148,7 @@ handle_admin_add_incoming_finished (void *cls,
response_code, response_code,
ec, ec,
row_id, row_id,
json); j);
TALER_BANK_admin_add_incoming_cancel (aai); TALER_BANK_admin_add_incoming_cancel (aai);
} }
@ -247,7 +248,7 @@ TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx,
aai->job = GNUNET_CURL_job_add (ctx, aai->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
(GC_JCC) &handle_admin_add_incoming_finished, &handle_admin_add_incoming_finished,
aai); aai);
return aai; return aai;
} }

View File

@ -169,15 +169,16 @@ parse_account_history (struct TALER_BANK_HistoryHandle *hh,
* *
* @param cls the `struct TALER_BANK_HistoryHandle` * @param cls the `struct TALER_BANK_HistoryHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_history_finished (void *cls, handle_history_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_BANK_HistoryHandle *hh = cls; struct TALER_BANK_HistoryHandle *hh = cls;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
const json_t *j = response;
hh->job = NULL; hh->job = NULL;
switch (response_code) switch (response_code)
@ -188,7 +189,7 @@ handle_history_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
parse_account_history (hh, parse_account_history (hh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -204,27 +205,27 @@ handle_history_finished (void *cls,
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the bank is buggy /* This should never happen, either us or the bank is buggy
(or API version conflict); just pass JSON reply to the application */ (or API version conflict); just pass JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
/* Access denied */ /* Access denied */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_UNAUTHORIZED: case MHD_HTTP_UNAUTHORIZED:
/* Nothing really to verify, bank says one of the signatures is /* Nothing really to verify, bank says one of the signatures is
invalid; as we checked them, this should never happen, we invalid; as we checked them, this should never happen, we
should pass the JSON reply to the application */ should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_NOT_FOUND: case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, this should never /* Nothing really to verify, this should never
happen, we should pass the JSON reply to the application */ happen, we should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_INTERNAL_SERVER_ERROR: case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API /* Server had an internal issue; we should retry, but this API
leaves this to the application */ leaves this to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
@ -232,7 +233,7 @@ handle_history_finished (void *cls,
"Unexpected response code %u\n", "Unexpected response code %u\n",
(unsigned int) response_code); (unsigned int) response_code);
GNUNET_break (0); GNUNET_break (0);
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
response_code = 0; response_code = 0;
break; break;
} }
@ -242,7 +243,7 @@ handle_history_finished (void *cls,
TALER_BANK_DIRECTION_NONE, TALER_BANK_DIRECTION_NONE,
0LLU, 0LLU,
NULL, NULL,
json); j);
TALER_BANK_history_cancel (hh); TALER_BANK_history_cancel (hh);
} }
@ -350,7 +351,7 @@ TALER_BANK_history (struct GNUNET_CURL_Context *ctx,
hh->job = GNUNET_CURL_job_add (ctx, hh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
(GC_JCC) &handle_history_finished, &handle_history_finished,
hh); hh);
return hh; return hh;
} }

View File

@ -70,15 +70,16 @@ struct TALER_BANK_RejectHandle
* *
* @param cls the `struct TALER_BANK_RejectHandle` * @param cls the `struct TALER_BANK_RejectHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_reject_finished (void *cls, handle_reject_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_BANK_RejectHandle *rh = cls; struct TALER_BANK_RejectHandle *rh = cls;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
const json_t *j = response;
rh->job = NULL; rh->job = NULL;
switch (response_code) switch (response_code)
@ -97,27 +98,27 @@ handle_reject_finished (void *cls,
case MHD_HTTP_BAD_REQUEST: case MHD_HTTP_BAD_REQUEST:
/* This should never happen, either us or the bank is buggy /* This should never happen, either us or the bank is buggy
(or API version conflict); just pass JSON reply to the application */ (or API version conflict); just pass JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_FORBIDDEN: case MHD_HTTP_FORBIDDEN:
/* Access denied */ /* Access denied */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_UNAUTHORIZED: case MHD_HTTP_UNAUTHORIZED:
/* Nothing really to verify, bank says one of the signatures is /* Nothing really to verify, bank says one of the signatures is
invalid; as we checked them, this should never happen, we invalid; as we checked them, this should never happen, we
should pass the JSON reply to the application */ should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_NOT_FOUND: case MHD_HTTP_NOT_FOUND:
/* Nothing really to verify, this should never /* Nothing really to verify, this should never
happen, we should pass the JSON reply to the application */ happen, we should pass the JSON reply to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
case MHD_HTTP_INTERNAL_SERVER_ERROR: case MHD_HTTP_INTERNAL_SERVER_ERROR:
/* Server had an internal issue; we should retry, but this API /* Server had an internal issue; we should retry, but this API
leaves this to the application */ leaves this to the application */
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
break; break;
default: default:
/* unexpected response code */ /* unexpected response code */
@ -125,7 +126,7 @@ handle_reject_finished (void *cls,
"Unexpected response code %u\n", "Unexpected response code %u\n",
(unsigned int) response_code); (unsigned int) response_code);
GNUNET_break (0); GNUNET_break (0);
ec = TALER_BANK_parse_ec_ (json); ec = TALER_BANK_parse_ec_ (j);
response_code = 0; response_code = 0;
break; break;
} }
@ -215,7 +216,7 @@ TALER_BANK_reject (struct GNUNET_CURL_Context *ctx,
rh->job = GNUNET_CURL_job_add (ctx, rh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
(GC_JCC) &handle_reject_finished, &handle_reject_finished,
rh); rh);
return rh; return rh;
} }

View File

@ -193,16 +193,17 @@ verify_deposit_signature_forbidden (const struct TALER_EXCHANGE_DepositHandle *d
* *
* @param cls the `struct TALER_EXCHANGE_DepositHandle` * @param cls the `struct TALER_EXCHANGE_DepositHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_deposit_finished (void *cls, handle_deposit_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_DepositHandle *dh = cls; struct TALER_EXCHANGE_DepositHandle *dh = cls;
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL; struct TALER_ExchangePublicKeyP *ep = NULL;
const json_t *j = response;
dh->job = NULL; dh->job = NULL;
switch (response_code) switch (response_code)
@ -212,7 +213,7 @@ handle_deposit_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_deposit_signature_ok (dh, verify_deposit_signature_ok (dh,
json, j,
&exchange_pub)) &exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -231,7 +232,7 @@ handle_deposit_finished (void *cls,
/* Double spending; check signatures on transaction history */ /* Double spending; check signatures on transaction history */
if (GNUNET_OK != if (GNUNET_OK !=
verify_deposit_signature_forbidden (dh, verify_deposit_signature_forbidden (dh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -261,9 +262,9 @@ handle_deposit_finished (void *cls,
} }
dh->cb (dh->cb_cls, dh->cb (dh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
ep, ep,
json); j);
TALER_EXCHANGE_deposit_cancel (dh); TALER_EXCHANGE_deposit_cancel (dh);
} }
@ -511,7 +512,7 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
dh->job = GNUNET_CURL_job_add (ctx, dh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_deposit_finished, &handle_deposit_finished,
dh); dh);
return dh; return dh;
} }

View File

@ -834,13 +834,14 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
static void static void
keys_completed_cb (void *cls, keys_completed_cb (void *cls,
long response_code, long response_code,
const json_t *resp_obj) const void *resp_obj)
{ {
struct KeysRequest *kr = cls; struct KeysRequest *kr = cls;
struct TALER_EXCHANGE_Handle *exchange = kr->exchange; struct TALER_EXCHANGE_Handle *exchange = kr->exchange;
struct TALER_EXCHANGE_Keys kd; struct TALER_EXCHANGE_Keys kd;
struct TALER_EXCHANGE_Keys kd_old; struct TALER_EXCHANGE_Keys kd_old;
enum TALER_EXCHANGE_VersionCompatibility vc; enum TALER_EXCHANGE_VersionCompatibility vc;
const json_t *j = resp_obj;
GNUNET_log (GNUNET_ERROR_TYPE_INFO, GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received keys from URL `%s' with status %ld.\n", "Received keys from URL `%s' with status %ld.\n",
@ -863,7 +864,7 @@ keys_completed_cb (void *cls,
exchange); exchange);
return; return;
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (NULL == resp_obj) if (NULL == j)
{ {
response_code = 0; response_code = 0;
break; break;
@ -902,7 +903,7 @@ keys_completed_cb (void *cls,
} }
if (GNUNET_OK != if (GNUNET_OK !=
decode_keys_json (resp_obj, decode_keys_json (j,
GNUNET_YES, GNUNET_YES,
&kd, &kd,
&vc)) &vc))
@ -927,7 +928,7 @@ keys_completed_cb (void *cls,
break; break;
} }
json_decref (exchange->key_data_raw); json_decref (exchange->key_data_raw);
exchange->key_data_raw = json_deep_copy (resp_obj); exchange->key_data_raw = json_deep_copy (j);
exchange->retry_delay = GNUNET_TIME_UNIT_ZERO; exchange->retry_delay = GNUNET_TIME_UNIT_ZERO;
break; break;
default: default:
@ -1484,7 +1485,7 @@ request_keys (void *cls)
kr->job = GNUNET_CURL_job_add (exchange->ctx, kr->job = GNUNET_CURL_job_add (exchange->ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
(GC_JCC) &keys_completed_cb, &keys_completed_cb,
kr); kr);
exchange->kr = kr; exchange->kr = kr;
} }

View File

@ -158,14 +158,15 @@ verify_payback_signature_ok (const struct TALER_EXCHANGE_PaybackHandle *ph,
* *
* @param cls the `struct TALER_EXCHANGE_PaybackHandle` * @param cls the `struct TALER_EXCHANGE_PaybackHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_payback_finished (void *cls, handle_payback_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_PaybackHandle *ph = cls; struct TALER_EXCHANGE_PaybackHandle *ph = cls;
const json_t *j = response;
ph->job = NULL; ph->job = NULL;
switch (response_code) switch (response_code)
@ -175,7 +176,7 @@ handle_payback_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_payback_signature_ok (ph, verify_payback_signature_ok (ph,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -194,7 +195,7 @@ handle_payback_finished (void *cls,
const struct TALER_EXCHANGE_DenomPublicKey *dki; const struct TALER_EXCHANGE_DenomPublicKey *dki;
dki = ph->pk; dki = ph->pk;
history = json_object_get (json, history = json_object_get (j,
"history"); "history");
if (GNUNET_OK != if (GNUNET_OK !=
TALER_EXCHANGE_verify_coin_history (dki->fee_deposit.currency, TALER_EXCHANGE_verify_coin_history (dki->fee_deposit.currency,
@ -207,11 +208,11 @@ handle_payback_finished (void *cls,
} }
ph->cb (ph->cb_cls, ph->cb (ph->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
&total, &total,
GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_ABS,
NULL, NULL,
json); j);
TALER_EXCHANGE_payback_cancel (ph); TALER_EXCHANGE_payback_cancel (ph);
return; return;
} }
@ -243,11 +244,11 @@ handle_payback_finished (void *cls,
} }
ph->cb (ph->cb_cls, ph->cb (ph->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
NULL, NULL,
GNUNET_TIME_UNIT_FOREVER_ABS, GNUNET_TIME_UNIT_FOREVER_ABS,
NULL, NULL,
json); j);
TALER_EXCHANGE_payback_cancel (ph); TALER_EXCHANGE_payback_cancel (ph);
} }
@ -344,7 +345,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
ph->job = GNUNET_CURL_job_add (ctx, ph->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_payback_finished, &handle_payback_finished,
ph); ph);
return ph; return ph;
} }

View File

@ -1032,16 +1032,17 @@ verify_refresh_melt_signature_forbidden (struct TALER_EXCHANGE_RefreshMeltHandle
* *
* @param cls the `struct TALER_EXCHANGE_RefreshMeltHandle` * @param cls the `struct TALER_EXCHANGE_RefreshMeltHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_refresh_melt_finished (void *cls, handle_refresh_melt_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_RefreshMeltHandle *rmh = cls; struct TALER_EXCHANGE_RefreshMeltHandle *rmh = cls;
uint32_t noreveal_index = TALER_CNC_KAPPA; /* invalid value */ uint32_t noreveal_index = TALER_CNC_KAPPA; /* invalid value */
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
const json_t *j = response;
rmh->job = NULL; rmh->job = NULL;
switch (response_code) switch (response_code)
@ -1051,7 +1052,7 @@ handle_refresh_melt_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_refresh_melt_signature_ok (rmh, verify_refresh_melt_signature_ok (rmh,
json, j,
&exchange_pub, &exchange_pub,
&noreveal_index)) &noreveal_index))
{ {
@ -1062,10 +1063,10 @@ handle_refresh_melt_finished (void *cls,
{ {
rmh->melt_cb (rmh->melt_cb_cls, rmh->melt_cb (rmh->melt_cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
noreveal_index, noreveal_index,
(0 == response_code) ? NULL : &exchange_pub, (0 == response_code) ? NULL : &exchange_pub,
json); j);
rmh->melt_cb = NULL; rmh->melt_cb = NULL;
} }
break; break;
@ -1077,7 +1078,7 @@ handle_refresh_melt_finished (void *cls,
/* Double spending; check signatures on transaction history */ /* Double spending; check signatures on transaction history */
if (GNUNET_OK != if (GNUNET_OK !=
verify_refresh_melt_signature_forbidden (rmh, verify_refresh_melt_signature_forbidden (rmh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -1108,10 +1109,10 @@ handle_refresh_melt_finished (void *cls,
if (NULL != rmh->melt_cb) if (NULL != rmh->melt_cb)
rmh->melt_cb (rmh->melt_cb_cls, rmh->melt_cb (rmh->melt_cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
UINT32_MAX, UINT32_MAX,
NULL, NULL,
json); j);
TALER_EXCHANGE_refresh_melt_cancel (rmh); TALER_EXCHANGE_refresh_melt_cancel (rmh);
} }
@ -1218,7 +1219,7 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
rmh->job = GNUNET_CURL_job_add (ctx, rmh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_refresh_melt_finished, &handle_refresh_melt_finished,
rmh); rmh);
return rmh; return rmh;
} }
@ -1411,14 +1412,15 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
* *
* @param cls the `struct TALER_EXCHANGE_RefreshHandle` * @param cls the `struct TALER_EXCHANGE_RefreshHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_refresh_reveal_finished (void *cls, handle_refresh_reveal_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_RefreshRevealHandle *rrh = cls; struct TALER_EXCHANGE_RefreshRevealHandle *rrh = cls;
const json_t *j = response;
rrh->job = NULL; rrh->job = NULL;
switch (response_code) switch (response_code)
@ -1433,7 +1435,7 @@ handle_refresh_reveal_finished (void *cls,
memset (sigs, 0, sizeof (sigs)); memset (sigs, 0, sizeof (sigs));
ret = refresh_reveal_ok (rrh, ret = refresh_reveal_ok (rrh,
json, j,
coin_privs, coin_privs,
sigs); sigs);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
@ -1448,7 +1450,7 @@ handle_refresh_reveal_finished (void *cls,
rrh->md->num_fresh_coins, rrh->md->num_fresh_coins,
coin_privs, coin_privs,
sigs, sigs,
json); j);
rrh->reveal_cb = NULL; rrh->reveal_cb = NULL;
} }
for (unsigned int i=0;i<rrh->md->num_fresh_coins;i++) for (unsigned int i=0;i<rrh->md->num_fresh_coins;i++)
@ -1481,11 +1483,11 @@ handle_refresh_reveal_finished (void *cls,
if (NULL != rrh->reveal_cb) if (NULL != rrh->reveal_cb)
rrh->reveal_cb (rrh->reveal_cb_cls, rrh->reveal_cb (rrh->reveal_cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
0, 0,
NULL, NULL,
NULL, NULL,
json); j);
TALER_EXCHANGE_refresh_reveal_cancel (rrh); TALER_EXCHANGE_refresh_reveal_cancel (rrh);
} }
@ -1645,7 +1647,7 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
rrh->job = GNUNET_CURL_job_add (ctx, rrh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_refresh_reveal_finished, &handle_refresh_reveal_finished,
rrh); rrh);
return rrh; return rrh;
} }

View File

@ -301,14 +301,15 @@ parse_refresh_link_ok (struct TALER_EXCHANGE_RefreshLinkHandle *rlh,
* *
* @param cls the `struct TALER_EXCHANGE_RefreshLinkHandle` * @param cls the `struct TALER_EXCHANGE_RefreshLinkHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_refresh_link_finished (void *cls, handle_refresh_link_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_RefreshLinkHandle *rlh = cls; struct TALER_EXCHANGE_RefreshLinkHandle *rlh = cls;
const json_t *j = response;
rlh->job = NULL; rlh->job = NULL;
switch (response_code) switch (response_code)
@ -318,7 +319,7 @@ handle_refresh_link_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
parse_refresh_link_ok (rlh, parse_refresh_link_ok (rlh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -348,12 +349,12 @@ handle_refresh_link_finished (void *cls,
if (NULL != rlh->link_cb) if (NULL != rlh->link_cb)
rlh->link_cb (rlh->link_cb_cls, rlh->link_cb (rlh->link_cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
0, 0,
NULL, NULL,
NULL, NULL,
NULL, NULL,
json); j);
TALER_EXCHANGE_refresh_link_cancel (rlh); TALER_EXCHANGE_refresh_link_cancel (rlh);
} }
@ -415,7 +416,7 @@ TALER_EXCHANGE_refresh_link (struct TALER_EXCHANGE_Handle *exchange,
rlh->job = GNUNET_CURL_job_add (ctx, rlh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_refresh_link_finished, &handle_refresh_link_finished,
rlh); rlh);
return rlh; return rlh;
} }

View File

@ -133,16 +133,17 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
* *
* @param cls the `struct TALER_EXCHANGE_RefundHandle` * @param cls the `struct TALER_EXCHANGE_RefundHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_refund_finished (void *cls, handle_refund_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_RefundHandle *rh = cls; struct TALER_EXCHANGE_RefundHandle *rh = cls;
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL; struct TALER_ExchangePublicKeyP *ep = NULL;
const json_t *j = response;
rh->job = NULL; rh->job = NULL;
switch (response_code) switch (response_code)
@ -152,7 +153,7 @@ handle_refund_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
verify_refund_signature_ok (rh, verify_refund_signature_ok (rh,
json, j,
&exchange_pub)) &exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -203,9 +204,9 @@ handle_refund_finished (void *cls,
} }
rh->cb (rh->cb_cls, rh->cb (rh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
ep, ep,
json); j);
TALER_EXCHANGE_refund_cancel (rh); TALER_EXCHANGE_refund_cancel (rh);
} }
@ -386,7 +387,7 @@ refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
rh->job = GNUNET_CURL_job_add (ctx, rh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_refund_finished, &handle_refund_finished,
rh); rh);
return rh; return rh;
} }

View File

@ -456,14 +456,15 @@ free_rhistory (struct TALER_EXCHANGE_ReserveHistory *rhistory,
* *
* @param cls the `struct TALER_EXCHANGE_ReserveStatusHandle` * @param cls the `struct TALER_EXCHANGE_ReserveStatusHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_reserve_status_finished (void *cls, handle_reserve_status_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_ReserveStatusHandle *rsh = cls; struct TALER_EXCHANGE_ReserveStatusHandle *rsh = cls;
const json_t *j = response;
rsh->job = NULL; rsh->job = NULL;
switch (response_code) switch (response_code)
@ -483,7 +484,7 @@ handle_reserve_status_finished (void *cls,
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (j,
spec, spec,
NULL, NULL,
NULL)) NULL))
@ -492,7 +493,7 @@ handle_reserve_status_finished (void *cls,
response_code = 0; response_code = 0;
break; break;
} }
history = json_object_get (json, history = json_object_get (j,
"history"); "history");
if (NULL == history) if (NULL == history)
{ {
@ -531,7 +532,7 @@ handle_reserve_status_finished (void *cls,
rsh->cb (rsh->cb_cls, rsh->cb (rsh->cb_cls,
response_code, response_code,
TALER_EC_NONE, TALER_EC_NONE,
json, j,
&balance, &balance,
len, len,
rhistory); rhistory);
@ -567,8 +568,8 @@ handle_reserve_status_finished (void *cls,
{ {
rsh->cb (rsh->cb_cls, rsh->cb (rsh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
json, j,
NULL, NULL,
0, NULL); 0, NULL);
rsh->cb = NULL; rsh->cb = NULL;
@ -631,7 +632,7 @@ TALER_EXCHANGE_reserve_status (struct TALER_EXCHANGE_Handle *exchange,
rsh->job = GNUNET_CURL_job_add (ctx, rsh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_NO, GNUNET_NO,
(GC_JCC) &handle_reserve_status_finished, &handle_reserve_status_finished,
rsh); rsh);
return rsh; return rsh;
} }
@ -891,14 +892,15 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *
* *
* @param cls the `struct TALER_EXCHANGE_ReserveWithdrawHandle` * @param cls the `struct TALER_EXCHANGE_ReserveWithdrawHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_reserve_withdraw_finished (void *cls, handle_reserve_withdraw_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh = cls; struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh = cls;
const json_t *j = response;
wsh->job = NULL; wsh->job = NULL;
switch (response_code) switch (response_code)
@ -908,7 +910,7 @@ handle_reserve_withdraw_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK != if (GNUNET_OK !=
reserve_withdraw_ok (wsh, reserve_withdraw_ok (wsh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -923,7 +925,7 @@ handle_reserve_withdraw_finished (void *cls,
check the signatures in the history... */ check the signatures in the history... */
if (GNUNET_OK != if (GNUNET_OK !=
reserve_withdraw_payment_required (wsh, reserve_withdraw_payment_required (wsh,
json)) j))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -958,9 +960,9 @@ handle_reserve_withdraw_finished (void *cls,
{ {
wsh->cb (wsh->cb_cls, wsh->cb (wsh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
NULL, NULL,
json); j);
wsh->cb = NULL; wsh->cb = NULL;
} }
TALER_EXCHANGE_reserve_withdraw_cancel (wsh); TALER_EXCHANGE_reserve_withdraw_cancel (wsh);
@ -1039,7 +1041,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wsh->job = GNUNET_CURL_job_add (ctx, wsh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_reserve_withdraw_finished, &handle_reserve_withdraw_finished,
wsh); wsh);
return wsh; return wsh;
} }

View File

@ -134,12 +134,12 @@ verify_deposit_wtid_signature_ok (const struct TALER_EXCHANGE_TrackTransactionHa
* *
* @param cls the `struct TALER_EXCHANGE_TrackTransactionHandle` * @param cls the `struct TALER_EXCHANGE_TrackTransactionHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_deposit_wtid_finished (void *cls, handle_deposit_wtid_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_TrackTransactionHandle *dwh = cls; struct TALER_EXCHANGE_TrackTransactionHandle *dwh = cls;
const struct TALER_WireTransferIdentifierRawP *wtid = NULL; const struct TALER_WireTransferIdentifierRawP *wtid = NULL;
@ -148,6 +148,7 @@ handle_deposit_wtid_finished (void *cls,
struct TALER_Amount coin_contribution_s; struct TALER_Amount coin_contribution_s;
struct TALER_ExchangePublicKeyP exchange_pub; struct TALER_ExchangePublicKeyP exchange_pub;
struct TALER_ExchangePublicKeyP *ep = NULL; struct TALER_ExchangePublicKeyP *ep = NULL;
const json_t *j = response;
dwh->job = NULL; dwh->job = NULL;
switch (response_code) switch (response_code)
@ -164,7 +165,7 @@ handle_deposit_wtid_finished (void *cls,
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (j,
spec, spec,
NULL, NULL)) NULL, NULL))
{ {
@ -179,7 +180,7 @@ handle_deposit_wtid_finished (void *cls,
coin_contribution = &coin_contribution_s; coin_contribution = &coin_contribution_s;
if (GNUNET_OK != if (GNUNET_OK !=
verify_deposit_wtid_signature_ok (dwh, verify_deposit_wtid_signature_ok (dwh,
json, j,
&exchange_pub)) &exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -200,7 +201,7 @@ handle_deposit_wtid_finished (void *cls,
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (j,
spec, spec,
NULL, NULL)) NULL, NULL))
{ {
@ -238,9 +239,9 @@ handle_deposit_wtid_finished (void *cls,
} }
dwh->cb (dwh->cb_cls, dwh->cb (dwh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
ep, ep,
json, j,
wtid, wtid,
execution_time, execution_time,
coin_contribution); coin_contribution);
@ -337,7 +338,7 @@ TALER_EXCHANGE_track_transaction (struct TALER_EXCHANGE_Handle *exchange,
dwh->job = GNUNET_CURL_job_add (ctx, dwh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_deposit_wtid_finished, &handle_deposit_wtid_finished,
dwh); dwh);
return dwh; return dwh;
} }

View File

@ -248,14 +248,15 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
* *
* @param cls the `struct TALER_EXCHANGE_TrackTransferHandle` * @param cls the `struct TALER_EXCHANGE_TrackTransferHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_track_transfer_finished (void *cls, handle_track_transfer_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_TrackTransferHandle *wdh = cls; struct TALER_EXCHANGE_TrackTransferHandle *wdh = cls;
const json_t *j = response;
wdh->job = NULL; wdh->job = NULL;
switch (response_code) switch (response_code)
@ -265,7 +266,7 @@ handle_track_transfer_finished (void *cls,
case MHD_HTTP_OK: case MHD_HTTP_OK:
if (GNUNET_OK == if (GNUNET_OK ==
check_track_transfer_response_ok (wdh, check_track_transfer_response_ok (wdh,
json)) j))
return; return;
GNUNET_break_op (0); GNUNET_break_op (0);
response_code = 0; response_code = 0;
@ -298,9 +299,9 @@ handle_track_transfer_finished (void *cls,
} }
wdh->cb (wdh->cb_cls, wdh->cb (wdh->cb_cls,
response_code, response_code,
TALER_JSON_get_error_code (json), TALER_JSON_get_error_code (j),
NULL, NULL,
json, j,
NULL, NULL,
GNUNET_TIME_UNIT_ZERO_ABS, GNUNET_TIME_UNIT_ZERO_ABS,
NULL, NULL,
@ -359,7 +360,7 @@ TALER_EXCHANGE_track_transfer (struct TALER_EXCHANGE_Handle *exchange,
wdh->job = GNUNET_CURL_job_add (ctx, wdh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_track_transfer_finished, &handle_track_transfer_finished,
wdh); wdh);
return wdh; return wdh;
} }

View File

@ -202,15 +202,16 @@ lookup_fee (const struct FeeMap *fm,
* *
* @param cls the `struct TALER_EXCHANGE_WireHandle` * @param cls the `struct TALER_EXCHANGE_WireHandle`
* @param response_code HTTP response code, 0 on error * @param response_code HTTP response code, 0 on error
* @param json parsed JSON result, NULL on error * @param response parsed JSON result, NULL on error
*/ */
static void static void
handle_wire_finished (void *cls, handle_wire_finished (void *cls,
long response_code, long response_code,
const json_t *json) const void *response)
{ {
struct TALER_EXCHANGE_WireHandle *wh = cls; struct TALER_EXCHANGE_WireHandle *wh = cls;
enum TALER_ErrorCode ec; enum TALER_ErrorCode ec;
const json_t *j = response;
wh->job = NULL; wh->job = NULL;
ec = TALER_EC_NONE; ec = TALER_EC_NONE;
@ -232,7 +233,7 @@ handle_wire_finished (void *cls,
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (j,
spec, spec,
NULL, NULL)) NULL, NULL))
{ {
@ -359,7 +360,7 @@ handle_wire_finished (void *cls,
if (NULL != wh->cb) if (NULL != wh->cb)
wh->cb (wh->cb_cls, wh->cb (wh->cb_cls,
response_code, response_code,
(0 == response_code) ? ec : TALER_JSON_get_error_code (json), (0 == response_code) ? ec : TALER_JSON_get_error_code (j),
0, 0,
NULL); NULL);
TALER_EXCHANGE_wire_cancel (wh); TALER_EXCHANGE_wire_cancel (wh);
@ -412,7 +413,7 @@ TALER_EXCHANGE_wire (struct TALER_EXCHANGE_Handle *exchange,
wh->job = GNUNET_CURL_job_add (ctx, wh->job = GNUNET_CURL_job_add (ctx,
eh, eh,
GNUNET_YES, GNUNET_YES,
(GC_JCC) &handle_wire_finished, &handle_wire_finished,
wh); wh);
return wh; return wh;
} }

View File

@ -37,12 +37,6 @@
"JSON parsing failed at %s:%u: %s (%s)\n", \ "JSON parsing failed at %s:%u: %s (%s)\n", \
__FILE__, __LINE__, error.text, error.source) __FILE__, __LINE__, error.text, error.source)
/**
* A shorter name to make type casts less verbose.
*/
typedef GNUNET_CURL_JobCompletionCallback GC_JCC;
/** /**
* Convert a TALER amount to a JSON object. * Convert a TALER amount to a JSON object.
* *