Author: faridz
Date: Mon Apr 14 01:38:10 2008
New Revision: 647698
URL: http://svn.apache.org/viewvc?rev=647698&view=rev
Log:
2008-04-14 Farid Zaripov <[EMAIL PROTECTED]>
STDXX-854
* include/loc/_ctype.h (narrow): Don't cast __c to unsigned char,
use __c as index in _C_narrow_tab.
Modified:
stdcxx/trunk/include/loc/_ctype.h
Modified: stdcxx/trunk/include/loc/_ctype.h
URL:
http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_ctype.h?rev=647698&r1=647697&r2=647698&view=diff
==============================================================================
--- stdcxx/trunk/include/loc/_ctype.h (original)
+++ stdcxx/trunk/include/loc/_ctype.h Mon Apr 14 01:38:10 2008
@@ -541,20 +541,21 @@
inline char
ctype<wchar_t>::narrow (char_type __c, char __dfault) const
{
- const _RWSTD_SIZE_T __inx = _RWSTD_STATIC_CAST (unsigned char, __c);
-
// optimize away all but the first call to the virtual do_widen()
- if ( __inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
- && _C_narrow_tab [__inx])
- return _C_narrow_tab [__inx];
+ if ( 0 <= __c
+ && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
+ && _C_narrow_tab [__c])
+ return _C_narrow_tab [__c];
// template argument provided to work around an HP aCC bug (PR #27087)
ctype<wchar_t>* const __self = _RWSTD_CONST_CAST (ctype<wchar_t>*, this);
const char __ch = do_narrow (__c, __dfault);
- if (__inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab && __ch !=
__dfault)
- __self->_C_narrow_tab [__inx] = __ch;
+ if ( 0 <= __c
+ && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
+ && __ch != __dfault)
+ __self->_C_narrow_tab [__c] = __ch;
return __ch;
}