components/stdcxx/patches/078-tests.localization.patch
author Jesse Butler <jesse.butler@oracle.com>
Mon, 17 Oct 2016 16:13:44 -0700
changeset 7119 2f82d964b8be
parent 402 94ae4d75524c
permissions -rw-r--r--
24830297 drop unneeded metadata layers from base image
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
402
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     1
--- stdcxx-4.2.1/tests/src/locale.cpp	2008-04-24 17:23:00.000000000 -0700
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     2
+++ stdcxx-4.2.1/tests/src/locale.cpp	2011-02-23 15:23:26.419730197 -0800
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     3
@@ -411,8 +411,13 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     4
     // execute a shell command and redirect its output into the file
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     5
     const int exit_status =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     6
         grep_exp && *grep_exp
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     7
+#if defined(__SUNPRO_CC)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     8
+      ? rw_system ("/usr/bin/locale -a | grep \"%s\" > %s", grep_exp, fname)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     9
+      : rw_system ("/usr/bin/locale -a > %s", fname);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    10
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    11
       ? rw_system ("locale -a | grep \"%s\" > %s", grep_exp, fname)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    12
       : rw_system ("locale -a > %s", fname);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    13
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    14
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    15
     if (exit_status) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    16
         return deflocname;   // error
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    17
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    18
--- stdcxx-4.2.1/tests/localization/22.locale.money.put.mt.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    19
+++ stdcxx-4.2.1/tests/localization/22.locale.money.put.mt.cpp	2011-04-06 12:34:13.954979492 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    20
@@ -65,17 +65,18 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    21
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    22
 // should all threads share the same set of locale objects instead
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    23
 // of creating their own?
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    24
-int opt_shared_locale;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    25
+static int opt_shared_locale = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    26
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    27
+// print verbose info messages
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    28
+static int opt_verbose = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    29
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    30
 /**************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    31
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    32
 // array of locale names to use for testing
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    33
-static const char*
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    34
-locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    35
+static const char* locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    36
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    37
 // number of locale names in the array
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    38
-static std::size_t
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    39
-nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    40
+static std::size_t nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    41
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    42
 /**************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    43
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    44
@@ -107,7 +108,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    45
     };
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    46
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    47
     // name of the locale the data corresponds to
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    48
-    const char* locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    49
+    std::string locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    50
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    51
     // optionally set to the named locale for threads to share
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    52
     std::locale locale_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    53
@@ -191,11 +192,16 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    54
         // facet from it and use it to format a random money value
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    55
         const std::locale loc =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    56
             opt_shared_locale ? data.locale_
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    57
-                                 : std::locale (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    58
+                              : std::locale (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    59
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    60
         if (test_char) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    61
             // exercise the narrow char specialization of the facet
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    62
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    63
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    64
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    65
+                         "exercising std::money_put<char> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    66
+                          data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    67
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    68
             const std::money_put<char> &np =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    69
                 std::use_facet<std::money_put<char> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    70
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    71
@@ -219,7 +225,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    72
             }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    73
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    74
             RW_ASSERT (!nio.fail ());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    75
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    76
+            RW_ASSERT (0 == std::strncmp (ncs, data.ncs_, sizeof (ncs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    77
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    78
             RW_ASSERT (!rw_strncmp (ncs, data.ncs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    79
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    80
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    81
         }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    82
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    83
@@ -230,6 +240,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    84
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    85
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    86
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    87
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    88
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    89
+                         "exercising std::money_put<wchar_t> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    90
+                          data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    91
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    92
             const std::money_put<wchar_t> &wp =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    93
                 std::use_facet<std::money_put<wchar_t> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    94
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    95
@@ -253,7 +268,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    96
             }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    97
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    98
             RW_ASSERT (!wio.fail ());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    99
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   100
+            RW_ASSERT (0 == std::wcsncmp (wcs, data.wcs_, sizeof (wcs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   101
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   102
             RW_ASSERT (!rw_strncmp (wcs, data.wcs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   103
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   104
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   105
 #endif   // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   106
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   107
@@ -280,6 +299,12 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   108
     wio.rdbuf (&wsb);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   109
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   110
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   111
+    for (size_t i = 0; i < MAX_THREADS; ++i) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   112
+        locales[i] = 0UL;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   113
+        my_money_data[i].locale_name_ = "";
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   114
+        my_money_data[i].locale_ = std::locale();
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   115
+    }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   116
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   117
     // find all installed locales for which setlocale (LC_ALL) succeeds
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   118
     const char* const locale_list =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   119
         rw_opt_locales ? rw_opt_locales : rw_locales (_RWSTD_LC_ALL);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   120
@@ -298,7 +323,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   121
         data.locale_name_ = name;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   122
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   123
         try {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   124
-            const std::locale loc (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   125
+            const std::locale loc (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   126
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   127
             // initialize with random but valid values
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   128
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   129
@@ -343,7 +368,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   130
             rw_assert (!nio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   131
                        "money_put<char>::put(...) "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   132
                        "failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   133
-                       data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   134
+                       data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   135
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   136
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   137
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   138
@@ -372,7 +397,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   139
             rw_assert (!nio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   140
                        "money_put<wchar_t>::put(...) "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   141
                        "failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   142
-                       data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   143
+                       data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   144
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   145
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   146
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   147
--- stdcxx-4.2.1/tests/localization/22.locale.num.put.mt.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   148
+++ stdcxx-4.2.1/tests/localization/22.locale.num.put.mt.cpp	2011-04-06 12:01:45.334923153 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   149
@@ -38,7 +38,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   150
 #include <valcmp.h>
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   151
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   152
 #define MAX_THREADS      32
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   153
-#define MAX_LOOPS    100000
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   154
+#define MAX_LOOPS 10000
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   155
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   156
 // default number of threads (will be adjusted to the number
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   157
 // of processors/cores later)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   158
@@ -62,17 +62,18 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   159
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   160
 // should all threads share the same set of locale objects instead
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   161
 // of creating their own?
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   162
-int opt_shared_locale;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   163
+static int opt_shared_locale = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   164
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   165
+// print verbose information messages
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   166
+static int opt_verbose = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   167
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   168
 /**************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   169
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   170
 // array of locale names to use for testing
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   171
-static const char*
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   172
-locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   173
+static const char* locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   174
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   175
 // number of locale names in the array
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   176
-static std::size_t
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   177
-nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   178
+static std::size_t nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   179
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   180
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   181
 struct MyNumData {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   182
@@ -104,7 +105,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   183
     };
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   184
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   185
     // name of the locale the data corresponds to
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   186
-    const char* locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   187
+    std::string locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   188
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   189
     // optionally set to the named locale for threads to share
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   190
     std::locale locale_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   191
@@ -245,11 +246,16 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   192
         // so that the locale is used not only by the num_put facet
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   193
         const std::locale loc =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   194
             opt_shared_locale ? data.locale_
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   195
-                                 : std::locale (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   196
+                                 : std::locale (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   197
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   198
         if (test_char) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   199
             // exercise the narrow char specialization of the facet
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   200
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   201
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   202
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   203
+                         "exercising std::num_put<char> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   204
+                         data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   205
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   206
             const std::num_put<char> &np =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   207
                 std::use_facet<std::num_put<char> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   208
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   209
@@ -260,7 +266,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   210
                       nio, ' ', '\0');
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   211
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   212
             RW_ASSERT (!nio.fail ()); 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   213
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   214
+            RW_ASSERT (0 == std::strncmp (ncs, data.ncs_, sizeof (ncs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   215
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   216
             RW_ASSERT (!rw_strncmp (ncs, data.ncs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   217
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   218
         }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   219
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   220
         // both specializations may be tested at the same time
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   221
@@ -270,6 +280,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   222
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   223
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   224
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   225
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   226
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   227
+                         "exercising std::num_put<wchar_t> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   228
+                         data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   229
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   230
             const std::num_put<wchar_t> &wp =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   231
                 std::use_facet<std::num_put<wchar_t> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   232
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   233
@@ -280,7 +295,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   234
                       wio, L' ', L'\0');
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   235
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   236
             RW_ASSERT (!wio.fail ()); 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   237
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   238
+            RW_ASSERT (0 == std::wcsncmp (wcs, data.wcs_, sizeof (wcs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   239
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   240
             RW_ASSERT (!rw_strncmp (wcs, data.wcs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   241
+#endif // _RWSTD_OS_SUNOS || _RWSTD_OS_LINUX
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   242
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   243
 #endif   // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   244
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   245
@@ -308,6 +327,12 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   246
     wio.rdbuf (&wsb);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   247
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   248
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   249
+    for (size_t i = 0; i < MAX_THREADS; ++i) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   250
+         locales[i] = 0UL;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   251
+         my_num_data[i].locale_name_ = "";
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   252
+         my_num_data[i].locale_ = std::locale();
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   253
+    }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   254
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   255
     // find all installed locales for which setlocale(LC_ALL) succeeds
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   256
     const char* const locale_list =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   257
         rw_opt_locales ? rw_opt_locales : rw_locales (_RWSTD_LC_ALL);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   258
@@ -319,14 +344,14 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   259
          name += std::strlen (name) + 1) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   260
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   261
         const std::size_t inx = nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   262
-        locales [inx] = name;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   263
+        locales [inx] = strdup (name);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   264
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   265
         // fill in the value and results for this locale
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   266
         MyNumData& data = my_num_data [nlocales];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   267
-        data.locale_name_ = name;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   268
+        data.locale_name_ = std::string (name);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   269
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   270
         try {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   271
-            const std::locale loc (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   272
+            const std::locale loc (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   273
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   274
             data.value_ = nlocales & 1 ? -1 * nlocales : nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   275
             data.type_ = MyNumData::PutId (nlocales % MyNumData::put_max);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   276
@@ -343,7 +368,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   277
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   278
             rw_fatal (!nio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   279
                       "num_put<char>::put(...) failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   280
-                      data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   281
+                      data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   282
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   283
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   284
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   285
@@ -358,7 +383,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   286
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   287
             rw_fatal (!wio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   288
                       "num_put<wchar_t>::put(...) failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   289
-                      data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   290
+                      data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   291
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   292
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   293
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   294
@@ -466,3 +491,4 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   295
                     &rw_opt_setlocales,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   296
                     &opt_shared_locale);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   297
 }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   298
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   299
--- stdcxx-4.2.1/tests/localization/22.locale.time.put.mt.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   300
+++ stdcxx-4.2.1/tests/localization/22.locale.time.put.mt.cpp	2011-04-06 12:41:28.710792084 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   301
@@ -34,6 +34,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   302
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   303
 #include <cstring>    // for strlen ()
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   304
 #include <ctime>      // for tm
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   305
+#include <cstdio>     // for sprintf
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   306
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   307
 #include <rw_locale.h>
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   308
 #include <rw_thread.h>
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   309
@@ -65,17 +66,18 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   310
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   311
 // should all threads share the same set of locale objects instead
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   312
 // of creating their own?
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   313
-int opt_shared_locale;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   314
+static int opt_shared_locale = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   315
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   316
+// print verbose info messages
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   317
+static int opt_verbose = 0;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   318
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   319
 /**************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   320
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   321
 // array of locale names to use for testing
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   322
-static const char*
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   323
-locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   324
+static const char* locales [MAX_THREADS];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   325
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   326
 // number of locale names in the array
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   327
-static std::size_t
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   328
-nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   329
+static std::size_t nlocales;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   330
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   331
 /**************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   332
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   333
@@ -85,7 +87,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   334
     enum { BufferSize = 64 };
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   335
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   336
     // name of the locale the data corresponds to
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   337
-    const char* locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   338
+    std::string locale_name_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   339
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   340
     // optionally set to the named locale for threads to share
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   341
     std::locale locale_;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   342
@@ -148,13 +150,19 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   343
     MyStreambuf<char, std::char_traits<char> > nsb;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   344
     nio.rdbuf (&nsb);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   345
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   346
+    (void) ::memset(ncs, '\0', std::size_t (MyTimeData::BufferSize));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   347
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   348
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   349
     wchar_t                 wcs [MyTimeData::BufferSize];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   350
     MyIos<wchar_t, std::char_traits<wchar_t> >       wio;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   351
     MyStreambuf<wchar_t, std::char_traits<wchar_t> > wsb;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   352
     wio.rdbuf (&wsb);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   353
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   354
+    (void) ::memset(wcs, '\0',
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   355
+                    std::size_t (MyTimeData::BufferSize) * sizeof(wchar_t));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   356
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   357
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   358
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   359
     for (int i = 0; i != opt_nloops; ++i) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   360
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   361
         // save the name of the locale
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   362
@@ -165,11 +173,16 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   363
         // using a random conversion specifier
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   364
         const std::locale loc =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   365
             opt_shared_locale ? data.locale_
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   366
-                                 : std::locale (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   367
+                              : std::locale (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   368
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   369
         if (test_char) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   370
             // exercise the narrow char specialization of the facet
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   371
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   372
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   373
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   374
+                         "exercising std::time_put<char> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   375
+                          data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   376
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   377
             const std::time_put<char> &tp =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   378
                 std::use_facet<std::time_put<char> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   379
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   380
@@ -181,7 +194,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   381
                      nio, ' ', &data.time_, data.format_) = '\0';
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   382
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   383
             RW_ASSERT (!nio.fail ());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   384
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   385
+            RW_ASSERT (0 == std::strncmp(ncs, data.ncs_, sizeof(ncs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   386
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   387
             RW_ASSERT (!rw_strncmp(ncs, data.ncs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   388
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   389
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   390
         }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   391
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   392
@@ -192,6 +209,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   393
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   394
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   395
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   396
+            if (opt_verbose)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   397
+                rw_info (0, 0, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   398
+                         "exercising std::time_put<wchar_t> in locale '%s'",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   399
+                         data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   400
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   401
             const std::time_put<wchar_t> &wp =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   402
                 std::use_facet<std::time_put<wchar_t> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   403
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   404
@@ -202,7 +224,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   405
                      wio, L' ', &data.time_, data.format_) = L'\0';
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   406
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   407
             RW_ASSERT (!wio.fail ());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   408
+#if defined(_RWSTD_OS_SUNOS) || defined(_RWSTD_OS_LINUX)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   409
+            RW_ASSERT (0 == std::wcsncmp(wcs, data.wcs_, sizeof(wcs)));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   410
+#else
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   411
             RW_ASSERT (!rw_strncmp(wcs, data.wcs_));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   412
+#endif
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   413
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   414
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   415
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   416
@@ -229,6 +255,12 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   417
     wio.rdbuf (&wsb);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   418
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   419
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   420
+    for (size_t i = 0; i < MAX_THREADS; ++i) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   421
+        locales[i] = 0UL;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   422
+         my_time_data[i].locale_name_ = "";
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   423
+         my_time_data[i].locale_ = std::locale();
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   424
+    }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   425
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   426
     // find all installed locales for which setlocale (LC_ALL) succeeds
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   427
     const char* const locale_list =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   428
         rw_opt_locales ? rw_opt_locales : rw_locales (_RWSTD_LC_ALL);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   429
@@ -264,7 +296,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   430
         data.format_ = cvtspecs [nlocales % (sizeof cvtspecs - 1)];
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   431
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   432
         try {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   433
-            const std::locale loc (data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   434
+            const std::locale loc (data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   435
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   436
             const std::time_put<char> &np =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   437
                 std::use_facet<std::time_put<char> >(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   438
@@ -278,7 +310,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   439
             rw_fatal (!nio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   440
                       "time_put<char>::put(..., %c) "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   441
                       "failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   442
-                      data.format_, data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   443
+                      data.format_, data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   444
             
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   445
 #ifndef _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   446
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   447
@@ -294,7 +326,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   448
             rw_fatal (!wio.fail (), __FILE__, __LINE__,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   449
                       "time_put<wchar_t>::put(..., %c) "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   450
                       "failed for locale(%#s)",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   451
-                      data.format_, data.locale_name_);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   452
+                      data.format_, data.locale_name_.c_str());
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   453
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   454
 #endif // _RWSTD_NO_WCHAR_T
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   455
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   456
--- stdcxx-4.2.1/tests/localization/22.locale.money.get.cpp	2008-04-24 17:23:10.000000000 -0700
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   457
+++ stdcxx-4.2.1/tests/localization/22.locale.money.get.cpp	2011-03-22 15:37:13.547889349 -0700
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   458
@@ -340,7 +340,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   459
         io.imbue (std::locale (io.getloc (), pf));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   460
     }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   461
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   462
-    io.flags (std::ios_base::fmtflags (flags));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   463
+    io.setf (std::ios_base::fmtflags (flags));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   464
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   465
     // expand (widen) input sequence
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   466
     const charT* const next = rw_expand ((charT*)0, str);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   467
@@ -772,7 +772,8 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   468
     // all spaces extracted since currency symbol (last) is mandatory
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   469
     // verify that the facet doesn't extract too many optional spaces
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   470
     // leaving none for the final required currency symbol
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   471
-    TEST (T,  103.0, "103 ", 4, showbase, eofbit, 0, "-1@$", " ");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   472
+    // 22.2.6.1.2, p3: if showbase is set, currency symbol is mandatory
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   473
+    TEST (T,  103.0, "103 ", 4, showbase, eofbit|failbit, 0, "-1@$", " ");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   474
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   475
     // 22.2.6.1.2, p3: [Example: If showbase is off, then for
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   476
     // a negative sign value of "()" and a currency symbol of "L",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   477
@@ -818,7 +819,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   478
     // specifier that's last in the pattern doesn't confuse the facet into
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   479
     // extracting all the optional whitespace, leaving none to complete
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   480
     // the negative_sign
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   481
-    TEST (T, -109.1, "-109  ", 6, 0, eofbit, 0, "-1@$", "");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   482
+    TEST (T, -109.1, "-109  ", 6, 0, eofbit|failbit, 0, "-1@$", "");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   483
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   484
     // verify that optional space after value and before currency
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   485
     // symbol is treated correctly
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   486
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   487
--- stdcxx-4.2.1/tests/localization/22.locale.codecvt.length.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   488
+++ stdcxx-4.2.1/tests/localization/22.locale.codecvt.length.cpp	2011-06-23 13:59:09.859216905 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   489
@@ -202,10 +202,11 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   490
              "(state_type&, const extern_type*, const extern_type*, "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   491
              "size_t)");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   492
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   493
-    const CodecvtByname cvt ("");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   494
+    const std::locale loc (std::locale::classic(), new CodecvtByname(""));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   495
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   496
-    test_codecvt (&cvt);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   497
+    const CodecvtByname& cvt = std::use_facet<CodecvtByname>(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   498
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   499
+    test_codecvt (&cvt);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   500
 }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   501
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   502
 /****************************************************************************/
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   503
@@ -266,10 +267,16 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   504
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   505
     // lowercase utf ==> relaxed checking (i.e., some, but not all,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   506
     // invalid UTF-8 sequence are accepted)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   507
