2002-01-30 Paolo Carlini <pcarlini@unitus.it>
authorPaolo Carlini <pcarlini@unitus.it>
Wed, 30 Jan 2002 21:00:40 +0000 (22:00 +0100)
committerPaolo Carlini <paolo@gcc.gnu.org>
Wed, 30 Jan 2002 21:00:40 +0000 (21:00 +0000)
        * config/locale/numpunct_members_gnu.cc
(numpunct<char, wchar_t>::_M_initialize_numpunct()):
Fix initialization of _M_grouping for locales which have
_M_thousands_sep == '\0'(L'\0', respectively).
* testsuite/22_locale/numpunct_byname.cc (test02): Add test.

From-SVN: r49343

libstdc++-v3/ChangeLog
libstdc++-v3/config/locale/numpunct_members_gnu.cc
libstdc++-v3/testsuite/22_locale/numpunct_byname.cc

index 05ff24c8b55498573229318354fb56f926924222..34126053580786bfea4d090b5506031684f3d38a 100644 (file)
@@ -1,3 +1,11 @@
+2002-01-30  Paolo Carlini  <pcarlini@unitus.it>
+
+       * config/locale/numpunct_members_gnu.cc
+       (numpunct<char, wchar_t>::_M_initialize_numpunct()):
+       Fix initialization of _M_grouping for locales which have
+       _M_thousands_sep == '\0'(L'\0', respectively).
+       * testsuite/22_locale/numpunct_byname.cc (test02): Add test.
+
 2002-01-30  Paolo Carlini  <pcarlini@unitus.it>
 
        * testsuite/27_io/ostream_inserter_arith.cc (test03):
index de9e386fd46705aba117957a5652513c2400fef7..4284c7c07b37971b5312f4123b9460b71b2599c1 100644 (file)
@@ -53,7 +53,11 @@ namespace std
          // Named locale.
          _M_decimal_point = *(__nl_langinfo_l(RADIXCHAR, __cloc));
          _M_thousands_sep = *(__nl_langinfo_l(THOUSEP, __cloc));
-         _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
+         // Check for NUL, which implies no grouping.
+         if (_M_thousands_sep == '\0')
+           _M_grouping = "";
+         else
+           _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
        }
       // NB: There is no way to extact this info from posix locales.
       // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
@@ -79,7 +83,10 @@ namespace std
          // Named locale.
          _M_decimal_point = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_DECIMAL_POINT_WC, __cloc)}).__w);
          _M_thousands_sep = static_cast<wchar_t>(((union { const char *__s; unsigned int __w; }){ __s: __nl_langinfo_l(_NL_NUMERIC_THOUSANDS_SEP_WC, __cloc)}).__w);
-         _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
+         if (_M_thousands_sep == L'\0')
+           _M_grouping = "";
+         else
+           _M_grouping = __nl_langinfo_l(GROUPING, __cloc);
        }
       // NB: There is no way to extact this info from posix locales.
       // _M_truename = __nl_langinfo_l(YESSTR, __cloc);
index 6b6d7d80a0f361f35dc6fd179fd67ab8aa13e1dc..4c69b291a0a8e4ae9fe550bee66e6cd58c55e3c3 100644 (file)
@@ -72,9 +72,26 @@ void test01()
   VERIFY( dp1 != dp3 );
 }
 
+void test02()
+{
+  using namespace std;
+  
+  bool test = true;
+
+  locale loc_it("it_IT");
+
+  const numpunct<char>& nump_it = use_facet<numpunct<char> >(loc_it); 
+
+  string g = nump_it.grouping();
+
+  VERIFY( g == "" );
+}
+
+
 int main()
 {
   test01();
+  test02();
 
   return 0;
 }