aboutsummaryrefslogtreecommitdiff
path: root/src/mint/mint_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/mint_common.c')
-rw-r--r--src/mint/mint_common.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/src/mint/mint_common.c b/src/mint/mint_common.c
index f0ee09110..41b9d6ed5 100644
--- a/src/mint/mint_common.c
+++ b/src/mint/mint_common.c
@@ -231,42 +231,5 @@ TALER_MINT_denomkeys_iterate (const char *mint_base_dir,
231} 231}
232 232
233 233
234int
235TALER_TALER_DB_extract_amount_nbo (PGresult *result,
236 unsigned int row,
237 int indices[3],
238 struct TALER_AmountNBO *denom_nbo)
239{
240 if ((indices[0] < 0) || (indices[1] < 0) || (indices[2] < 0))
241 return GNUNET_NO;
242 if (sizeof (uint32_t) != PQgetlength (result, row, indices[0]))
243 return GNUNET_SYSERR;
244 if (sizeof (uint32_t) != PQgetlength (result, row, indices[1]))
245 return GNUNET_SYSERR;
246 if (PQgetlength (result, row, indices[2]) > TALER_CURRENCY_LEN)
247 return GNUNET_SYSERR;
248 denom_nbo->value = *(uint32_t *) PQgetvalue (result, row, indices[0]);
249 denom_nbo->fraction = *(uint32_t *) PQgetvalue (result, row, indices[1]);
250 memset (denom_nbo->currency, 0, TALER_CURRENCY_LEN);
251 memcpy (denom_nbo->currency, PQgetvalue (result, row, indices[2]), PQgetlength (result, row, indices[2]));
252 return GNUNET_OK;
253}
254
255
256int
257TALER_TALER_DB_extract_amount (PGresult *result,
258 unsigned int row,
259 int indices[3],
260 struct TALER_Amount *denom)
261{
262 struct TALER_AmountNBO denom_nbo;
263 int res;
264
265 res = TALER_TALER_DB_extract_amount_nbo (result, row, indices, &denom_nbo);
266 if (GNUNET_OK != res)
267 return res;
268 *denom = TALER_amount_ntoh (denom_nbo);
269 return GNUNET_OK;
270}
271 234
272/* end of mint_common.c */ 235/* end of mint_common.c */