stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r366896 - /incubator/stdcxx/trunk/tests/src/printf.cpp
Date Sat, 07 Jan 2006 19:57:09 GMT
Author: sebor
Date: Sat Jan  7 11:57:06 2006
New Revision: 366896

URL: http://svn.apache.org/viewcvs?rev=366896&view=rev
Log:
2006-01-07  Martin Sebor  <sebor@roguewave.com>

	* printf.cpp (_rw_vasnprintf_c99): Added a case for the 'b' format
	specifier as an extension for the formatting of Boolean values.
	(_rw_fmtinteger): Added handling of the 'b' format specifier.

Modified:
    incubator/stdcxx/trunk/tests/src/printf.cpp

Modified: incubator/stdcxx/trunk/tests/src/printf.cpp
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/tests/src/printf.cpp?rev=366896&r1=366895&r2=366896&view=diff
==============================================================================
--- incubator/stdcxx/trunk/tests/src/printf.cpp (original)
+++ incubator/stdcxx/trunk/tests/src/printf.cpp Sat Jan  7 11:57:06 2006
@@ -24,7 +24,6 @@
 #include <testdefs.h>
 #include <printf.h>
 
-#include <assert.h>   // for assert
 #include <errno.h>    // for errno, errno constants
 #include <float.h>    // for floating point macros
 #include <locale.h>
@@ -154,7 +153,7 @@
     unsigned fl_zero   : 1;
 
     // optional modifiers
-    unsigned mod_A     : 1;    // extension (Arrays)
+    unsigned mod_A     : 1;    // extension: arrays
     unsigned mod_h     : 1;    // short modifier
     unsigned mod_hh    : 1;    // char modifier
     unsigned mod_l     : 1;    // long modifier
@@ -562,6 +561,7 @@
 
     switch (spec.cvtspec) {
 
+    case 'b':   // extension: bool
     case 'd':
     case 'i':
     case 'o':
@@ -1201,6 +1201,13 @@
     FmtSpec &spec = pspec [paramno];
 
     switch (spec.cvtspec) {
+    case 'b': // extension: int argument formatted as bool
+        spec.param.i = PARAM (int, i);
+        len = _rw_fmtstr (spec, pbuf, pbufsize,
+                          spec.param.i ? "true" : "false",
+                          _RWSTD_SIZE_MAX);
+        break;
+        
     case 'd':
     case 'i':
         if (spec.mod_hh) {



Mime
View raw message