stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r637239 - in /stdcxx/branches/4.2.x: src/memattr.cpp src/num_put.cpp src/time_put.cpp tests/regress/22.locale.num.put.stdcxx-2.cpp
Date Fri, 14 Mar 2008 20:09:39 GMT
Author: faridz
Date: Fri Mar 14 13:09:38 2008
New Revision: 637239

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

	Merge changes from trunk.

	2008-02-15 Farid Zaripov <farid_zaripov@epam.com>
	* tests/regress/22.locale.num.put.stdcxx-2.cpp: New regression test for STDCXX-2 issue.


	2008-02-19 Farid Zaripov <farid_zaripov@epam.com>
	STDCXX-2
	* src/num_put.cpp (__rw_fix_flt): Added new parameter: precision.
	Added workaround for STDCXX-2 issue.
	(__rw_put_num): Pass precision value in the __rw_fix_flt().


	2008-02-19 Farid Zaripov <farid_zaripov@epam.com>
	STDCXX-2
	* src/num_put.cpp (__rw_fix_flt): Updated workaround for STDCXX-2 issue.
	Fixed detection of infinity (#INF), added detection of the quiet NAN (#IND).


	2008-02-22  Farid Zaripov  <farid_zaripov@epam.com>
	* src/memattr.cpp (__rw_memattr): Declare errno_save as unused to disable
	eccp warning #177-D "variable "errno_save" declared but not referenced".


	2008-02-22  Farid Zaripov  <farid_zaripov@epam.com>
	* src/time_put.cpp (__rw_get_timepunct): Remove const qualifier to disable
	eccp warning #191-D: "type qualifier is meaningless on cast type".


	2008-02-22  Martin Sebor  <sebor@roguewave.com>
	* time_put.cpp (__rw_get_timepunct): Removed unnecessary
	reinterpret_cast in a call to operator delete().

Added:
    stdcxx/branches/4.2.x/tests/regress/22.locale.num.put.stdcxx-2.cpp
      - copied unchanged from r635445, stdcxx/trunk/tests/regress/22.locale.num.put.stdcxx-2.cpp
Modified:
    stdcxx/branches/4.2.x/src/memattr.cpp
    stdcxx/branches/4.2.x/src/num_put.cpp
    stdcxx/branches/4.2.x/src/time_put.cpp

Modified: stdcxx/branches/4.2.x/src/memattr.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/memattr.cpp?rev=637239&r1=637238&r2=637239&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/memattr.cpp (original)
+++ stdcxx/branches/4.2.x/src/memattr.cpp Fri Mar 14 13:09:38 2008
@@ -202,6 +202,8 @@
                 return next == page ? -1 : DIST (next, addr);
         }
 
