stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r653293 - /stdcxx/trunk/tests/localization/22.locale.num.put.cpp
Date Mon, 05 May 2008 03:19:27 GMT
Author: sebor
Date: Sun May  4 20:19:27 2008
New Revision: 653293

URL: http://svn.apache.org/viewvc?rev=653293&view=rev
Log:
2008-05-04  Martin Sebor  <sebor@roguewave.com>

	STDCXX-788
	* 22.locale.num.put.cpp (do_tesT): Cast narrow character to unsigned
	char before converting it to the generic charT to avoid potential sign
	extension and to silence HP aCC 6 remark #4271-D: type conversion may
	lose sign.
	(long_test): Cast macro argument to unsigned type before shifting it
	left to avoid an arithmetic overflow and to silence HP aCC 6 remark
	#4300-D: Overflow while computing constant in left shift operation.

Modified:
    stdcxx/trunk/tests/localization/22.locale.num.put.cpp

Modified: stdcxx/trunk/tests/localization/22.locale.num.put.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/localization/22.locale.num.put.cpp?rev=653293&r1=653292&r2=653293&view=diff
==============================================================================
--- stdcxx/trunk/tests/localization/22.locale.num.put.cpp (original)
+++ stdcxx/trunk/tests/localization/22.locale.num.put.cpp Sun May  4 20:19:27 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.
  * 
  **************************************************************************/
 
@@ -328,7 +328,12 @@
 
 #endif   // _RWSTD_LDBL_MAX_10_EXP
 
-    const charT* const bufend = np.put (buf, ios, fill, val);
+    // cast the narrow fill character to unsigned char before
+    // converting it to charT to avoid potential sign extension
+    typedef unsigned char UChar;
+    const charT wfill = charT (UChar (fill));
+
+    const charT* const bufend = np.put (buf, ios, wfill, val);
 
     // verify 22.2.2.2.2, p21
     if (ios.width ()) {
@@ -1171,7 +1176,7 @@
 
     // locale 3.0 extension
 
-#define BASE(n)   ((n)  << _RWSTD_IOS_BASEOFF)
+#define BASE(n)   int (unsigned (n)  << _RWSTD_IOS_BASEOFF)
 
     // bases 0 and 10 are both base 10
     // base 1 is roman (values 1 through 4999)



Mime
View raw message