summaryrefslogtreecommitdiff
path: root/src/sq/sq_result_helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sq/sq_result_helper.c')
-rw-r--r--src/sq/sq_result_helper.c505
1 files changed, 252 insertions, 253 deletions
diff --git a/src/sq/sq_result_helper.c b/src/sq/sq_result_helper.c
index 6cef94326..5ea3f1e56 100644
--- a/src/sq/sq_result_helper.c
+++ b/src/sq/sq_result_helper.c
@@ -1,4 +1,3 @@
1
2/* 1/*
3 This file is part of GNUnet 2 This file is part of GNUnet
4 Copyright (C) 2017 GNUnet e.V. 3 Copyright (C) 2017 GNUnet e.V.
@@ -40,53 +39,53 @@
40 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 39 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
41 */ 40 */
42static int 41static int
43extract_var_blob(void *cls, 42extract_var_blob (void *cls,
44 sqlite3_stmt *result, 43 sqlite3_stmt *result,
45 unsigned int column, 44 unsigned int column,
46 size_t *dst_size, 45 size_t *dst_size,
47 void *dst) 46 void *dst)
48{ 47{
49 int have; 48 int have;
50 const void *ret; 49 const void *ret;
51 void **rdst = (void **)dst; 50 void **rdst = (void **) dst;
52 51
53 if (SQLITE_NULL == 52 if (SQLITE_NULL ==
54 sqlite3_column_type(result, 53 sqlite3_column_type (result,
55 column)) 54 column))
56 { 55 {
57 *rdst = NULL; 56 *rdst = NULL;
58 *dst_size = 0; 57 *dst_size = 0;
59 return GNUNET_YES; 58 return GNUNET_YES;
60 } 59 }
61 60
62 if (SQLITE_BLOB != 61 if (SQLITE_BLOB !=
63 sqlite3_column_type(result, 62 sqlite3_column_type (result,
64 column)) 63 column))
65 { 64 {
66 GNUNET_break(0); 65 GNUNET_break (0);
67 return GNUNET_SYSERR; 66 return GNUNET_SYSERR;
68 } 67 }
69 /* sqlite manual says to invoke 'sqlite3_column_blob()' 68 /* sqlite manual says to invoke 'sqlite3_column_blob()'
70 before calling sqlite3_column_bytes() */ 69 before calling sqlite3_column_bytes() */
71 ret = sqlite3_column_blob(result, 70 ret = sqlite3_column_blob (result,
72 column); 71 column);
73 have = sqlite3_column_bytes(result, 72 have = sqlite3_column_bytes (result,
74 column); 73 column);
75 if (have < 0) 74 if (have < 0)
76 { 75 {
77 GNUNET_break(0); 76 GNUNET_break (0);
78 return GNUNET_SYSERR; 77 return GNUNET_SYSERR;
79 } 78 }
80 *dst_size = have; 79 *dst_size = have;
81 if (0 == have) 80 if (0 == have)
82 { 81 {
83 *rdst = NULL; 82 *rdst = NULL;
84 return GNUNET_OK; 83 return GNUNET_OK;
85 } 84 }
86 *rdst = GNUNET_malloc(have); 85 *rdst = GNUNET_malloc (have);
87 GNUNET_memcpy(*rdst, 86 GNUNET_memcpy (*rdst,
88 ret, 87 ret,
89 have); 88 have);
90 return GNUNET_OK; 89 return GNUNET_OK;
91} 90}
92 91
@@ -97,15 +96,15 @@ extract_var_blob(void *cls,
97 * @param cls pointer to pointer of allocation 96 * @param cls pointer to pointer of allocation
98 */ 97 */
99static void 98static void
100clean_var_blob(void *cls) 99clean_var_blob (void *cls)
101{ 100{
102 void **dptr = (void **)cls; 101 void **dptr = (void **) cls;
103 102
104 if (NULL != *dptr) 103 if (NULL != *dptr)
105 { 104 {
106 GNUNET_free(*dptr); 105 GNUNET_free (*dptr);
107 *dptr = NULL; 106 *dptr = NULL;
108 } 107 }
109} 108}
110 109
111 110
@@ -117,8 +116,8 @@ clean_var_blob(void *cls)
117 * @return array entry for the result specification to use 116 * @return array entry for the result specification to use
118 */ 117 */
119struct GNUNET_SQ_ResultSpec 118struct GNUNET_SQ_ResultSpec
120GNUNET_SQ_result_spec_variable_size(void **dst, 119GNUNET_SQ_result_spec_variable_size (void **dst,
121 size_t *sptr) 120 size_t *sptr)
122{ 121{
123 struct GNUNET_SQ_ResultSpec rs = { 122 struct GNUNET_SQ_ResultSpec rs = {
124 .conv = &extract_var_blob, 123 .conv = &extract_var_blob,
@@ -146,44 +145,44 @@ GNUNET_SQ_result_spec_variable_size(void **dst,
146 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 145 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
147 */ 146 */
148static int 147static int
149extract_fixed_blob(void *cls, 148extract_fixed_blob (void *cls,
150 sqlite3_stmt *result, 149 sqlite3_stmt *result,
151 unsigned int column, 150 unsigned int column,
152 size_t *dst_size, 151 size_t *dst_size,
153 void *dst) 152 void *dst)
154{ 153{
155 int have; 154 int have;
156 const void *ret; 155 const void *ret;
157 156
158 if ((0 == *dst_size) && 157 if ((0 == *dst_size) &&
159 (SQLITE_NULL == 158 (SQLITE_NULL ==
160 sqlite3_column_type(result, 159 sqlite3_column_type (result,
161 column))) 160 column)))
162 { 161 {
163 return GNUNET_YES; 162 return GNUNET_YES;
164 } 163 }
165 164
166 if (SQLITE_BLOB != 165 if (SQLITE_BLOB !=
167 sqlite3_column_type(result, 166 sqlite3_column_type (result,
168 column)) 167 column))
169 { 168 {
170 GNUNET_break(0); 169 GNUNET_break (0);
171 return GNUNET_SYSERR; 170 return GNUNET_SYSERR;
172 } 171 }
173 /* sqlite manual says to invoke 'sqlite3_column_blob()' 172 /* sqlite manual says to invoke 'sqlite3_column_blob()'
174 before calling sqlite3_column_bytes() */ 173 before calling sqlite3_column_bytes() */
175 ret = sqlite3_column_blob(result, 174 ret = sqlite3_column_blob (result,
176 column); 175 column);
177 have = sqlite3_column_bytes(result, 176 have = sqlite3_column_bytes (result,
178 column); 177 column);
179 if (*dst_size != have) 178 if (*dst_size != have)
180 { 179 {
181 GNUNET_break(0); 180 GNUNET_break (0);
182 return GNUNET_SYSERR; 181 return GNUNET_SYSERR;
183 } 182 }
184 GNUNET_memcpy(dst, 183 GNUNET_memcpy (dst,
185 ret, 184 ret,
186 have); 185 have);
187 return GNUNET_OK; 186 return GNUNET_OK;
188} 187}
189 188
@@ -196,8 +195,8 @@ extract_fixed_blob(void *cls,
196 * @return array entry for the result specification to use 195 * @return array entry for the result specification to use
197 */ 196 */
198struct GNUNET_SQ_ResultSpec 197struct GNUNET_SQ_ResultSpec
199GNUNET_SQ_result_spec_fixed_size(void *dst, 198GNUNET_SQ_result_spec_fixed_size (void *dst,
200 size_t dst_size) 199 size_t dst_size)
201{ 200{
202 struct GNUNET_SQ_ResultSpec rs = { 201 struct GNUNET_SQ_ResultSpec rs = {
203 .conv = &extract_fixed_blob, 202 .conv = &extract_fixed_blob,
@@ -223,40 +222,40 @@ GNUNET_SQ_result_spec_fixed_size(void *dst,
223 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 222 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
224 */ 223 */
225static int 224static int
226extract_utf8_string(void *cls, 225extract_utf8_string (void *cls,
227 sqlite3_stmt *result, 226 sqlite3_stmt *result,
228 unsigned int column, 227 unsigned int column,
229 size_t *dst_size, 228 size_t *dst_size,
230 void *dst) 229 void *dst)
231{ 230{
232 const char *text; 231 const char *text;
233 char **rdst = dst; 232 char **rdst = dst;
234 233
235 if (SQLITE_NULL == 234 if (SQLITE_NULL ==
236 sqlite3_column_type(result, 235 sqlite3_column_type (result,
237 column)) 236 column))
238 { 237 {
239 *rdst = NULL; 238 *rdst = NULL;
240 return GNUNET_OK; 239 return GNUNET_OK;
241 } 240 }
242 if (SQLITE_TEXT != 241 if (SQLITE_TEXT !=
243 sqlite3_column_type(result, 242 sqlite3_column_type (result,
244 column)) 243 column))
245 { 244 {
246 GNUNET_break(0); 245 GNUNET_break (0);
247 return GNUNET_SYSERR; 246 return GNUNET_SYSERR;
248 } 247 }
249 /* sqlite manual guarantees that 'sqlite3_column_text()' 248 /* sqlite manual guarantees that 'sqlite3_column_text()'
250 is 0-terminated */ 249 is 0-terminated */
251 text = (const char *)sqlite3_column_text(result, 250 text = (const char *) sqlite3_column_text (result,
252 column); 251 column);
253 if (NULL == text) 252 if (NULL == text)
254 { 253 {
255 GNUNET_break(0); 254 GNUNET_break (0);
256 return GNUNET_SYSERR; 255 return GNUNET_SYSERR;
257 } 256 }
258 *dst_size = strlen(text) + 1; 257 *dst_size = strlen (text) + 1;
259 *rdst = GNUNET_strdup(text); 258 *rdst = GNUNET_strdup (text);
260 return GNUNET_OK; 259 return GNUNET_OK;
261} 260}
262 261
@@ -267,15 +266,15 @@ extract_utf8_string(void *cls,
267 * @param cls pointer to pointer of allocation 266 * @param cls pointer to pointer of allocation
268 */ 267 */
269static void 268static void
270clean_utf8_string(void *cls) 269clean_utf8_string (void *cls)
271{ 270{
272 char **dptr = (char **)cls; 271 char **dptr = (char **) cls;
273 272
274 if (NULL != *dptr) 273 if (NULL != *dptr)
275 { 274 {
276 GNUNET_free(*dptr); 275 GNUNET_free (*dptr);
277 *dptr = NULL; 276 *dptr = NULL;
278 } 277 }
279} 278}
280 279
281 280
@@ -286,7 +285,7 @@ clean_utf8_string(void *cls)
286 * @return array entry for the result specification to use 285 * @return array entry for the result specification to use
287 */ 286 */
288struct GNUNET_SQ_ResultSpec 287struct GNUNET_SQ_ResultSpec
289GNUNET_SQ_result_spec_string(char **dst) 288GNUNET_SQ_result_spec_string (char **dst)
290{ 289{
291 struct GNUNET_SQ_ResultSpec rs = { 290 struct GNUNET_SQ_ResultSpec rs = {
292 .conv = &extract_utf8_string, 291 .conv = &extract_utf8_string,
@@ -313,42 +312,42 @@ GNUNET_SQ_result_spec_string(char **dst)
313 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 312 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
314 */ 313 */
315static int 314static int
316extract_rsa_pub(void *cls, 315extract_rsa_pub (void *cls,
317 sqlite3_stmt *result, 316 sqlite3_stmt *result,
318 unsigned int column, 317 unsigned int column,
319 size_t *dst_size, 318 size_t *dst_size,
320 void *dst) 319 void *dst)
321{ 320{
322 struct GNUNET_CRYPTO_RsaPublicKey **pk = dst; 321 struct GNUNET_CRYPTO_RsaPublicKey **pk = dst;
323 int have; 322 int have;
324 const void *ret; 323 const void *ret;
325 324
326 if (SQLITE_BLOB != 325 if (SQLITE_BLOB !=
327 sqlite3_column_type(result, 326 sqlite3_column_type (result,
328 column)) 327 column))
329 { 328 {
330 GNUNET_break(0); 329 GNUNET_break (0);
331 return GNUNET_SYSERR; 330 return GNUNET_SYSERR;
332 } 331 }
333 /* sqlite manual says to invoke 'sqlite3_column_blob()' 332 /* sqlite manual says to invoke 'sqlite3_column_blob()'
334 before calling sqlite3_column_bytes() */ 333 before calling sqlite3_column_bytes() */
335 ret = sqlite3_column_blob(result, 334 ret = sqlite3_column_blob (result,
336 column); 335 column);
337 have = sqlite3_column_bytes(result, 336 have = sqlite3_column_bytes (result,
338 column); 337 column);
339 if (have < 0) 338 if (have < 0)
340 { 339 {
341 GNUNET_break(0); 340 GNUNET_break (0);
342 return GNUNET_SYSERR; 341 return GNUNET_SYSERR;
343 } 342 }
344 343
345 *pk = GNUNET_CRYPTO_rsa_public_key_decode(ret, 344 *pk = GNUNET_CRYPTO_rsa_public_key_decode (ret,
346 have); 345 have);
347 if (NULL == *pk) 346 if (NULL == *pk)
348 { 347 {
349 GNUNET_break(0); 348 GNUNET_break (0);
350 return GNUNET_SYSERR; 349 return GNUNET_SYSERR;
351 } 350 }
352 return GNUNET_OK; 351 return GNUNET_OK;
353} 352}
354 353
@@ -360,15 +359,15 @@ extract_rsa_pub(void *cls,
360 * @param cls closure 359 * @param cls closure
361 */ 360 */
362static void 361static void
363clean_rsa_pub(void *cls) 362clean_rsa_pub (void *cls)
364{ 363{
365 struct GNUNET_CRYPTO_RsaPublicKey **pk = cls; 364 struct GNUNET_CRYPTO_RsaPublicKey **pk = cls;
366 365
367 if (NULL != *pk) 366 if (NULL != *pk)
368 { 367 {
369 GNUNET_CRYPTO_rsa_public_key_free(*pk); 368 GNUNET_CRYPTO_rsa_public_key_free (*pk);
370 *pk = NULL; 369 *pk = NULL;
371 } 370 }
372} 371}
373 372
374 373
@@ -379,7 +378,7 @@ clean_rsa_pub(void *cls)
379 * @return array entry for the result specification to use 378 * @return array entry for the result specification to use
380 */ 379 */
381struct GNUNET_SQ_ResultSpec 380struct GNUNET_SQ_ResultSpec
382GNUNET_SQ_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa) 381GNUNET_SQ_result_spec_rsa_public_key (struct GNUNET_CRYPTO_RsaPublicKey **rsa)
383{ 382{
384 struct GNUNET_SQ_ResultSpec rs = { 383 struct GNUNET_SQ_ResultSpec rs = {
385 .conv = &extract_rsa_pub, 384 .conv = &extract_rsa_pub,
@@ -406,42 +405,42 @@ GNUNET_SQ_result_spec_rsa_public_key(struct GNUNET_CRYPTO_RsaPublicKey **rsa)
406 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 405 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
407 */ 406 */
408static int 407static int
409extract_rsa_sig(void *cls, 408extract_rsa_sig (void *cls,
410 sqlite3_stmt *result, 409 sqlite3_stmt *result,
411 unsigned int column, 410 unsigned int column,
412 size_t *dst_size, 411 size_t *dst_size,
413 void *dst) 412 void *dst)
414{ 413{
415 struct GNUNET_CRYPTO_RsaSignature **sig = dst; 414 struct GNUNET_CRYPTO_RsaSignature **sig = dst;
416 int have; 415 int have;
417 const void *ret; 416 const void *ret;
418 417
419 if (SQLITE_BLOB != 418 if (SQLITE_BLOB !=
420 sqlite3_column_type(result, 419 sqlite3_column_type (result,
421 column)) 420 column))
422 { 421 {
423 GNUNET_break(0); 422 GNUNET_break (0);
424 return GNUNET_SYSERR; 423 return GNUNET_SYSERR;
425 } 424 }
426 /* sqlite manual says to invoke 'sqlite3_column_blob()' 425 /* sqlite manual says to invoke 'sqlite3_column_blob()'
427 before calling sqlite3_column_bytes() */ 426 before calling sqlite3_column_bytes() */
428 ret = sqlite3_column_blob(result, 427 ret = sqlite3_column_blob (result,
429 column); 428 column);
430 have = sqlite3_column_bytes(result, 429 have = sqlite3_column_bytes (result,
431 column); 430 column);
432 if (have < 0) 431 if (have < 0)
433 { 432 {
434 GNUNET_break(0); 433 GNUNET_break (0);
435 return GNUNET_SYSERR; 434 return GNUNET_SYSERR;
436 } 435 }
437 436
438 *sig = GNUNET_CRYPTO_rsa_signature_decode(ret, 437 *sig = GNUNET_CRYPTO_rsa_signature_decode (ret,
439 have); 438 have);
440 if (NULL == *sig) 439 if (NULL == *sig)
441 { 440 {
442 GNUNET_break(0); 441 GNUNET_break (0);
443 return GNUNET_SYSERR; 442 return GNUNET_SYSERR;
444 } 443 }
445 return GNUNET_OK; 444 return GNUNET_OK;
446} 445}
447 446
@@ -453,15 +452,15 @@ extract_rsa_sig(void *cls,
453 * @param cls result data to clean up 452 * @param cls result data to clean up
454 */ 453 */
455static void 454static void
456clean_rsa_sig(void *cls) 455clean_rsa_sig (void *cls)
457{ 456{
458 struct GNUNET_CRYPTO_RsaSignature **sig = cls; 457 struct GNUNET_CRYPTO_RsaSignature **sig = cls;
459 458
460 if (NULL != *sig) 459 if (NULL != *sig)
461 { 460 {
462 GNUNET_CRYPTO_rsa_signature_free(*sig); 461 GNUNET_CRYPTO_rsa_signature_free (*sig);
463 *sig = NULL; 462 *sig = NULL;
464 } 463 }
465} 464}
466 465
467 466
@@ -472,7 +471,7 @@ clean_rsa_sig(void *cls)
472 * @return array entry for the result specification to use 471 * @return array entry for the result specification to use
473 */ 472 */
474struct GNUNET_SQ_ResultSpec 473struct GNUNET_SQ_ResultSpec
475GNUNET_SQ_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig) 474GNUNET_SQ_result_spec_rsa_signature (struct GNUNET_CRYPTO_RsaSignature **sig)
476{ 475{
477 struct GNUNET_SQ_ResultSpec rs = { 476 struct GNUNET_SQ_ResultSpec rs = {
478 .conv = &extract_rsa_sig, 477 .conv = &extract_rsa_sig,
@@ -499,25 +498,25 @@ GNUNET_SQ_result_spec_rsa_signature(struct GNUNET_CRYPTO_RsaSignature **sig)
499 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 498 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
500 */ 499 */
501static int 500static int
502extract_abs_time(void *cls, 501extract_abs_time (void *cls,
503 sqlite3_stmt *result, 502 sqlite3_stmt *result,
504 unsigned int column, 503 unsigned int column,
505 size_t *dst_size, 504 size_t *dst_size,
506 void *dst) 505 void *dst)
507{ 506{
508 struct GNUNET_TIME_Absolute *u = dst; 507 struct GNUNET_TIME_Absolute *u = dst;
509 struct GNUNET_TIME_Absolute t; 508 struct GNUNET_TIME_Absolute t;
510 509
511 GNUNET_assert(sizeof(uint64_t) == *dst_size); 510 GNUNET_assert (sizeof(uint64_t) == *dst_size);
512 if (SQLITE_INTEGER != 511 if (SQLITE_INTEGER !=
513 sqlite3_column_type(result, 512 sqlite3_column_type (result,
514 column)) 513 column))
515 { 514 {
516 GNUNET_break(0); 515 GNUNET_break (0);
517 return GNUNET_SYSERR; 516 return GNUNET_SYSERR;
518 } 517 }
519 t.abs_value_us = (uint64_t)sqlite3_column_int64(result, 518 t.abs_value_us = (uint64_t) sqlite3_column_int64 (result,
520 column); 519 column);
521 if (INT64_MAX == t.abs_value_us) 520 if (INT64_MAX == t.abs_value_us)
522 t = GNUNET_TIME_UNIT_FOREVER_ABS; 521 t = GNUNET_TIME_UNIT_FOREVER_ABS;
523 *u = t; 522 *u = t;
@@ -532,7 +531,7 @@ extract_abs_time(void *cls,
532 * @return array entry for the result specification to use 531 * @return array entry for the result specification to use
533 */ 532 */
534struct GNUNET_SQ_ResultSpec 533struct GNUNET_SQ_ResultSpec
535GNUNET_SQ_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at) 534GNUNET_SQ_result_spec_absolute_time (struct GNUNET_TIME_Absolute *at)
536{ 535{
537 struct GNUNET_SQ_ResultSpec rs = { 536 struct GNUNET_SQ_ResultSpec rs = {
538 .conv = &extract_abs_time, 537 .conv = &extract_abs_time,
@@ -558,28 +557,28 @@ GNUNET_SQ_result_spec_absolute_time(struct GNUNET_TIME_Absolute *at)
558 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 557 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
559 */ 558 */
560static int 559static int
561extract_abs_time_nbo(void *cls, 560extract_abs_time_nbo (void *cls,
562 sqlite3_stmt *result, 561 sqlite3_stmt *result,
563 unsigned int column, 562 unsigned int column,
564 size_t *dst_size, 563 size_t *dst_size,
565 void *dst) 564 void *dst)
566{ 565{
567 struct GNUNET_TIME_AbsoluteNBO *u = dst; 566 struct GNUNET_TIME_AbsoluteNBO *u = dst;
568 struct GNUNET_TIME_Absolute t; 567 struct GNUNET_TIME_Absolute t;
569 568
570 GNUNET_assert(sizeof(uint64_t) == *dst_size); 569 GNUNET_assert (sizeof(uint64_t) == *dst_size);
571 if (SQLITE_INTEGER != 570 if (SQLITE_INTEGER !=
572 sqlite3_column_type(result, 571 sqlite3_column_type (result,
573 column)) 572 column))
574 { 573 {
575 GNUNET_break(0); 574 GNUNET_break (0);
576 return GNUNET_SYSERR; 575 return GNUNET_SYSERR;
577 } 576 }
578 t.abs_value_us = (uint64_t)sqlite3_column_int64(result, 577 t.abs_value_us = (uint64_t) sqlite3_column_int64 (result,
579 column); 578 column);
580 if (INT64_MAX == t.abs_value_us) 579 if (INT64_MAX == t.abs_value_us)
581 t = GNUNET_TIME_UNIT_FOREVER_ABS; 580 t = GNUNET_TIME_UNIT_FOREVER_ABS;
582 *u = GNUNET_TIME_absolute_hton(t); 581 *u = GNUNET_TIME_absolute_hton (t);
583 return GNUNET_OK; 582 return GNUNET_OK;
584} 583}
585 584
@@ -591,7 +590,7 @@ extract_abs_time_nbo(void *cls,
591 * @return array entry for the result specification to use 590 * @return array entry for the result specification to use
592 */ 591 */
593struct GNUNET_SQ_ResultSpec 592struct GNUNET_SQ_ResultSpec
594GNUNET_SQ_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at) 593GNUNET_SQ_result_spec_absolute_time_nbo (struct GNUNET_TIME_AbsoluteNBO *at)
595{ 594{
596 struct GNUNET_SQ_ResultSpec rs = { 595 struct GNUNET_SQ_ResultSpec rs = {
597 .conv = &extract_abs_time_nbo, 596 .conv = &extract_abs_time_nbo,
@@ -617,31 +616,31 @@ GNUNET_SQ_result_spec_absolute_time_nbo(struct GNUNET_TIME_AbsoluteNBO *at)
617 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 616 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
618 */ 617 */
619static int 618static int
620extract_uint16(void *cls, 619extract_uint16 (void *cls,
621 sqlite3_stmt *result, 620 sqlite3_stmt *result,
622 unsigned int column, 621 unsigned int column,
623 size_t *dst_size, 622 size_t *dst_size,
624 void *dst) 623 void *dst)
625{ 624{
626 uint64_t v; 625 uint64_t v;
627 uint16_t *u = dst; 626 uint16_t *u = dst;
628 627
629 GNUNET_assert(sizeof(uint16_t) == *dst_size); 628 GNUNET_assert (sizeof(uint16_t) == *dst_size);
630 if (SQLITE_INTEGER != 629 if (SQLITE_INTEGER !=
631 sqlite3_column_type(result, 630 sqlite3_column_type (result,
632 column)) 631 column))
633 { 632 {
634 GNUNET_break(0); 633 GNUNET_break (0);
635 return GNUNET_SYSERR; 634 return GNUNET_SYSERR;
636 } 635 }
637 v = (uint64_t)sqlite3_column_int64(result, 636 v = (uint64_t) sqlite3_column_int64 (result,
638 column); 637 column);
639 if (v > UINT16_MAX) 638 if (v > UINT16_MAX)
640 { 639 {
641 GNUNET_break(0); 640 GNUNET_break (0);
642 return GNUNET_SYSERR; 641 return GNUNET_SYSERR;
643 } 642 }
644 *u = (uint16_t)v; 643 *u = (uint16_t) v;
645 return GNUNET_OK; 644 return GNUNET_OK;
646} 645}
647 646
@@ -653,7 +652,7 @@ extract_uint16(void *cls,
653 * @return array entry for the result specification to use 652 * @return array entry for the result specification to use
654 */ 653 */
655struct GNUNET_SQ_ResultSpec 654struct GNUNET_SQ_ResultSpec
656GNUNET_SQ_result_spec_uint16(uint16_t *u16) 655GNUNET_SQ_result_spec_uint16 (uint16_t *u16)
657{ 656{
658 struct GNUNET_SQ_ResultSpec rs = { 657 struct GNUNET_SQ_ResultSpec rs = {
659 .conv = &extract_uint16, 658 .conv = &extract_uint16,
@@ -679,31 +678,31 @@ GNUNET_SQ_result_spec_uint16(uint16_t *u16)
679 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 678 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
680 */ 679 */
681static int 680static int
682extract_uint32(void *cls, 681extract_uint32 (void *cls,
683 sqlite3_stmt *result, 682 sqlite3_stmt *result,
684 unsigned int column, 683 unsigned int column,
685 size_t *dst_size, 684 size_t *dst_size,
686 void *dst) 685 void *dst)
687{ 686{
688 uint64_t v; 687 uint64_t v;
689 uint32_t *u = dst; 688 uint32_t *u = dst;
690 689
691 GNUNET_assert(sizeof(uint32_t) == *dst_size); 690 GNUNET_assert (sizeof(uint32_t) == *dst_size);
692 if (SQLITE_INTEGER != 691 if (SQLITE_INTEGER !=
693 sqlite3_column_type(result, 692 sqlite3_column_type (result,
694 column)) 693 column))
695 { 694 {
696 GNUNET_break(0); 695 GNUNET_break (0);
697 return GNUNET_SYSERR; 696 return GNUNET_SYSERR;
698 } 697 }
699 v = (uint64_t)sqlite3_column_int64(result, 698 v = (uint64_t) sqlite3_column_int64 (result,
700 column); 699 column);
701 if (v > UINT32_MAX) 700 if (v > UINT32_MAX)
702 { 701 {
703 GNUNET_break(0); 702 GNUNET_break (0);
704 return GNUNET_SYSERR; 703 return GNUNET_SYSERR;
705 } 704 }
706 *u = (uint32_t)v; 705 *u = (uint32_t) v;
707 return GNUNET_OK; 706 return GNUNET_OK;
708} 707}
709 708
@@ -715,7 +714,7 @@ extract_uint32(void *cls,
715 * @return array entry for the result specification to use 714 * @return array entry for the result specification to use
716 */ 715 */
717struct GNUNET_SQ_ResultSpec 716struct GNUNET_SQ_ResultSpec
718GNUNET_SQ_result_spec_uint32(uint32_t *u32) 717GNUNET_SQ_result_spec_uint32 (uint32_t *u32)
719{ 718{
720 struct GNUNET_SQ_ResultSpec rs = { 719 struct GNUNET_SQ_ResultSpec rs = {
721 .conv = &extract_uint32, 720 .conv = &extract_uint32,
@@ -741,24 +740,24 @@ GNUNET_SQ_result_spec_uint32(uint32_t *u32)
741 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) 740 * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL)
742 */ 741 */
743static int 742static int
744extract_uint64(void *cls, 743extract_uint64 (void *cls,
745 sqlite3_stmt *result, 744 sqlite3_stmt *result,
746 unsigned int column, 745 unsigned int column,
747 size_t *dst_size, 746 size_t *dst_size,
748 void *dst) 747 void *dst)
749{ 748{
750 uint64_t *u = dst; 749 uint64_t *u = dst;
751 750
752 GNUNET_assert(sizeof(uint64_t) == *dst_size); 751 GNUNET_assert (sizeof(uint64_t) == *dst_size);
753 if (SQLITE_INTEGER != 752 if (SQLITE_INTEGER !=
754 sqlite3_column_type(result, 753 sqlite3_column_type (result,
755 column)) 754 column))
756 { 755 {
757 GNUNET_break(0); 756 GNUNET_break (0);
758 return GNUNET_SYSERR; 757 return GNUNET_SYSERR;
759 } 758 }
760 *u = (uint64_t)sqlite3_column_int64(result, 759 *u = (uint64_t) sqlite3_column_int64 (result,
761 column); 760 column);
762 return GNUNET_OK; 761 return GNUNET_OK;
763} 762}
764 763
@@ -770,7 +769,7 @@ extract_uint64(void *cls,
770 * @return array entry for the result specification to use 769 * @return array entry for the result specification to use
771 */ 770 */
772struct GNUNET_SQ_ResultSpec 771struct GNUNET_SQ_ResultSpec
773GNUNET_SQ_result_spec_uint64(uint64_t *u64) 772GNUNET_SQ_result_spec_uint64 (uint64_t *u64)
774{ 773{
775 struct GNUNET_SQ_ResultSpec rs = { 774 struct GNUNET_SQ_ResultSpec rs = {
776 .conv = &extract_uint64, 775 .conv = &extract_uint64,