Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 46860 invoked from network); 19 Feb 2008 14:01:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Feb 2008 14:01:44 -0000 Received: (qmail 61148 invoked by uid 500); 19 Feb 2008 14:01:39 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 61137 invoked by uid 500); 19 Feb 2008 14:01:39 -0000 Mailing-List: contact commits-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list commits@stdcxx.apache.org Received: (qmail 61127 invoked by uid 99); 19 Feb 2008 14:01:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2008 06:01:38 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 Feb 2008 14:01:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 632D11A9832; Tue, 19 Feb 2008 06:01:21 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r629100 - /stdcxx/trunk/src/num_put.cpp Date: Tue, 19 Feb 2008 14:01:20 -0000 To: commits@stdcxx.apache.org From: faridz@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080219140121.632D11A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: faridz Date: Tue Feb 19 06:01:16 2008 New Revision: 629100 URL: http://svn.apache.org/viewvc?rev=629100&view=rev Log: 2008-02-19 Farid Zaripov 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(). Modified: stdcxx/trunk/src/num_put.cpp Modified: stdcxx/trunk/src/num_put.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/num_put.cpp?rev=629100&r1=629099&r2=629100&view=diff ============================================================================== --- stdcxx/trunk/src/num_put.cpp (original) +++ stdcxx/trunk/src/num_put.cpp Tue Feb 19 06:01:16 2008 @@ -563,10 +563,33 @@ 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 ( !(flags & _RWSTD_IOS_FIXED) + && 2 < len + && '0' == beg [0] + && ('.' == beg [1] || ',' == beg [1])) { + + // for the 0.0 value the MSVC libc inserts redundant '0' character + 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 @@ -608,6 +631,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 +785,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 +813,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 +842,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