From: Art Yerkes Date: Fri, 4 Mar 2005 01:47:01 +0000 (+0000) Subject: Some warning suppression. Read the . X-Git-Tag: backups/alex_devel_branch@15093~6^2~15 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=8dd6c79a583c6b99e4a74f77dc99f990ec0b5c43 Some warning suppression. Read the . svn path=/trunk/; revision=13810 --- diff --git a/reactos/lib/adns/Makefile b/reactos/lib/adns/Makefile index 55602219f59..70b4ee60f69 100644 --- a/reactos/lib/adns/Makefile +++ b/reactos/lib/adns/Makefile @@ -8,7 +8,7 @@ TARGET_NAME = adns TARGET_CFLAGS = \ -O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32 + -Wstrict-prototypes -Wmissing-prototypes -Wall -DADNS_JGAA_WIN32 -D__USE_W32API -D__REACTOS__ # require os code to explicitly request A/W version of structs/functions TARGET_CFLAGS += -Isrc -Iadns_win32 diff --git a/reactos/lib/adns/adns_win32/adns_win32.h b/reactos/lib/adns/adns_win32/adns_win32.h index 81e621c66b8..23aeff98f98 100644 --- a/reactos/lib/adns/adns_win32/adns_win32.h +++ b/reactos/lib/adns/adns_win32/adns_win32.h @@ -157,5 +157,34 @@ ADNS_API int adns_getpid(void); #include "timercmp.h" /* arty added: mingw headers don't seem to have it */ +/* + * + * These fix the following warning in GCC: + * warning: passing arg 1 of `ntohs' with different width due to prototype + * + * Even if you declare an unsigned char or unsigned short variable and pass + * it to htons or ntohs, this warning will be generated. I believe this is + * a gcc bug. You can try to reproduce the bug like this: + * + * u_short foo(u_short bar) { + * return htons(bar); + * } + * + * Using the reactos compiler settings this generates the error. Unless I'm + * missing something, the active prototypes for htons and ntohs are: + * + * u_short PASCAL htons(u_short); + * u_short PASCAL ntohs(u_short); + * + * From winsock2.h. Since the function above has exactly the same signature + * as htons except for the required PASCAL (__stdcall) decoration, gcc is + * erroneously detecting a narrowed value. + * + */ +#ifdef __REACTOS__ +#define htons(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff)) +#define ntohs(x) htons(x) +#endif + #endif /* ADNS_WIN32_H_INCLUDED */ diff --git a/reactos/lib/adns/src/event.c b/reactos/lib/adns/src/event.c index 62e6b512113..d07a201afca 100644 --- a/reactos/lib/adns/src/event.c +++ b/reactos/lib/adns/src/event.c @@ -52,7 +52,7 @@ static void tcp_close(adns_state ads) { serv= ads->tcpserver; adns_socket_close(ads->tcpsocket); - ads->tcpsocket= -1; + ads->tcpsocket= INVALID_SOCKET; ads->tcprecv.used= ads->tcprecv_skip= ads->tcpsend.used= 0; }