-    const WCodecvtByname cvt_relaxd ("utf-8@UCS");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   508
+	std::locale loc_relaxd (std::locale(), new WCodecvtByname ("utf-8@UCS"));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   509
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   510
     // capital UTF ==> strict checking
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   511
-    const WCodecvtByname cvt_strict ("UTF-8@UCS");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   512
+    std::locale loc_strict (std::locale(), new WCodecvtByname ("UTF-8@UCS"));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   513
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   514
+    const WCodecvtByname& cvt_relaxd =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   515
+        std::use_facet<WCodecvtByname> (loc_relaxd);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   516
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   517
+    const WCodecvtByname& cvt_strict =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   518
+        std::use_facet<WCodecvtByname> (loc_strict);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   519
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   520
 #undef STRICT
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   521
 #define STRICT(from, nc, maxi, res) \
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   522
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   523
--- stdcxx-4.2.1/tests/localization/22.locale.codecvt.out.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   524
+++ stdcxx-4.2.1/tests/localization/22.locale.codecvt.out.cpp	2011-06-23 14:04:06.286408279 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   525
@@ -482,7 +482,9 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   526
              "const intern_type*, "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   527
              "extern_type*, extern_type*, exterm_type*&)");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   528
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   529
-    const CodecvtByname cvt ("");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   530
+    const std::locale loc (std::locale::classic(), new CodecvtByname(""));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   531
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   532
+    const CodecvtByname& cvt = std::use_facet<CodecvtByname>(loc);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   533
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   534
     test_codecvt (&cvt);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   535
 }
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   536
@@ -555,10 +557,16 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   537
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   538
     // lowercase utf ==> relaxed checking (i.e., some, but not all,
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   539
     // invalid UTF-8 sequence are accepted)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   540
