You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2007/05/23 19:44:03 UTC

svn commit: r541001 - in /incubator/stdcxx/trunk/tests: localization/ self/ strings/

Author: faridz
Date: Wed May 23 10:44:02 2007
New Revision: 541001

URL: http://svn.apache.org/viewvc?view=rev&rev=541001
Log:
2007-05-23 Farid Zaripov <Fa...@epam.com>

	* 22.locale.codecvt.length.cpp: Added checking result of the rw_locales()
	before dereferencing.
	* 22.locale.codecvt.out.cpp: Ditto.
	* 22.locale.ctype.cpp: Ditto.
	* 22.locale.messages.cpp: Ditto.
	* 22.locale.moneypunct.cpp: Ditto.
	* 22.locale.num.put.cpp: Ditto.
	* 22.locale.time.get.cpp: Ditto.
	* 22.locale.num.get.cpp: Ditto. Corrected len parameter of the rw_widen().
	* 0.inputiter.cpp [_MSC_VER]: Disabled GUI window from abort().
	* 0.outputiter.cpp [_MSC_VER]: Ditto.
	* 21.cwchar.cpp [_MSC_VER]: Disabled GUI window with error from
	CRT assertion fail.

Modified:
    incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.length.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.out.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.ctype.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.messages.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.num.put.cpp
    incubator/stdcxx/trunk/tests/localization/22.locale.time.get.cpp
    incubator/stdcxx/trunk/tests/self/0.inputiter.cpp
    incubator/stdcxx/trunk/tests/self/0.outputiter.cpp
    incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.length.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.length.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.length.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.length.cpp Wed May 23 10:44:02 2007
@@ -254,7 +254,7 @@
     *mb_cur_max = 0;
 
     // iterate over all installed locales
