From a9c27b3ee95cbd5a3c81d9999a97e6de7b770b5d Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 5 Nov 1999 22:33:33 +0000 Subject: Update. 1999-11-05 Ulrich Drepper * sysdeps/unix/sysv/linux/bits/resource.h (RLIM_INFINITY): Adjust for kernel changes. * sysdeps/unix/sysv/linux/bits/types.h (__rlim_t, __rlim64_t): Make unsigned. 1999-10-04 Tim Waugh * posix/wordexp-test.c: More tests. * posix/wordexp.c (wordexp): Explicit null words should be kept. 1999-11-04 Shinya Hanataka * locale/programs/linereader.c (get_string): Correct type of buf2 variable. * locale/programs/ld-ctype.c (ctype_output): Store index correctly for _NL_CTYPE_INDIGITS_MB_LEN, _NL_CTYPE_INDIGITS_WC_LEN, _NL_CTYPE_INDIGITS*_MB, _NL_CTYPE_OUTDIGIT*_MB, and _NL_CTYPE_OUTDIGIT*_WC. (allocate_arrays): Completely initialize mapping tables. * locale/programs/ld-time.c (time_startup): We need the wide car string. (time_finish): Correct handling of era. (time_output): Fix a few array indeces. (time_read): Pass the repertoire map to lr_token. --- locale/programs/ld-ctype.c | 15 ++++++++++++- locale/programs/ld-time.c | 52 ++++++++++++++++++++------------------------ locale/programs/linereader.c | 2 +- 3 files changed, 39 insertions(+), 30 deletions(-) (limited to 'locale') diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index ffc759b272..6378c131bf 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -836,6 +836,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, iov[2 + elem + offset].iov_len = sizeof (uint32_t); *(uint32_t *) iov[2 + elem + offset].iov_base = ctype->mbdigits_act / 10; + idx[elem + 1] = idx[elem] + sizeof (uint32_t); break; case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS_WC_LEN): @@ -843,6 +844,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, iov[2 + elem + offset].iov_len = sizeof (uint32_t); *(uint32_t *) iov[2 + elem + offset].iov_base = ctype->wcdigits_act / 10; + idx[elem + 1] = idx[elem] + sizeof (uint32_t); break; case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_MB): @@ -865,6 +867,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, ctype->mbdigits[cnt]->nbytes); *cp++ = '\0'; } + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_MB): @@ -880,6 +883,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, *(char *) mempcpy (iov[2 + elem + offset].iov_base, ctype->mbdigits[cnt]->bytes, ctype->mbdigits[cnt]->nbytes) = '\0'; + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC): @@ -893,12 +897,14 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, cnt < ctype->wcdigits_act; cnt += 10) ((uint32_t *) iov[2 + elem + offset].iov_base)[cnt / 10] = ctype->wcdigits[cnt]; + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; case _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT0_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_OUTDIGIT9_WC): cnt = elem - _NL_CTYPE_OUTDIGIT0_WC; iov[2 + elem + offset].iov_base = &ctype->wcoutdigits[cnt]; iov[2 + elem + offset].iov_len = sizeof (uint32_t); + idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; default: @@ -2933,6 +2939,12 @@ Computing table size for character classes might take a while..."), /* EOF must map to EOF. */ ctype->map[idx][127] = EOF; + + /* The 32 bit map collection. */ + for (idx2 = 0; idx2 < ctype->map_collection_act[idx]; ++idx2) + if (ctype->map_collection[idx][idx2] != 0) + ctype->map[idx][128 + ctype->charnames[idx2]] + = ctype->map_collection[idx][idx2]; } /* Extra array for class and map names. */ @@ -3041,7 +3053,8 @@ Computing table size for character classes might take a while..."), } /* Next we allocate an array large enough and fill in the values. */ - sorted = alloca (number * sizeof (struct translit_t **)); + sorted = (struct translit_t **) alloca (number + * sizeof (struct translit_t **)); runp = ctype->translit; number = 0; do diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index 6703eb7a60..b08906ef3e 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -118,7 +118,7 @@ time_startup (struct linereader *lr, struct localedef_t *locale, if (time != NULL) { lr->translate_strings = 1; - lr->return_widestr = 0; + lr->return_widestr = 1; } } @@ -432,12 +432,12 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap) } /* Now generate the wide character name and format. */ - wstr = wcschr ((wchar_t *) time->wera, L':'); /* end direction */ - wstr = wstr ? wcschr (wstr, L':') : NULL; /* end offset */ - wstr = wstr ? wcschr (wstr, L':') : NULL; /* end start */ - wstr = wstr ? wcschr (wstr, L':') : NULL; /* end end */ + wstr = wcschr ((wchar_t *) time->wera[idx], L':');/* end direction */ + wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end offset */ + wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end start */ + wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end end */ time->era_entries[idx].wname = (uint32_t *) wstr; - wstr = wstr ? wcschr (wstr, L':') : NULL; /* end name */ + wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end name */ time->era_entries[idx].wformat = (uint32_t *) wstr; } } @@ -670,12 +670,11 @@ time_output (struct localedef_t *locale, struct charmap_t *charmap, assert (idx[1 + last_idx] % 4 == 0); iov[2 + cnt].iov_base = (void *) time->era_entries[num].wname; - iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[cnt].wformat, L'\0') + iov[2 + cnt].iov_len = ((wcschr ((wchar_t *) time->era_entries[num].wformat, L'\0') - (wchar_t *) time->era_entries[num].wname + 1) * sizeof (uint32_t)); - ++cnt; - idx[1 + last_idx] += iov[2 + cnt].iov_len; + ++cnt; } ++last_idx; @@ -869,7 +868,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, do { - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); nowtok = now->tok; } while (nowtok == tok_eol); @@ -895,7 +894,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, /* Ingore empty lines. */ if (nowtok == tok_eol) { - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); nowtok = now->tok; continue; } @@ -946,7 +945,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, } \ \ /* Match the semicolon. */ \ - now = lr_token (ldfile, charmap, NULL); \ + now = lr_token (ldfile, charmap, repertoire); \ if (now->tok != tok_semicolon && now->tok != tok_eol) \ break; \ } \ @@ -960,7 +959,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, \ if (now->tok == tok_semicolon) \ { \ - now = lr_token (ldfile, charmap, NULL); \ + now = lr_token (ldfile, charmap, repertoire); \ if (now->tok == tok_eol) \ lr_error (ldfile, _("extra trailing semicolon")); \ else if (now->tok == tok_string) \ @@ -994,10 +993,9 @@ time_read (struct linereader *ldfile, struct localedef_t *result, lr_ignore_rest (ldfile, 0); break; } - do { - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_string) goto err_label; if (!ignore_content && (now->val.str.startmb == NULL @@ -1008,7 +1006,6 @@ time_read (struct linereader *ldfile, struct localedef_t *result, lr_ignore_rest (ldfile, 0); break; } - if (!ignore_content) { time->era = xrealloc (time->era, @@ -1020,9 +1017,8 @@ time_read (struct linereader *ldfile, struct localedef_t *result, * sizeof (char *)); time->wera[time->num_era++] = now->val.str.startwc; } - - now = lr_token (ldfile, charmap, NULL); - if (now->tok != tok_eof && now->tok != tok_semicolon) + now = lr_token (ldfile, charmap, repertoire); + if (now->tok != tok_eol && now->tok != tok_semicolon) goto err_label; } while (now->tok == tok_semicolon); @@ -1038,7 +1034,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, break; \ } \ \ - now = lr_token (ldfile, charmap, NULL); \ + now = lr_token (ldfile, charmap, repertoire); \ if (now->tok != tok_string) \ goto err_label; \ else if (time->cat != NULL) \ @@ -1079,7 +1075,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, break; \ } \ \ - now = lr_token (ldfile, charmap, NULL); \ + now = lr_token (ldfile, charmap, repertoire); \ if (now->tok != tok_number) \ goto err_label; \ else if (time->cat != 0) \ @@ -1102,25 +1098,25 @@ time_read (struct linereader *ldfile, struct localedef_t *result, break; } - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_number) goto err_label; time->week_ndays = now->val.num; - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_semicolon) goto err_label; - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_number) goto err_label; time->week_1stday = now->val.num; - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_semicolon) goto err_label; - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok != tok_number) goto err_label; time->week_1stweek = now->val.num; @@ -1130,7 +1126,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, case tok_end: /* Next we assume `LC_TIME'. */ - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); if (now->tok == tok_eof) break; if (now->tok == tok_eol) @@ -1147,7 +1143,7 @@ time_read (struct linereader *ldfile, struct localedef_t *result, } /* Prepare for the next round. */ - now = lr_token (ldfile, charmap, NULL); + now = lr_token (ldfile, charmap, repertoire); nowtok = now->tok; } diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 99ed0f2480..564173083e 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -535,7 +535,7 @@ get_string (struct linereader *lr, const struct charmap_t *charmap, { int return_widestr = lr->return_widestr; char *buf; - char *buf2 = NULL; + wchar_t *buf2 = NULL; size_t bufact; size_t bufmax = 56; -- cgit v1.2.3