diff options
Diffstat (limited to 'src/psycstore')
-rw-r--r-- | src/psycstore/gnunet-service-psycstore.c | 16 | ||||
-rw-r--r-- | src/psycstore/plugin_psycstore_sqlite.c | 6 | ||||
-rw-r--r-- | src/psycstore/psycstore_api.c | 16 | ||||
-rw-r--r-- | src/psycstore/test_plugin_psycstore.c | 4 | ||||
-rw-r--r-- | src/psycstore/test_psycstore.c | 6 |
5 files changed, 24 insertions, 24 deletions
diff --git a/src/psycstore/gnunet-service-psycstore.c b/src/psycstore/gnunet-service-psycstore.c index 801ea628d..33e894b5e 100644 --- a/src/psycstore/gnunet-service-psycstore.c +++ b/src/psycstore/gnunet-service-psycstore.c | |||
@@ -117,7 +117,7 @@ send_result_code (struct GNUNET_SERVER_Client *client, uint64_t op_id, | |||
117 | res->op_id = op_id; | 117 | res->op_id = op_id; |
118 | if (0 < err_size) | 118 | if (0 < err_size) |
119 | { | 119 | { |
120 | memcpy (&res[1], err_msg, err_size); | 120 | GNUNET_memcpy (&res[1], err_msg, err_size); |
121 | ((char *) &res[1])[err_size - 1] = '\0'; | 121 | ((char *) &res[1])[err_size - 1] = '\0'; |
122 | } | 122 | } |
123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -201,7 +201,7 @@ send_fragment (void *cls, struct GNUNET_MULTICAST_MessageHeader *msg, | |||
201 | res->header.size = htons (sizeof (struct FragmentResult) + msg_size); | 201 | res->header.size = htons (sizeof (struct FragmentResult) + msg_size); |
202 | res->op_id = sc->op_id; | 202 | res->op_id = sc->op_id; |
203 | res->psycstore_flags = htonl (flags); | 203 | res->psycstore_flags = htonl (flags); |
204 | memcpy (&res[1], msg, msg_size); | 204 | GNUNET_memcpy (&res[1], msg, msg_size); |
205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 205 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
206 | "Sending fragment %ld to client\n", | 206 | "Sending fragment %ld to client\n", |
207 | GNUNET_ntohll (msg->fragment_id)); | 207 | GNUNET_ntohll (msg->fragment_id)); |
@@ -229,8 +229,8 @@ send_state_var (void *cls, const char *name, | |||
229 | res->header.size = htons (sizeof (struct StateResult) + name_size + value_size); | 229 | res->header.size = htons (sizeof (struct StateResult) + name_size + value_size); |
230 | res->op_id = sc->op_id; | 230 | res->op_id = sc->op_id; |
231 | res->name_size = htons (name_size); | 231 | res->name_size = htons (name_size); |
232 | memcpy (&res[1], name, name_size); | 232 | GNUNET_memcpy (&res[1], name, name_size); |
233 | memcpy ((char *) &res[1] + name_size, value, value_size); | 233 | GNUNET_memcpy ((char *) &res[1] + name_size, value, value_size); |
234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
235 | "Sending state variable %s to client\n", name); | 235 | "Sending state variable %s to client\n", name); |
236 | GNUNET_SERVER_notification_context_add (nc, sc->client); | 236 | GNUNET_SERVER_notification_context_add (nc, sc->client); |
@@ -563,13 +563,13 @@ recv_state_message_part (void *cls, | |||
563 | { | 563 | { |
564 | scls->mod_oper = pmod->oper; | 564 | scls->mod_oper = pmod->oper; |
565 | scls->mod_name = GNUNET_malloc (name_size); | 565 | scls->mod_name = GNUNET_malloc (name_size); |
566 | memcpy (scls->mod_name, name, name_size); | 566 | GNUNET_memcpy (scls->mod_name, name, name_size); |
567 | 567 | ||
568 | scls->mod_value_size = value_size; | 568 | scls->mod_value_size = value_size; |
569 | scls->mod_value = GNUNET_malloc (scls->mod_value_size); | 569 | scls->mod_value = GNUNET_malloc (scls->mod_value_size); |
570 | scls->mod_value_remaining | 570 | scls->mod_value_remaining |
571 | = scls->mod_value_size - (psize - sizeof (*pmod) - name_size); | 571 | = scls->mod_value_size - (psize - sizeof (*pmod) - name_size); |
572 | memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining); | 572 | GNUNET_memcpy (scls->mod_value, value, value_size - scls->mod_value_remaining); |
573 | } | 573 | } |
574 | } | 574 | } |
575 | scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; | 575 | scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_MODIFIER; |
@@ -585,7 +585,7 @@ recv_state_message_part (void *cls, | |||
585 | scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR; | 585 | scls->msg_state = GNUNET_PSYC_MESSAGE_STATE_ERROR; |
586 | } | 586 | } |
587 | psize = ntohs (pmsg->size); | 587 | psize = ntohs (pmsg->size); |
588 | memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining), | 588 | GNUNET_memcpy (scls->mod_value + (scls->mod_value_size - scls->mod_value_remaining), |
589 | &pmsg[1], psize - sizeof (*pmsg)); | 589 | &pmsg[1], psize - sizeof (*pmsg)); |
590 | scls->mod_value_remaining -= psize - sizeof (*pmsg); | 590 | scls->mod_value_remaining -= psize - sizeof (*pmsg); |
591 | if (0 == scls->mod_value_remaining) | 591 | if (0 == scls->mod_value_remaining) |
@@ -814,7 +814,7 @@ handle_state_get (void *cls, | |||
814 | if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */ | 814 | if (GNUNET_NO == ret && name_size >= 5) /* min: _a_b\0 */ |
815 | { | 815 | { |
816 | char *p, *n = GNUNET_malloc (name_size); | 816 | char *p, *n = GNUNET_malloc (name_size); |
817 | memcpy (n, name, name_size); | 817 | GNUNET_memcpy (n, name, name_size); |
818 | while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret) | 818 | while (&n[1] < (p = strrchr (n, '_')) && GNUNET_NO == ret) |
819 | { | 819 | { |
820 | *p = '\0'; | 820 | *p = '\0'; |
diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c index 46bdfa1bd..83ede6e41 100644 --- a/src/psycstore/plugin_psycstore_sqlite.c +++ b/src/psycstore/plugin_psycstore_sqlite.c | |||
@@ -1046,10 +1046,10 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb, | |||
1046 | msg->header.size = htons (sizeof (*msg) + data_size); | 1046 | msg->header.size = htons (sizeof (*msg) + data_size); |
1047 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); | 1047 | msg->header.type = htons (GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE); |
1048 | msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0)); | 1048 | msg->hop_counter = htonl ((uint32_t) sqlite3_column_int64 (stmt, 0)); |
1049 | memcpy (&msg->signature, | 1049 | GNUNET_memcpy (&msg->signature, |
1050 | sqlite3_column_blob (stmt, 1), | 1050 | sqlite3_column_blob (stmt, 1), |
1051 | sqlite3_column_bytes (stmt, 1)); | 1051 | sqlite3_column_bytes (stmt, 1)); |
1052 | memcpy (&msg->purpose, | 1052 | GNUNET_memcpy (&msg->purpose, |
1053 | sqlite3_column_blob (stmt, 2), | 1053 | sqlite3_column_blob (stmt, 2), |
1054 | sqlite3_column_bytes (stmt, 2)); | 1054 | sqlite3_column_bytes (stmt, 2)); |
1055 | msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3)); | 1055 | msg->fragment_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 3)); |
@@ -1057,7 +1057,7 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb, | |||
1057 | msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5)); | 1057 | msg->message_id = GNUNET_htonll (sqlite3_column_int64 (stmt, 5)); |
1058 | msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6)); | 1058 | msg->group_generation = GNUNET_htonll (sqlite3_column_int64 (stmt, 6)); |
1059 | msg->flags = htonl (sqlite3_column_int64 (stmt, 7)); | 1059 | msg->flags = htonl (sqlite3_column_int64 (stmt, 7)); |
1060 | memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size); | 1060 | GNUNET_memcpy (&msg[1], sqlite3_column_blob (stmt, 9), data_size); |
1061 | 1061 | ||
1062 | return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8)); | 1062 | return cb (cb_cls, (void *) msg, sqlite3_column_int64 (stmt, 8)); |
1063 | } | 1063 | } |
diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index 234218fba..379483e80 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c | |||
@@ -476,7 +476,7 @@ send_next_message (void *cls, size_t size, void *buf) | |||
476 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 476 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
477 | "Sending message of type %d to PSYCstore service. ID: %" PRIu64 "\n", | 477 | "Sending message of type %d to PSYCstore service. ID: %" PRIu64 "\n", |
478 | ntohs (op->msg->type), op->op_id); | 478 | ntohs (op->msg->type), op->op_id); |
479 | memcpy (buf, op->msg, ret); | 479 | GNUNET_memcpy (buf, op->msg, ret); |
480 | 480 | ||
481 | GNUNET_CONTAINER_DLL_remove (h->transmit_head, h->transmit_tail, op); | 481 | GNUNET_CONTAINER_DLL_remove (h->transmit_head, h->transmit_tail, op); |
482 | 482 | ||
@@ -800,7 +800,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
800 | req->header.size = htons (sizeof (*req) + size); | 800 | req->header.size = htons (sizeof (*req) + size); |
801 | req->channel_key = *channel_key; | 801 | req->channel_key = *channel_key; |
802 | req->psycstore_flags = htonl (psycstore_flags); | 802 | req->psycstore_flags = htonl (psycstore_flags); |
803 | memcpy (&req[1], msg, size); | 803 | GNUNET_memcpy (&req[1], msg, size); |
804 | 804 | ||
805 | op->op_id = get_next_op_id (h); | 805 | op->op_id = get_next_op_id (h); |
806 | req->op_id = GNUNET_htonll (op->op_id); | 806 | req->op_id = GNUNET_htonll (op->op_id); |
@@ -1016,7 +1016,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
1016 | req->slave_key = *slave_key; | 1016 | req->slave_key = *slave_key; |
1017 | req->do_membership_test = GNUNET_YES; | 1017 | req->do_membership_test = GNUNET_YES; |
1018 | } | 1018 | } |
1019 | memcpy (&req[1], method_prefix, method_size); | 1019 | GNUNET_memcpy (&req[1], method_prefix, method_size); |
1020 | ((char *) &req[1])[method_size - 1] = '\0'; | 1020 | ((char *) &req[1])[method_size - 1] = '\0'; |
1021 | 1021 | ||
1022 | op->op_id = get_next_op_id (h); | 1022 | op->op_id = get_next_op_id (h); |
@@ -1094,7 +1094,7 @@ GNUNET_PSYCSTORE_message_get_latest (struct GNUNET_PSYCSTORE_Handle *h, | |||
1094 | 1094 | ||
1095 | op->op_id = get_next_op_id (h); | 1095 | op->op_id = get_next_op_id (h); |
1096 | req->op_id = GNUNET_htonll (op->op_id); | 1096 | req->op_id = GNUNET_htonll (op->op_id); |
1097 | memcpy (&req[1], method_prefix, method_size); | 1097 | GNUNET_memcpy (&req[1], method_prefix, method_size); |
1098 | 1098 | ||
1099 | GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op); | 1099 | GNUNET_CONTAINER_DLL_insert_tail (h->transmit_head, h->transmit_tail, op); |
1100 | transmit_next (h); | 1100 | transmit_next (h); |
@@ -1334,8 +1334,8 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, | |||
1334 | ? STATE_OP_LAST | 1334 | ? STATE_OP_LAST |
1335 | : 0; | 1335 | : 0; |
1336 | 1336 | ||
1337 | memcpy (&req[1], modifiers[i].name, name_size); | 1337 | GNUNET_memcpy (&req[1], modifiers[i].name, name_size); |
1338 | memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size); | 1338 | GNUNET_memcpy ((char *) &req[1] + name_size, modifiers[i].value, modifiers[i].value_size); |
1339 | 1339 | ||
1340 | op->op_id = get_next_op_id (h); | 1340 | op->op_id = get_next_op_id (h); |
1341 | req->op_id = GNUNET_htonll (op->op_id); | 1341 | req->op_id = GNUNET_htonll (op->op_id); |
@@ -1482,7 +1482,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
1482 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET); | 1482 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET); |
1483 | req->header.size = htons (sizeof (*req) + name_size); | 1483 | req->header.size = htons (sizeof (*req) + name_size); |
1484 | req->channel_key = *channel_key; | 1484 | req->channel_key = *channel_key; |
1485 | memcpy (&req[1], name, name_size); | 1485 | GNUNET_memcpy (&req[1], name, name_size); |
1486 | 1486 | ||
1487 | op->op_id = get_next_op_id (h); | 1487 | op->op_id = get_next_op_id (h); |
1488 | req->op_id = GNUNET_htonll (op->op_id); | 1488 | req->op_id = GNUNET_htonll (op->op_id); |
@@ -1535,7 +1535,7 @@ GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h, | |||
1535 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX); | 1535 | req->header.type = htons (GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_GET_PREFIX); |
1536 | req->header.size = htons (sizeof (*req) + name_size); | 1536 | req->header.size = htons (sizeof (*req) + name_size); |
1537 | req->channel_key = *channel_key; | 1537 | req->channel_key = *channel_key; |
1538 | memcpy (&req[1], name_prefix, name_size); | 1538 | GNUNET_memcpy (&req[1], name_prefix, name_size); |
1539 | 1539 | ||
1540 | op->op_id = get_next_op_id (h); | 1540 | op->op_id = get_next_op_id (h); |
1541 | req->op_id = GNUNET_htonll (op->op_id); | 1541 | req->op_id = GNUNET_htonll (op->op_id); |
diff --git a/src/psycstore/test_plugin_psycstore.c b/src/psycstore/test_plugin_psycstore.c index fc5e1f6b6..0959da642 100644 --- a/src/psycstore/test_plugin_psycstore.c +++ b/src/psycstore/test_plugin_psycstore.c | |||
@@ -218,7 +218,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
218 | msg->fragment_offset = GNUNET_htonll (0); | 218 | msg->fragment_offset = GNUNET_htonll (0); |
219 | msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); | 219 | msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); |
220 | 220 | ||
221 | memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); | 221 | GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); |
222 | 222 | ||
223 | msg->purpose.size = htonl (ntohs (msg->header.size) | 223 | msg->purpose.size = htonl (ntohs (msg->header.size) |
224 | - sizeof (msg->header) | 224 | - sizeof (msg->header) |
@@ -272,7 +272,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
272 | struct GNUNET_MULTICAST_MessageHeader *msg1 | 272 | struct GNUNET_MULTICAST_MessageHeader *msg1 |
273 | = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key)); | 273 | = GNUNET_malloc (sizeof (*msg1) + sizeof (channel_pub_key)); |
274 | 274 | ||
275 | memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key)); | 275 | GNUNET_memcpy (msg1, msg, sizeof (*msg1) + sizeof (channel_pub_key)); |
276 | 276 | ||
277 | msg1->fragment_id = GNUNET_htonll (INT64_MAX); | 277 | msg1->fragment_id = GNUNET_htonll (INT64_MAX); |
278 | msg1->fragment_offset = GNUNET_htonll (32768); | 278 | msg1->fragment_offset = GNUNET_htonll (32768); |
diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index 1b589f2b1..f9a7ce9ca 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c | |||
@@ -469,7 +469,7 @@ fragment_store () | |||
469 | msg->group_generation = GNUNET_htonll (INT64_MAX - 3); | 469 | msg->group_generation = GNUNET_htonll (INT64_MAX - 3); |
470 | msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); | 470 | msg->flags = htonl (GNUNET_MULTICAST_MESSAGE_LAST_FRAGMENT); |
471 | 471 | ||
472 | memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); | 472 | GNUNET_memcpy (&msg[1], &channel_pub_key, sizeof (channel_pub_key)); |
473 | 473 | ||
474 | msg->purpose.size = htonl (ntohs (msg->header.size) | 474 | msg->purpose.size = htonl (ntohs (msg->header.size) |
475 | - sizeof (msg->header) | 475 | - sizeof (msg->header) |
@@ -484,7 +484,7 @@ fragment_store () | |||
484 | 484 | ||
485 | fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; | 485 | fcls.flags[1] = GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED; |
486 | fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); | 486 | fcls.msg[1] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); |
487 | memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key)); | 487 | GNUNET_memcpy (msg, fcls.msg[0], sizeof (*msg) + sizeof (channel_pub_key)); |
488 | msg->fragment_id = GNUNET_htonll (INT64_MAX - 4); | 488 | msg->fragment_id = GNUNET_htonll (INT64_MAX - 4); |
489 | msg->fragment_offset = GNUNET_htonll (1024); | 489 | msg->fragment_offset = GNUNET_htonll (1024); |
490 | 490 | ||
@@ -493,7 +493,7 @@ fragment_store () | |||
493 | 493 | ||
494 | fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; | 494 | fcls.flags[2] = GNUNET_PSYCSTORE_MESSAGE_STATE_HASH; |
495 | fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); | 495 | fcls.msg[2] = msg = GNUNET_malloc (sizeof (*msg) + sizeof (channel_pub_key)); |
496 | memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key)); | 496 | GNUNET_memcpy (msg, fcls.msg[1], sizeof (*msg) + sizeof (channel_pub_key)); |
497 | msg->fragment_id = GNUNET_htonll (INT64_MAX); | 497 | msg->fragment_id = GNUNET_htonll (INT64_MAX); |
498 | msg->fragment_offset = GNUNET_htonll (16384); | 498 | msg->fragment_offset = GNUNET_htonll (16384); |
499 | 499 | ||