++ Bugfixes:
2011-02-17: Simon Goldschmidt
- * ipaddr.c: Fixed constant not being 32 bit.
+ * many files: Added missing U/UL modifiers to fix 16-bit-arch portability.
2011-01-24: Simon Goldschmidt
* sockets.c: Fixed bug #31741: lwip_select seems to have threading problems
/* subnet mask not given, choose a safe subnet mask given the network class */
u8_t first_octet = ip4_addr1(&dhcp->offered_ip_addr);
if (first_octet <= 127) {
- ip4_addr_set_u32(&sn_mask, PP_HTONL(0xff000000));
+ ip4_addr_set_u32(&sn_mask, PP_HTONL(0xff000000UL));
} else if (first_octet >= 192) {
- ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffffff00));
+ ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffffff00UL));
} else {
- ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffff0000));
+ ip4_addr_set_u32(&sn_mask, PP_HTONL(0xffff0000UL));
}
}
/* copy network address */
ip_addr_get_network(&gw_addr, &dhcp->offered_ip_addr, &sn_mask);
/* use first host address on network as gateway */
- ip4_addr_set_u32(&gw_addr, ip4_addr_get_u32(&gw_addr) | PP_HTONL(0x00000001));
+ ip4_addr_set_u32(&gw_addr, ip4_addr_get_u32(&gw_addr) | PP_HTONL(0x00000001UL));
}
#if LWIP_DHCP_AUTOIP_COOP
ip_addr_copy(iphdr->dest, *ip_current_src_addr());
ICMPH_TYPE_SET(iecho, ICMP_ER);
/* adjust the checksum */
- if (iecho->chksum >= PP_HTONS(0xffff - (ICMP_ECHO << 8))) {
+ if (iecho->chksum >= PP_HTONS(0xffffU - (ICMP_ECHO << 8))) {
iecho->chksum += PP_HTONS(ICMP_ECHO << 8) + 1;
} else {
iecho->chksum += PP_HTONS(ICMP_ECHO << 8);
*/
#define IGMP_TTL 1
#define IGMP_MINLEN 8
-#define ROUTER_ALERT 0x9404
+#define ROUTER_ALERT 0x9404U
#define ROUTER_ALERTLEN 4
/*
}
/* Incrementally update the IP checksum. */
- if (IPH_CHKSUM(iphdr) >= PP_HTONS(0xffff - 0x100)) {
+ if (IPH_CHKSUM(iphdr) >= PP_HTONS(0xffffU - 0x100)) {
IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + PP_HTONS(0x100) + 1);
} else {
IPH_CHKSUM_SET(iphdr, IPH_CHKSUM(iphdr) + PP_HTONS(0x100));
PACK_STRUCT_FIELD(u16_t _id);
/* fragment offset field */
PACK_STRUCT_FIELD(u16_t _offset);
-#define IP_RF 0x8000 /* reserved fragment flag */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
+#define IP_RF 0x8000U /* reserved fragment flag */
+#define IP_DF 0x4000U /* dont fragment flag */
+#define IP_MF 0x2000U /* more fragments flag */
+#define IP_OFFMASK 0x1fffU /* mask for fragmenting bits */
/* time to live */
PACK_STRUCT_FIELD(u8_t _ttl);
/* protocol*/
u16_t acked;
u16_t snd_buf; /* Available buffer space for sending (in bytes). */
-#define TCP_SNDQUEUELEN_OVERFLOW (0xffff-3)
+#define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3)
u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */
#if TCP_OVERSIZE
/** 5 seconds period */
#define ARP_TMR_INTERVAL 5000
-#define ETHTYPE_ARP 0x0806
-#define ETHTYPE_IP 0x0800
-#define ETHTYPE_VLAN 0x8100
-#define ETHTYPE_PPPOEDISC 0x8863 /* PPP Over Ethernet Discovery Stage */
-#define ETHTYPE_PPPOE 0x8864 /* PPP Over Ethernet Session Stage */
+#define ETHTYPE_ARP 0x0806U
+#define ETHTYPE_IP 0x0800U
+#define ETHTYPE_VLAN 0x8100U
+#define ETHTYPE_PPPOEDISC 0x8863U /* PPP Over Ethernet Discovery Stage */
+#define ETHTYPE_PPPOE 0x8864U /* PPP Over Ethernet Session Stage */
/** MEMCPY-like macro to copy to/from struct eth_addr's that are local variables
* or known to be 32-bit aligned within the protocol header. */
magicInit();
- subnetMask = PP_HTONL(0xffffff00);
+ subnetMask = PP_HTONL(0xffffff00UL);
for (i = 0; i < NUM_PPP; i++) {
/* Initialize each protocol to the standard option set. */