[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] f25041: We can't compare a TCHAR*windowClassName with a ch...

GitHub noreply at github.com
Mon Dec 31 13:56:03 UTC 2018


  Branch: refs/heads/WIN64_UNICODE
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: f25041584cb703d00ef9677b4403c50244daa024
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/f25041584cb703d00ef9677b4403c50244daa024
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  We can't compare a TCHAR*windowClassName with a char*buf

Even if buf were re-interpreted as WCHAR* when -DUNICODE,
strcmp wouldn't do the right thing (it will stop at first ASCII because high 8 bits will be zero!)
We thus use the TCHAR*dedicated `_tcscmp`.
If ever we want to switch to UTF16 (WCHAR*) windowClassName, then it will be `wcscmp`.


  Commit: 84a8d172d1c524487cf9c2e06f2fc807ef27c6d9
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/84a8d172d1c524487cf9c2e06f2fc807ef27c6d9
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Prefs.c

  Log Message:
  -----------
  Tu quoque NewspeakVM, frustra TEXT macro...

That's the limit of using compiler warnings: we only focus on the sections we compile...
BTW, ifdef NewspeakVM, OK, but what do Pharo people think about it?


  Commit: 7d3264e523709ea92aa1a70d1c9a97a863d3c0a8
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/7d3264e523709ea92aa1a70d1c9a97a863d3c0a8
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

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

  Log Message:
  -----------
  gai_strerror returns a TCHAR*, we cannot simply fprintf it...

Choose the UNICODE variant, because error messages are presumably localized an may use non ASCII characters
The alternative would be to use `_ftprintf(stderr,TEXT("%s"),gai_strerror(gaiError))` and let -DUNICODE decide...


  Commit: 6ff9625b6cb47487bf5421921c9b7b9742571e7b
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/6ff9625b6cb47487bf5421921c9b7b9742571e7b
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32DnsInfo.c

  Log Message:
  -----------
  Let lookup account for NULL terminating a WCHAR*

The low level `RegQueryValueEx` deals with a char*, but here char* just means some un-interpreted bytes, not a string!
If we compile with `-DUNICODE` the un-interpreted bytes will contain a WCHAR*
And if we want to properly NULL terminate this WCHAR*, then we need 2 null bytes, not 1!


  Commit: 32840ac857dbef54e25c61c3e7bb0a9dde5aca5f
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/32840ac857dbef54e25c61c3e7bb0a9dde5aca5f
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32DnsInfo.c

  Log Message:
  -----------
  Revert to ASCII only version of DnsInfo

Rationale: there's no urge in providing localized UNICODE info...
That's IP addresses, etc...
Eventually, server names could be UNICODE but this seems to be a real mess!
The short term goal is to enable compilation with -DUNICODE
For longer term, we'll see later.


  Commit: 475d84cf63fc05ca814fa67016f46e90263d0894
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/475d84cf63fc05ca814fa67016f46e90263d0894
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c

  Log Message:
  -----------
  iconPath is char*, LoadImage expects a TCHAR*

We now interpret iconPath as UTF-8 encoded
We convert it to WideChar and call the W version.
TODO: for now, do not deal with UNC long filenames...


  Commit: ef245b6d485b0286f648fda560b0564d812593e5
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/ef245b6d485b0286f648fda560b0564d812593e5
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/plugins/HostWindowPlugin/sqWin32HostWindowPlugin.c

  Log Message:
  -----------
  And account for the fact that iconPath is not NULL-TERMINATED!


  Commit: 07ff6a63ab5841ece882f93092d900d36ca371b0
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/07ff6a63ab5841ece882f93092d900d36ca371b0
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  DPRINTF must take a TCHAR*fmt because wvsprintf does!

though, vfprintf does not, so reconcile by using _vftprintf from <tchar.h>


  Commit: dfe4d09597d2c6ed94ff9d1f6305df677bf39067
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/dfe4d09597d2c6ed94ff9d1f6305df677bf39067
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  NOTIFYICONDATA.szTip maybe a WCHAR* if -DUNICODE

so let's use appropriate TCHAR* functions/macros


  Commit: db33158941b1a8e74224d98ff6e81b2f20e6959c
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/db33158941b1a8e74224d98ff6e81b2f20e6959c
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  _DISPLAY_DEVICE.DeviceString may be a WCHAR* if -DUNICODE, we cannot simply sprintf

We have to test #ifdef UNICODE, and if so, convert to UTF8


  Commit: 46bd992b7633dfc4f96b142104651313b826809c
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/46bd992b7633dfc4f96b142104651313b826809c
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c
    M platforms/win32/vm/sqWin32Prefs.c
    M platforms/win32/vm/sqWin32Prefs.h

  Log Message:
  -----------
  VM_VERSION_TEXT is a TCHAR*, we cannot simply fprintf

But there is no need for UNICODE in VM_VERSION_TEXT
Revert to plain ASCII and rename it VM_VERSION_VERBOSE


  Commit: c5f207c84ce1a9dca04ff4126e24a7489986c9c5
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/c5f207c84ce1a9dca04ff4126e24a7489986c9c5
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  iniName, manufacturer and model may be WCHAR* if -DUNICODE

Let iniName be WCHAR unconditionally.
Get manufacturer and model into a UTF16 buffer, then convert them to UTF8
while at it, protect buffer overrun strcat - > wcsNcat


  Commit: d9b3927ed91ef60eeca7ec14dd7f48ccb6022cde
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/d9b3927ed91ef60eeca7ec14dd7f48ccb6022cde
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  Information queried in Registry can be WideChar if -DUNICODE

We want to generate an UTF8 report (do we really?).
So provide a `RegLookupUTF8String`, so as to make all the queries with W variant,
then convert all information to UTF8

While at it, use snprintf instead of sprintf and strncat instead of strcat


  Commit: 8b14fbfcb43951d7a7f87be1d927fadc7db85007
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/8b14fbfcb43951d7a7f87be1d927fadc7db85007
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  Make stderrName and stdoutName be WCHAR*

There was a mixture of TCHAR* and char* which could not work with -DUNICODE
Who knows, the TempPath might be localized, so go UNICODE...


  Commit: 643a5e3bc03142a49115588a1b215cf963563e42
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/643a5e3bc03142a49115588a1b215cf963563e42
  Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
  Date:   2018-12-31 (Mon, 31 Dec 2018)

  Changed paths:
    M platforms/win32/vm/sqWin32.h
    M platforms/win32/vm/sqWin32Main.c
    M platforms/win32/vm/sqWin32Service.c
    M platforms/win32/vm/sqWin32Window.c

  Log Message:
  -----------
  Retract support for Windows95 (no you don't dream it's nearly 2019!)

I'm very sorry to dilapidate all this historical knowledge, but frankly YAGNI!
Even if we are a museum, we can't expose all our art in permanent collections!
Note that minimal version is already set to XP (via WINVER:=-D_WIN32_WINNT=0x0501 -DWINVER=0x0501 in Makefile.tools)
So we're keeping this stuf for nothing, and now it gets in our way to UNICODE.


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/1893512441e9...643a5e3bc031
      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the Vm-dev mailing list