Author: faridz
Date: Tue Jun  3 02:18:40 2008
New Revision: 662717

URL: http://svn.apache.org/viewvc?rev=662717&view=rev
Log:
2008-06-03  Farid Zaripov  <[EMAIL PROTECTED]>

        Merged r662715 from 4.2.x branch.
        * tests/src/file.cpp (rw_nextfd) [_MSC_VER]: Disable expected "Invalid 
file descriptor"
        CRT assertions from _commit().

Modified:
    stdcxx/trunk/tests/src/file.cpp

Modified: stdcxx/trunk/tests/src/file.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/trunk/tests/src/file.cpp?rev=662717&r1=662716&r2=662717&view=diff
==============================================================================
--- stdcxx/trunk/tests/src/file.cpp (original)
+++ stdcxx/trunk/tests/src/file.cpp Tue Jun  3 02:18:40 2008
@@ -50,6 +50,9 @@
 #  include <unistd.h>     // for close(), open()
 #else
 #  include <io.h>         // for _commit()
+#  ifdef _MSC_VER
+#    include <crtdbg.h>   // for _CrtSetReportMode()
+#  endif
 #endif
 
 #include <assert.h>   // for assert
@@ -480,6 +483,12 @@
 
 #if defined (_WIN32) || defined (_WIN64)
 
+#  ifdef _MSC_VER
+        // save the report mode and disable "Invalid file descriptor"
+        // CRT assertions from _commit()
+        const int prev_mode = _CrtSetReportMode (_CRT_ASSERT, 0);
+#  endif
+
         for (int i = 0; i != 256; ++i) {
 
             const int ret = _commit (i);
@@ -487,6 +496,13 @@
             if (-1 != ret || EBADF != errno)
                 ++*count;
         }
+
+#  ifdef _MSC_VER
+        // restore the previous mode
+        if (-1 != prev_mode)
+            _CrtSetReportMode (_CRT_ASSERT, prev_mode);
+#  endif
+
 #else   // if not Windoze
 
         for (int i = 0; i != 256; ++i) {


Reply via email to