commit 24bba23bd889e974f5c180f99a907338790001d7
parent 9fb9c0fab3959f41b66dcad2ccaa14305ef2b35e
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date: Thu, 18 Jan 2024 11:51:45 +0100
[httpd] fix get charity
Diffstat:
3 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/src/donau/donau-httpd_get-charity.c b/src/donau/donau-httpd_get-charity.c
@@ -91,23 +91,20 @@ DH_handler_charity_get (
rc->connection,
MHD_HTTP_OK,
GNUNET_JSON_pack_data_auto ("charity_pub",
- meta.charity_pub),
- GNUNET_JSON_pack_data_auto ("url",
- &meta.charity_url),
- GNUNET_JSON_pack_data_auto ("name",
- &meta.charity_name),
+ &meta.charity_pub),
+ GNUNET_JSON_pack_string ("url",
+ meta.charity_url),
+ GNUNET_JSON_pack_string ("name",
+ meta.charity_name),
TALER_JSON_pack_amount ("max_per_year",
- meta.max_per_year),
+ &meta.max_per_year),
TALER_JSON_pack_amount ("receipts_to_date",
- meta.receipts_to_date),
+ &meta.receipts_to_date),
GNUNET_JSON_pack_uint64 ("current_year",
meta.current_year));
- GNUNET_free (meta.charity_pub);
GNUNET_free (meta.charity_url);
GNUNET_free (meta.charity_name);
- GNUNET_free (meta.max_per_year);
- GNUNET_free (meta.receipts_to_date);
return result;
}
}
diff --git a/src/donaudb/pg_lookup_charity.c b/src/donaudb/pg_lookup_charity.c
@@ -44,9 +44,9 @@ DH_PG_lookup_charity (
GNUNET_PQ_result_spec_string ("charity_url",
&meta->charity_url),
TALER_PQ_RESULT_SPEC_AMOUNT ("max_per_year",
- meta->max_per_year),
+ &meta->max_per_year),
TALER_PQ_RESULT_SPEC_AMOUNT ("receipts_to_date",
- meta->receipts_to_date),
+ &meta->receipts_to_date),
GNUNET_PQ_result_spec_uint64 ("current_year",
&meta->current_year),
GNUNET_PQ_result_spec_end
diff --git a/src/include/donaudb_plugin.h b/src/include/donaudb_plugin.h
@@ -82,7 +82,7 @@ struct DONAUDB_CharityMetaData
/**
* Charity public key
*/
- struct DONAU_CharityPublicKeyP *charity_pub;
+ struct DONAU_CharityPublicKeyP charity_pub;
/**
* Charity name
@@ -97,12 +97,12 @@ struct DONAUDB_CharityMetaData
/**
* Charity yearly donation limit
*/
- struct TALER_Amount *max_per_year;
+ struct TALER_Amount max_per_year;
/**
* Charity donations received in the current year
*/
- struct TALER_Amount *receipts_to_date;
+ struct TALER_Amount receipts_to_date;
/**
* Current year