Return-Path: Delivered-To: apmail-stdcxx-commits-archive@www.apache.org Received: (qmail 17458 invoked from network); 31 Mar 2008 17:35:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Mar 2008 17:35:27 -0000 Received: (qmail 30452 invoked by uid 500); 31 Mar 2008 17:35:27 -0000 Delivered-To: apmail-stdcxx-commits-archive@stdcxx.apache.org Received: (qmail 30437 invoked by uid 500); 31 Mar 2008 17:35:27 -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 30428 invoked by uid 99); 31 Mar 2008 17:35:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 31 Mar 2008 10:35:27 -0700 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; Mon, 31 Mar 2008 17:34:44 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 098BA1A983E; Mon, 31 Mar 2008 10:35:04 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r643078 - in /stdcxx/trunk: include/iomanip include/loc/_num_get.cc src/ios.cpp Date: Mon, 31 Mar 2008 17:35:03 -0000 To: commits@stdcxx.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080331173504.098BA1A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebor Date: Mon Mar 31 10:35:02 2008 New Revision: 643078 URL: http://svn.apache.org/viewvc?rev=643078&view=rev Log: 2008-03-31 Martin Sebor STDCXX-814 * include/iomanip (__rw_setbase): Cast first argument of a shift expression to unsigned int to avoid benign arithmetic overflow and silence HP aCC 6 remark #4300: Overflow while computing constant in left shift operation. * include/loc/_num_get.cc (num_get::_C_get): Same. * src/ios.cpp (ios_base::flags): Same. Modified: stdcxx/trunk/include/iomanip stdcxx/trunk/include/loc/_num_get.cc stdcxx/trunk/src/ios.cpp Modified: stdcxx/trunk/include/iomanip URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/iomanip?rev=643078&r1=643077&r2=643078&view=diff ============================================================================== --- stdcxx/trunk/include/iomanip (original) +++ stdcxx/trunk/include/iomanip Mon Mar 31 10:35:02 2008 @@ -23,7 +23,7 @@ * implied. See the License for the specific language governing * permissions and limitations under the License. * - * Copyright 1994-2005 Rogue Wave Software. + * Copyright 1994-2008 Rogue Wave Software, Inc. * **************************************************************************/ @@ -87,7 +87,8 @@ const unsigned __ifl = __strm.flags () & ~_STD::ios_base::basefield - & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) + & ~( _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK) + << _RWSTD_IOS_BASEOFF) | __base << _RWSTD_IOS_BASEOFF; __strm.flags (_STD::ios_base::fmtflags (__ifl)); Modified: stdcxx/trunk/include/loc/_num_get.cc URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_num_get.cc?rev=643078&r1=643077&r2=643078&view=diff ============================================================================== --- stdcxx/trunk/include/loc/_num_get.cc (original) +++ stdcxx/trunk/include/loc/_num_get.cc Mon Mar 31 10:35:02 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. * **************************************************************************/ @@ -490,7 +490,8 @@ // set the base determined above const unsigned __fl2 = __fl & ~_RWSTD_IOS_BASEFIELD - & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) + & ~( _RWSTD_STATIC_CAST (unsigned, _RWSTD_IOS_BASEMASK) + << _RWSTD_IOS_BASEOFF) | __base << _RWSTD_IOS_BASEOFF; // 22.2.2.1.2, p11: Stage 3 Modified: stdcxx/trunk/src/ios.cpp URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/ios.cpp?rev=643078&r1=643077&r2=643078&view=diff ============================================================================== --- stdcxx/trunk/src/ios.cpp (original) +++ stdcxx/trunk/src/ios.cpp Mon Mar 31 10:35:02 2008 @@ -22,7 +22,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. * **************************************************************************/ @@ -95,29 +95,28 @@ ios_base::fmtflags ios_base::flags (fmtflags fl) { + const unsigned mask = + ~(unsigned (_RWSTD_IOS_BASEMASK) << _RWSTD_IOS_BASEOFF); + unsigned ifl = unsigned (fl); switch (fl & basefield) { // if basefield is set, clear the base mask and set // the numeric base bits according to the basefield case oct: - ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) - | 8U << _RWSTD_IOS_BASEOFF; + ifl = ifl & mask | 8U << _RWSTD_IOS_BASEOFF; break; case dec: - ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) - | 10U << _RWSTD_IOS_BASEOFF; + ifl = ifl & mask | 10U << _RWSTD_IOS_BASEOFF; break; case hex: - ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) - | 16U << _RWSTD_IOS_BASEOFF; + ifl = ifl & mask | 16U << _RWSTD_IOS_BASEOFF; break; case _RWSTD_IOS_BIN: - ifl = ifl & ~(_RWSTD_IOS_BASEMASK << _RWSTD_IOS_BASEOFF) - | 2U << _RWSTD_IOS_BASEOFF; + ifl = ifl & mask | 2U << _RWSTD_IOS_BASEOFF; break; case 0: