From ac309256c3a0d5a4aead53a012c1961ed14caea2 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Fri, 4 Mar 2005 02:09:43 +0000 Subject: [PATCH] Warning cleanups. - #define log to something else that isn't a gcc intrinsic - Move some definitions around in the bsd headers so that proper order is maintained between selinfo and socket and functions that take these as arguments. - Miscellaneous casts. svn path=/trunk/; revision=13811 --- .../include/freebsd/src/sys/sys/select.h | 19 +++++++------------ .../include/freebsd/src/sys/sys/socketvar.h | 19 +++++++++++++++++++ .../include/freebsd/src/sys/sys/systm.h | 6 +++--- .../drivers/lib/oskittcp/oskittcp/in_pcb.c | 2 +- .../drivers/lib/oskittcp/oskittcp/interface.c | 10 +++++----- reactos/drivers/lib/oskittcp/oskittcp/route.c | 4 ++-- 6 files changed, 37 insertions(+), 23 deletions(-) diff --git a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h index 18d3fc6b663..128c5e72cdd 100644 --- a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h +++ b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/select.h @@ -40,18 +40,13 @@ struct listener_mgr; #endif -/* - * Used to maintain information about processes that wish to be - * notified when I/O becomes possible. - */ -struct selinfo { -#if defined(OSKIT) - struct listener_mgr *si_sel; -#endif /* OSKIT */ - pid_t si_pid; /* process to be notified */ - short si_flags; /* see below */ -}; -#define SI_COLL 0x0001 /* collision occurred */ +/* Included to suppress warnings about struct socket being declared in the + * parameter list. Selinfo reoredered with struct socket. */ + +struct selinfo; +struct socket; + +#include #ifdef KERNEL struct proc; diff --git a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h index 5afe34897af..ab007da6433 100644 --- a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h +++ b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/socketvar.h @@ -40,6 +40,25 @@ #include /* for struct filedesc */ #include /* for struct selinfo */ +/* Warning suppression */ +struct sockaddr; + +/* + * Used to maintain information about processes that wish to be + * notified when I/O becomes possible. + * + * Moved from sys/select.h and replaced with an #include. + */ +struct selinfo { +#if defined(OSKIT) + struct listener_mgr *si_sel; +#endif /* OSKIT */ + pid_t si_pid; /* process to be notified */ + short si_flags; /* see below */ +}; +#define SI_COLL 0x0001 /* collision occurred */ + + /* * Kernel structure per socket. * Contains send and receive buffer queues, diff --git a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h index 5203cd64ee4..0337f780875 100644 --- a/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h +++ b/reactos/drivers/lib/oskittcp/include/freebsd/src/sys/sys/systm.h @@ -125,16 +125,16 @@ void printf __P((const char *, ...)); #include #include + int __cdecl vprintf(const char *, va_list); -static inline int log ( int blah, const char* fmt, ... ) +#define log bsd_log +static inline int bsd_log ( int blah, const char* fmt, ... ) { va_list arg; int i; va_start(arg, fmt); -#ifndef __NTDRIVER__ i = vprintf ( fmt, arg ); -#endif va_end(arg); return i; } diff --git a/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c b/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c index 7d0f36b311c..233835bf9d2 100644 --- a/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c +++ b/reactos/drivers/lib/oskittcp/oskittcp/in_pcb.c @@ -312,7 +312,7 @@ in_pcbladdr(inp, nam, plocal_sin) * Don't do pcblookup call here; return interface in plocal_sin * and exit to caller, that will do the lookup. */ - *plocal_sin = ia->ia_ifa.ifa_addr; + *plocal_sin = (struct sockaddr_in *)ia->ia_ifa.ifa_addr; OS_DbgPrint(OSK_MID_TRACE,("plocal sin %x\n", (*plocal_sin)->sin_addr.s_addr)); diff --git a/reactos/drivers/lib/oskittcp/oskittcp/interface.c b/reactos/drivers/lib/oskittcp/oskittcp/interface.c index 151d4ab003b..1680944239c 100644 --- a/reactos/drivers/lib/oskittcp/oskittcp/interface.c +++ b/reactos/drivers/lib/oskittcp/oskittcp/interface.c @@ -365,7 +365,7 @@ int OskitTCPAccept( void *socket, */ so = head->so_q; - inp = so ? so->so_pcb : 0; + inp = so ? (struct inpcb *)so->so_pcb : NULL; if( inp ) { ((struct sockaddr_in *)AddrOut)->sin_addr.s_addr = inp->inp_faddr.s_addr; @@ -381,7 +381,7 @@ int OskitTCPAccept( void *socket, /*so->so_state &= ~SS_COMP;*/ - mnam.m_data = &sa; + mnam.m_data = (char *)&sa; mnam.m_len = sizeof(sa); (void) soaccept(so, &mnam); @@ -452,7 +452,7 @@ void OskitTCPSetAddress( void *socket, OSK_UINT RemoteAddress, OSK_UI16 RemotePort ) { struct socket *so = socket; - struct inpcb *inp = so->so_pcb; + struct inpcb *inp = (struct inpcb *)so->so_pcb; inp->inp_laddr.s_addr = LocalAddress; inp->inp_lport = LocalPort; inp->inp_faddr.s_addr = RemoteAddress; @@ -465,7 +465,7 @@ void OskitTCPGetAddress( void *socket, OSK_UINT *RemoteAddress, OSK_UI16 *RemotePort ) { struct socket *so = socket; - struct inpcb *inp = so ? so->so_pcb : 0; + struct inpcb *inp = so ? (struct inpcb *)so->so_pcb : NULL; if( inp ) { *LocalAddress = inp->inp_laddr.s_addr; *LocalPort = inp->inp_lport; @@ -589,7 +589,7 @@ struct ifaddr *ifa_ifwithnet(addr) if( ifaddr ) { - sin = (struct sockaddr *)&ifaddr->ifa_addr; + sin = (struct sockaddr_in *)&ifaddr->ifa_addr; OS_DbgPrint(OSK_MID_TRACE,("ifaddr->addr = %x\n", sin->sin_addr.s_addr)); diff --git a/reactos/drivers/lib/oskittcp/oskittcp/route.c b/reactos/drivers/lib/oskittcp/oskittcp/route.c index b8649667c12..fb703b790c9 100644 --- a/reactos/drivers/lib/oskittcp/oskittcp/route.c +++ b/reactos/drivers/lib/oskittcp/oskittcp/route.c @@ -314,8 +314,8 @@ ifa_ifwithroute(flags, dst, gateway) register struct ifaddr *ifa; OS_DbgPrint(OSK_MID_TRACE,("Called: flags %\n", flags)); - OskitDumpBuffer( dst, sizeof(*dst) ); - OskitDumpBuffer( gateway, sizeof(*gateway) ); + OskitDumpBuffer( (void *)dst, sizeof(*dst) ); + OskitDumpBuffer( (void *)gateway, sizeof(*gateway) ); if ((flags & RTF_GATEWAY) == 0) { /*