-    for (const char *name = rw_locales (_RWSTD_LC_CTYPE, 0); *name;
+    for (const char *name = rw_locales (_RWSTD_LC_CTYPE, 0); name && *name;
          name += std::strlen (name) + 1) {
 
         if (std::setlocale (LC_CTYPE, name)) {

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.out.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.out.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.out.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.codecvt.out.cpp Wed May 23 10:44:02 2007
@@ -273,7 +273,7 @@
     *mb_cur_max = 0;
 
     // iterate over all installed locales
-    for (const char *name = rw_locales (); *name;
+    for (const char *name = rw_locales (); name && *name;
          name += std::strlen (name) + 1) {
 
         if (std::setlocale (LC_CTYPE, name)) {

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.ctype.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.ctype.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.ctype.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.ctype.cpp Wed May 23 10:44:02 2007
@@ -80,7 +80,7 @@
 
 #define BEGIN_LOCALE_LOOP(num, locname, loop_cntrl)                        \
    for (const char* locname = rw_locales (LC_CTYPE, 0);                    \
-        *locname; locname += std::strlen (locname) + 1) {                  \
+        locname && *locname; locname += std::strlen (locname) + 1) {       \
        _TRY {                                                              \
            const std::locale loc (locname);                                \
            const std::ctype<char> &ctc =                                   \

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.messages.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.messages.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.messages.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.messages.cpp Wed May 23 10:44:02 2007
@@ -158,6 +158,9 @@
 {
     const char *name = rw_locales (LC_ALL, "");
 
+    if (!name)
+        return 0;
+
     char namebuf [256];
 
     // get the full name of the "C" locale for comparison with aliases

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.moneypunct.cpp Wed May 23 10:44:02 2007
@@ -238,7 +238,7 @@
     const char *first_non_c = 0;
 
     // exercise named locales (including "C" and "POSIX")
-    for (const char* s = rw_locales (); *s; s += std::strlen (s) + 1) {
+    for (const char* s = rw_locales (); s && *s; s += std::strlen (s) + 1) {
         if (check_moneypunct (s))
             if (   !first_non_c
                 && std::strcmp ("C", s)

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.num.get.cpp Wed May 23 10:44:02 2007
@@ -192,12 +192,12 @@
 
     virtual string_type do_truename () const {
         char_type name [40];
-        return rw_widen (name, truename_, sizeof name / sizeof *name);
+        return rw_widen (name, truename_, sizeof name / sizeof *name - 1);
     }
 
     virtual string_type do_falsename () const {
         char_type name [40];
-        return rw_widen (name, falsename_, sizeof name / sizeof *name);
+        return rw_widen (name, falsename_, sizeof name / sizeof *name - 1);
     }
 };
 
@@ -1943,7 +1943,7 @@
     if (test_locale) {
         // verify that the global LC_NUMERIC locale setting
         // has no impact on the facet (in case it uses scanf())
-        for (const char *name = rw_locales (LC_NUMERIC, 0); *name;
+        for (const char *name = rw_locales (LC_NUMERIC, 0); name && *name;
              name += std::strlen (name) + 1) {
 
             // find the first locale whose decimal_point character

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.num.put.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.num.put.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.num.put.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.num.put.cpp Wed May 23 10:44:02 2007
@@ -1480,7 +1480,7 @@
 
     if (1) {
         // verify that the global LC_NUMERIC setting has no impact on the facet
-        for (const char *name = rw_locales (LC_NUMERIC, 0); *name;
+        for (const char *name = rw_locales (LC_NUMERIC, 0); name && *name;
              name += std::strlen (name) + 1) {
 
             // find the first locale whose decimal_point character

Modified: incubator/stdcxx/trunk/tests/localization/22.locale.time.get.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/localization/22.locale.time.get.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/localization/22.locale.time.get.cpp (original)
+++ incubator/stdcxx/trunk/tests/localization/22.locale.time.get.cpp Wed May 23 10:44:02 2007
@@ -1584,7 +1584,9 @@
 #else   // _WIN{32,64}
 
     // FIXME: handle non-UNIX systems
-    for (const char *loc = rw_locales (); *loc; loc += std::strlen (loc) + 1) {
+    for (const char *loc = rw_locales (); loc && *loc;
+         loc += std::strlen (loc) + 1) {
+
         if (!std::strcmp (loc, name))
             return loc;
     }

Modified: incubator/stdcxx/trunk/tests/self/0.inputiter.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/self/0.inputiter.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/self/0.inputiter.cpp (original)
+++ incubator/stdcxx/trunk/tests/self/0.inputiter.cpp Wed May 23 10:44:02 2007
@@ -30,6 +30,10 @@
 #include <signal.h>
 #include <stdio.h>
 
+#ifdef _MSC_VER
+#include <crtdbg.h>     // for _CrtSetReportMode()
+#endif
+
 #include <alg_test.h>   // for InputIter
 #include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test(), ...
@@ -353,6 +357,11 @@
 
 int main (int argc, char *argv[])
 {
+#ifdef _MSC_VER
+    // disable GUI window from abort()
+    _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG);
+#endif
+
     return rw_test (argc, argv, __FILE__,
                     0 /* no clause */,
                     0 /* no comment */, run_test,

Modified: incubator/stdcxx/trunk/tests/self/0.outputiter.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/self/0.outputiter.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/self/0.outputiter.cpp (original)
+++ incubator/stdcxx/trunk/tests/self/0.outputiter.cpp Wed May 23 10:44:02 2007
@@ -30,6 +30,10 @@
 #include <signal.h>
 #include <stdio.h>
 
+#ifdef _MSC_VER
+#include <crtdbg.h>     // for _CrtSetReportMode()
+#endif
+
 #include <alg_test.h>   // for OutputIter
 #include <rw_value.h>   // for UserClass
 #include <driver.h>     // for rw_test(), ...
@@ -326,6 +330,11 @@
 
 int main (int argc, char *argv[])
 {
+#ifdef _MSC_VER
+    // disable GUI window from abort()
+    _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG);
+#endif
+
     return rw_test (argc, argv, __FILE__,
                     0 /* no clause */,
                     0 /* no comment */, run_test,

Modified: incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp?view=diff&rev=541001&r1=541000&r2=541001
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp Wed May 23 10:44:02 2007
@@ -87,6 +87,10 @@
 
 /**************************************************************************/
 
+#ifdef _MSC_VER
+#include <crtdbg.h>   // for _CrtSetReportMode()
+#endif
+
 #include <cwchar>
 #include <any.h>      // for rw_any_t
 #include <driver.h>   // for rw_test(), ...
@@ -921,7 +925,18 @@
     /* const */ int tm_buf [16] = { 0 };
     const test_tm* tmb = (const test_tm*)&tm_buf;
 
+#ifdef _MSC_VER
+    // disable GUI window with error:
+    // Assertion failed: ("Zero length output buffer passed to strftime",0)
+    int oldmode = _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
+#endif
+
     TEST (test_size_t, wcsftime, (wstr, size, L"", tmb), WCSFTIME, -1);
+
+#ifdef _MSC_VER
+    // restore error report mode
+    _CrtSetReportMode (_CRT_ASSERT, oldmode);
+#endif
 
     TEST (test_wint_t, btowc, (i), BTOWC, -1);
     TEST (int, wctob, (wi), WCTOB, -1);