stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r647975 - /stdcxx/trunk/tests/utilities/20.temp.buffer.cpp
Date Mon, 14 Apr 2008 19:58:50 GMT
Author: elemings
Date: Mon Apr 14 12:58:45 2008
New Revision: 647975

URL: http://svn.apache.org/viewvc?rev=647975&view=rev
Log:
2008-04-14  Eric Lemings  <eric.lemings@roguewave.com>

	STDCXX-841
	* trunk/tests/utilities/20.temp.buffer.cpp (test_failure): Print
	correct value of `sizeof (T)' using rw_sprintf() function.
	Prevent division by zero in terminal condition of for statement.
	Also, use parentheses when calculating value of `nelems' to
	indicate precedence of operators explicitly.


Modified:
    stdcxx/trunk/tests/utilities/20.temp.buffer.cpp

Modified: stdcxx/trunk/tests/utilities/20.temp.buffer.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/utilities/20.temp.buffer.cpp?rev=647975&r1=647974&r2=647975&view=diff
==============================================================================
--- stdcxx/trunk/tests/utilities/20.temp.buffer.cpp (original)
+++ stdcxx/trunk/tests/utilities/20.temp.buffer.cpp Mon Apr 14 12:58:45 2008
@@ -39,6 +39,7 @@
 #endif
 
 #include <rw_new.h>
+#include <rw_printf.h>
 #include <driver.h>
 
 #ifndef _RWSTD_NO_SETRLIMIT
@@ -245,7 +246,7 @@
 {
     if (0 == tname) {
         static char buf [40];
-        std::sprintf (buf, "char[%u]", unsigned (sizeof (T)));
+        rw_sprintf (buf, "char[%zu]", sizeof (T));
         tname = buf;
     }
         
@@ -264,13 +265,13 @@
                "got { %#p, %td }",
                tname, nelems, pa.first, pa.second);
 
-    for (std::size_t i = 2; i < sizeof (T); i <<= 1) {
+    for (std::size_t i = 2; i && i < sizeof (T); i <<= 1) {
         // exercise arithmetic overflow (not to be confused
         // with the out-of-memory tests below)
 
         // attempts to allocate space for an array of elements
         // with a total size that exceeds SIZE_MAX must fail
-        nelems = _RWSTD_PTRDIFF_MAX / i + 1;
+        nelems = (_RWSTD_PTRDIFF_MAX / i) + 1;
 
         pa = std::get_temporary_buffer<T>(nelems);
 



Mime
View raw message