aboutsummaryrefslogtreecommitdiff
path: root/client/parse.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'client/parse.cpp')
-rw-r--r--client/parse.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/client/parse.cpp b/client/parse.cpp
index 5672ff2..300df7c 100644
--- a/client/parse.cpp
+++ b/client/parse.cpp
@@ -115,12 +115,15 @@ static int parse_number(const char * str, char * data, size_t * offset) {
unsigned long number = strtol(str + i, NULL, base);
long long mask = (1 << 8 * size) - 1;
number &= mask;
+ // NOTE: the hton? functions are used to convert host endianness to network
+ // endianness (big), and are required
switch (size) {
case 1:
data[*offset] = number & 0xff;
break;
case 2:
number = htons(number);
+ // TODO: check if the endianness is OK, or reverse these *offset indices*
data[*offset + 1] = (number) & 0xff;
data[*offset + 0] = (number >>= 8) & 0xff;
break;