]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Added missing U/UL modifiers to fix 16-bit-arch portability.
authorgoldsimon <goldsimon>
Fri, 18 Feb 2011 13:31:28 +0000 (13:31 +0000)
committergoldsimon <goldsimon>
Fri, 18 Feb 2011 13:31:28 +0000 (13:31 +0000)
CHANGELOG
src/core/dhcp.c
src/core/ipv4/icmp.c
src/core/ipv4/igmp.c
src/core/ipv4/ip.c
src/include/ipv4/lwip/ip.h
src/include/lwip/tcp.h
src/include/netif/etharp.h
src/netif/ppp/ppp.c

index e2cb951fb93e5b5f2d3da10ce4c80e296da15150..66334319731a833664df5d865d4fa84f5701107a 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -234,7 +234,7 @@ HISTORY
   ++ 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
index e2f231fca88ced8e6f22b9ce46ce788a55972de8..81b4be271e9c9c8763f42dc8522cc6abdadd9da8 100644 (file)
@@ -965,11 +965,11 @@ dhcp_bind(struct netif *netif)
     /* 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));
     }
   }
 
@@ -979,7 +979,7 @@ dhcp_bind(struct netif *netif)
     /* 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
index 02e498d759f2d2ccfefa8415b96f293ecafbb69a..32902a522ca2e5538b468cf1a644551bba8f0969 100644 (file)
@@ -191,7 +191,7 @@ icmp_input(struct pbuf *p, struct netif *inp)
     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);
index 390a5a741c4ad9b2055b49e4218c7d5f5f5366c2..4e4405e16f9da0bc0b4ae646b224a812ff8882e6 100644 (file)
@@ -100,7 +100,7 @@ Steve Reynolds
  */
 #define IGMP_TTL                       1
 #define IGMP_MINLEN                    8
-#define ROUTER_ALERT                   0x9404
+#define ROUTER_ALERT                   0x9404U
 #define ROUTER_ALERTLEN                4
 
 /*
index b5afb5a0ca6658fcdbf8e8bf6685e972733d92ec..6f248716b63def78813f28271104ac298219ff94 100644 (file)
@@ -201,7 +201,7 @@ ip_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
   }
 
   /* 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));
index 296e344bad16763f3e7f1fae9ec7ee25af53975c..74f501d1ab49f9649791deb66beba33d2401fcad 100644 (file)
@@ -122,10 +122,10 @@ struct ip_hdr {
   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*/
index a09c5ef7dcbcc9f455707fa898cbf5007f80a60d..07dcd10e7863a7c9c723299034feacce1f53000f 100644 (file)
@@ -228,7 +228,7 @@ struct tcp_pcb {
   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
index a4803ec4dbbd9341b05f049cbf056f1058a6408e..02a3d8bccacbd4fcc7743e3fad94f171cc14a630 100644 (file)
@@ -134,11 +134,11 @@ PACK_STRUCT_END
 /** 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. */
index fdf5e4199fbd914260ded1a37547856168d81dc3..0c2d20e8e870f8a293c2e8ef27e96885f2c36ff2 100644 (file)
@@ -439,7 +439,7 @@ pppInit(void)
 
   magicInit();
 
-  subnetMask = PP_HTONL(0xffffff00);
+  subnetMask = PP_HTONL(0xffffff00UL);
 
   for (i = 0; i < NUM_PPP; i++) {
     /* Initialize each protocol to the standard option set. */