]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lwip.git/commitdiff
Apply patch #5745: Fix "Constant is long" warnings with 16bit
authorkieranm <kieranm>
Wed, 11 Apr 2007 13:32:41 +0000 (13:32 +0000)
committerkieranm <kieranm>
Wed, 11 Apr 2007 13:32:41 +0000 (13:32 +0000)
compilers.  Contributed by avatar@mmlab.cse.yzu.edu.tw

CHANGELOG
src/core/inet.c
src/include/ipv4/lwip/ip_addr.h
src/include/lwip/sockets.h
src/include/lwip/sys.h
src/include/lwip/tcp.h

index 06c7dc49855ae34ab879b8bdefa59e18e9a8d8cd..3273d99d9a30e27ce62d793b0e35e81e44a5a98e 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -111,6 +111,11 @@ HISTORY
 
   ++ Bug fixes:
 
+  2007-04-11 Kieran Mansley
+  * inet.c, ip_addr.h, sockets.h, sys.h, tcp.h: Apply patch #5745: Fix
+    "Constant is long" warnings with 16bit compilers.  Contributed by
+    avatar@mmlab.cse.yzu.edu.tw
+
   2007-04-05 Frédéric Bernon, Jonathan Larmour
   * api_msg.c: Fix bug #16830: "err_tcp() posts to connection mailbox when no pend on
     the mailbox is active". Now, the post is only done during a connect, and do_send,
index 2c54389e223484abc22c654887e0a01c0fbb1eb8..95c984d37ce29195f6ebc60c8142eafef17161bb 100644 (file)
@@ -434,7 +434,7 @@ inet_aton(const char *cp, struct in_addr *addr)
     break;
 
   case 2:             /* a.b -- 8.24 bits */
-    if (val > 0xffffff)
+    if (val > 0xffffffUL)
       return (0);
     val |= parts[0] << 24;
     break;
@@ -524,8 +524,8 @@ htonl(u32_t n)
 {
   return ((n & 0xff) << 24) |
     ((n & 0xff00) << 8) |
-    ((n & 0xff0000) >> 8) |
-    ((n & 0xff000000) >> 24);
+    ((n & 0xff0000UL) >> 8) |
+    ((n & 0xff000000UL) >> 24);
 }
 
 u32_t
index d877ebebe8a271319686b5833e40977098688354..ce7004074796890e0f0d3f2448652f76c7b9aa69 100644 (file)
@@ -78,39 +78,39 @@ extern const struct ip_addr ip_addr_broadcast;
 #define IP_ADDR_ANY         ((struct ip_addr *)&ip_addr_any)
 #define IP_ADDR_BROADCAST   ((struct ip_addr *)&ip_addr_broadcast)
 
-#define INADDR_NONE         ((u32_t)0xffffffff)  /* 255.255.255.255 */
-#define INADDR_LOOPBACK     ((u32_t)0x7f000001)  /* 127.0.0.1 */
+#define INADDR_NONE         ((u32_t)0xffffffffUL)  /* 255.255.255.255 */
+#define INADDR_LOOPBACK     ((u32_t)0x7f000001UL)  /* 127.0.0.1 */
 
 /* Definitions of the bits in an Internet address integer.
 
    On subnets, host and network parts are found according to
    the subnet mask, not these masks.  */
 
-#define IN_CLASSA(a)        ((((u32_t)(a)) & 0x80000000) == 0)
+#define IN_CLASSA(a)        ((((u32_t)(a)) & 0x80000000UL) == 0)
 #define IN_CLASSA_NET       0xff000000
 #define IN_CLASSA_NSHIFT    24
 #define IN_CLASSA_HOST      (0xffffffff & ~IN_CLASSA_NET)
 #define IN_CLASSA_MAX       128
 
-#define IN_CLASSB(a)        ((((u32_t)(a)) & 0xc0000000) == 0x80000000)
+#define IN_CLASSB(a)        ((((u32_t)(a)) & 0xc0000000UL) == 0x80000000UL)
 #define IN_CLASSB_NET       0xffff0000
 #define IN_CLASSB_NSHIFT    16
 #define IN_CLASSB_HOST      (0xffffffff & ~IN_CLASSB_NET)
 #define IN_CLASSB_MAX       65536
 
-#define IN_CLASSC(a)        ((((u32_t)(a)) & 0xe0000000) == 0xc0000000)
+#define IN_CLASSC(a)        ((((u32_t)(a)) & 0xe0000000UL) == 0xc0000000UL)
 #define IN_CLASSC_NET       0xffffff00
 #define IN_CLASSC_NSHIFT    8
 #define IN_CLASSC_HOST      (0xffffffff & ~IN_CLASSC_NET)
 
