A simple but substantial change: uIP used the htons()/HTONS() macro

functions for converting between host and network byte order. These
names are the de facto standard names for this functionality because
of the original BSD TCP/IP implementation. But they cause problems for
uIP/Contiki: some platforms define these names themselves (Mac OS,
most notably), causing compilation problems for Contiki on those
platforms.

This commit changes all htons to uip_htons instead. Same goes for
htonl, ntohs, and ntohl. All-caps versions as well.
This commit is contained in:
adamdunkels 2010-10-19 18:29:03 +00:00
parent 5a46c629de
commit 5585d72c86
115 changed files with 675 additions and 675 deletions

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: loader-arch.c,v 1.1 2006/06/17 22:41:21 adamdunkels Exp $
* @(#)$Id: loader-arch.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $
*/
#include "contiki.h"
@ -68,13 +68,13 @@ loader_arch_load(unsigned short startaddr)
/* Read the magic word and version number from the first four bytes
in EEPROM. */
eeprom_read(startaddr, (char *)&tmp, 2);
if(tmp != HTONS(LOADER_ARCH_MAGIC)) {
if(tmp != UIP_HTONS(LOADER_ARCH_MAGIC)) {
beep_beep(60000);
return;
}
eeprom_read(startaddr + 2, (char *)&tmp, 2);
if(tmp != HTONS(LOADER_ARCH_VERSION)) {
if(tmp != UIP_HTONS(LOADER_ARCH_VERSION)) {
return;
}
@ -83,7 +83,7 @@ loader_arch_load(unsigned short startaddr)
/* Read the total lenghth that the checksum covers. */
eeprom_read(startaddr, (char *)&sumlen, 2);
sumlen = htons(sumlen);
sumlen = uip_htons(sumlen);
sum = 0;
@ -153,7 +153,7 @@ loader_arch_load(unsigned short startaddr)
/* Read the size of the code segment from the next two bytes in EEPROM. */
eeprom_read(startaddr, (char *)&codelen, 2);
/* Convert from network byte order to host byte order. */
codelen = htons(codelen);
codelen = uip_htons(codelen);
/* Flash program code into ROM. We use the available space in the
@ -193,7 +193,7 @@ loader_arch_load(unsigned short startaddr)
eeprom_read(startaddr + 2 + codelen, (char *)&datalen, 2);
/* Convert from network byte order to host byte order. */
datalen = htons(datalen);
datalen = uip_htons(datalen);
if(datalen > 0) {
/* Read the contents of the data memory into RAM. */