stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r656613 - in /stdcxx/branches/4.3.x: etc/config/windows/projects.js etc/config/windows/run_locale_utils.wsf tests/src/driver.cpp util/charmap.cpp
Date Thu, 15 May 2008 12:13:07 GMT
Author: faridz
Date: Thu May 15 05:13:07 2008
New Revision: 656613

URL: http://svn.apache.org/viewvc?rev=656613&view=rev
Log:
2008-05-15  Farid Zaripov  <farid_zaripov@epam.com>

	Merged from branches/4.2.x.


	2008-05-15  Farid Zaripov  <farid_zaripov@epam.com>
	* etc/config/windows/run_locale_utils.wsf (check_locale_m): Skip empty lines.


	2008-05-14  Martin Sebor  <sebor@roguewave.com>
	* util/charmap.cpp (utf8_decode): Explicitly initialized a local
	variable to silence gcc warning: variable may be used uninitialized.


	2008-05-14  Farid Zaripov  <farid_zaripov@epam.com>
	* util/charmap.cpp (convert_sym_to_ucs): Fixed bug with
	skipping the first digit in symbolic name.


	2008-05-13  Farid Zaripov  <farid_zaripov@epam.com>
	* util/charmap.cpp (convert_to_ucs) [_MSC_VER]: Process return code
	of MultiByteToWideChar() and fall back to convert_sym_to_ucs() if
	the conversion table for the requested codepage is not installed.


	2008-05-12  Farid Zaripov  <farid_zaripov@epam.com>
	* tests/src/driver.cpp (_rw_opt_no_popups) [_WIN32]: New function for handling
	--no-popups option (disables Windows and MSVC CRT popup windows).
	(_rw_opt_debug_heap) [_MSC_VER && _DEBUG]: New function for handling --debug-heap
	option (enables the intensive heap memory checking).
	(_rw_setopts_windows)[_WIN32]: New function for installing handlers for --no-popups
	and --debug-heap options.
	(rw_vtest) [_WIN32]: Call _rw_setopts_windows().
	* etc/config/windows/projects.js (CreateProjectDefs): Added --no-popups option
	when running tests using exec utility.

Modified:
    stdcxx/branches/4.3.x/etc/config/windows/projects.js
    stdcxx/branches/4.3.x/etc/config/windows/run_locale_utils.wsf
    stdcxx/branches/4.3.x/tests/src/driver.cpp
    stdcxx/branches/4.3.x/util/charmap.cpp

Modified: stdcxx/branches/4.3.x/etc/config/windows/projects.js
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/etc/config/windows/projects.js?rev=656613&r1=656612&r2=656613&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/etc/config/windows/projects.js (original)
+++ stdcxx/branches/4.3.x/etc/config/windows/projects.js Thu May 15 05:13:07 2008
@@ -334,7 +334,7 @@
         " /PRJDIR:\"" + runtestsDef.VCProjDir + "\"" +
         " /CONFIG:\"%SOLUTION%\"" +
         " /LOGFILE:\"runtests.log\"" +
-        " /RUNFLAGS:\"--compat -x \'--compat -O -\' -t " + EXEC_TIMEOUT + "\"";
+        " /RUNFLAGS:\"--compat -x \'--no-popups --compat -O -\' -t " + EXEC_TIMEOUT + "\"";
     runtestsDef.CustomBuildOut = "$(OutDir)\\runtests.log";
     runtestsDef.CustomBuildDeps = "%FILES%";
     //runtestsDef.PrjDeps.push(alltestsDef);

Modified: stdcxx/branches/4.3.x/etc/config/windows/run_locale_utils.wsf
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/etc/config/windows/run_locale_utils.wsf?rev=656613&r1=656612&r2=656613&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/etc/config/windows/run_locale_utils.wsf (original)
+++ stdcxx/branches/4.3.x/etc/config/windows/run_locale_utils.wsf Thu May 15 05:13:07 2008
@@ -243,6 +243,9 @@
 
         var line = aout[i].replace("\r", "").replace("\n", "");
         
+        if (0 == line.length)
+            continue;
+
         if (0 > line.search(new RegExp(".cm")))
         {
             DebugOutLine(" incorrect.");

Modified: stdcxx/branches/4.3.x/tests/src/driver.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/tests/src/driver.cpp?rev=656613&r1=656612&r2=656613&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/tests/src/driver.cpp (original)
+++ stdcxx/branches/4.3.x/tests/src/driver.cpp Thu May 15 05:13:07 2008
@@ -45,9 +45,13 @@
 #include <stdlib.h>    // for free
 #include <string.h>    // for strchr, strcpy
 
+#ifdef _WIN32
+#  include <windows.h> // for SetErrorMode()
+#endif   // _WIN32
+
 #ifdef _MSC_VER
 #  include <crtdbg.h>  // for _CrtSetReportMode(), _CrtSetDbgFlag()
-#endif
+#endif   // _MSC_VER
 
 #if !defined (_WIN32) && !defined (_WIN64)
 #  include <unistd.h>         // for isatty()
@@ -492,12 +496,6 @@
     // set mode: enable the option
     opt_verbose = 1;
 
-#ifdef _MSC_VER
-    _CrtSetDbgFlag (  _CRTDBG_ALLOC_MEM_DF
-                    | _CRTDBG_CHECK_ALWAYS_DF
-                    | _CRTDBG_LEAK_CHECK_DF);
-#endif
-
     return 0;
 }
 
@@ -547,12 +545,6 @@
     // set mode: enable the option
     opt_compat = 1;
 
