Apply patch #5745: Fix "Constant is long" warnings with 16bit

compilers.  Contributed by avatar@mmlab.cse.yzu.edu.tw
This commit is contained in:
kieranm 2007-04-11 13:32:41 +00:00
parent 712a22e18c
commit 05909d6fa7
6 changed files with 26 additions and 21 deletions

View File

@ -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,

View 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

View 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, \

View 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 */

View 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);

View 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 */