From a5e12b53160fbf359dd469408c600f0eb976590b Mon Sep 17 00:00:00 2001 From: David Barksdale Date: Sun, 19 Jul 2015 15:35:07 +0000 Subject: Remove this GNUNET_htonl_signed nonsense --- src/include/gnunet_common.h | 76 +------------------------------------- src/psyc/gnunet-service-psyc.c | 12 +++--- src/psyc/psyc_api.c | 6 +-- src/social/gnunet-service-social.c | 4 +- src/social/social_api.c | 2 +- src/util/common_endian.c | 43 --------------------- 6 files changed, 14 insertions(+), 129 deletions(-) (limited to 'src') diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index 24b922aad..c082398f8 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -727,9 +727,9 @@ GNUNET_ntohll (uint64_t n); * Convert double to network byte order. * * @param d - * The value in network byte order. + * The value in host byte order. * - * @return The same value in host byte order. + * @return The same value in network byte order. */ double GNUNET_hton_double (double d); @@ -747,78 +747,6 @@ double GNUNET_ntoh_double (double d); -/** - * Convert signed 64-bit integer to network byte order. - * - * @param n - * The value in host byte order. - * - * @return The same value in network byte order. - */ -uint64_t -GNUNET_htonll_signed (int64_t n); - - -/** - * Convert signed 64-bit integer to host byte order. - * - * @param n - * The value in network byte order. - * - * @return The same value in host byte order. - */ -int64_t -GNUNET_ntohll_signed (uint64_t n); - - -/** - * Convert signed 32-bit integer to network byte order. - * - * @param n - * The value in host byte order. - * - * @return The same value in network byte order. - */ -uint32_t -GNUNET_htonl_signed (int32_t n); - - -/** - * Convert signed 32-bit integer to host byte order. - * - * @param n - * The value in network byte order. - * - * @return The same value in host byte order. - */ -int32_t -GNUNET_ntohl_signed (uint32_t n); - - -/** - * Convert signed 16-bit integer to network byte order. - * - * @param n - * The value in host byte order. - * - * @return The same value in network byte order. - */ -uint16_t -GNUNET_htons_signed (int16_t n); - - -/** - * Convert signed 16-bit integer to host byte order. - * - * @param n - * The value in network byte order. - * - * @return The same value in host byte order. - */ -int16_t -GNUNET_ntohs_signed (uint16_t n); - - /* ************************* allocation functions ****************** */ /** diff --git a/src/psyc/gnunet-service-psyc.c b/src/psyc/gnunet-service-psyc.c index 29ef07f10..4c34f6108 100644 --- a/src/psyc/gnunet-service-psyc.c +++ b/src/psyc/gnunet-service-psyc.c @@ -653,7 +653,7 @@ client_send_result (struct GNUNET_SERVER_Client *client, uint64_t op_id, res = GNUNET_malloc (sizeof (*res) + data_size); res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE); res->header.size = htons (sizeof (*res) + data_size); - res->result_code = GNUNET_htonll_signed (result_code); + res->result_code = GNUNET_htonll (result_code); res->op_id = op_id; if (0 < data_size) memcpy (&res[1], data, data_size); @@ -1544,7 +1544,7 @@ store_recv_master_counters (void *cls, int result, uint64_t max_fragment_id, struct GNUNET_PSYC_CountersResultMessage res; res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK); res.header.size = htons (sizeof (res)); - res.result_code = GNUNET_htonl_signed (result); + res.result_code = htonl (result); res.max_message_id = GNUNET_htonll (max_message_id); if (GNUNET_OK == result || GNUNET_NO == result) @@ -1590,7 +1590,7 @@ store_recv_slave_counters (void *cls, int result, uint64_t max_fragment_id, struct GNUNET_PSYC_CountersResultMessage res; res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN_ACK); res.header.size = htons (sizeof (res)); - res.result_code = GNUNET_htonl_signed (result); + res.result_code = htonl (result); res.max_message_id = GNUNET_htonll (max_message_id); if (GNUNET_OK == result || GNUNET_NO == result) @@ -1680,7 +1680,7 @@ client_recv_master_start (void *cls, struct GNUNET_SERVER_Client *client, struct GNUNET_PSYC_CountersResultMessage res; res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK); res.header.size = htons (sizeof (res)); - res.result_code = GNUNET_htonl_signed (GNUNET_OK); + res.result_code = htonl (GNUNET_OK); res.max_message_id = GNUNET_htonll (mst->max_message_id); GNUNET_SERVER_notification_context_add (nc, client); @@ -1791,7 +1791,7 @@ client_recv_slave_join (void *cls, struct GNUNET_SERVER_Client *client, struct GNUNET_PSYC_CountersResultMessage res; res.header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN_ACK); res.header.size = htons (sizeof (res)); - res.result_code = GNUNET_htonl_signed (GNUNET_OK); + res.result_code = htonl (GNUNET_OK); res.max_message_id = GNUNET_htonll (chn->max_message_id); GNUNET_SERVER_notification_context_add (nc, client); @@ -2310,7 +2310,7 @@ store_recv_fragment_history (void *cls, res->header.size = htons (sizeof (*res) + psize); res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_HISTORY_RESULT); res->op_id = op->op_id; - res->result_code = GNUNET_htonll_signed (GNUNET_OK); + res->result_code = GNUNET_htonll (GNUNET_OK); pmsg = (struct GNUNET_PSYC_MessageHeader *) &res[1]; psyc_msg_init (pmsg, mmsg, flags | GNUNET_PSYC_MESSAGE_HISTORIC); diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c index 048257bdc..5fc5391a0 100644 --- a/src/psyc/psyc_api.c +++ b/src/psyc/psyc_api.c @@ -263,7 +263,7 @@ channel_recv_result (void *cls, uint16_t data_size = size - sizeof (*res); const char *data = (0 < data_size) ? (void *) &res[1] : NULL; GNUNET_CLIENT_MANAGER_op_result (chn->client, GNUNET_ntohll (res->op_id), - GNUNET_ntohll_signed (res->result_code), + GNUNET_ntohll (res->result_code), data, data_size); } @@ -433,7 +433,7 @@ master_recv_start_ack (void *cls, struct GNUNET_PSYC_CountersResultMessage * cres = (struct GNUNET_PSYC_CountersResultMessage *) msg; - int32_t result = GNUNET_ntohl_signed (cres->result_code); + int32_t result = ntohl (cres->result_code); if (GNUNET_OK != result && GNUNET_NO != result) { LOG (GNUNET_ERROR_TYPE_ERROR, "Could not start master: %ld\n", result); @@ -486,7 +486,7 @@ slave_recv_join_ack (void *cls, sizeof (struct GNUNET_PSYC_Channel)); struct GNUNET_PSYC_CountersResultMessage * cres = (struct GNUNET_PSYC_CountersResultMessage *) msg; - int32_t result = GNUNET_ntohl_signed (cres->result_code); + int32_t result = ntohl (cres->result_code); if (GNUNET_YES != result && GNUNET_NO != result) { LOG (GNUNET_ERROR_TYPE_ERROR, "Could not join slave.\n"); diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c index 48621ad83..4211772f1 100644 --- a/src/social/gnunet-service-social.c +++ b/src/social/gnunet-service-social.c @@ -497,7 +497,7 @@ client_send_result (struct GNUNET_SERVER_Client *client, uint64_t op_id, res = GNUNET_malloc (sizeof (*res) + data_size); res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE); res->header.size = htons (sizeof (*res) + data_size); - res->result_code = GNUNET_htonll_signed (result_code); + res->result_code = GNUNET_htonll (result_code); res->op_id = op_id; if (0 < data_size) memcpy (&res[1], data, data_size); @@ -1558,7 +1558,7 @@ psyc_recv_history_message (void *cls, res->header.size = htons (sizeof (*res) + size); res->header.type = htons (GNUNET_MESSAGE_TYPE_PSYC_HISTORY_RESULT); res->op_id = opcls->op_id; - res->result_code = GNUNET_htonll_signed (GNUNET_OK); + res->result_code = GNUNET_htonll (GNUNET_OK); memcpy (&res[1], msg, size); diff --git a/src/social/social_api.c b/src/social/social_api.c index 3c580b0bc..74a13cc35 100644 --- a/src/social/social_api.c +++ b/src/social/social_api.c @@ -661,7 +661,7 @@ place_recv_result (void *cls, uint16_t data_size = size - sizeof (*res); const char *data = (0 < data_size) ? (const char *) &res[1] : NULL; GNUNET_CLIENT_MANAGER_op_result (plc->client, GNUNET_ntohll (res->op_id), - GNUNET_ntohll_signed (res->result_code), + GNUNET_ntohll (res->result_code), data, data_size); } diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 81f9a79e8..45707f4ef 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c @@ -93,47 +93,4 @@ GNUNET_ntoh_double (double d) } -uint64_t -GNUNET_htonll_signed (int64_t n) -{ - return GNUNET_htonll (n - INT64_MIN); -} - - -int64_t -GNUNET_ntohll_signed (uint64_t n) -{ - return GNUNET_ntohll (n) + INT64_MIN; -} - - -uint32_t -GNUNET_htonl_signed (int32_t n) -{ - return htonl (n - INT32_MIN); -} - - -int32_t -GNUNET_ntohl_signed (uint32_t n) -{ - return ntohl (n) + INT32_MIN; -} - - -uint16_t -GNUNET_htons_signed (int16_t n) -{ - return htons (n - INT16_MIN); -} - - -int16_t -GNUNET_ntohs_signed (uint16_t n) -{ - return ntohs (n) + INT16_MIN; -} - - - /* end of common_endian.c */ -- cgit v1.2.3