stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r658434 - /stdcxx/branches/4.2.x/include/loc/_ctype.h
Date Tue, 20 May 2008 21:09:30 GMT
Author: sebor
Date: Tue May 20 14:09:30 2008
New Revision: 658434

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

	STDCXX-941
	* include/loc/_ctype.h (narrow): Silenced the useless HP aCC 3
	Warning (suggestion) 887: Type 'unsigned int' is smaller than
	type 'unsigned long', unwanted widening in value may result.
	Regression introduced in 4.2.1 (in r649646).

Modified:
    stdcxx/branches/4.2.x/include/loc/_ctype.h

Modified: stdcxx/branches/4.2.x/include/loc/_ctype.h
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/include/loc/_ctype.h?rev=658434&r1=658433&r2=658434&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/include/loc/_ctype.h (original)
+++ stdcxx/branches/4.2.x/include/loc/_ctype.h Tue May 20 14:09:30 2008
@@ -25,7 +25,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2005 Rogue Wave Software.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -541,7 +541,11 @@
 inline char
 ctype<wchar_t>::narrow (char_type __c, char __dfault) const
 {
-    const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (_RWSTD_UWCHAR_INT_T, __c);
+    // carefully convert wchar_t to the unsigned form of its
+    // underlying integer type, avoiding sign extension and
+    // similar issues
+    const _RWSTD_UWCHAR_INT_T __inx =
+        _RWSTD_STATIC_CAST (_RWSTD_UWCHAR_INT_T, __c);
 
     // optimize away all but the first call to the virtual do_widen()
     if (   __inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab



Mime
View raw message