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:
@@ -72,6 +72,8 @@ extern const int *__ctype_toupper;
|
|||||||
#define isupper(c) __isctype((c), _ISupper)
|
#define isupper(c) __isctype((c), _ISupper)
|
||||||
#define isxdigit(c) __isctype((c), _ISxdigit)
|
#define isxdigit(c) __isctype((c), _ISxdigit)
|
||||||
|
|
||||||
|
extern unsigned short int __ctype_mb_cur_max;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _STDLIB_H_
|
#ifndef _STDLIB_H_
|
||||||
@@ -13,9 +13,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wchar_t.h>
|
#include <wchar_t.h>
|
||||||
|
|
||||||
|
|
||||||
#define RAND_MAX 0x7fffffff
|
#define RAND_MAX 0x7fffffff
|
||||||
#define MB_CUR_MAX 1
|
#define MB_CUR_MAX (__ctype_get_mb_cur_max())
|
||||||
|
|
||||||
#define EXIT_SUCCESS 0
|
#define EXIT_SUCCESS 0
|
||||||
#define EXIT_FAILURE 1
|
#define EXIT_FAILURE 1
|
||||||
@@ -180,6 +179,9 @@ extern int grantpt(int masterFD);
|
|||||||
extern char* ptsname(int masterFD);
|
extern char* ptsname(int masterFD);
|
||||||
extern int unlockpt(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
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ struct LocaleCtypeDataBridge {
|
|||||||
const int* posixToUpperMap;
|
const int* posixToUpperMap;
|
||||||
|
|
||||||
LocaleCtypeDataBridge();
|
LocaleCtypeDataBridge();
|
||||||
|
|
||||||
|
void setMbCurMax(unsigned short mbCurMax);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,5 @@ MergeObject posix_gnu_locale.o :
|
|||||||
lc-messages.c
|
lc-messages.c
|
||||||
lc-monetary.c
|
lc-monetary.c
|
||||||
lc-numeric.c
|
lc-numeric.c
|
||||||
mb_cur_max.c
|
|
||||||
xlocale.c
|
xlocale.c
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ __END_NAMESPACE_C99
|
|||||||
|
|
||||||
/* Maximum length of a multibyte character in the current locale. */
|
/* Maximum length of a multibyte character in the current locale. */
|
||||||
#define MB_CUR_MAX (__ctype_get_mb_cur_max ())
|
#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
|
__BEGIN_NAMESPACE_STD
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ LocaleCtypeDataBridge::LocaleCtypeDataBridge()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LocaleCtypeDataBridge::setMbCurMax(unsigned short mbCurMax)
|
||||||
|
{
|
||||||
|
__ctype_mb_cur_max = mbCurMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
LocaleMessagesDataBridge::LocaleMessagesDataBridge()
|
LocaleMessagesDataBridge::LocaleMessagesDataBridge()
|
||||||
:
|
:
|
||||||
posixLanginfo(gPosixLanginfo)
|
posixLanginfo(gPosixLanginfo)
|
||||||
|
|||||||
@@ -26,6 +26,20 @@
|
|||||||
#undef toupper
|
#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
|
int
|
||||||
isalnum(int c)
|
isalnum(int c)
|
||||||
{
|
{
|
||||||
@@ -180,3 +194,6 @@ toupper(int c)
|
|||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user