[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 95e670: Fix suspiscious check in Win32 socket plugin

Nicolas Cellier noreply at github.com
Tue Aug 23 16:20:47 UTC 2022


  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 95e670d2b80c0a92d4de0b5d512b05db5a1f0dfb
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/95e670d2b80c0a92d4de0b5d512b05db5a1f0dfb
  Author: Nicolas Cellier <nicolas.cellier at sirehna.com>
  Date:   2022-08-23 (Tue, 23 Aug 2022)

  Changed paths:
    M platforms/win32/plugins/SocketPlugin/sqWin32NewNet.c

  Log Message:
  -----------
  Fix suspiscious check in Win32 socket plugin

>/usr/x86_64-w64-mingw32/sys-root/mingw/include/WinSock2.h:1029:88: note: passing argument to parameter 'optval' here
>  WINSOCK_API_LINKAGE int WSAAPI setsockopt(SOCKET s,int level,int optname,const char *optval,int optlen);
>                                                                                       ^
>../../../platforms/win32/plugins/SocketPlugin/sqWin32NewNet.c:1758:7: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
>  if (!opt == 0
>      ^    ~~

Since opt is a pointer, !opt means (pointer is NULL)<br>
Then (!opt) == 0, means (pointer is NULL) is false, hence (pointer is not NULL).

So we would barf if pointer is not NULL?<br>
But on next line (reached if pointer IS NULL), we would dereference the pointer...<br>
Err, non-sensical.

I guess the intention was to BARF if pointer is NULL.


  Commit: 6e3e0156dcb7b3f880292ce27a220354df186e68
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/6e3e0156dcb7b3f880292ce27a220354df186e68
  Author: Nicolas Cellier <nicolas.cellier at sirehna.com>
  Date:   2022-08-23 (Tue, 23 Aug 2022)

  Changed paths:
    M src/plugins/SocketPlugin/SocketPlugin.c

  Log Message:
  -----------
  Fix some compiler warnings in generated code for SocketPlugin

See https://source.squeak.org/VMMaker/VMMaker.oscog-nice.3250.diff


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/1f1edcb426b4...6e3e0156dcb7


More information about the Vm-dev mailing list