[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 146933: Correct win32 sqLocCurrencyNotation

GitHub noreply at github.com
Mon Jul 25 08:06:15 UTC 2016


  Branch: refs/heads/Cog
  Home:   https://github.com/OpenSmalltalk/opensmalltalk-vm
  Commit: 146933838498a72753f5c9aa157268913b576915
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/146933838498a72753f5c9aa157268913b576915
  Author: Nicolas Cellier <nicolas.cellier at sirehna.com>
  Date:   2016-07-25 (Mon, 25 Jul 2016)

  Changed paths:
    M platforms/win32/plugins/LocalePlugin/sqWin32Locale.c

  Log Message:
  -----------
  Correct win32  sqLocCurrencyNotation

As commented in https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/d8683fe30158890145096ff1f2999ae53c292b37
the current code is checking if the address of currString is even???
Whether the address is even or odd does not depend on GetLocaleInfo, but rather on stack alignment of local variables on target architecture.
The code should rather check if the contents is even!!!

The contents is a String, "0", "1", "2" or "3" See LOCALE_ICURRENCY on msdn https://msdn.microsoft.com/en-us/library/windows/desktop/dd373755(v=vs.85).aspx
Testing if the string is even or odd is not practical.
But it's easier to return a number with LOCALE_RETURN_NUMBER see https://msdn.microsoft.com/en-us/library/windows/desktop/dd373825(v=vs.85).aspx
and see example of usage in GetLocaleInfo doc on msdn https://msdn.microsoft.com/en-us/library/windows/desktop/dd318101(v=vs.85).aspx

Phew, this function is brainfuck, thus error-prone, isn't it?


  Commit: 56683023fd1d73c0c034dfc687e8b047466c1f34
      https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/56683023fd1d73c0c034dfc687e8b047466c1f34
  Author: Nicolas Cellier <nicolas.cellier at sirehna.com>
  Date:   2016-07-25 (Mon, 25 Jul 2016)

  Changed paths:
    M platforms/Cross/vm/sq.h
    M platforms/Mac OS/vm/sqMacMain.c
    M platforms/iOS/vm/Common/Classes/sqSqueakMainApp.m
    M platforms/unix/vm/sqUnixMain.c
    M platforms/win32/vm/sqWin32Main.c

  Log Message:
  -----------
  Merge branch 'Cog' of github.com:OpenSmalltalk/opensmalltalk-vm into Cog


Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/fdba979177ff...56683023fd1d


More information about the Vm-dev mailing list