summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2014-12-31 11:59:39 +0000
committerSteve Holme <steve_holme@hotmail.com>2014-12-31 12:17:01 +0000
commite86a6151f49e045b009e8b4db072cf3eb3c7bdf1 (patch)
treebc844b9c1f9a462cee9436c5a45d98ab248d8631
parentf4413ca65a2b5bf469df3a4ab05d965e5f59c91d (diff)
downloadgnurl-e86a6151f49e045b009e8b4db072cf3eb3c7bdf1.tar.gz
gnurl-e86a6151f49e045b009e8b4db072cf3eb3c7bdf1.tar.bz2
gnurl-e86a6151f49e045b009e8b4db072cf3eb3c7bdf1.zip
endian: Added standard function descriptions
-rw-r--r--lib/endian.c50
-rw-r--r--lib/endian.h5
2 files changed, 49 insertions, 6 deletions
diff --git a/lib/endian.c b/lib/endian.c
index cf3e3c5e0..cc329771e 100644
--- a/lib/endian.c
+++ b/lib/endian.c
@@ -25,9 +25,17 @@
#include "endian.h"
/*
- * This function converts from the little endian format used in the incoming
- * package to whatever endian format we're using natively. Argument is a
- * pointer to a 2 byte buffer.
+ * Curl_read16_le()
+ *
+ * This function converts a 16-bit integer from the little endian format, as
+ * used in the incoming package to whatever endian format we're using
+ * natively.
+ *
+ * Parameters:
+ *
+ * buf [in] - A pointer to a 2 byte buffer.
+ *
+ * Returns the integer.
*/
unsigned short Curl_read16_le(unsigned char *buf)
{
@@ -36,9 +44,17 @@ unsigned short Curl_read16_le(unsigned char *buf)
}
/*
- * This function converts from the little endian format used in the
- * incoming package to whatever endian format we're using natively.
- * Argument is a pointer to a 4 byte buffer.
+ * Curl_read32_le()
+ *
+ * This function converts a 32-bit integer from the little endian format, as
+ * used in the incoming package to whatever endian format we're using
+ * natively.
+ *
+ * Parameters:
+ *
+ * buf [in] - A pointer to a 4 byte buffer.
+ *
+ * Returns the integer.
*/
unsigned int Curl_read32_le(unsigned char *buf)
{
@@ -46,6 +62,17 @@ unsigned int Curl_read32_le(unsigned char *buf)
((unsigned int)buf[2] << 16) | ((unsigned int)buf[3] << 24);
}
+/*
+ * Curl_write32_le()
+ *
+ * This function converts a 32-bit integer from the native endian format,
+ * to little endian format ready for sending down the wire.
+ *
+ * Parameters:
+ *
+ * value [in] - The 32-bit integer value.
+ * buffer [in] - A pointer to the output buffer.
+ */
void Curl_write32_le(const int value, unsigned char *buffer)
{
buffer[0] = (char)(value & 0x000000FF);
@@ -55,6 +82,17 @@ void Curl_write32_le(const int value, unsigned char *buffer)
}
#if (CURL_SIZEOF_CURL_OFF_T > 4)
+/*
+ * Curl_write64_le()
+ *
+ * This function converts a 64-bit integer from the native endian format,
+ * to little endian format ready for sending down the wire.
+ *
+ * Parameters:
+ *
+ * value [in] - The 64-bit integer value.
+ * buffer [in] - A pointer to the output buffer.
+ */
#if defined(HAVE_LONGLONG)
void Curl_write64_le(const long long value, unsigned char *buffer)
#else
diff --git a/lib/endian.h b/lib/endian.h
index 852fef376..a8811c940 100644
--- a/lib/endian.h
+++ b/lib/endian.h
@@ -22,12 +22,17 @@
*
***************************************************************************/
+/* Converts a 16-bit integer from little endian */
unsigned short Curl_read16_le(unsigned char *buf);
+
+/* Converts a 32-bit integer from little endian */
unsigned int Curl_read32_le(unsigned char *buf);
+/* Converts a 32-bit integer to little endian */
void Curl_write32_le(const int value, unsigned char *buffer);
#if (CURL_SIZEOF_CURL_OFF_T > 4)
+/* Converts a 64-bit integer to little endian */
#if defined(HAVE_LONGLONG)
void Curl_write64_le(const long long value, unsigned char *buffer);
#else