2000-06-29  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/ld-ctype.c (ctype_output): Don't generate unaligned
	data files.
This commit is contained in:
Ulrich Drepper 2000-06-30 00:11:52 +00:00
parent 27ffef477c
commit f175216dbf
4 changed files with 33 additions and 7 deletions

View File

@ -1,3 +1,8 @@
2000-06-29 Ulrich Drepper <drepper@redhat.com>
* locale/programs/ld-ctype.c (ctype_output): Don't generate unaligned
data files.
2000-06-29 Greg McGary <greg@mcgary.org> 2000-06-29 Greg McGary <greg@mcgary.org>
* sysdeps/i386/bp-asm.h (PCOFF): New constant. * sysdeps/i386/bp-asm.h (PCOFF): New constant.

View File

@ -833,11 +833,12 @@ void
ctype_output (struct localedef_t *locale, struct charmap_t *charmap, ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
const char *output_path) const char *output_path)
{ {
static const char nulbytes[3] = { 0, 0, 0 };
struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype; struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype;
const size_t nelems = (_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE) const size_t nelems = (_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)
+ (ctype->map_collection_nr - 2)); + (ctype->map_collection_nr - 2));
struct iovec iov[2 + nelems + ctype->nr_charclass struct iovec iov[2 + nelems + ctype->nr_charclass
+ ctype->map_collection_nr]; + ctype->map_collection_nr + 2];
struct locale_file data; struct locale_file data;
uint32_t idx[nelems + 1]; uint32_t idx[nelems + 1];
uint32_t default_missing_len; 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); idx[elem + 1] = idx[elem] + sizeof (uint32_t);
break; 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 /* Compute the length of all possible characters. For INDIGITS
there might be more than one. We simply concatenate all of there might be more than one. We simply concatenate all of
them with a NUL byte following. The NUL byte wouldn't be them with a NUL byte following. The NUL byte wouldn't be
necessary but it makes it easier for the user. */ necessary but it makes it easier for the user. */
total = 0; total = 0;
for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB); for (cnt = elem - _NL_ITEM_INDEX (_NL_CTYPE_INDIGITS0_MB);
cnt < ctype->mbdigits_act; cnt += 10) cnt < ctype->mbdigits_act; cnt += 10)
total += ctype->mbdigits[cnt]->nbytes + 1; 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; idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len;
break; 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; total = ctype->wcdigits_act / 10;
iov[2 + elem + offset].iov_base = 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 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);
} }

View File

@ -1,5 +1,7 @@
2000-06-29 Ulrich Drepper <drepper@redhat.com> 2000-06-29 Ulrich Drepper <drepper@redhat.com>
* Makefile: Regenerate locale data also if localedef changed.
* tst-fmon.data: Until we know what is correct, but the spaces * tst-fmon.data: Until we know what is correct, but the spaces
after DEM back in. after DEM back in.

View File

@ -140,7 +140,7 @@ do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test
# Theses locales are generated by gen-locale.sh # Theses locales are generated by gen-locale.sh
LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \ LOCALES := de_DE.ISO-8859-1 de_DE.UTF-8 en_US.ANSI_X3.4-1968 \
en_US.ISO-8859-1 ja_JP.EUC-JP en_US.ISO-8859-1 ja_JP.EUC-JP
LOCALE_FILES := LC_ADDRESS LC_IDENTIFICATION LC_MONETARY LC_PAPER \ LOCALE_FILES := LC_ADDRESS LC_IDENTIFICATION LC_MONETARY LC_PAPER \
LC_COLLATE LC_MEASUREMENT LC_NAME LC_TELEPHONE LC_CTYPE \ LC_COLLATE LC_MEASUREMENT LC_NAME LC_TELEPHONE LC_CTYPE \
@ -151,7 +151,8 @@ ALL_LC_FILES := $(foreach locale, $(LOCALES), \
ALL_OBJ_LC_FILES := $(addprefix $(objpfx), $(ALL_LC_FILES)) ALL_OBJ_LC_FILES := $(addprefix $(objpfx), $(ALL_LC_FILES))
$(ALL_OBJ_LC_FILES): gen-locale.sh Makefile charmaps/* locales/* $(ALL_OBJ_LC_FILES): gen-locale.sh Makefile charmaps/* locales/* \
$(common-objpfx)locale/localedef
$(SHELL) -e gen-locale.sh $(common-objpfx) $(SHELL) -e gen-locale.sh $(common-objpfx)
$(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: $(ALL_OBJ_LC_FILES) $(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: $(ALL_OBJ_LC_FILES)