From 25e81d7cf1ca92af770ae315999921a00de38304 Mon Sep 17 00:00:00 2001 From: Martin Ayotte Date: Fri, 3 Jul 2015 23:04:22 -0400 Subject: [PATCH] fix DNS issue caused by HTON macro weirdness on 32bits + fix inet_aton() --- STM32F4/libraries/arduino_uip/Dns.cpp | 3 +-- STM32F4/libraries/arduino_uip/utility/util.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/STM32F4/libraries/arduino_uip/Dns.cpp b/STM32F4/libraries/arduino_uip/Dns.cpp index 2b97fb7..d6d31bd 100644 --- a/STM32F4/libraries/arduino_uip/Dns.cpp +++ b/STM32F4/libraries/arduino_uip/Dns.cpp @@ -58,8 +58,7 @@ int DNSClient::inet_aton(const char* aIPAddrString, IPAddress& aResult) { // See if we've been given a valid IP address const char* p =aIPAddrString; - while (*p && - ( (*p == '.') || (*p >= '0') || (*p <= '9') )) + while (*p && ( (*p == '.') || ((*p >= '0') && (*p <= '9')) )) { p++; } diff --git a/STM32F4/libraries/arduino_uip/utility/util.h b/STM32F4/libraries/arduino_uip/utility/util.h index 5042e82..06f3cee 100644 --- a/STM32F4/libraries/arduino_uip/utility/util.h +++ b/STM32F4/libraries/arduino_uip/utility/util.h @@ -1,7 +1,7 @@ #ifndef UTIL_H #define UTIL_H -#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) ) +#define htons(x) ( ((x)<< 8 & 0xFF00) | ((x)>> 8 & 0x00FF) ) #define ntohs(x) htons(x) #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \