diff --git a/include/_ctype.h b/include/_ctype.h --- a/include/_ctype.h +++ b/include/_ctype.h @@ -100,14 +100,14 @@ __maskrune(__ct_rune_t _c, unsigned long _f) { return ((_c < 0 || _c >= _CACHED_RUNES) ? ___runetype(_c) : - _CurrentRuneLocale->__runetype[_c]) & _f; + _CurrentRuneLocale->__runetype[_c & 0xff]) & _f; } static __inline int __sbmaskrune(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= __mb_sb_limit) ? 0 : - _CurrentRuneLocale->__runetype[_c] & _f; + _CurrentRuneLocale->__runetype[_c & 0xff] & _f; } static __inline int @@ -126,35 +126,35 @@ __isctype(__ct_rune_t _c, unsigned long _f) { return (_c < 0 || _c >= 128) ? 0 : - !!(_DefaultRuneLocale.__runetype[_c] & _f); + !!(_DefaultRuneLocale.__runetype[_c & 0xff] & _f); } static __inline __ct_rune_t __toupper(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___toupper(_c) : - _CurrentRuneLocale->__mapupper[_c]; + _CurrentRuneLocale->__mapupper[_c & 0xff]; } static __inline __ct_rune_t __sbtoupper(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : - _CurrentRuneLocale->__mapupper[_c]; + _CurrentRuneLocale->__mapupper[_c & 0xff]; } static __inline __ct_rune_t __tolower(__ct_rune_t _c) { return (_c < 0 || _c >= _CACHED_RUNES) ? ___tolower(_c) : - _CurrentRuneLocale->__maplower[_c]; + _CurrentRuneLocale->__maplower[_c & 0xff]; } static __inline __ct_rune_t __sbtolower(__ct_rune_t _c) { return (_c < 0 || _c >= __mb_sb_limit) ? _c : - _CurrentRuneLocale->__maplower[_c]; + _CurrentRuneLocale->__maplower[_c & 0xff]; } static __inline int diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h --- a/include/xlocale/_ctype.h +++ b/include/xlocale/_ctype.h @@ -80,7 +80,7 @@ int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return ((__c < 0 || __c >= _CACHED_RUNES) ? ___runetype_l(__c, __loc) : - runes->__runetype[__c]) & __f; + runes->__runetype[__c & 0xff]) & __f; } _XLOCALE_INLINE int @@ -105,7 +105,7 @@ int __limit; _RuneLocale *runes = __runes_for_locale(__loc, &__limit); return (__c < 0 || __c >= __limit) ? 0 : - runes->__runetype[__c] & __f; + runes->__runetype[__c &0xff] & __f; } _XLOCALE_INLINE int @@ -150,14 +150,14 @@ int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___tolower_l(__c, __l) : - __runes->__maplower[__c]; + __runes->__maplower[__c & 0xff]; } _XLOCALE_INLINE int towupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= _CACHED_RUNES) ? ___toupper_l(__c, __l) : - __runes->__mapupper[__c]; + __runes->__mapupper[__c & 0xff]; } _XLOCALE_INLINE int __wcwidth_l(__ct_rune_t _c, locale_t __l) @@ -190,14 +190,14 @@ int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : - __runes->__maplower[__c]; + __runes->__maplower[__c & 0xff]; } _XLOCALE_INLINE int toupper_l(int __c, locale_t __l) { int __limit; _RuneLocale *__runes = __runes_for_locale(__l, &__limit); return (__c < 0 || __c >= __limit) ? __c : - __runes->__mapupper[__c]; + __runes->__mapupper[__c & 0xff]; } #endif #endif /* (defined(_XLOCALE_WCTYPES) && !defined(_XLOCALE_WCTYPE_H)) || \