-#ifdef _MSC_VER
-    _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_DEBUG);
-    _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_DEBUG);
-    _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
-#endif
-
     return 0;
 }
 
@@ -930,6 +922,128 @@
     return 0;
 }
 
+
+#ifdef _WIN32
+
+static int
+_rw_opt_no_popups (int argc, char *argv[])
+{
+    static int opt_no_popups;
+
+    if (0 == argc) {
+        // query mode: return the value of the option
+        return opt_no_popups;
+    }
+
+    if (1 == argc && argv && 0 == argv [0]) {
+        // help mode: set argv[0] to the text of the help message
+
+        static const char helpstr[] = {
+            "Prevents the program from using message box popup window's for\n"
+            "error messages.\n"
+        };
+
+        argv [0] = _RWSTD_CONST_CAST (char*, helpstr);
+
+        return 0;
+    }
+
+    // set mode: enable the option
+    opt_no_popups = 1;
+
+    SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
+
+#  ifdef _MSC_VER
+    _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
+    _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+    _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#  endif   // _MSC_VER
+
+    return 0;
+}
+
+#endif   // _WIN32
+
+
+#if defined (_MSC_VER) && defined (_DEBUG)
+
+static int
+_rw_opt_debug_heap (int argc, char *argv[])
+{
+    static int opt_debug_heap;
+
+    if (0 == argc) {
+        // query mode: return the value of the option
+        return opt_debug_heap;
+    }
+
+    if (1 == argc && argv && 0 == argv [0]) {
+        // help mode: set argv[0] to the text of the help message
+
+        static const char helpstr[] = {
+            "Enables the heap consistency checking on every memory allocation\n"
+            "and deallocation request.\n"
+        };
+
+        argv [0] = _RWSTD_CONST_CAST (char*, helpstr);
+
+        return 0;
+    }
+
+    // set mode: enable the option
+    opt_debug_heap = 1;
+
+    _CrtSetDbgFlag (  _CRTDBG_ALLOC_MEM_DF
+                    | _CRTDBG_CHECK_ALWAYS_DF
+                    | _CRTDBG_LEAK_CHECK_DF);
+
+    return 0;
+}
+
+#endif   // _MSC_VER && _DEBUG
+
+
+#ifdef _WIN32
+
+static int
+_rw_setopts_windows ()
+{
+    int nopts =
+        rw_setopts ("|-no-popups ",
+                    _rw_opt_no_popups,
+                    0 /* detect missing handlers */);
+
+    if (1 > nopts) {
+        rw_fprintf (rw_stderr,
+                    "%s:%d: rw_setopts() failed\n", __FILE__, __LINE__);
+        abort ();
+        return 1;
+    }
+
+#  if defined (_MSC_VER) && defined (_DEBUG)
+
+    nopts =
+        rw_setopts ("|-debug-heap ",
+                    _rw_opt_debug_heap,
+                    0 /* detect missing handlers */);
+
+    if (1 > nopts) {
+        rw_fprintf (rw_stderr,
+                    "%s:%d: rw_setopts() failed\n", __FILE__, __LINE__);
+        abort ();
+        return 1;
+    }
+
+#  endif   // _MSC_VER && _DEBUG
+
+    return 0;
+}
+
+#endif   // _WIN32
+
 /************************************************************************/
 
 _TEST_EXPORT int
@@ -995,6 +1109,10 @@
 
     _rw_setopts_lines ();
 
+#ifdef _WIN32
+    _rw_setopts_windows ();
+#endif   // _WIN32
+
     int status = rw_runopts (argc, argv);
 
     if (status)

Modified: stdcxx/branches/4.3.x/util/charmap.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.3.x/util/charmap.cpp?rev=656613&r1=656612&r2=656613&view=diff
==============================================================================
--- stdcxx/branches/4.3.x/util/charmap.cpp (original)
+++ stdcxx/branches/4.3.x/util/charmap.cpp Thu May 15 05:13:07 2008
@@ -179,7 +179,7 @@
     const unsigned char* const ch_end =
         _RWSTD_REINTERPRET_CAST (const unsigned char*, to);
 
-    size_t num_bytes;
+    size_t num_bytes = 0;
 
     wchar_t ret = 0;
 
@@ -649,7 +649,7 @@
                     sym.c_str ());
     }
 
-    const unsigned long val = std::strtoul (&*++it, (char**)0, 16);
+    const unsigned long val = std::strtoul (&*it, (char**)0, 16);
 
     if (_RWSTD_WCHAR_MAX <= val)
         issue_diag (E_UCS, true, 0, 
@@ -690,18 +690,24 @@
 
     if (0 != codepage_) {
         wchar_t ret[2] = {0};
-        MultiByteToWideChar (codepage_, 0, encoding.c_str(), -1, ret, 2);
-        if (ret[1] != 0)
+        const int res = MultiByteToWideChar (codepage_, 0,
+                                             encoding.c_str(), -1,
+                                             ret, 2);
+        if (!res && ERROR_INVALID_PARAMETER == GetLastError ()) {
+            // the required codepage conversion table is not installed
+            wc = convert_sym_to_ucs (sym_name);
+            return true;
+        }
+
+        if (!res || ret[1] != 0)
             return false;
 
         wc = ret[0];
         return true;
-    } else {
-        wc = convert_sym_to_ucs (sym_name);
-        return true;
     }
 
-    return false;
+    wc = convert_sym_to_ucs (sym_name);
+    return true;
 
 #endif  // _MSC_VER
 }



Mime
View raw message