aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/bank-lib')
-rw-r--r--src/bank-lib/fakebank.c25
-rw-r--r--src/bank-lib/fakebank_history.c1
-rw-r--r--src/bank-lib/taler-fakebank-run.c7
-rw-r--r--src/bank-lib/testing_api_cmd_history.c52
-rw-r--r--src/bank-lib/testing_api_cmd_reject.c57
5 files changed, 78 insertions, 64 deletions
diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c
index 4323afdc..94e2e8d7 100644
--- a/src/bank-lib/fakebank.c
+++ b/src/bank-lib/fakebank.c
@@ -367,7 +367,9 @@ handle_mhd_completion_callback (void *cls,
enum MHD_RequestTerminationCode toe)
{
/* struct TALER_FAKEBANK_Handle *h = cls; */
-
+ (void) cls;
+ (void) connection;
+ (void) toe;
GNUNET_JSON_post_parser_cleanup (*con_cls);
*con_cls = NULL;
}
@@ -607,6 +609,8 @@ handle_home_page (struct TALER_FAKEBANK_Handle *h,
struct MHD_Response *resp;
#define HELLOMSG "Hello, Fakebank!"
+ (void) h;
+ (void) con_cls;
resp = MHD_create_response_from_buffer
(strlen (HELLOMSG),
HELLOMSG,
@@ -640,8 +644,10 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
const char *delta;
struct Transaction *pos;
- if (GNUNET_OK != TFH_parse_history_common_args (connection,
- &ha))
+ (void) con_cls;
+ if (GNUNET_OK !=
+ TFH_parse_history_common_args (connection,
+ &ha))
{
GNUNET_break (0);
return MHD_NO;
@@ -666,9 +672,10 @@ handle_history (struct TALER_FAKEBANK_Handle *h,
ha.range = &hri;
if (NULL == start)
+ {
pos = 0 > hri.count ?
h->transactions_tail : h->transactions_head;
-
+ }
else if (NULL != h->transactions_head)
{
for (pos = h->transactions_head;
@@ -727,8 +734,10 @@ handle_history_range (struct TALER_FAKEBANK_Handle *h,
long long unsigned int end_stamp;
struct Transaction *pos;
- if (GNUNET_OK != TFH_parse_history_common_args (connection,
- &ha))
+ (void) con_cls;
+ if (GNUNET_OK !=
+ TFH_parse_history_common_args (connection,
+ &ha))
{
GNUNET_break (0);
return MHD_NO;
@@ -771,6 +780,7 @@ handle_history_range (struct TALER_FAKEBANK_Handle *h,
&TFH_handle_history_range_advance);
}
+
/**
* Handle incoming HTTP request.
*
@@ -796,11 +806,10 @@ handle_mhd_request (void *cls,
{
struct TALER_FAKEBANK_Handle *h = cls;
+ (void) version;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Fakebank, serving: %s\n",
url);
-
-
if ( (0 == strcasecmp (url,
"/")) &&
(0 == strcasecmp (method,
diff --git a/src/bank-lib/fakebank_history.c b/src/bank-lib/fakebank_history.c
index b1770bb8..2ad363b4 100644
--- a/src/bank-lib/fakebank_history.c
+++ b/src/bank-lib/fakebank_history.c
@@ -130,6 +130,7 @@ struct Transaction *
TFH_handle_history_range_skip (const struct HistoryArgs *ha,
const struct Transaction *pos)
{
+ (void) ha;
/* Transactions
* are stored from "head"/older to "tail"/younger. */
return pos->next;
diff --git a/src/bank-lib/taler-fakebank-run.c b/src/bank-lib/taler-fakebank-run.c
index 51d054bc..2ed21d52 100644
--- a/src/bank-lib/taler-fakebank-run.c
+++ b/src/bank-lib/taler-fakebank-run.c
@@ -43,11 +43,13 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
-
+ (void) cls;
+ (void) args;
+ (void) cfgfile;
+ (void) cfg;
if (NULL == TALER_FAKEBANK_start (8082))
ret = 1;
ret = 0;
-
}
@@ -74,6 +76,5 @@ main (int argc,
&run,
NULL))
return 1;
-
return ret;
}
diff --git a/src/bank-lib/testing_api_cmd_history.c b/src/bank-lib/testing_api_cmd_history.c
index c5b31197..ca861314 100644
--- a/src/bank-lib/testing_api_cmd_history.c
+++ b/src/bank-lib/testing_api_cmd_history.c
@@ -809,6 +809,7 @@ history_cb (void *cls,
struct TALER_TESTING_Interpreter *is = cls;
struct HistoryState *hs = is->commands[is->ip].cls;
+ (void) row_id;
/*NOTE: "204 No Content" is used to signal the end of results.*/
if (MHD_HTTP_NO_CONTENT == http_status)
{
@@ -821,16 +822,19 @@ history_cb (void *cls,
GNUNET_break (0);
total = build_history (is, &h);
- GNUNET_log
- (GNUNET_ERROR_TYPE_ERROR,
- "Expected history of length %llu, got %llu;"
- " HTTP status code: %u, failed: %d\n",
- (unsigned long long) total,
- (unsigned long long) hs->results_obtained,
- http_status,
- hs->failed);
- print_expected (h, total, UINT_MAX);
- free_history (h, total);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Expected history of length %llu, got %llu;"
+ " HTTP status code: %u/%d, failed: %d\n",
+ (unsigned long long) total,
+ (unsigned long long) hs->results_obtained,
+ http_status,
+ (int) ec,
+ hs->failed);
+ print_expected (h,
+ total,
+ UINT_MAX);
+ free_history (h,
+ total);
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -841,10 +845,9 @@ history_cb (void *cls,
if (MHD_HTTP_OK != http_status)
{
hs->hh = NULL;
- GNUNET_log
- (GNUNET_ERROR_TYPE_ERROR,
- "Unwanted response code from /history[-range]: %u\n",
- http_status);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unwanted response code from /history[-range]: %u\n",
+ http_status);
TALER_TESTING_interpreter_fail (is);
return;
}
@@ -894,6 +897,7 @@ history_run (void *cls,
const uint64_t *row_id_ptr = &row_id;
struct TALER_BANK_AuthenticationData *auth;
+ (void) cmd;
/* Get row_id from trait. */
if (NULL != hs->start_row_reference)
{
@@ -942,15 +946,14 @@ history_range_run (void *cls,
const struct TALER_TESTING_Command *cmd,
struct TALER_TESTING_Interpreter *is)
{
-
struct HistoryState *hs = cls;
const struct GNUNET_TIME_Absolute *start_date;
const struct GNUNET_TIME_Absolute *end_date;
struct TALER_BANK_AuthenticationData *auth;
+ (void) cmd;
if (NULL != hs->start_row_reference)
{
-
const struct TALER_TESTING_Command *history_cmd;
history_cmd = TALER_TESTING_interpreter_lookup_command
@@ -974,7 +977,6 @@ history_range_run (void *cls,
if (NULL != hs->end_row_reference)
{
-
const struct TALER_TESTING_Command *history_cmd;
history_cmd = TALER_TESTING_interpreter_lookup_command
@@ -1024,6 +1026,7 @@ history_cleanup (void *cls,
{
struct HistoryState *hs = cls;
+ (void) cmd;
if (NULL != hs->hh)
{
TALER_LOG_WARNING ("/history did not complete\n");
@@ -1050,14 +1053,13 @@ history_cleanup (void *cls,
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history
- (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- const char *start_row_reference,
- unsigned long long num_results)
+TALER_TESTING_cmd_bank_history (const char *label,
+ const char *bank_url,
+ uint64_t account_no,
+ enum TALER_BANK_Direction direction,
+ unsigned int ascending,
+ const char *start_row_reference,
+ unsigned long long num_results)
{
struct HistoryState *hs;
diff --git a/src/bank-lib/testing_api_cmd_reject.c b/src/bank-lib/testing_api_cmd_reject.c
index 1f19a379..8d37266d 100644
--- a/src/bank-lib/testing_api_cmd_reject.c
+++ b/src/bank-lib/testing_api_cmd_reject.c
@@ -79,14 +79,16 @@ reject_cb (void *cls,
{
GNUNET_break (0);
fprintf (stderr,
- "Unexpected response code %u:\n",
- http_status);
+ "Unexpected response code %u/%d\n",
+ http_status,
+ (int) ec);
TALER_TESTING_interpreter_fail (is);
return;
}
TALER_TESTING_interpreter_next (is);
}
+
/**
* Cleanup the state of a "reject" CMD, and possibly
* cancel a pending operation thereof.
@@ -95,21 +97,21 @@ reject_cb (void *cls,
* @param cmd the command.
*/
static void
-reject_cleanup
- (void *cls,
- const struct TALER_TESTING_Command *cmd)
+reject_cleanup (void *cls,
+ const struct TALER_TESTING_Command *cmd)
{
struct RejectState *rs = cls;
+ (void) cmd;
if (NULL != rs->rh)
{
TALER_LOG_WARNING ("/reject did not complete\n");
TALER_BANK_reject_cancel (rs->rh);
}
-
GNUNET_free (rs);
}
+
/**
* Run the command.
*
@@ -128,19 +130,18 @@ reject_run (void *cls,
const uint64_t *row_id;
extern struct TALER_BANK_AuthenticationData AUTHS[];
- deposit_cmd = TALER_TESTING_interpreter_lookup_command
- (is, rs->deposit_reference);
-
+ (void) cmd;
+ deposit_cmd
+ = TALER_TESTING_interpreter_lookup_command (is,
+ rs->deposit_reference);
if (NULL == deposit_cmd)
TALER_TESTING_FAIL (is);
-
- GNUNET_assert
- (GNUNET_OK == TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT
- (deposit_cmd, &credit_account));
-
- GNUNET_assert
- (GNUNET_OK == TALER_TESTING_GET_TRAIT_ROW_ID
- (deposit_cmd, &row_id));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT (deposit_cmd,
+ &credit_account));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_TESTING_GET_TRAIT_ROW_ID (deposit_cmd,
+ &row_id));
TALER_LOG_INFO ("Account %llu rejects deposit\n",
(unsigned long long) *credit_account);
rs->rh = TALER_BANK_reject (is->ctx,
@@ -191,7 +192,6 @@ reject_traits (void *cls,
* @param deposit_reference reference to a command that will
* provide a "row id" and credit (bank) account to craft
* the "reject" request.
- *
* @return the command.
*/
struct TALER_TESTING_Command
@@ -205,16 +205,17 @@ TALER_TESTING_cmd_bank_reject (const char *label,
rs->bank_url = bank_url;
rs->deposit_reference = deposit_reference;
- struct TALER_TESTING_Command cmd = {
- .cls = rs,
- .run = &reject_run,
- .cleanup = &reject_cleanup,
- .label = label,
- .traits = &reject_traits
- };
-
- return cmd;
-
+ {
+ struct TALER_TESTING_Command cmd = {
+ .cls = rs,
+ .run = &reject_run,
+ .cleanup = &reject_cleanup,
+ .label = label,
+ .traits = &reject_traits
+ };
+
+ return cmd;
+ }
}