Remove this GNUNET_htonl_signed nonsense
authorDavid Barksdale <amatus.amongus@gmail.com>
Sun, 19 Jul 2015 15:35:07 +0000 (15:35 +0000)
committerDavid Barksdale <amatus.amongus@gmail.com>
Sun, 19 Jul 2015 15:35:07 +0000 (15:35 +0000)
src/include/gnunet_common.h
src/psyc/gnunet-service-psyc.c
src/psyc/psyc_api.c
src/social/gnunet-service-social.c
src/social/social_api.c
src/util/common_endian.c

index 24b922aad3275a16b434a3a27c53f1234655f424..c082398f875cde87458ab6887ab882251f03f4b0 100644 (file)
@@ -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 ****************** */
 
 /**
index 29ef07f109c613f18e510ea366247a3bd518058b..4c34f6108ab27d30eec1a8947c0e2e34e2148878 100644 (file)
@@ -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);
index 048257bdc2af46497fcd42c2b5c4eeea6f9fe2e2..5fc5391a056da18af0c64def8b88716ed12dd7bf 100644 (file)
@@ -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");
index 48621ad8317652ff51b94f959fa6452fc4221ad7..4211772f1e7ff295fdae9a93d865928806b3089e 100644 (file)
@@ -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);
 
index 3c580b0bc6cfdbb73b869437d8e743387f39b52e..74a13cc35a42b84648d0077607a120c02ca3efa8 100644 (file)
@@ -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);
 }
 
index 81f9a79e8842cd929b0025403e95d7be38e9ec31..45707f4ef70f14f8d4abb1df0fd6602b642438cf 100644 (file)
@@ -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 */