-    const WCodecvtByname cvt_relaxd ("utf-8@UCS");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   541
+    std::locale loc_relaxd (std::locale(), new WCodecvtByname ("utf-8@UCS"));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   542
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   543
     // capital UTF ==> strict checking
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   544
-    const WCodecvtByname cvt_strict ("UTF-8@UCS");
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   545
+    std::locale loc_strict (std::locale(), new WCodecvtByname ("UTF-8@UCS"));
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   546
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   547
+    const WCodecvtByname& cvt_relaxd =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   548
+        std::use_facet<WCodecvtByname> (loc_relaxd);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   549
+
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   550
+    const WCodecvtByname& cvt_strict =
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   551
+        std::use_facet<WCodecvtByname> (loc_strict);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   552
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   553
 #undef STRICT
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   554
 #define STRICT(from, from_end_off, from_next_off,    \
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   555
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   556
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   557
--- stdcxx-4.2.1/tests/localization/22.locale.num.put.cpp	2008-04-24 20:23:10.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   558
+++ stdcxx-4.2.1/tests/localization/22.locale.num.put.cpp	2011-06-23 14:19:35.515277321 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   559
@@ -505,12 +505,10 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   560
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   561
     Ios<charT> ios;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   562
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   563
-    const std::num_put<charT> np;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   564
-
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   565
     Streambuf<charT> sb;
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   566
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   567
 #define DIRECT_USE_TEST(T) \
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   568
-    np.put (std::ostreambuf_iterator<charT>(&sb), ios, charT (), (T)0)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   569
+    std::use_facet<std::num_put<charT> >(sb.getloc()).put (std::ostreambuf_iterator<charT>(&sb), ios, charT (), (T)0)
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   570
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   571
 #ifndef _RWSTD_NO_BOOL
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   572
 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   573
--- stdcxx-4.2.1/util/charmap.cpp	2008-04-24 20:28:51.000000000 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   574
+++ stdcxx-4.2.1/util/charmap.cpp	2011-06-27 14:00:58.064216427 -0400
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   575
@@ -221,7 +221,7 @@
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   576
     
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   577
     if (ch_end < ch + num_bytes - 1) {
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   578
         // the input doesn't have enough characters
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   579
-        issue_diag (E_MBCHAR, true, 0, 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   580
+        issue_diag (W_CHAR, true, 0, 
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   581
                     "incomplete multibyte character in character "
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   582
                     "map file: expecting %u bytes, found %u\n",
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   583
                     num_bytes, ch_end - ch);
94ae4d75524c 7064836 stdcxx to Userland
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
   584