Commit c611af37 authored by Alexandre Julliard's avatar Alexandre Julliard

include: Try harder to redefine u_long, and avoid using it in headers as far as possible.

parent 854c3a87
......@@ -18,9 +18,9 @@
struct tcp_keepalive
{
u_long onoff;
u_long keepalivetime;
u_long keepaliveinterval;
ULONG onoff;
ULONG keepalivetime;
ULONG keepaliveinterval;
};
#ifndef USE_WS_PREFIX
......
......@@ -80,6 +80,7 @@
# define timeval unix_timeval
# define select unix_select
# define socklen_t unix_socklen_t
# define u_long unix_u_long
# include <sys/types.h>
# include <time.h>
# include <stdlib.h>
......@@ -87,6 +88,7 @@
# undef timeval
# undef select
# undef socklen_t
# undef u_long
# undef FD_SETSIZE
# undef FD_CLR
# undef FD_SET
......@@ -118,22 +120,16 @@
typedef unsigned char WS_u_char;
typedef unsigned short WS_u_short;
typedef unsigned int WS_u_int;
#ifdef _MSC_VER
typedef unsigned long WS_u_long;
#else
typedef unsigned int WS_u_long;
#endif
typedef ULONG WS_u_long;
#elif (defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__)) && !defined(_BSDTYPES_DEFINED)
/* MinGW doesn't define the u_xxx types */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
#ifdef _MSC_VER
typedef unsigned long u_long;
#else
typedef unsigned int u_long;
#endif
typedef ULONG u_long;
#define _BSDTYPES_DEFINED
#else
#define u_long ULONG /* make sure we don't use the system u_long */
#endif
#ifdef USE_WS_PREFIX
......@@ -301,7 +297,7 @@ struct WS(netent)
char* n_name; /* official name of net */
char** n_aliases; /* alias list */
short n_addrtype; /* net address type */
WS(u_long) n_net; /* network # */
ULONG n_net; /* network # */
};
......@@ -523,9 +519,9 @@ int WINAPI __WSAFDIsSet(SOCKET,WS(fd_set)*);
#ifdef WORDS_BIGENDIAN
#define htonl(l) ((u_long)(l))
#define htonl(l) ((ULONG)(l))
#define htons(s) ((u_short)(s))
#define ntohl(l) ((u_long)(l))
#define ntohl(l) ((ULONG)(l))
#define ntohs(s) ((u_short)(s))
#else /* WORDS_BIGENDIAN */
......@@ -534,9 +530,9 @@ static inline u_short __wine_ushort_swap(u_short s)
{
return (s >> 8) | (s << 8);
}
static inline u_long __wine_ulong_swap(u_long l)
static inline ULONG __wine_ulong_swap(ULONG l)
{
return ((u_long)__wine_ushort_swap((u_short)l) << 16) | __wine_ushort_swap((u_short)(l >> 16));
return ((ULONG)__wine_ushort_swap((u_short)l) << 16) | __wine_ushort_swap((u_short)(l >> 16));
}
#define htonl(l) __wine_ulong_swap(l)
#define htons(s) __wine_ushort_swap(s)
......@@ -584,14 +580,14 @@ static inline u_long __wine_ulong_swap(u_long l)
#endif /* USE_WS_PREFIX */
#ifndef USE_WS_PREFIX
#define INADDR_ANY ((u_long)0x00000000)
#define INADDR_ANY ((ULONG)0x00000000)
#define INADDR_LOOPBACK 0x7f000001
#define INADDR_BROADCAST ((u_long)0xffffffff)
#define INADDR_BROADCAST ((ULONG)0xffffffff)
#define INADDR_NONE 0xffffffff
#else
#define WS_INADDR_ANY ((WS_u_long)0x00000000)
#define WS_INADDR_ANY ((ULONG)0x00000000)
#define WS_INADDR_LOOPBACK 0x7f000001
#define WS_INADDR_BROADCAST ((WS_u_long)0xffffffff)
#define WS_INADDR_BROADCAST ((ULONG)0xffffffff)
#define WS_INADDR_NONE 0xffffffff
#endif /* USE_WS_PREFIX */
......@@ -604,7 +600,7 @@ typedef struct WS(in_addr)
struct {
WS(u_short) s_w1,s_w2;
} S_un_w;
WS(u_long) S_addr;
ULONG S_addr;
} S_un;
#ifndef USE_WS_PREFIX
#define s_addr S_un.S_addr
......@@ -778,23 +774,23 @@ typedef struct WS(WSAData)
* Socket I/O flags (supported by spec 1.1)
*/
#ifndef USE_WS_PREFIX
#define FIONREAD _IOR('f', 127, u_long)
#define FIONBIO _IOW('f', 126, u_long)
#define FIOASYNC _IOW('f', 125, u_long)
#define SIOCSHIWAT _IOW('s', 0, u_long)
#define SIOCGHIWAT _IOR('s', 1, u_long)
#define SIOCSLOWAT _IOW('s', 2, u_long)
#define SIOCGLOWAT _IOR('s', 3, u_long)
#define SIOCATMARK _IOR('s', 7, u_long)
#define FIONREAD _IOR('f', 127, ULONG)
#define FIONBIO _IOW('f', 126, ULONG)
#define FIOASYNC _IOW('f', 125, ULONG)
#define SIOCSHIWAT _IOW('s', 0, ULONG)
#define SIOCGHIWAT _IOR('s', 1, ULONG)
#define SIOCSLOWAT _IOW('s', 2, ULONG)
#define SIOCGLOWAT _IOR('s', 3, ULONG)
#define SIOCATMARK _IOR('s', 7, ULONG)
#else
#define WS_FIONREAD WS__IOR('f', 127, WS_u_long)
#define WS_FIONBIO WS__IOW('f', 126, WS_u_long)
#define WS_FIOASYNC WS__IOW('f', 125, WS_u_long)
#define WS_SIOCSHIWAT WS__IOW('s', 0, WS_u_long)
#define WS_SIOCGHIWAT WS__IOR('s', 1, WS_u_long)
#define WS_SIOCSLOWAT WS__IOW('s', 2, WS_u_long)
#define WS_SIOCGLOWAT WS__IOR('s', 3, WS_u_long)
#define WS_SIOCATMARK WS__IOR('s', 7, WS_u_long)
#define WS_FIONREAD WS__IOR('f', 127, ULONG)
#define WS_FIONBIO WS__IOW('f', 126, ULONG)
#define WS_FIOASYNC WS__IOW('f', 125, ULONG)
#define WS_SIOCSHIWAT WS__IOW('s', 0, ULONG)
#define WS_SIOCGHIWAT WS__IOR('s', 1, ULONG)
#define WS_SIOCSLOWAT WS__IOW('s', 2, ULONG)
#define WS_SIOCGLOWAT WS__IOR('s', 3, ULONG)
#define WS_SIOCATMARK WS__IOR('s', 7, ULONG)
#endif
/*
......@@ -1051,9 +1047,9 @@ struct WS(servent)* WINAPI WS(getservbyname)(const char*,const char*);
struct WS(servent)* WINAPI WS(getservbyport)(int,const char*);
int WINAPI WS(getsockname)(SOCKET,struct WS(sockaddr)*,int*);
int WINAPI WS(getsockopt)(SOCKET,int,int,char*,int*);
WS(u_long) WINAPI WS(inet_addr)(const char*);
ULONG WINAPI WS(inet_addr)(const char*);
char* WINAPI WS(inet_ntoa)(struct WS(in_addr));
int WINAPI WS(ioctlsocket)(SOCKET,LONG,WS(u_long)*);
int WINAPI WS(ioctlsocket)(SOCKET,LONG,ULONG*);
int WINAPI WS(listen)(SOCKET,int);
int WINAPI WS(recv)(SOCKET,char*,int,int);
int WINAPI WS(recvfrom)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
......
......@@ -144,7 +144,7 @@ extern "C" {
#define WS_SIO_ADDRESS_LIST_QUERY _WSAIOR(WS_IOC_WS2,22)
#define WS_SIO_ADDRESS_LIST_CHANGE _WSAIO(WS_IOC_WS2,23)
#define WS_SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(WS_IOC_WS2,24)
#define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, WS_u_long)
#define WS_SIO_GET_INTERFACE_LIST WS__IOR('t', 127, ULONG)
#else /* USE_WS_PREFIX */
#undef IOC_VOID
#undef IOC_IN
......@@ -180,7 +180,7 @@ extern "C" {
#define SIO_ADDRESS_LIST_QUERY _WSAIOR(IOC_WS2,22)
#define SIO_ADDRESS_LIST_CHANGE _WSAIO(IOC_WS2,23)
#define SIO_QUERY_TARGET_PNP_HANDLE _WSAIOR(IOC_WS2,24)
#define SIO_GET_INTERFACE_LIST _IOR ('t', 127, u_long)
#define SIO_GET_INTERFACE_LIST _IOR ('t', 127, ULONG)
#endif /* USE_WS_PREFIX */
/* Constants for WSAIoctl() */
......@@ -547,13 +547,13 @@ typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYNAME)(const char*,const char*
typedef struct WS(servent)* (WINAPI *LPFN_GETSERVBYPORT)(int,const char*);
typedef int (WINAPI *LPFN_GETSOCKNAME)(SOCKET,struct WS(sockaddr)*,int*);
typedef int (WINAPI *LPFN_GETSOCKOPT)(SOCKET,int,int,char*,int*);
typedef WS(u_long) (WINAPI *LPFN_HTONL)(WS(u_long));
typedef ULONG (WINAPI *LPFN_HTONL)(ULONG);
typedef WS(u_short) (WINAPI *LPFN_HTONS)(WS(u_short));
typedef ULONG (WINAPI *LPFN_INET_ADDR)(const char*);
typedef char* (WINAPI *LPFN_INET_NTOA)(struct WS(in_addr);
typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,LONG,WS(u_long)*);
typedef int (WINAPI *LPFN_IOCTLSOCKET)(SOCKET,LONG,ULONG*);
typedef int (WINAPI *LPFN_LISTEN)(SOCKET,int);
typedef WS(u_long) (WINAPI *LPFN_NTOHL)(WS(u_long));
typedef ULONG (WINAPI *LPFN_NTOHL)(ULONG);
typedef WS(u_short) (WINAPI *LPFN_NTOHS)(WS(u_short));
typedef int (WINAPI *LPFN_RECV)(SOCKET,char*,int,int);
typedef int (WINAPI *LPFN_RECVFROM)(SOCKET,char*,int,int,struct WS(sockaddr)*,int*);
......@@ -599,7 +599,7 @@ INT WINAPI WSAGetServiceClassInfoW(LPGUID,LPGUID,LPDWORD,LPWSASERVICECLASSINFOW)
INT WINAPI WSAGetServiceClassNameByClassIdA(LPGUID,LPSTR,LPDWORD);
INT WINAPI WSAGetServiceClassNameByClassIdW(LPGUID,LPWSTR,LPDWORD);
#define WSAGetServiceClassNameByClassId WINELIB_NAME_AW(WSAGetServiceClassNameByClassId)
int WINAPI WSAHtonl(SOCKET,WS(u_long),WS(u_long)*);
int WINAPI WSAHtonl(SOCKET,ULONG,ULONG*);
int WINAPI WSAHtons(SOCKET,WS(u_short),WS(u_short)*);
int WINAPI WSAInstallServiceClassA(LPWSASERVICECLASSINFOA);
int WINAPI WSAInstallServiceClassW(LPWSASERVICECLASSINFOW);
......@@ -613,7 +613,7 @@ INT WINAPI WSALookupServiceEnd(HANDLE);
INT WINAPI WSALookupServiceNextA(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
INT WINAPI WSALookupServiceNextW(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
#define WSALookupServiceNext WINELIB_NAME_AW(WSALookupServiceNext)
int WINAPI WSANtohl(SOCKET,WS(u_long),WS(u_long)*);
int WINAPI WSANtohl(SOCKET,ULONG,ULONG*);
int WINAPI WSANtohs(SOCKET,WS(u_short),WS(u_short)*);
INT WINAPI WSAProviderConfigChange(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
int WINAPI WSARecv(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
......@@ -672,7 +672,7 @@ typedef INT (WINAPI *LPFNWSAGETSERVICECLASSINFOW)(LPGUID,LPGUID,LPDWORD,LPWSASER
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDA)(LPGUID,LPSTR,LPDWORD);
typedef INT (WINAPI *LPFN_WSAGETSERVICECLASSNAMEBYCLASSIDW)(LPGUID,LPWSTR,LPDWORD);
#define LPFN_WSAGETSERVICECLASSNAMEBYCLASSID WINELIB_NAME_AW(LPFN_WSAGETSERVICECLASSNAMEBYCLASSID)
typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,WS(u_long),WS(u_long)*);
typedef int (WINAPI *LPFN_WSAHTONL)(SOCKET,ULONG,ULONG*);
typedef int (WINAPI *LPFN_WSAHTONS)(SOCKET,WS(u_short),WS(u_short)*);
typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSA)(LPWSASERVICECLASSINFOA);
typedef int (WINAPI LPFN_WSAINSTALLSERVICECLASSW)(LPWSASERVICECLASSINFOW);
......@@ -685,7 +685,7 @@ typedef INT (WINAPI *LPFN_WSALOOKUPSERVICEEND(HANDLE);
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTA)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETA);
typedef INT (WINAPI *LPFN_WSALOOKUPSERVICENEXTW)(HANDLE,DWORD,LPDWORD,LPWSAQUERYSETW);
#define LPFN_WSALOOKUPSERVICENEXT WINELIB_NAME_AW(LPFN_WSALOOKUPSERVICENEXT)
typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,WS(u_long),WS(u_long)*);
typedef int (WINAPI *LPFN_WSANTOHL)(SOCKET,ULONG,ULONG*);
typedef int (WINAPI *LPFN_WSANTOHS)(SOCKET,WS(u_short),WS(u_short)*);
typedef INT (WINAPI *LPFN_WSAPROVIDERCONFIGCHANGE)(LPHANDLE,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
typedef int (WINAPI *LPFN_WSARECV)(SOCKET,LPWSABUF,DWORD,LPDWORD,LPDWORD,LPWSAOVERLAPPED,LPWSAOVERLAPPED_COMPLETION_ROUTINE);
......
......@@ -45,7 +45,7 @@ typedef union sockaddr_gen
/* Structure to keep interface specific information */
typedef struct _INTERFACE_INFO
{
WS(u_long) iiFlags; /* Interface flags */
ULONG iiFlags; /* Interface flags */
WS(sockaddr_gen) iiAddress; /* Interface address */
WS(sockaddr_gen) iiBroadcastAddress; /* Broadcast address */
WS(sockaddr_gen) iiNetmask; /* Network mask */
......@@ -148,8 +148,8 @@ struct WS(ip_mreq_source) {
struct WS(ip_msfilter) {
struct WS(in_addr) imsf_multiaddr;
struct WS(in_addr) imsf_interface;
WS(u_long) imsf_fmode;
WS(u_long) imsf_numsrc;
ULONG imsf_fmode;
ULONG imsf_numsrc;
struct WS(in_addr) imsf_slist[1];
} WS(IP_MSFILTER), *WS(PIP_MSFILTER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment