[Privoxy-devel] incompatible pointer type
    Lee 
    ler762 at gmail.com
       
    Mon Jan  7 19:38:56 UTC 2019
    
    
  
All pointers are the same size - correct?
I get a couple of warnings in jbsockets.c about incompatible pointer types - eg:
jbsockets.c: In function ‘set_no_delay_flag’:
jbsockets.c:140:49: warning: passing argument 4 of ‘setsockopt’ from
incompatible pointer type [-Wincompatible-pointer-types]
    if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &mi, sizeof(int)))
                                                 ^
In file included from jbsockets.c:52:0:
/usr/i686-w64-mingw32/sys-root/mingw/include/winsock2.h:999:34: note:
expected ‘const char *’ but argument is of type ‘int *’
   WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int
optname,const char *optval,int optlen);
                                  ^~~~~~~~~~
that boils down to Windows expects a 'char*' pointer & *nix expects a
'int*' pointer.
I can make the warnings go away by casting the 4th parameter to (char*)
-   if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &mi, sizeof(int)))
+   if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&mi, sizeof(int)))
but a 'char*' pointer is the same size as an 'int*' pointer, so this
is just a cosmetic issue that can safely be ignored.  Correct?
Thanks,
Lee
    
    
More information about the Privoxy-devel
mailing list