about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-06-30 00:11:52 +0000
committerUlrich Drepper <drepper@redhat.com>2000-06-30 00:11:52 +0000
commitf175216dbf9354a73441b54f5135fe673f536c20 (patch)
treedb620d7f05ad7cee9d98153e480f8d4dec13851b
parent27ffef477cf5c8a7ee463002db538f5654b9ab4d (diff)
downloadglibc-f175216dbf9354a73441b54f5135fe673f536c20.tar.gz
glibc-f175216dbf9354a73441b54f5135fe673f536c20.tar.xz
glibc-f175216dbf9354a73441b54f5135fe673f536c20.zip
Update.
2000-06-29  Ulrich Drepper  <drepper@redhat.com>

	* locale/programs/ld-ctype.c (ctype_output): Don't generate unaligned
	data files.
-rw-r--r--ChangeLog5
-rw-r--r--locale/programs/ld-ctype.c28
-rw-r--r--localedata/ChangeLog2
-rw-r--r--localedata/Makefile5
4 files changed, 33 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a2edaebebe..162794ac3a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
 	* sysdeps/i386/bp-asm.h (PCOFF): New constant.
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 417660160f..c00d2cb2cc 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);
 }
 
 
diff --git a/localedata/ChangeLog b/localedata/ChangeLog
index 7bb05283bd..6ec7bbda62 100644
--- a/localedata/ChangeLog
+++ b/localedata/ChangeLog
@@ -1,5 +1,7 @@
 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
 	after DEM back in.
 
diff --git a/localedata/Makefile b/localedata/Makefile
index 7658ff727a..33c080e1cc 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -140,7 +140,7 @@ do-tst-ctype: tst-ctype.sh $(objpfx)tst-ctype do-collate-test
 
 # Theses locales are generated by gen-locale.sh
 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       \
 		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): 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)
 
 $(addsuffix .out,$(addprefix $(objpfx),$(locale_test_suite))): %: $(ALL_OBJ_LC_FILES)