Let MB_CUR_LEN lookup the actual value.
* instead of yielding 1, MB_CUR_LEN now looks up the correct value in the ctype data provided by the locale backend
This commit is contained in:
parent
fa02fc6907
commit
e0eb1d38c4
@ -72,6 +72,8 @@ extern const int *__ctype_toupper;
|
||||
#define isupper(c) __isctype((c), _ISupper)
|
||||
#define isxdigit(c) __isctype((c), _ISxdigit)
|
||||
|
||||
extern unsigned short int __ctype_mb_cur_max;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2010 Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2002-2011 Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _STDLIB_H_
|
||||
@ -13,9 +13,8 @@
|
||||
#include <sys/types.h>
|
||||
#include <wchar_t.h>
|
||||
|
||||
|
||||
#define RAND_MAX 0x7fffffff
|
||||
#define MB_CUR_MAX 1
|
||||
#define MB_CUR_MAX (__ctype_get_mb_cur_max())
|
||||
|
||||
#define EXIT_SUCCESS 0
|
||||
#define EXIT_FAILURE 1
|
||||
@ -180,6 +179,9 @@ extern int grantpt(int masterFD);
|
||||
extern char* ptsname(int masterFD);
|
||||
extern int unlockpt(int masterFD);
|
||||
|
||||
/* internal accessor to value for MB_CUR_MAX */
|
||||
extern unsigned short __ctype_get_mb_cur_max(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
@ -31,6 +31,8 @@ struct LocaleCtypeDataBridge {
|
||||
const int* posixToUpperMap;
|
||||
|
||||
LocaleCtypeDataBridge();
|
||||
|
||||
void setMbCurMax(unsigned short mbCurMax);
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,6 +23,5 @@ MergeObject posix_gnu_locale.o :
|
||||
lc-messages.c
|
||||
lc-monetary.c
|
||||
lc-numeric.c
|
||||
mb_cur_max.c
|
||||
xlocale.c
|
||||
;
|
||||
|
@ -135,7 +135,7 @@ __END_NAMESPACE_C99
|
||||
|
||||
/* Maximum length of a multibyte character in the current locale. */
|
||||
#define MB_CUR_MAX (__ctype_get_mb_cur_max ())
|
||||
extern size_t __ctype_get_mb_cur_max (void) __THROW;
|
||||
extern unsigned short __ctype_get_mb_cur_max(void);
|
||||
|
||||
|
||||
__BEGIN_NAMESPACE_STD
|
||||
|
@ -36,6 +36,12 @@ LocaleCtypeDataBridge::LocaleCtypeDataBridge()
|
||||
}
|
||||
|
||||
|
||||
void LocaleCtypeDataBridge::setMbCurMax(unsigned short mbCurMax)
|
||||
{
|
||||
__ctype_mb_cur_max = mbCurMax;
|
||||
}
|
||||
|
||||
|
||||
LocaleMessagesDataBridge::LocaleMessagesDataBridge()
|
||||
:
|
||||
posixLanginfo(gPosixLanginfo)
|
||||
|
@ -26,6 +26,20 @@
|
||||
#undef toupper
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
|
||||
unsigned short int __ctype_mb_cur_max = 1;
|
||||
|
||||
|
||||
unsigned short
|
||||
__ctype_get_mb_cur_max()
|
||||
{
|
||||
return __ctype_mb_cur_max;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
isalnum(int c)
|
||||
{
|
||||
@ -180,3 +194,6 @@ toupper(int c)
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user