From commits-return-2418-apmail-stdcxx-commits-archive=stdcxx.apache.org@stdcxx.apache.org Wed Feb 13 22:32:49 2008 Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 99199 invoked from network); 13 Feb 2008 22:32:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2008 22:32:49 -0000 Received: (qmail 7277 invoked by uid 500); 13 Feb 2008 22:32:43 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 7250 invoked by uid 500); 13 Feb 2008 22:32:43 -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 7241 invoked by uid 99); 13 Feb 2008 22:32:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Feb 2008 14:32:43 -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; Wed, 13 Feb 2008 22:32:03 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AD4F81A9832; Wed, 13 Feb 2008 14:32:23 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r627606 - in /stdcxx/trunk/include: loc/_messages.cc loc/_money_get.cc sstream Date: Wed, 13 Feb 2008 22:32:22 -0000 To: commits@stdcxx.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080213223223.AD4F81A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebor Date: Wed Feb 13 14:32:19 2008 New Revision: 627606 URL: http://svn.apache.org/viewvc?rev=627606&view=rev Log: 2008-02-13 Martin Sebor STDCXX-695 * include/loc/_money_get.cc (_C_get): Introduced a convenience typedef for size_t, changed the type of the local __sign to int and cast it to size_t to silence the pesky HP aCC 6 remark #4271-D: type conversion may lose sign. * include/loc/_messages.cc (do_get): Same. * include/sstream (str): Avoided pointer math to silence remark #4271. Modified: stdcxx/trunk/include/loc/_messages.cc stdcxx/trunk/include/loc/_money_get.cc stdcxx/trunk/include/sstream Modified: stdcxx/trunk/include/loc/_messages.cc URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_messages.cc?rev=627606&r1=627605&r2=627606&view=diff ============================================================================== --- stdcxx/trunk/include/loc/_messages.cc (original) +++ stdcxx/trunk/include/loc/_messages.cc Wed Feb 13 14:32:19 2008 @@ -22,7 +22,7 @@ * implied. See the License for the specific language governing * permissions and limitations under the License. * - * Copyright 1994-2007 Rogue Wave Software, Inc. + * Copyright 1994-2008 Rogue Wave Software, Inc. * **************************************************************************/ @@ -78,9 +78,10 @@ return _RWSTD_REINTERPRET_CAST (const _CharT*, __text); } - typedef char_traits CharTraits; + typedef char_traits _CharTraits; + typedef _RWSTD_SIZE_T _SizeT; - const _RWSTD_SIZE_T __src_len = CharTraits::length (__text); + const _SizeT __src_len = _CharTraits::length (__text); const char* const __src_first = __text; const char* const __src_last = __text + __src_len; const char* __src_next = __src_first; @@ -105,7 +106,9 @@ switch (__res) { case codecvt_base::ok: // shrink the converted string accordingly - __result_str.resize (__dst_next - __dst_first); + _RWSTD_ASSERT (__dst_first <= __dst_next); + + __result_str.resize (_SizeT (__dst_next - __dst_first)); return __result_str; case codecvt_base::noconv: @@ -122,7 +125,7 @@ const _Ctype& __ctp = _RWSTD_USE_FACET (_Ctype, _RW::__rw_get_locale (__cat)); - for (_RWSTD_SIZE_T __i = 0; __i != __src_len; ++__i) + for (_SizeT __i = 0; __i != __src_len; ++__i) __dst_first [__i] = __ctp.widen (__text [__i]); return __result_str; Modified: stdcxx/trunk/include/loc/_money_get.cc URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_money_get.cc?rev=627606&r1=627605&r2=627606&view=diff ============================================================================== --- stdcxx/trunk/include/loc/_money_get.cc (original) +++ stdcxx/trunk/include/loc/_money_get.cc Wed Feb 13 14:32:19 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. * **************************************************************************/ @@ -94,7 +94,7 @@ const char *__grpend = 0; // the end of the last group - long __sign = 0; // the sign of the result if detected + int __sign = 0; // the sign of the result if detected (-1, 0, or +1) // buffer must always start with a sign (__rw_get_num requirement) // use a '+' and overwrite it with a '-' if necessary @@ -102,7 +102,9 @@ const int __fl = __flags.flags (); - for (_RWSTD_SIZE_T __i = 0; !__ebits && __i != sizeof __pat.field; ++__i) { + typedef _RWSTD_SIZE_T _SizeT; + + for (_SizeT __i = 0; !__ebits && __i != sizeof __pat.field; ++__i) { switch (__pat.field [__i]) { @@ -124,7 +126,7 @@ && (0 == __cs.size () || !(__fl & _RW::__rw_showbase))) break; - _RWSTD_SIZE_T __nc = 0; + _SizeT __nc = 0; while (__it != __end && __ctp.is (ctype_base::space, *__it)) { ++__it; @@ -148,7 +150,7 @@ || __sign < 0 && __ns.size () > 1 || __sign > 0 && __ps.size () > 1) { - for (_RWSTD_SIZE_T __nc = 0; __nc != __cs.size (); + for (_SizeT __nc = 0; __nc != __cs.size (); ++__nc, ++__it) { if (__it == __end || !_Traits::eq (*__it, __cs [__nc])) { @@ -259,7 +261,7 @@ if (__buf [1]) { // process the remainder of a multicharacter sign - const _RWSTD_SIZE_T __sizes [] = { + const _SizeT __sizes [] = { __ps.size () ? __ps.size () -1 : 0, __ns.size () ? __ns.size () -1 : 0 }; @@ -274,7 +276,7 @@ // if the first character of a multi-character sign // has been seen, try to extract the rest of the sign - _RWSTD_SIZE_T __inx = 0; + _SizeT __inx = 0; int __errtmp = 1; // no duplicates allowed @@ -304,7 +306,7 @@ // if both signs begin with the same character, // the result is positive (22.2.6.1.2, p3) *__buf = __inx ? '-' : '+'; - __sign = -long (__inx); + __sign = -int (__inx); } } else if (__sign < 0) { @@ -316,20 +318,21 @@ const char *__start = __buf + 1; for (; '0' == *__start && '0' == __start [1]; ++__start); + // invert the sign if negative __sign = __sign < 0; // widen narrow digits optionally preceded by the minus sign // into the basic_string object as required by 22.2.6.1.2, p1 - __pstr->resize ((__pcur - __start) + __sign); + __pstr->resize ((__pcur - __start) + _SizeT (__sign)); if (__sign) _Traits::assign ((*__pstr)[0], __ctp.widen ('-')); - __ctp.widen (__start, __pcur, &(*__pstr)[__sign]); + __ctp.widen (__start, __pcur, &(*__pstr)[_SizeT (__sign)]); } - const char *__grs = ""; - _RWSTD_SIZE_T __grn = 0; + const char *__grs = ""; + _SizeT __grn = 0; // 22.2.6.1.2, p1: thousands separators are optional Modified: stdcxx/trunk/include/sstream URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/sstream?rev=627606&r1=627605&r2=627606&view=diff ============================================================================== --- stdcxx/trunk/include/sstream (original) +++ stdcxx/trunk/include/sstream Wed Feb 13 14:32:19 2008 @@ -23,7 +23,7 @@ * implied. See the License for the specific language governing * permissions and limitations under the License. * - * Copyright 1994-2006 Rogue Wave Software. + * Copyright 1994-2008 Rogue Wave Software, Inc. * **************************************************************************/ @@ -198,7 +198,7 @@ __last = this->egptr (); } - return _C_string_type (__first, __last - __first); + return _C_string_type (__first, __last); }