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 <[EMAIL PROTECTED]>
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<char> CharTraits; + typedef char_traits<char> _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); }