about summary refs log tree commit diff
path: root/locale
diff options
context:
space:
mode:
Diffstat (limited to 'locale')
-rw-r--r--locale/lc-time.c4
-rw-r--r--locale/programs/ld-ctype.c43
-rw-r--r--locale/programs/ld-time.c5
3 files changed, 46 insertions, 6 deletions
diff --git a/locale/lc-time.c b/locale/lc-time.c
index 533e2e0d4c..78789dce41 100644
--- a/locale/lc-time.c
+++ b/locale/lc-time.c
@@ -98,9 +98,9 @@ _nl_get_era_entry (const struct tm *tp)
 		  ptr += 3 - (((ptr - (const char *) eras[cnt]) + 3) & 3);
 
 		  /* Skip wide era name.  */
-		  ptr = (char *) wcschr ((wchar_t *) ptr, '\0');
+		  ptr = (char *) (wcschr ((wchar_t *) ptr, '\0') + 1);
 		  /* Skip wide era format.  */
-		  ptr = (char *) wcschr ((wchar_t *) ptr, '\0');
+		  ptr = (char *) (wcschr ((wchar_t *) ptr, '\0') + 1);
 		}
 	    }
 	}
diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c
index 5d88fd0509..90a4492118 100644
--- a/locale/programs/ld-ctype.c
+++ b/locale/programs/ld-ctype.c
@@ -729,7 +729,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
 {
   struct locale_ctype_t *ctype = locale->categories[LC_CTYPE].ctype;
   const size_t nelems = (_NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)
-			 + 2 * (ctype->map_collection_nr - 2));
+			 + (ctype->map_collection_nr - 2));
   struct iovec iov[2 + nelems + ctype->nr_charclass
 		  + ctype->map_collection_nr];
   struct locale_file data;
@@ -951,7 +951,7 @@ ctype_output (struct localedef_t *locale, struct charmap_t *charmap,
       else
 	{
 	  /* Handle extra maps.  */
-	  size_t nr = (elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) >> 1;
+	  size_t nr = (elem - _NL_ITEM_INDEX (_NL_NUM_LC_CTYPE)) + 2;
 
 	  iov[2 + elem + offset].iov_base = ctype->map[nr];
 	  iov[2 + elem + offset].iov_len = ((ctype->plane_size
@@ -1712,6 +1712,36 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result,
 
       switch (nowtok)
 	{
+	case tok_charclass:
+	  now = lr_token (ldfile, charmap, NULL);
+	  while (now->tok == tok_ident || now->tok == tok_string)
+	    {
+	      ctype_class_new (ldfile, ctype, now->val.str.startmb);
+	      now = lr_token (ldfile, charmap, NULL);
+	      if (now->tok != tok_semicolon)
+		break;
+	      now = lr_token (ldfile, charmap, NULL);
+	    }
+	  if (now->tok != tok_eol)
+	    SYNTAX_ERROR (_("\
+%s: syntax error in definition of new character class"), "LC_CTYPE");
+	  break;
+
+	case tok_charconv:
+	  now = lr_token (ldfile, charmap, NULL);
+	  while (now->tok == tok_ident || now->tok == tok_string)
+	    {
+	      ctype_map_new (ldfile, ctype, now->val.str.startmb, charmap);
+	      now = lr_token (ldfile, charmap, NULL);
+	      if (now->tok != tok_semicolon)
+		break;
+	      now = lr_token (ldfile, charmap, NULL);
+	    }
+	  if (now->tok != tok_eol)
+	    SYNTAX_ERROR (_("\
+%s: syntax error in definition of new character map"), "LC_CTYPE");
+	  break;
+
 	case tok_class:
 	  /* Ignore the rest of the line if we don't need the input of
 	     this line.  */
@@ -2219,6 +2249,15 @@ with character code range values one must use the absolute ellipsis `...'"));
 	      free (now->val.str.startmb);
 	      goto read_charclass;
 	    }
+	  for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
+	    if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
+	      break;
+	  if (cnt < ctype->map_collection_nr)
+	    {
+	      mapidx = cnt;
+	      free (now->val.str.startmb);
+	      goto read_mapping;
+            }
 	  if (strcmp (now->val.str.startmb, "special1") == 0)
 	    {
 	      class_bit = _ISwspecial1;
diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c
index b08906ef3e..9ec58f6487 100644
--- a/locale/programs/ld-time.c
+++ b/locale/programs/ld-time.c
@@ -436,9 +436,10 @@ time_finish (struct localedef_t *locale, struct charmap_t *charmap)
 	  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;
+	  time->era_entries[idx].wname = (uint32_t *) wstr + 1;
 	  wstr = wstr ? wcschr (wstr + 1, L':') : NULL;	/* end name */
-	  time->era_entries[idx].wformat = (uint32_t *) wstr;
+	  *wstr = L'\0';
+	  time->era_entries[idx].wformat = (uint32_t *) wstr + 1;
 	}
     }