pastebin - collaborative debugging tool
rovema.kpaste.net RSS


RDE i10n fixes, review feedback #002
Posted by Anonymous on Fri 12th May 2023 10:29
raw | new post

  1. diff --git a/Base/RovLocale.cpp b/Base/RovLocale.cpp
  2. index 90e735b..9d25380 100644
  3. --- a/Base/RovLocale.cpp
  4. +++ b/Base/RovLocale.cpp
  5. @@ -1,9 +1,19 @@
  6. +///////////////////////////////////////////////////////////////////////////////
  7. +// RovLocale.cpp            POSIX i18n/l10n support functions
  8. +// Copyright                acontis technologies GmbH, Weingarten, Germany
  9. +// Response                 Roland Mainz <roland.mainz@rovema.de>
  10. +// Description              Support functions for i18n and l10n
  11. +///////////////////////////////////////////////////////////////////////////////
  12.  
  13.  #include "PosixSystem.hpp"
  14.  
  15. -pthread_once_t posix_localeobj_init = PTHREAD_ONCE_INIT;
  16. +/*
  17. + * ToDo:
  18. + * - Add implementations of |printf_l()|/|sprintf_l()| etc.
  19. + */
  20.  
  21. -static locale_t posix_localeobj = 0;
  22. +static pthread_once_t  posix_localeobj_init = PTHREAD_ONCE_INIT;
  23. +static locale_t                posix_localeobj = 0;
  24.  
  25.  static void init_posix_localeobj(void)
  26.  {
  27. @@ -16,3 +26,4 @@ locale_t rov_get_posix_localeobj(void)
  28.        
  29.         return posix_localeobj;
  30.  }
  31. +
  32. diff --git a/Rdc/RdsTypes.cpp b/Rdc/RdsTypes.cpp
  33. index 6b6861c..68c92b8 100755
  34. --- a/Rdc/RdsTypes.cpp
  35. +++ b/Rdc/RdsTypes.cpp
  36. @@ -724,7 +724,7 @@ RINLINE T_Bool g_ReadNumericalValueFromString (
  37.               _eValueType);
  38.  
  39.    } // end if (!bOk)
  40. - #ifdef JNA
  41. +#ifdef JNA
  42.    (void)uselocale(saved_locale);
  43.  #endif
  44.    return(bOk);
  45. diff --git a/Rdc/RdsUnit.h b/Rdc/RdsUnit.h
  46. index 1e3f903..ed39e22 100755
  47. --- a/Rdc/RdsUnit.h
  48. +++ b/Rdc/RdsUnit.h
  49. @@ -559,22 +559,11 @@ public:
  50.  //******************************************************************************
  51.  RINLINE T_Bool  C_RdsUnitSize::convertString2Double(const string &_anyStr, T_Double64 & _anyDouble)
  52.  {
  53. -#ifdef JNA
  54. -    locale_t saved_locale;
  55. -    locale_t posix_locale;
  56. -
  57. -    /*
  58. -     * Use POSIX locale because the code below uses functions which
  59. -     * parse floating-poing values using locale-specific functions
  60. -     */
  61. -    posix_locale = rov_get_posix_localeobj();
  62. -    saved_locale = uselocale(posix_locale);
  63. -#endif
  64. +    locale_t posix_locale = rov_get_posix_localeobj();
  65. +
  66.      T_String stopStr = (T_String) _anyStr.c_str();
  67. -    _anyDouble = strtod(stopStr, & stopStr);
  68. -#ifdef JNA
  69. -    (void)uselocale(saved_locale);
  70. -#endif
  71. +    _anyDouble = strtod_l(stopStr, & stopStr, posix_locale);
  72. +
  73.      return true;
  74.  }    // end C_RdsUnitSize::convertString2Double

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at