summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-30 16:53:41 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-30 16:53:41 +0000
commita22cd12f5e3ea29c5c527efce55b50bc197d680b (patch)
treee15e35feeb1466f133d13b812290ebe6d734bda0
parent66ac0abe0341c5b3b1189c0ef9805ac931aecf6e (diff)
downloadglibc-a22cd12f5e3ea29c5c527efce55b50bc197d680b.tar.gz
glibc-a22cd12f5e3ea29c5c527efce55b50bc197d680b.tar.xz
glibc-a22cd12f5e3ea29c5c527efce55b50bc197d680b.zip
Update.
1999-12-30  Ulrich Drepper  <drepper@cygnus.com>

	* locale/programs/ld-collate.c (insert_value): Don't pass wide string
	to new_element if the wide char is not valid.
	(handle_ellipsis): Likewise.
	(collate_read): It's no problem if the string in the collating element
	definition cannot be represented as multibyte or wide char string.
-rw-r--r--ChangeLog8
-rw-r--r--locale/programs/ld-collate.c59
2 files changed, 27 insertions, 40 deletions
diff --git a/ChangeLog b/ChangeLog
index dcd47ce435..169662910d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+1999-12-30  Ulrich Drepper  <drepper@cygnus.com>
+
+	* locale/programs/ld-collate.c (insert_value): Don't pass wide string
+	to new_element if the wide char is not valid.
+	(handle_ellipsis): Likewise.
+	(collate_read): It's no problem if the string in the collating element
+	definition cannot be represented as multibyte or wide char string.
+
 1999-12-13  Andreas Jaeger  <aj@suse.de>
 
 	* resolv/resolv.h: Remove K&R compatibility.
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index ae132b4da5..65af8e6b6a 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -876,7 +876,8 @@ insert_value (struct linereader *ldfile, struct token *arg,
 
 	  /* We have to allocate an entry.  */
 	  elem = new_element (collate, seq != NULL ? seq->bytes : NULL,
-			      seq != NULL ? seq->nbytes : 0, wcs,
+			      seq != NULL ? seq->nbytes : 0,
+			      wc == ILLEGAL_CHAR_VALUE ? NULL : wcs,
 			      arg->val.str.startmb, arg->val.str.lenmb, 1);
 
 	  /* And add it to the table.  */
@@ -1061,7 +1062,9 @@ sequence is not lower than that of the last character"), "LC_COLLATE");
 		      uint32_t wcs[2] = { seq->ucs4, 0 };
 
 		      /* We have to allocate an entry.  */
-		      elem = new_element (collate, mbcnt, len, wcs, seq->name,
+		      elem = new_element (collate, mbcnt, len,
+					  seq->ucs4 == ILLEGAL_CHAR_VALUE
+					  ? NULL : wcs, seq->name,
 					  namelen, 1);
 
 		      /* And add it to the table.  */
@@ -1257,8 +1260,7 @@ order for `%.*s' already defined at %s:%zu"),
 					  seq != NULL ? seq->bytes : NULL,
 					  seq != NULL ? seq->nbytes : 0,
 					  wc == ILLEGAL_CHAR_VALUE
-					  ? NULL : wcs,
-					  buf, lenfrom, 1);
+					  ? NULL : wcs, buf, lenfrom, 1);
 		    }
 		  else
 		    {
@@ -2561,45 +2563,22 @@ collate_read (struct linereader *ldfile, struct localedef_t *result,
 	      if (arg->tok != tok_string)
 		goto err_label;
 
-	      if (!ignore_content)
+	      if (!ignore_content && symbol != NULL)
 		{
-		  if (symbol == NULL)
-		    lr_error (ldfile, _("\
-%s: unknown character in collating element name"),
-			      "LC_COLLATE");
-		  if (arg->val.str.startmb == NULL)
-		    lr_error (ldfile, _("\
-%s: unknown character in collating element definition"),
-			      "LC_COLLATE");
-		  if (arg->val.str.startwc == NULL)
-		    lr_error (ldfile, _("\
-%s: unknown wide character in collating element definition"),
-			      "LC_COLLATE");
-		  else if (arg->val.str.lenwc < 2)
-		    lr_error (ldfile, _("\
-%s: substitution string in collating element definition must have at least two characters"),
-			      "LC_COLLATE");
-
-		  if (symbol != NULL)
-		    {
-		      /* The name is already defined.  */
-		      if (check_duplicate (ldfile, collate, charmap,
-					   repertoire, symbol, symbol_len))
-			goto col_elem_free;
+		  /* The name is already defined.  */
+		  if (check_duplicate (ldfile, collate, charmap,
+				       repertoire, symbol, symbol_len))
+		    goto col_elem_free;
 
-		      if (insert_entry (&collate->elem_table,
-					symbol, symbol_len,
-					new_element (collate,
-						     arg->val.str.startmb,
-						     arg->val.str.lenmb - 1,
-						     arg->val.str.startwc,
-						     symbol, symbol_len, 0))
-			  < 0)
-			lr_error (ldfile, _("\
+		  if (insert_entry (&collate->elem_table,
+				    symbol, symbol_len,
+				    new_element (collate,
+						 arg->val.str.startmb,
+						 arg->val.str.lenmb - 1,
+						 arg->val.str.startwc,
+						 symbol, symbol_len, 0)) < 0)
+		    lr_error (ldfile, _("\
 error while adding collating element"));
-		    }
-		  else
-		    goto col_elem_free;
 		}
 	      else
 		{