-#define IN_CLASSD(a)        (((u32_t)(a) & 0xf0000000) == 0xe0000000)
+#define IN_CLASSD(a)        (((u32_t)(a) & 0xf0000000UL) == 0xe0000000UL)
 #define IN_CLASSD_NET       0xf0000000          /* These ones aren't really */
 #define IN_CLASSD_NSHIFT    28                  /*   net and host fields, but */
 #define IN_CLASSD_HOST      0x0fffffff          /*   routing needn't know. */
 #define IN_MULTICAST(a)     IN_CLASSD(a)
 
-#define IN_EXPERIMENTAL(a)  (((u32_t)(a) & 0xf0000000) == 0xf0000000)
-#define IN_BADCLASS(a)      (((u32_t)(a) & 0xf0000000) == 0xf0000000)
+#define IN_EXPERIMENTAL(a)  (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
+#define IN_BADCLASS(a)      (((u32_t)(a) & 0xf0000000UL) == 0xf0000000UL)
 
 #define IN_LOOPBACKNET      127                 /* official! */
 
@@ -141,7 +141,7 @@ extern const struct ip_addr ip_addr_broadcast;
 
 u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *);
 
-#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))
+#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000UL)) == ntohl(0xe0000000UL))
 
 #define ip_addr_debug_print(debug, ipaddr) \
         LWIP_DEBUGF(debug, ("%"U16_F".%"U16_F".%"U16_F".%"U16_F, \
index bdcd724cc0b5c23e5c0a9e130bb22ddbdccdc665..79ea9cd5de2028795099a5be67ecbd91c2063112 100644 (file)
@@ -177,10 +177,10 @@ typedef struct ip_mreq {
  * we restrict parameters to at most 128 bytes.
  */
 #if !defined(FIONREAD) || !defined(FIONBIO)
-#define IOCPARM_MASK    0x7f            /* parameters must be < 128 bytes */
-#define IOC_VOID        0x20000000      /* no parameters */
-#define IOC_OUT         0x40000000      /* copy out parameters */
-#define IOC_IN          0x80000000      /* copy in parameters */
+#define IOCPARM_MASK    0x7fU           /* parameters must be < 128 bytes */
+#define IOC_VOID        0x20000000UL    /* no parameters */
+#define IOC_OUT         0x40000000UL    /* copy out parameters */
+#define IOC_IN          0x80000000UL    /* copy in parameters */
 #define IOC_INOUT       (IOC_IN|IOC_OUT)
                                         /* 0x20000000 distinguishes new &
                                            old ioctl's */
index 6a429abca17ca16d774da23bf93ed0832a6a7fa9..d631ad1b0b3e8276d5961cbffc63544e0b9d903c 100644 (file)
@@ -65,7 +65,7 @@ struct sys_timeo {u8_t dummy;};
 #include "arch/sys_arch.h"
 
 /** Return code for timeouts from sys_arch_mbox_fetch and sys_arch_sem_wait */
-#define SYS_ARCH_TIMEOUT 0xffffffff
+#define SYS_ARCH_TIMEOUT 0xffffffffUL
 
 typedef void (* sys_timeout_handler)(void *arg);
 
index 4c9227ecb52c888ed88f5ad027df69c8fb0afd2f..1aaeb3705d9e3d7a040d09d540761b93b8e6a87a 100644 (file)
@@ -149,7 +149,7 @@ void             tcp_rexmit_rto  (struct tcp_pcb *pcb);
 
 #define TCP_OOSEQ_TIMEOUT        6U /* x RTO */
 
-#define TCP_MSL 60000  /* The maximum segment lifetime in microseconds */
+#define TCP_MSL 60000U /* The maximum segment lifetime in microseconds */
 
 /*
  * User-settable options (used with setsockopt).
@@ -163,15 +163,15 @@ void             tcp_rexmit_rto  (struct tcp_pcb *pcb);
 
 /* Keepalive values, compliant with RFC 1122. Don't change this unless you know what you're doing */
 #ifndef  TCP_KEEPIDLE_DEFAULT
-#define  TCP_KEEPIDLE_DEFAULT     7200000                                      /* Default KEEPALIVE timer in milliseconds */
+#define  TCP_KEEPIDLE_DEFAULT     7200000UL /* Default KEEPALIVE timer in milliseconds */
 #endif
 
 #ifndef  TCP_KEEPINTVL_DEFAULT
-#define  TCP_KEEPINTVL_DEFAULT    75000                                        /* Default Time between KEEPALIVE probes in milliseconds */
+#define  TCP_KEEPINTVL_DEFAULT    75000UL   /* Default Time between KEEPALIVE probes in milliseconds */
 #endif
 
 #ifndef  TCP_KEEPCNT_DEFAULT
-#define  TCP_KEEPCNT_DEFAULT      9                                            /* Default Counter for KEEPALIVE probes */
+#define  TCP_KEEPCNT_DEFAULT      9U        /* Default Counter for KEEPALIVE probes */
 #endif
 
 #define  TCP_MAXIDLE              TCP_KEEPCNT_DEFAULT * TCP_KEEPINTVL_DEFAULT  /* Maximum KEEPALIVE probe time */