+#  else
+        _RWSTD_UNUSED (errno_save);
 #  endif
 
         if (_RWSTD_SIZE_MAX == nbytes) {

Modified: stdcxx/branches/4.2.x/src/num_put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/num_put.cpp?rev=637239&r1=637238&r2=637239&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/num_put.cpp (original)
+++ stdcxx/branches/4.2.x/src/num_put.cpp Fri Mar 14 13:09:38 2008
@@ -563,10 +563,35 @@
 
 
 static inline void
-__rw_fix_flt (char *&end, _RWSTD_SIZE_T &len, unsigned flags)
+__rw_fix_flt (char *&end, _RWSTD_SIZE_T &len,
+              unsigned flags, _RWSTD_STREAMSIZE prec)
 {
 #if defined (_WIN32) || defined (_WIN64)
 
+    char* beg = end - len;
+
+    // workaround for the STDCXX-2 issue
+    if (   _RWSTD_IOS_FIXED != (flags & _RWSTD_IOS_FLOATFIELD)
+        && _RWSTD_IOS_SCIENTIFIC != (flags & _RWSTD_IOS_FLOATFIELD)
+        && 2 < len
+        && '0' == beg [0]
+        && ('.' == beg [1] || ',' == beg [1])) {
+
+        // for the 0.0 value the MSVC libc inserts redundant '0' character
+        // when %g format is used in sprintf()
+        const char* ptr;
+        for (ptr = beg + 2; ptr != end && '0' == *ptr; ++ptr) ;
+
+        if (ptr == end) {
+            const _RWSTD_SIZE_T exp_len =
+                0 > prec ? 7 : (1 < prec ? prec + 1 : 2);
+            if (exp_len < len) {
+                end = beg + exp_len;
+                len = exp_len;
+            }
+        }
+    }
+
     if (len > 5) {
         // make Win32 output conform to C99 printf() requirements
         // on the exponent: The exponent always contains at least
@@ -579,15 +604,30 @@
             --end;
         }
         else if ('#' == end [-4]) {
-            // normalize the format of infinity to conform to C99
+            // may be #INF or #IND
+            const bool cap = !!(flags & _RWSTD_IOS_UPPERCASE);
 
-            const char str[] = "iInNfF";
+            if ('F' == end [-1]) {
+                // assuming #INF
+                // normalize the format of infinity to conform to C99
+
+                const char str[] = "iInNfF";
+
+                end [-6] = str [cap + 0];
+                end [-5] = str [cap + 2];
+                end [-4] = str [cap + 4];
+            }
+            else {
+                // assuming #IND
+                // normalize the format of NaN to conform to C99
 
-            const bool cap = !!(flags & _RWSTD_IOS_UPPERCASE);
+                const char str[] = "nNaA";
+
+                end [-6] = str [cap + 0];
+                end [-5] = str [cap + 2];
+                end [-4] = str [cap + 0];
+            }
 
-            end [-6] = str [cap + 0];
-            end [-5] = str [cap + 2];
-            end [-4] = str [cap + 4];
             end -= 3;
             len -= 3;
         }
@@ -608,6 +648,8 @@
 
 #else
 
+    _RWSTD_UNUSED (prec);
+
     // normalize the format of infinity and NaN to one of
     // { INF, inf, NAN, nan, NANQ, nanq, NANS, nans }
     // for portability
@@ -760,7 +802,7 @@
         end = *pbuf + len;
 
         // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags);
+        __rw_fix_flt (end, len, flags, fpr);
         break;
 
     case __rw_facet::_C_double | __rw_facet::_C_ptr:
@@ -788,7 +830,7 @@
         end = *pbuf + len;
 
         // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags);
+        __rw_fix_flt (end, len, flags, fpr);
         break;
 
 #ifndef _RWSTD_NO_LONG_DOUBLE
@@ -817,7 +859,7 @@
         end = *pbuf + len;
 
         // fix up output to conform to C99
-        __rw_fix_flt (end, len, flags);
+        __rw_fix_flt (end, len, flags, fpr);
         break;
 
 #endif   // _RWSTD_NO_LONG_DOUBLE

Modified: stdcxx/branches/4.2.x/src/time_put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/src/time_put.cpp?rev=637239&r1=637238&r2=637239&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/src/time_put.cpp (original)
+++ stdcxx/branches/4.2.x/src/time_put.cpp Fri Mar 14 13:09:38 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2006 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -612,10 +612,10 @@
             // reallocate, again using operator new to avoid mismatch
             // with facet destructor
             char* const tmp = 
-                _RWSTD_STATIC_CAST(char* const, ::operator new (tmpsize));
+                _RWSTD_STATIC_CAST(char*, ::operator new (tmpsize));
             memcpy (tmp, pun, sizeof *pun + off);
 
-            ::operator delete (_RWSTD_REINTERPRET_CAST (char*, pun));
+            ::operator delete (pun);
 
             pun      = _RWSTD_REINTERPRET_CAST (__rw_time_t*, tmp);
             pmem     = _RWSTD_REINTERPRET_CAST (_RWSTD_UINT32_T*, pun);



Mime
View raw message