diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-12 19:07:40 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-12 19:07:40 +0000 |
commit | 6c471eeb15e27f8226492b4860a3c2acb94c5f25 (patch) | |
tree | a3a9dcba12ee5356c03056c10b7aba5367b2ef34 /src/datastore/plugin_datastore_mysql.c | |
parent | 16bcbbea7133fd2265d46bd2ae1dc70e8c9ba96f (diff) | |
download | gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.tar.gz gnunet-6c471eeb15e27f8226492b4860a3c2acb94c5f25.zip |
-consistently use struct GNUNET_HashCode
Diffstat (limited to 'src/datastore/plugin_datastore_mysql.c')
-rw-r--r-- | src/datastore/plugin_datastore_mysql.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index ed7741cfc..b92877d98 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c | |||
@@ -281,7 +281,7 @@ mysql_plugin_estimate_size (void *cls) | |||
281 | * @return GNUNET_OK on success | 281 | * @return GNUNET_OK on success |
282 | */ | 282 | */ |
283 | static int | 283 | static int |
284 | mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, | 284 | mysql_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |
285 | const void *data, enum GNUNET_BLOCK_Type type, | 285 | const void *data, enum GNUNET_BLOCK_Type type, |
286 | uint32_t priority, uint32_t anonymity, uint32_t replication, | 286 | uint32_t priority, uint32_t anonymity, uint32_t replication, |
287 | struct GNUNET_TIME_Absolute expiration, char **msg) | 287 | struct GNUNET_TIME_Absolute expiration, char **msg) |
@@ -297,15 +297,15 @@ mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, | |||
297 | unsigned long hashSize; | 297 | unsigned long hashSize; |
298 | unsigned long hashSize2; | 298 | unsigned long hashSize2; |
299 | unsigned long lsize; | 299 | unsigned long lsize; |
300 | GNUNET_HashCode vhash; | 300 | struct GNUNET_HashCode vhash; |
301 | 301 | ||
302 | if (size > MAX_DATUM_SIZE) | 302 | if (size > MAX_DATUM_SIZE) |
303 | { | 303 | { |
304 | GNUNET_break (0); | 304 | GNUNET_break (0); |
305 | return GNUNET_SYSERR; | 305 | return GNUNET_SYSERR; |
306 | } | 306 | } |
307 | hashSize = sizeof (GNUNET_HashCode); | 307 | hashSize = sizeof (struct GNUNET_HashCode); |
308 | hashSize2 = sizeof (GNUNET_HashCode); | 308 | hashSize2 = sizeof (struct GNUNET_HashCode); |
309 | lsize = size; | 309 | lsize = size; |
310 | GNUNET_CRYPTO_hash (data, size, &vhash); | 310 | GNUNET_CRYPTO_hash (data, size, &vhash); |
311 | if (GNUNET_OK != | 311 | if (GNUNET_OK != |
@@ -403,11 +403,11 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
403 | unsigned long size; | 403 | unsigned long size; |
404 | unsigned long long uid; | 404 | unsigned long long uid; |
405 | char value[GNUNET_DATASTORE_MAX_VALUE_SIZE]; | 405 | char value[GNUNET_DATASTORE_MAX_VALUE_SIZE]; |
406 | GNUNET_HashCode key; | 406 | struct GNUNET_HashCode key; |
407 | struct GNUNET_TIME_Absolute expiration; | 407 | struct GNUNET_TIME_Absolute expiration; |
408 | MYSQL_BIND rbind[7]; | 408 | MYSQL_BIND rbind[7]; |
409 | 409 | ||
410 | hashSize = sizeof (GNUNET_HashCode); | 410 | hashSize = sizeof (struct GNUNET_HashCode); |
411 | memset (rbind, 0, sizeof (rbind)); | 411 | memset (rbind, 0, sizeof (rbind)); |
412 | rbind[0].buffer_type = MYSQL_TYPE_LONG; | 412 | rbind[0].buffer_type = MYSQL_TYPE_LONG; |
413 | rbind[0].buffer = &type; | 413 | rbind[0].buffer = &type; |
@@ -442,8 +442,8 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
442 | return; | 442 | return; |
443 | } | 443 | } |
444 | GNUNET_assert (size <= sizeof (value)); | 444 | GNUNET_assert (size <= sizeof (value)); |
445 | if ((rbind[4].buffer_length != sizeof (GNUNET_HashCode)) || | 445 | if ((rbind[4].buffer_length != sizeof (struct GNUNET_HashCode)) || |
446 | (hashSize != sizeof (GNUNET_HashCode))) | 446 | (hashSize != sizeof (struct GNUNET_HashCode))) |
447 | { | 447 | { |
448 | GNUNET_break (0); | 448 | GNUNET_break (0); |
449 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); | 449 | proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); |
@@ -486,8 +486,8 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt | |||
486 | * @param proc_cls closure for proc | 486 | * @param proc_cls closure for proc |
487 | */ | 487 | */ |
488 | static void | 488 | static void |
489 | mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key, | 489 | mysql_plugin_get_key (void *cls, uint64_t offset, const struct GNUNET_HashCode * key, |
490 | const GNUNET_HashCode * vhash, | 490 | const struct GNUNET_HashCode * vhash, |
491 | enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, | 491 | enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc, |
492 | void *proc_cls) | 492 | void *proc_cls) |
493 | { | 493 | { |
@@ -501,8 +501,8 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key, | |||
501 | 501 | ||
502 | GNUNET_assert (key != NULL); | 502 | GNUNET_assert (key != NULL); |
503 | GNUNET_assert (NULL != proc); | 503 | GNUNET_assert (NULL != proc); |
504 | hashSize = sizeof (GNUNET_HashCode); | 504 | hashSize = sizeof (struct GNUNET_HashCode); |
505 | hashSize2 = sizeof (GNUNET_HashCode); | 505 | hashSize2 = sizeof (struct GNUNET_HashCode); |
506 | memset (cbind, 0, sizeof (cbind)); | 506 | memset (cbind, 0, sizeof (cbind)); |
507 | total = -1; | 507 | total = -1; |
508 | cbind[0].buffer_type = MYSQL_TYPE_LONGLONG; | 508 | cbind[0].buffer_type = MYSQL_TYPE_LONGLONG; |
@@ -669,7 +669,7 @@ struct ReplCtx | |||
669 | * GNUNET_NO to delete the item and continue (if supported) | 669 | * GNUNET_NO to delete the item and continue (if supported) |
670 | */ | 670 | */ |
671 | static int | 671 | static int |
672 | repl_proc (void *cls, const GNUNET_HashCode * key, uint32_t size, | 672 | repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |
673 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 673 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, |
674 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 674 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, |
675 | uint64_t uid) | 675 | uint64_t uid) |
@@ -763,7 +763,7 @@ mysql_plugin_get_keys (void *cls, | |||
763 | const char *query = "SELECT hash FROM gn090"; | 763 | const char *query = "SELECT hash FROM gn090"; |
764 | int ret; | 764 | int ret; |
765 | MYSQL_STMT *statement; | 765 | MYSQL_STMT *statement; |
766 | GNUNET_HashCode key; | 766 | struct GNUNET_HashCode key; |
767 | MYSQL_BIND cbind[1]; | 767 | MYSQL_BIND cbind[1]; |
768 | unsigned long length; | 768 | unsigned long length; |
769 | 769 | ||
@@ -808,7 +808,7 @@ mysql_plugin_get_keys (void *cls, | |||
808 | } | 808 | } |
809 | while (0 == (ret = mysql_stmt_fetch (statement))) | 809 | while (0 == (ret = mysql_stmt_fetch (statement))) |
810 | { | 810 | { |
811 | if (sizeof (GNUNET_HashCode) == length) | 811 | if (sizeof (struct GNUNET_HashCode) == length) |
812 | proc (proc_cls, &key, 1); | 812 | proc (proc_cls, &key, 1); |
813 | } | 813 | } |
814 | if (ret != MYSQL_NO_DATA) | 814 | if (ret != MYSQL_NO_DATA) |
@@ -869,7 +869,7 @@ struct ExpiCtx | |||
869 | * GNUNET_NO to delete the item and continue (if supported) | 869 | * GNUNET_NO to delete the item and continue (if supported) |
870 | */ | 870 | */ |
871 | static int | 871 | static int |
872 | expi_proc (void *cls, const GNUNET_HashCode * key, uint32_t size, | 872 | expi_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size, |
873 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, | 873 | const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority, |
874 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, | 874 | uint32_t anonymity, struct GNUNET_TIME_Absolute expiration, |
875 | uint64_t uid) | 875 | uint64_t uid) |