summaryrefslogtreecommitdiff
path: root/extra/locale/gen_wctype.c
diff options
context:
space:
mode:
authorEugene Yudin <e.yudin@ndmsystems.com>2017-07-24 22:27:00 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2017-07-28 19:06:07 +0200
commitb98192b80ee5654aa7c5590bcc266c5eec2c67a5 (patch)
treeb6f6dbf90cd2dadceb24b4ea8e4ea8831e79c88e /extra/locale/gen_wctype.c
parent63597398e4fa0db50638568a8caa1637bab44705 (diff)
fix tolower and locales
The function towlower doesn't work with locales different from C. Issue was introduced in commit: 8cde3a9bf2856dcb9a759dec7ecb04a68e712254 Call to setlocale is needed for correct generation of the table uplow_diff. Otherwise you receive compile time error "range assumption error" after uncommenting the call. Similar problem described here: http://lists.uclibc.org/pipermail/uclibc/2015-March/048852.html This commit fix the problem by using int32_t values.
Diffstat (limited to 'extra/locale/gen_wctype.c')
-rw-r--r--extra/locale/gen_wctype.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/extra/locale/gen_wctype.c b/extra/locale/gen_wctype.c
index 70345096b..99c505d44 100644
--- a/extra/locale/gen_wctype.c
+++ b/extra/locale/gen_wctype.c
@@ -83,8 +83,8 @@
#define mywxdigit(D,C) (mywdigit(D,C) || (unsigned)(((C) | 0x20) - 'a') <= 5)
typedef struct {
- short l;
- short u;
+ int32_t l;
+ int32_t u;
} uldiff_entry;
typedef struct {
@@ -227,12 +227,11 @@ int main(int argc, char **argv)
++verbose;
continue;
}
- /* setlocale might be just a stub */
- /* if (!setlocale(LC_CTYPE, *argv)) {
+ /* setlocale might be just a stub */
+ if (!setlocale(LC_CTYPE, *argv)) {
verbose_msg("setlocale(LC_CTYPE,%s) failed! Skipping this locale...\n", *argv);
continue;
}
- */
if (!(totitle = wctrans("totitle"))) {
verbose_msg("no totitle transformation.\n");
}
@@ -402,7 +401,7 @@ int main(int argc, char **argv)
u = (long)(int) towupper(c) - c;
ult[c] = 0;
if (l || u) {
- if ((l != (short)l) || (u != (short)u)) {
+ if ((l != (int32_t)l) || (u != (int32_t)u)) {
verbose_msg("range assumption error! %x %ld %ld\n", c, l, u);
return EXIT_FAILURE;
}
@@ -684,7 +683,7 @@ int main(int argc, char **argv)
printf("#define __LOCALE_DATA_WCuplow_diffs %7u\n", ul_count);
printf("\n#ifdef WANT_WCuplow_diff_data\n\n");
- printf("\nstatic const short __LOCALE_DATA_WCuplow_diff_data[%zu] = {",
+ printf("\nstatic const int32_t __LOCALE_DATA_WCuplow_diff_data[%zu] = {",
2 * (size_t) ul_count);
for (i = 0; i < ul_count; i++) {
if (i % 4 == 0) {