diff options
author | Christian Grothoff <christian@grothoff.org> | 2022-08-22 22:47:41 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2022-08-22 22:47:41 +0200 |
commit | b14e18eb31c957276c3f74834495d1bfa5c9329a (patch) | |
tree | bbde2d22eb1069607dcce675a5c39a276663b06b | |
parent | 1a62744325edc68e106b806ede0ac418d880ca4f (diff) |
-fix misc clang compiler warnings
17 files changed, 105 insertions, 43 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index d95dafdc..d55d5a07 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -333,6 +333,7 @@ handle_mhd_completion_callback (void *cls, { struct TMH_HandlerContext *hc = *con_cls; + (void) cls; if (NULL == hc) return; GNUNET_SCHEDULER_begin_async_scope (&hc->async_scope_id); @@ -440,6 +441,8 @@ handle_server_options (const struct TMH_RequestHandler *rh, struct MHD_Connection *connection, struct TMH_HandlerContext *hc) { + (void) rh; + (void) hc; return TALER_MHD_reply_cors_preflight (connection); } @@ -664,7 +667,7 @@ url_handler (void *cls, .handler = &TMH_private_get_instances_default_ID_kyc, }, { - NULL + .url_prefix = NULL } }; @@ -918,7 +921,7 @@ url_handler (void *cls, .handler = &TMH_private_get_transfers }, { - NULL + .url_prefix = NULL } }; static struct TMH_RequestHandler public_handlers[] = { @@ -1049,7 +1052,7 @@ url_handler (void *cls, .handler = &handle_server_options }, { - NULL + .url_prefix = NULL } }; struct TMH_HandlerContext *hc = *con_cls; diff --git a/src/backend/taler-merchant-httpd_get-orders-ID.c b/src/backend/taler-merchant-httpd_get-orders-ID.c index 5d229fc2..c1db5ea9 100644 --- a/src/backend/taler-merchant-httpd_get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_get-orders-ID.c @@ -758,6 +758,10 @@ process_refunds_cb (void *cls, { struct GetOrderData *god = cls; + (void) refund_serial; + (void) timestamp; + (void) exchange_url; + (void) rtransaction_id; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found refund of %s for coin %s with reason `%s' in database\n", TALER_amount2s (refund_amount), @@ -823,6 +827,7 @@ TMH_get_orders_ID (const struct TMH_RequestHandler *rh, bool contract_available = false; const char *merchant_base_url; + (void) rh; if (NULL == god) { god = GNUNET_new (struct GetOrderData); diff --git a/src/backend/taler-merchant-httpd_get-tips-ID.c b/src/backend/taler-merchant-httpd_get-tips-ID.c index 0486de3e..b20de7e1 100644 --- a/src/backend/taler-merchant-httpd_get-tips-ID.c +++ b/src/backend/taler-merchant-httpd_get-tips-ID.c @@ -164,6 +164,7 @@ TMH_get_tips_ID (const struct TMH_RequestHandler *rh, char *exchange_url; struct TALER_ReservePrivateKeyP reserve_priv; + (void) rh; if (GNUNET_OK != GNUNET_CRYPTO_hash_from_string (hc->infix, &tip_id.hash)) diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c index d0e4752f..8be93a01 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -1312,7 +1312,7 @@ process_pay_with_exchange ( goto AGE_FAIL; } dc->age_commitment.mask = denom_details->key.age_mask; - if ((dc->age_commitment.num + 1) != + if (((int) (dc->age_commitment.num + 1)) != __builtin_popcount (dc->age_commitment.mask.bits)) { GNUNET_break_op (0); diff --git a/src/backend/taler-merchant-httpd_private-delete-instances-ID.c b/src/backend/taler-merchant-httpd_private-delete-instances-ID.c index 9926d0b3..2791d6d7 100644 --- a/src/backend/taler-merchant-httpd_private-delete-instances-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-instances-ID.c @@ -92,6 +92,7 @@ TMH_private_delete_instances_ID (const struct TMH_RequestHandler *rh, { struct TMH_MerchantInstance *mi = hc->instance; + (void) rh; return delete_instances_ID (mi, connection); } @@ -104,6 +105,7 @@ TMH_private_delete_instances_default_ID (const struct TMH_RequestHandler *rh, { struct TMH_MerchantInstance *mi; + (void) rh; mi = TMH_lookup_instance (hc->infix); if (NULL == mi) { diff --git a/src/backend/taler-merchant-httpd_private-delete-orders-ID.c b/src/backend/taler-merchant-httpd_private-delete-orders-ID.c index 9d0b4fb4..dfdb486e 100644 --- a/src/backend/taler-merchant-httpd_private-delete-orders-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-orders-ID.c @@ -41,6 +41,7 @@ TMH_private_delete_orders_ID (const struct TMH_RequestHandler *rh, const char *force_s; bool force; + (void) rh; force_s = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "force"); diff --git a/src/backend/taler-merchant-httpd_private-delete-products-ID.c b/src/backend/taler-merchant-httpd_private-delete-products-ID.c index bb7964aa..7d314785 100644 --- a/src/backend/taler-merchant-httpd_private-delete-products-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-products-ID.c @@ -39,6 +39,7 @@ TMH_private_delete_products_ID (const struct TMH_RequestHandler *rh, struct TMH_MerchantInstance *mi = hc->instance; enum GNUNET_DB_QueryStatus qs; + (void) rh; GNUNET_assert (NULL != mi); GNUNET_assert (NULL != hc->infix); qs = TMH_db->delete_product (TMH_db->cls, diff --git a/src/backend/taler-merchant-httpd_private-delete-reserves-ID.c b/src/backend/taler-merchant-httpd_private-delete-reserves-ID.c index c391ed0e..bbfba877 100644 --- a/src/backend/taler-merchant-httpd_private-delete-reserves-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-reserves-ID.c @@ -41,6 +41,7 @@ TMH_private_delete_reserves_ID (const struct TMH_RequestHandler *rh, struct TALER_ReservePublicKeyP reserve_pub; const char *purge; + (void) rh; if (GNUNET_OK != GNUNET_STRINGS_string_to_data (hc->infix, strlen (hc->infix), @@ -59,7 +60,7 @@ TMH_private_delete_reserves_ID (const struct TMH_RequestHandler *rh, GNUNET_assert (NULL != mi); if ( (NULL != purge) && (0 == strcasecmp (purge, - "yes")) ) + "yes")) ) qs = TMH_db->purge_reserve (TMH_db->cls, mi->settings.id, &reserve_pub); diff --git a/src/backend/taler-merchant-httpd_private-delete-transfers-ID.c b/src/backend/taler-merchant-httpd_private-delete-transfers-ID.c index 1e191eb6..9b4412ba 100644 --- a/src/backend/taler-merchant-httpd_private-delete-transfers-ID.c +++ b/src/backend/taler-merchant-httpd_private-delete-transfers-ID.c @@ -33,6 +33,7 @@ TMH_private_delete_transfers_ID (const struct TMH_RequestHandler *rh, unsigned long long serial; char dummy; + (void) rh; GNUNET_assert (NULL != mi); if (1 != sscanf (hc->infix, diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c index 0709679b..10c76013 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c +++ b/src/backend/taler-merchant-httpd_private-get-instances-ID-kyc.c @@ -433,6 +433,54 @@ handle_kyc_timeout (void *cls) /** + * We are done with the KYC request @a ekr. + * Remove it from the work list and check if + * we are done overall. + * + * @param[in] ekr key request that is done (and will be freed) + */ +static void +ekr_finished (struct ExchangeKycRequest *ekr) +{ + struct KycContext *kc = ekr->kc; + + GNUNET_CONTAINER_DLL_remove (kc->exchange_pending_head, + kc->exchange_pending_tail, + ekr); + GNUNET_free (ekr->exchange_url); + GNUNET_free (ekr->payto_uri); + GNUNET_free (ekr); + if (NULL != kc->exchange_pending_head) + return; /* wait for more */ + /* All exchange requests done, create final + big response from cummulated replies */ + if ( (0 == json_array_size (kc->pending_kycs)) && + (0 == json_array_size (kc->timeout_kycs)) ) + { + /* special case: all KYC operations did succeed + after we asked at the exchanges => 204 */ + struct MHD_Response *response; + + response = MHD_create_response_from_buffer (0, + "", + MHD_RESPMEM_PERSISTENT); + resume_kyc_with_response (kc, + MHD_HTTP_NO_CONTENT, + response); + return; + } + resume_kyc_with_response ( + kc, + kc->response_code, /* MHD_HTTP_OK or MHD_HTTP_BAD_GATEWAY */ + TALER_MHD_MAKE_JSON_PACK ( + GNUNET_JSON_pack_array_incref ("pending_kycs", + kc->pending_kycs), + GNUNET_JSON_pack_array_incref ("timeout_kycs", + kc->timeout_kycs))); +} + + +/** * Function called with the result of a KYC check. * * @param cls a `struct ExchangeKycRequest *` @@ -520,41 +568,8 @@ exchange_check_cb (void *cls, ks->ec), GNUNET_JSON_pack_uint64 ("exchange_http_status", ks->http_status)))); - break; - } - GNUNET_CONTAINER_DLL_remove (kc->exchange_pending_head, - kc->exchange_pending_tail, - ekr); - GNUNET_free (ekr->exchange_url); - GNUNET_free (ekr->payto_uri); - GNUNET_free (ekr); - if (NULL != kc->exchange_pending_head) - return; /* wait for more */ - /* All exchange requests done, create final - big response from cummulated replies */ - if ( (0 == json_array_size (kc->pending_kycs)) && - (0 == json_array_size (kc->timeout_kycs)) ) - { - /* special case: all KYC operations did succeed - after we asked at the exchanges => 204 */ - struct MHD_Response *response; - - response = MHD_create_response_from_buffer (0, - "", - MHD_RESPMEM_PERSISTENT); - resume_kyc_with_response (kc, - MHD_HTTP_NO_CONTENT, - response); - return; } - resume_kyc_with_response ( - kc, - kc->response_code, /* MHD_HTTP_OK or MHD_HTTP_BAD_GATEWAY */ - TALER_MHD_MAKE_JSON_PACK ( - GNUNET_JSON_pack_array_incref ("pending_kycs", - kc->pending_kycs), - GNUNET_JSON_pack_array_incref ("timeout_kycs", - kc->timeout_kycs))); + ekr_finished (ekr); } @@ -581,7 +596,31 @@ kyc_with_exchange (void *cls, struct KycContext *kc = ekr->kc; struct TALER_PaytoHashP h_payto; + (void) payto_uri; + (void) wire_fee; + (void) exchange_trusted; ekr->fo = NULL; + if (MHD_HTTP_OK != hr->http_status) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + "Exchange responded with HTTP status %u (%d) to /kyc-check request!\n", + hr->http_status, + hr->ec); + kc->response_code = MHD_HTTP_BAD_GATEWAY; + GNUNET_assert ( + 0 == + json_array_append_new ( + kc->timeout_kycs, + GNUNET_JSON_PACK ( + GNUNET_JSON_pack_string ("exchange_url", + ekr->exchange_url), + GNUNET_JSON_pack_uint64 ("exchange_code", + hr->ec), + GNUNET_JSON_pack_uint64 ("exchange_http_status", + hr->http_status)))); + ekr_finished (ekr); + return; + } TALER_payto_hash (ekr->payto_uri, &h_payto); ekr->kyc = TALER_EXCHANGE_kyc_check ( @@ -832,6 +871,7 @@ TMH_private_get_instances_ID_kyc (const struct TMH_RequestHandler *rh, { struct TMH_MerchantInstance *mi = hc->instance; + (void) rh; return get_instances_ID_kyc (mi, connection, hc); @@ -845,6 +885,7 @@ TMH_private_get_instances_default_ID_kyc (const struct TMH_RequestHandler *rh, { struct TMH_MerchantInstance *mi; + (void) rh; mi = TMH_lookup_instance (hc->infix); if (NULL == mi) { diff --git a/src/backend/taler-merchant-httpd_private-get-instances.c b/src/backend/taler-merchant-httpd_private-get-instances.c index 3eedcd83..dc0f566f 100644 --- a/src/backend/taler-merchant-httpd_private-get-instances.c +++ b/src/backend/taler-merchant-httpd_private-get-instances.c @@ -29,7 +29,7 @@ * @param value a `struct TMH_MerchantInstance *` * @return #GNUNET_OK (continue to iterate) */ -static int +static enum GNUNET_GenericReturnValue add_instance (void *cls, const struct GNUNET_HashCode *key, void *value) @@ -107,6 +107,7 @@ TMH_private_get_instances (const struct TMH_RequestHandler *rh, { json_t *ia; + (void) rh; (void) hc; ia = json_array (); GNUNET_assert (NULL != ia); diff --git a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c index 5b1481a7..5545b02f 100644 --- a/src/backend/taler-merchant-httpd_private-get-reserves-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-reserves-ID.c @@ -152,6 +152,7 @@ TMH_private_get_reserves_ID (const struct TMH_RequestHandler *rh, struct TALER_ReservePublicKeyP reserve_pub; bool tips; + (void) rh; if (GNUNET_OK != GNUNET_STRINGS_string_to_data (hc->infix, strlen (hc->infix), diff --git a/src/backend/taler-merchant-httpd_private-get-reserves.c b/src/backend/taler-merchant-httpd_private-get-reserves.c index be0925d3..6621ffb4 100644 --- a/src/backend/taler-merchant-httpd_private-get-reserves.c +++ b/src/backend/taler-merchant-httpd_private-get-reserves.c @@ -94,6 +94,7 @@ TMH_private_get_reserves (const struct TMH_RequestHandler *rh, enum TALER_EXCHANGE_YesNoAll active; enum TALER_EXCHANGE_YesNoAll failures; + (void) rh; if (! (TALER_arg_to_yna (connection, "active", TALER_EXCHANGE_YNA_ALL, diff --git a/src/backend/taler-merchant-httpd_private-get-tips-ID.c b/src/backend/taler-merchant-httpd_private-get-tips-ID.c index 51089928..17002168 100644 --- a/src/backend/taler-merchant-httpd_private-get-tips-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-tips-ID.c @@ -45,6 +45,7 @@ TMH_private_get_tips_ID (const struct TMH_RequestHandler *rh, bool fpu; json_t *pickups_json = NULL; + (void) rh; GNUNET_assert (NULL != hc->infix); // FIXME: support long-polling (client-side already implemented) if (GNUNET_OK != diff --git a/src/backend/taler-merchant-httpd_private-get-tips.c b/src/backend/taler-merchant-httpd_private-get-tips.c index 4f358be2..91a05366 100644 --- a/src/backend/taler-merchant-httpd_private-get-tips.c +++ b/src/backend/taler-merchant-httpd_private-get-tips.c @@ -62,6 +62,7 @@ TMH_private_get_tips (const struct TMH_RequestHandler *rh, uint64_t offset; int64_t limit; + (void) rh; if (! (TALER_arg_to_yna (connection, "expired", TALER_EXCHANGE_YNA_NO, diff --git a/src/backend/taler-merchant-httpd_private-get-transfers.c b/src/backend/taler-merchant-httpd_private-get-transfers.c index 03a7beaa..c43781dd 100644 --- a/src/backend/taler-merchant-httpd_private-get-transfers.c +++ b/src/backend/taler-merchant-httpd_private-get-transfers.c @@ -103,6 +103,7 @@ TMH_private_get_transfers (const struct TMH_RequestHandler *rh, uint64_t offset; enum TALER_EXCHANGE_YesNoAll verified; + (void) rh; payto_uri = MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "payto_uri"); diff --git a/src/backend/taler-merchant-httpd_qr.c b/src/backend/taler-merchant-httpd_qr.c index 4539beed..59e80bf2 100644 --- a/src/backend/taler-merchant-httpd_qr.c +++ b/src/backend/taler-merchant-httpd_qr.c @@ -78,11 +78,11 @@ TMH_create_qrcode (const char *uri) "style='shape-rendering: crispedges;'>\n", qrc->width, qrc->width); - for (unsigned int y = 0; y<qrc->width; y++) + for (unsigned int y = 0; y<(unsigned int) qrc->width; y++) { - for (unsigned int x = 0; x<qrc->width; x++) + for (unsigned int x = 0; x<(unsigned int) qrc->width; x++) { - unsigned int off = x + y * qrc->width; + unsigned int off = x + y * (unsigned int) qrc->width; if (0 == (qrc->data[off] & 1)) continue; GNUNET_buffer_write_fstr (&buf, |