Author: faridz
Date: Fri Apr 18 11:30:47 2008
New Revision: 649646
URL: http://svn.apache.org/viewvc?rev=649646&view=rev
Log:
2008-04-18 Farid Zaripov <[EMAIL PROTECTED]>
* include/rw/_defs.h: #define new general purpose config macro
_RWSTD_UWCHAR_INT_T.
* include/loc/_ctype.h (narrow): Cast __c to _RWSTD_UWCHAR_INT_T to
avoid warnings
about signed/unsigned comparisons.
Modified:
stdcxx/trunk/include/loc/_ctype.h
stdcxx/trunk/include/rw/_defs.h
Modified: stdcxx/trunk/include/loc/_ctype.h
URL:
http://svn.apache.org/viewvc/stdcxx/trunk/include/loc/_ctype.h?rev=649646&r1=649645&r2=649646&view=diff
==============================================================================
--- stdcxx/trunk/include/loc/_ctype.h (original)
+++ stdcxx/trunk/include/loc/_ctype.h Fri Apr 18 11:30:47 2008
@@ -541,21 +541,20 @@
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);
+
// optimize away all but the first call to the virtual do_widen()
- if ( 0 <= __c
- && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
- && _C_narrow_tab [__c])
- return _C_narrow_tab [__c];
+ if ( __inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
+ && _C_narrow_tab [__inx])
+ return _C_narrow_tab [__inx];
// 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 ( 0 <= __c
- && __c < sizeof _C_narrow_tab / sizeof *_C_narrow_tab
- && __ch != __dfault)
- __self->_C_narrow_tab [__c] = __ch;
+ if (__inx < sizeof _C_narrow_tab / sizeof *_C_narrow_tab && __ch !=
__dfault)
+ __self->_C_narrow_tab [__inx] = __ch;
return __ch;
}
Modified: stdcxx/trunk/include/rw/_defs.h
URL:
http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_defs.h?rev=649646&r1=649645&r2=649646&view=diff
==============================================================================
--- stdcxx/trunk/include/rw/_defs.h (original)
+++ stdcxx/trunk/include/rw/_defs.h Fri Apr 18 11:30:47 2008
@@ -1269,6 +1269,20 @@
#endif // _RWSTD_SSIZE_T
+// _RWSTD_UWCHAR_INT_T is "unsigned wchar_t"
+#ifndef _RWSTD_UWCHAR_INT_T
+# if _RWSTD_CHAR_SIZE == _RWSTD_WCHAR_SIZE
+# define _RWSTD_UWCHAR_INT_T unsigned char
+# elif _RWSTD_SHRT_SIZE == _RWSTD_WCHAR_SIZE
+# define _RWSTD_UWCHAR_INT_T unsigned short
+# elif _RWSTD_INT_SIZE == _RWSTD_WCHAR_SIZE
+# define _RWSTD_UWCHAR_INT_T unsigned int
+# else
+# define _RWSTD_UWCHAR_INT_T _RWSTD_SIZE_T
+# endif
+#endif // _RWSTD_UWCHAR_INT_T
+
+
#if defined(SNI)
# define _RWSTD_USING_SNI(name) _USING(__SNI::name)
# if defined(_RWSTD_STRICT_ANSI)