You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/05/26 01:08:26 UTC

svn commit: r541809 - /incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp

Author: sebor
Date: Fri May 25 16:08:25 2007
New Revision: 541809

URL: http://svn.apache.org/viewvc?view=rev&rev=541809
Log:
2007-05-25  Martin Sebor  <se...@roguewave.com>

	STDCXX-426
	* 21.cwchar.cpp (test_file_functions): Opened a new file for I/O
	instead of reusing stdout and called fwide() first before any prior
	output since 7.19.2, p5 of C99 prohibits wide character I/O functions
	from being called on a byte-oriented stream.

Modified:
    incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp

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=541809&r1=541808&r2=541809
==============================================================================
--- incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp (original)
+++ incubator/stdcxx/trunk/tests/strings/21.cwchar.cpp Fri May 25 16:08:25 2007
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 1994-2005 Rogue Wave Software.
+ * Copyright 2004-2005 Rogue Wave Software.
  * 
  **************************************************************************/
 
@@ -983,7 +983,8 @@
 
 // included here to avoid namespace pollution
 #include <cstdarg>       // for va_list
-#include <cstdio>        // for FILE
+#include <cstdio>        // for FILE, fopen()
+#include <file.h>        // for DEV_NUL
 #include <rw_printf.h>   // for rw_stdout
 
 namespace std {
@@ -1028,10 +1029,15 @@
     // an incomplete type and casts between two non-void pointers
     // require that the types be complete (in case they are related
     // by inheritance and need to be adjusted)
-    test_FILE* const fp = (test_FILE*)(void*)rw_stdout;
+    test_FILE* const fp = (test_FILE*)std::fopen (DEV_NULL, "w");
     test_va_list va;
     va_start (va, dummy);
 
+    // call fwide() first before any prior output since 7.19.2, p5
+    // of C99 prohibits wide character I/O functions from being called
+    // on a byte-oriented stream
+    TEST (int, fwide, (fp, i), FWIDE, -1);
+
     TEST (int, fwprintf, (fp, L""), FWPRINTF, -1);
     TEST (int, fwprintf, (fp, L"", uniqptr), FWPRINTF, -1);
 
@@ -1047,7 +1053,6 @@
     TEST (test_wint_t, getwc, (fp), GETWC, -1);
     TEST (test_wint_t, putwc, (L'\0', fp), PUTWC, -1);
     TEST (test_wint_t, ungetwc, (wi, fp), UNGETWC, -1);
-    TEST (int, fwide, (fp, i), FWIDE, -1);
 
     _RWSTD_UNUSED (str);
     _RWSTD_UNUSED (cstr);