diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-06-30 00:11:52 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-06-30 00:11:52 +0000 |
commit | f175216dbf9354a73441b54f5135fe673f536c20 (patch) | |
tree | db620d7f05ad7cee9d98153e480f8d4dec13851b /locale/programs/ld-ctype.c | |
parent | 27ffef477cf5c8a7ee463002db538f5654b9ab4d (diff) | |
download | glibc-f175216dbf9354a73441b54f5135fe673f536c20.zip glibc-f175216dbf9354a73441b54f5135fe673f536c20.tar.gz glibc-f175216dbf9354a73441b54f5135fe673f536c20.tar.bz2 |
Update.
2000-06-29 Ulrich Drepper <drepper@redhat.com>
* locale/programs/ld-ctype.c (ctype_output): Don't generate unaligned
data files.
Diffstat (limited to 'locale/programs/ld-ctype.c')
-rw-r--r-- | locale/programs/ld-ctype.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index 4176601..c00d2cb 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -833,11 +833,12 @@ void ctype_output (struct localedef_t *locale, struct charmap_t *charmap, const char *output_path) { + static const char nulbytes[3] = { 0, 0, 0 }; struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; const size_t nelems = (_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE) + (ctype->map_collection_nr - 2)); struct iovec iov[2 + nelems + ctype->nr_charclass - + ctype->map_collection_nr]; + + ctype->map_collection_nr + 2]; struct locale_file data; uint32_t idx[nelems + 1]; uint32_t default_missing_len; @@ -999,12 +1000,21 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, idx[elem + 1] = idx[elem] + sizeof (uint32_t); break; - case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_MB): + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB): + /* Align entries. */ + iov[2 + elem + offset].iov_base = (void *) nulbytes; + iov[2 + elem + offset].iov_len = (4 - idx[elem] % 4) % 4; + idx[elem] += iov[2 + elem + offset].iov_len; + ++offset; + /* FALLTRHOUGH */ + + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS1_MB) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_MB): /* Compute the length of all possible characters. For INDIGITS there might be more than one. We simply concatenate all of them with a NUL byte following. The NUL byte wouldn't be necessary but it makes it easier for the user. */ total = 0; + for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB); cnt < ctype->mbdigits_act; cnt += 10) total += ctype->mbdigits[cnt]->nbytes + 1; @@ -1038,7 +1048,15 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, 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): + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_WC): + /* Align entries. */ + iov[2 + elem + offset].iov_base = (void *) nulbytes; + iov[2 + elem + offset].iov_len = (4 - idx[elem] % 4) % 4; + idx[elem] += iov[2 + elem + offset].iov_len; + ++offset; + /* FALLTHROUGH */ + + case _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS1_WC) ... _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS9_WC): total = ctype->wcdigits_act / 10; iov[2 + elem + offset].iov_base = @@ -1124,9 +1142,9 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap, } assert (2 + elem + offset == (nelems + ctype->nr_charclass - + ctype->map_collection_nr + 2)); + + ctype->map_collection_nr + 2 + 2)); - write_locale_data (output_path, "LC_CTYPE", 2 + elem + offset, iov); + write_locale_data (output_path, "LC_CTYPE", 2 + elem + offset + 2, iov); } |