[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 0f9020: Fix a comment typo in sqImageFileAccessViaStdio.h.

Nicolas Cellier noreply at github.com
Tue Nov 8 20:27:01 UTC 2022

  Branch: refs/heads/virtend
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 0f9020bde4cb7ae5d93442428e87930b1eab120d
  Author: Eliot Miranda <eliot.miranda at gmail.com>
  Date:   2022-11-08 (Tue, 08 Nov 2022)

  Changed paths:
    M platforms/Cross/vm/sqImageFileAccessViaStdio.h
    M platforms/win32/plugins/FilePlugin/sqWin32FilePrims.c

  Log Message:
  Fix a comment typo in sqImageFileAccessViaStdio.h.
Fix some formatting in sqWin32FilePrims.c; if( is bad; if is a keyword, not
a function. char* foo is bad; the type of bar in "char* foo, bar;" is char.
This is why in K&R the asterisk is always associated with the variable, not the
base type. Returns should be om their own line for breakpointing when debugging.

  Commit: a4cea472355eac502a3720f9558701cb161377c1
  Author: Nicolas Cellier <nicolas.cellier at sirehna.com>
  Date:   2022-11-08 (Tue, 08 Nov 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.

Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/f25b72cb3b26...a4cea472355e

More information about the Vm-dev mailing list