From 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 12 Jul 2007 18:26:36 +0000 Subject: 2.5-18.1 --- locale/programs/3level.h | 58 ++- locale/programs/charmap-dir.c | 22 +- locale/programs/charmap-dir.h | 22 +- locale/programs/charmap-kw.gperf | 22 +- locale/programs/charmap-kw.h | 102 +++-- locale/programs/charmap.c | 41 +- locale/programs/charmap.h | 25 +- locale/programs/config.h | 22 +- locale/programs/ld-address.c | 38 +- locale/programs/ld-collate.c | 42 ++- locale/programs/ld-ctype.c | 53 +-- locale/programs/ld-identification.c | 22 +- locale/programs/ld-measurement.c | 22 +- locale/programs/ld-messages.c | 22 +- locale/programs/ld-monetary.c | 22 +- locale/programs/ld-name.c | 22 +- locale/programs/ld-numeric.c | 43 +-- locale/programs/ld-paper.c | 22 +- locale/programs/ld-telephone.c | 22 +- locale/programs/ld-time.c | 52 ++- locale/programs/linereader.c | 32 +- locale/programs/linereader.h | 22 +- locale/programs/locale-spec.c | 22 +- locale/programs/locale.c | 24 +- locale/programs/localedef.c | 54 ++- locale/programs/localedef.h | 22 +- locale/programs/locarchive.c | 22 +- locale/programs/locfile-kw.gperf | 22 +- locale/programs/locfile-kw.h | 729 ++++++++++++++++++++++-------------- locale/programs/locfile-token.h | 22 +- locale/programs/locfile.c | 31 +- locale/programs/locfile.h | 22 +- locale/programs/repertoire.c | 24 +- locale/programs/repertoire.h | 22 +- locale/programs/simple-hash.c | 26 +- locale/programs/simple-hash.h | 22 +- locale/programs/xmalloc.c | 23 +- locale/programs/xstrdup.c | 22 +- 38 files changed, 1047 insertions(+), 812 deletions(-) (limited to 'locale/programs') diff --git a/locale/programs/3level.h b/locale/programs/3level.h index ef4ba2bbc0..88f1b49724 100644 --- a/locale/programs/3level.h +++ b/locale/programs/3level.h @@ -1,21 +1,19 @@ -/* Copyright (C) 2000-2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Bruno Haible , 2000. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Construction of sparse 3-level tables. See wchar-lookup.h or coll-lookup.h for their structure and the @@ -204,6 +202,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t, } } } + +/* GCC ATM seems to do a poor job with pointers to nested functions passed + to inlined functions. Help it a little bit with this hack. */ +#define wchead_table_iterate(tp, fn) \ +do \ + { \ + struct wchead_table *t = (tp); \ + uint32_t index1; \ + for (index1 = 0; index1 < t->level1_size; index1++) \ + { \ + uint32_t lookup1 = t->level1[index1]; \ + if (lookup1 != ((uint32_t) ~0)) \ + { \ + uint32_t lookup1_shifted = lookup1 << t->q; \ + uint32_t index2; \ + for (index2 = 0; index2 < (1 << t->q); index2++) \ + { \ + uint32_t lookup2 = t->level2[index2 + lookup1_shifted]; \ + if (lookup2 != ((uint32_t) ~0)) \ + { \ + uint32_t lookup2_shifted = lookup2 << t->p; \ + uint32_t index3; \ + for (index3 = 0; index3 < (1 << t->p); index3++) \ + { \ + struct element_t *lookup3 \ + = t->level3[index3 + lookup2_shifted]; \ + if (lookup3 != NULL) \ + fn ((((index1 << t->q) + index2) << t->p) + index3, \ + lookup3); \ + } \ + } \ + } \ + } \ + } \ + } while (0) + #endif #ifndef NO_FINALIZE diff --git a/locale/programs/charmap-dir.c b/locale/programs/charmap-dir.c index 903bd5cabc..07d0cdcfd0 100644 --- a/locale/programs/charmap-dir.c +++ b/locale/programs/charmap-dir.c @@ -1,20 +1,18 @@ -/* Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include diff --git a/locale/programs/charmap-dir.h b/locale/programs/charmap-dir.h index 1d07c64ec1..256db8dc35 100644 --- a/locale/programs/charmap-dir.h +++ b/locale/programs/charmap-dir.h @@ -1,20 +1,18 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _CHARMAP_DIR_H #define _CHARMAP_DIR_H 1 diff --git a/locale/programs/charmap-kw.gperf b/locale/programs/charmap-kw.gperf index 83da36aa74..64f7452500 100644 --- a/locale/programs/charmap-kw.gperf +++ b/locale/programs/charmap-kw.gperf @@ -1,22 +1,20 @@ %{ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include diff --git a/locale/programs/charmap-kw.h b/locale/programs/charmap-kw.h index 089f45d7d8..d7d85774da 100644 --- a/locale/programs/charmap-kw.h +++ b/locale/programs/charmap-kw.h @@ -1,27 +1,56 @@ -/* ANSI-C code produced by gperf version 2.7.2 */ -/* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash programs/charmap-kw.gperf */ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* ANSI-C code produced by gperf version 3.0.1 */ +/* Command-line: gperf -acCgopt -k'1,2,5,9,$' -L ANSI-C -N charmap_hash charmap-kw.gperf */ + +#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ + && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ + && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ + && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ + && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ + && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ + && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ + && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ + && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ + && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ + && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ + && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ + && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ + && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ + && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ + && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ + && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ + && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ + && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ + && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ + && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ + && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ + && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) +/* The character set is not based on ISO-646. */ +#error "gperf generated tables don't work with this execution character set. Please report a bug to ." +#endif + +#line 1 "charmap-kw.gperf" + +/* Copyright (C) 1995,1996,1997,1998,1999,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include "locfile-token.h" +#line 23 "charmap-kw.gperf" struct keyword_t ; #define TOTAL_KEYWORDS 17 @@ -47,15 +76,15 @@ hash (register const char *str, register unsigned int len) 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 36, 25, 10, - 15, 20, 36, 36, 36, 36, 36, 36, 36, 36, - 36, 36, 36, 36, 36, 36, 36, 10, 0, 0, - 5, 36, 0, 0, 36, 36, 36, 0, 0, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 25, 20, + 15, 10, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 5, 0, 0, + 5, 36, 0, 0, 36, 36, 36, 5, 0, 36, 0, 36, 0, 36, 0, 36, 36, 0, 36, 36, - 36, 36, 36, 36, 36, 0, 36, 0, 0, 0, - 10, 0, 36, 0, 0, 0, 36, 36, 36, 0, + 36, 36, 36, 36, 36, 0, 36, 5, 0, 0, + 5, 0, 36, 5, 0, 0, 36, 36, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36, 36, - 25, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 0, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, @@ -75,17 +104,19 @@ hash (register const char *str, register unsigned int len) switch (hval) { default: - case 9: hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ case 8: case 7: case 6: case 5: hval += asso_values[(unsigned char)str[4]]; + /*FALLTHROUGH*/ case 4: case 3: case 2: hval += asso_values[(unsigned char)str[1]]; + /*FALLTHROUGH*/ case 1: hval += asso_values[(unsigned char)str[0]]; break; @@ -102,29 +133,46 @@ charmap_hash (register const char *str, register unsigned int len) static const struct keyword_t wordlist[] = { {""}, {""}, {""}, +#line 38 "charmap-kw.gperf" {"END", tok_end, 0}, {""}, +#line 39 "charmap-kw.gperf" {"WIDTH", tok_width, 0}, +#line 34 "charmap-kw.gperf" {"escseq", tok_escseq, 1}, +#line 36 "charmap-kw.gperf" {"include", tok_include, 1}, {""}, {""}, +#line 27 "charmap-kw.gperf" {"mb_cur_min", tok_mb_cur_min, 1}, +#line 28 "charmap-kw.gperf" {"escape_char", tok_escape_char, 1}, +#line 29 "charmap-kw.gperf" {"comment_char", tok_comment_char, 1}, +#line 25 "charmap-kw.gperf" {"code_set_name", tok_code_set_name, 1}, +#line 40 "charmap-kw.gperf" {"WIDTH_VARIABLE", tok_width_variable, 0}, - {"g1esc", tok_g1esc, 1}, +#line 26 "charmap-kw.gperf" + {"mb_cur_max", tok_mb_cur_max, 1}, +#line 35 "charmap-kw.gperf" {"addset", tok_addset, 1}, +#line 37 "charmap-kw.gperf" {"CHARMAP", tok_charmap, 0}, +#line 41 "charmap-kw.gperf" {"WIDTH_DEFAULT", tok_width_default, 0}, {""}, - {"g2esc", tok_g2esc, 1}, - {""}, {""}, {""}, {""}, +#line 33 "charmap-kw.gperf" {"g3esc", tok_g3esc, 1}, {""}, {""}, {""}, {""}, - {"g0esc", tok_g0esc, 1}, +#line 32 "charmap-kw.gperf" + {"g2esc", tok_g2esc, 1}, + {""}, {""}, {""}, {""}, +#line 31 "charmap-kw.gperf" + {"g1esc", tok_g1esc, 1}, {""}, {""}, {""}, {""}, - {"mb_cur_max", tok_mb_cur_max, 1} +#line 30 "charmap-kw.gperf" + {"g0esc", tok_g0esc, 1} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/locale/programs/charmap.c b/locale/programs/charmap.c index 8dbac6f5b9..52a69de4b0 100644 --- a/locale/programs/charmap.c +++ b/locale/programs/charmap.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996, 1998-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1998-2004,2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -49,8 +47,9 @@ static void new_width (struct linereader *cmfile, struct charmap_t *result, const char *from, const char *to, unsigned long int width); static void charmap_new_char (struct linereader *lr, struct charmap_t *cm, - int nbytes, char *bytes, const char *from, - const char *to, int decimal_ellipsis, int step); + size_t nbytes, unsigned char *bytes, + const char *from, const char *to, + int decimal_ellipsis, int step); bool enc_not_ascii_compatible; @@ -87,7 +86,8 @@ cmlr_open (const char *directory, const char *name, kw_hash_fct_t hf) } struct charmap_t * -charmap_read (const char *filename, int verbose, int be_quiet, int use_default) +charmap_read (const char *filename, int verbose, int error_not_found, + int be_quiet, int use_default) { struct charmap_t *result = NULL; @@ -131,13 +131,11 @@ charmap_read (const char *filename, int verbose, int be_quiet, int use_default) } if (cmfile != NULL) - { - result = parse_charmap (cmfile, verbose, be_quiet); + result = parse_charmap (cmfile, verbose, be_quiet); - if (result == NULL && !be_quiet) - WITH_CUR_LOCALE (error (0, errno, _("\ + if (result == NULL && error_not_found) + WITH_CUR_LOCALE (error (0, errno, _("\ character map file `%s' not found"), filename)); - } } if (result == NULL && filename != NULL && strchr (filename, '/') == NULL) @@ -927,7 +925,8 @@ charmap_find_value (const struct charmap_t *cm, const char *name, size_t len) static void charmap_new_char (struct linereader *lr, struct charmap_t *cm, - int nbytes, char *bytes, const char *from, const char *to, + size_t nbytes, unsigned char *bytes, + const char *from, const char *to, int decimal_ellipsis, int step) { hash_table *ht = &cm->char_table; diff --git a/locale/programs/charmap.h b/locale/programs/charmap.h index a4a6d3833b..fd711f2d11 100644 --- a/locale/programs/charmap.h +++ b/locale/programs/charmap.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-1999, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-1999,2001,2003,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _CHARMAP_H #define _CHARMAP_H @@ -71,7 +69,8 @@ extern bool enc_not_ascii_compatible; /* Prototypes for charmap handling functions. */ extern struct charmap_t *charmap_read (const char *filename, int verbose, - int be_quiet, int use_default); + int error_not_found, int be_quiet, + int use_default); /* Return the value stored under the given key in the hashing table. */ extern struct charseq *charmap_find_value (const struct charmap_t *charmap, diff --git a/locale/programs/config.h b/locale/programs/config.h index 12a921c1cf..6f9bfde903 100644 --- a/locale/programs/config.h +++ b/locale/programs/config.h @@ -1,22 +1,20 @@ /* Configuration for localedef program. - Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,2000,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LD_CONFIG_H #define _LD_CONFIG_H 1 diff --git a/locale/programs/ld-address.c b/locale/programs/ld-address.c index 079aa0094d..dac8551071 100644 --- a/locale/programs/ld-address.c +++ b/locale/programs/ld-address.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998-2002, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -224,17 +222,29 @@ No definition for %s category found"), "LC_ADDRESS")); if (address->lang_ab == NULL) { - if (verbose && ! nothing) + if ((cnt == sizeof (iso639) / sizeof (iso639[0]) + || iso639[cnt].ab[0] != '\0') + && verbose && ! nothing) WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' not defined"), "LC_ADDRESS", "lang_ab")); address->lang_ab = ""; } else if (address->lang_ab[0] == '\0') { - if (verbose) + if ((cnt == sizeof (iso639) / sizeof (iso639[0]) + || iso639[cnt].ab[0] != '\0') + && verbose) WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be empty"), "LC_ADDRESS", "lang_ab")); } + else if (cnt < sizeof (iso639) / sizeof (iso639[0]) + && iso639[cnt].ab[0] == '\0') + { + WITH_CUR_LOCALE (error (0, 0, _("%s: field `%s' must not be defined"), + "LC_ADDRESS", "lang_ab")); + + address->lang_ab = ""; + } else { if (cnt == sizeof (iso639) / sizeof (iso639[0])) diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 6d0d03c235..cf1bff130f 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -1297,7 +1295,7 @@ order for `%.*s' already defined at %s:%Zu"), { invalid_range: lr_error (ldfile, _("\ -`%s' and `%.*s' are no valid names for symbolic range"), +`%s' and `%.*s' are not valid names for symbolic range"), startp->name, (int) lento, endp->name); return; } @@ -2469,14 +2467,14 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap, runp = collate->start; while (runp != NULL) { - if (runp->mbs != NULL && runp->weights != NULL) + if (runp->mbs != NULL && runp->weights != NULL && !runp->is_character) /* Yep, the element really counts. */ ++elem_size; runp = runp->next; } /* Add 40% and find the next prime number. */ - elem_size = MIN (next_prime (elem_size * 1.4), 257); + elem_size = next_prime (elem_size * 1.4); /* Allocate the table. Each entry consists of two words: the hash value and an index in a secondary table which provides the index @@ -2496,18 +2494,20 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap, uint32_t namelen = strlen (runp->name); uint32_t hash = elem_hash (runp->name, namelen); size_t idx = hash % elem_size; + size_t start_idx = idx; if (elem_table[idx * 2] != 0) { - /* The spot is already take. Try iterating using the value + /* The spot is already taken. Try iterating using the value from the secondary hashing function. */ - size_t iter = hash % (elem_size - 2); + size_t iter = hash % (elem_size - 2) + 1; do { idx += iter; if (idx >= elem_size) idx -= elem_size; + assert (idx != start_idx); } while (elem_table[idx * 2] != 0); } @@ -2671,6 +2671,9 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, if (locfile_read (copy_locale, charmap) != 0) goto skip_category; } + + if (copy_locale->categories[LC_COLLATE].collate == NULL) + return; } lr_ignore_rest (ldfile, 1); @@ -3065,7 +3068,7 @@ collate_read (struct linereader *ldfile, struct localedef_t *result, lr_error (ldfile, _("\ %s: unknown symbol `%s' in equivalent definition"), "LC_COLLATE", symname); - goto col_sym_free; + goto sym_equiv_free; } if (insert_entry (&collate->sym_table, @@ -3530,13 +3533,13 @@ error while adding equivalent collating symbol")); break; } + struct element_t *seqp; if (state == 0) { /* We are outside an `order_start' region. This means we must only accept definitions of values for collation symbols since these are purely abstract values and don't need directions associated. */ - struct element_t *seqp; void *ptr; if (find_entry (&collate->seq_table, symstr, symlen, &ptr) == 0) @@ -3583,7 +3586,6 @@ error while adding equivalent collating symbol")); { /* It is possible that we already have this collation sequence. In this case we move the entry. */ - struct element_t *seqp = NULL; void *sym; void *ptr; diff --git a/locale/programs/ld-ctype.c b/locale/programs/ld-ctype.c index ed8fa919d5..40d5e4b17f 100644 --- a/locale/programs/ld-ctype.c +++ b/locale/programs/ld-ctype.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -994,8 +992,8 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, total += iov[2 + elem + offset].iov_len; } iov[2 + elem + offset].iov_base = (void *) nulbytes; - iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); - total += 1 + (4 - ((total + 1) % 4)); + iov[2 + elem + offset].iov_len = 4 - (total % 4); + total += 4 - (total % 4); idx[elem + 1] = idx[elem] + total; break; @@ -1012,8 +1010,8 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, total += iov[2 + elem + offset].iov_len; } iov[2 + elem + offset].iov_base = (void *) nulbytes; - iov[2 + elem + offset].iov_len = 1 + (4 - ((total + 1) % 4)); - total += 1 + (4 - ((total + 1) % 4)); + iov[2 + elem + offset].iov_len = 4 - (total % 4); + total += 4 - (total % 4); idx[elem + 1] = idx[elem] + total; break; @@ -1155,7 +1153,7 @@ ctype_output (struct localedef_t *locale, const struct charmap_t *charmap, iov[2 + elem + offset].iov_base = ctype->default_missing ?: (uint32_t *) L""; iov[2 + elem + offset].iov_len = - wcslen (iov[2 + elem + offset].iov_base); + wcslen (iov[2 + elem + offset].iov_base) * sizeof (uint32_t); idx[elem + 1] = idx[elem] + iov[2 + elem + offset].iov_len; break; @@ -1474,7 +1472,7 @@ charclass_symbolic_ellipsis (struct linereader *ldfile, { invalid_range: lr_error (ldfile, - _("`%s' and `%.*s' are no valid names for symbolic range"), + _("`%s' and `%.*s' are not valid names for symbolic range"), last_str, (int) now->val.str.lenmb, nowstr); return; } @@ -1868,6 +1866,9 @@ find_translit (struct localedef_t *locale, const struct charmap_t *charmap, assert (locale != NULL); ctype = locale->categories[LC_CTYPE].ctype; + if (ctype == NULL) + return NULL; + if (ctype->translit != NULL) result = find_translit2 (ctype, charmap, wch); @@ -2247,6 +2248,9 @@ ctype_read (struct linereader *ldfile, struct localedef_t *result, if (locfile_read (copy_locale, charmap) != 0) goto skip_category; } + + if (copy_locale->categories[LC_CTYPE].ctype == NULL) + return; } lr_ignore_rest (ldfile, 1); @@ -3768,7 +3772,7 @@ translit_flatten (struct locale_ctype_t *ctype, other = find_locale (LC_CTYPE, copy_locale, copy_repertoire, charmap); - if (other == NULL) + if (other == NULL || other->categories[LC_CTYPE].ctype == NULL) { WITH_CUR_LOCALE (error (0, 0, _("\ %s: transliteration data from locale `%s' not available"), @@ -3846,9 +3850,14 @@ allocate_arrays (struct locale_ctype_t *ctype, const struct charmap_t *charmap, { ctype->class_b[nr] = (uint32_t *) xcalloc (256 / 32, sizeof (uint32_t)); - for (idx = 0; idx < 256; ++idx) - if (ctype->class256_collection[idx] & _ISbit (nr)) - ctype->class_b[nr][idx >> 5] |= (uint32_t)1 << (idx & 0x1f); + /* We only set CLASS_B for the bits in the ISO C classes, not + the user defined classes. The number should not change but + who knows. */ +#define LAST_ISO_C_BIT 11 + if (nr <= LAST_ISO_C_BIT) + for (idx = 0; idx < 256; ++idx) + if (ctype->class256_collection[idx] & _ISbit (nr)) + ctype->class_b[nr][idx >> 5] |= (uint32_t) 1 << (idx & 0x1f); } for (nr = 0; nr < ctype->nr_charclass; nr++) diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c index ae5ea6fb16..d050f7aaa9 100644 --- a/locale/programs/ld-identification.c +++ b/locale/programs/ld-identification.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-measurement.c b/locale/programs/ld-measurement.c index e3ec90199e..6a9b847a1a 100644 --- a/locale/programs/ld-measurement.c +++ b/locale/programs/ld-measurement.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-messages.c b/locale/programs/ld-messages.c index d5cc393e4b..e98574f130 100644 --- a/locale/programs/ld-messages.c +++ b/locale/programs/ld-messages.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-monetary.c b/locale/programs/ld-monetary.c index 868ab6980e..27636d6498 100644 --- a/locale/programs/ld-monetary.c +++ b/locale/programs/ld-monetary.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-name.c b/locale/programs/ld-name.c index 80b42f7048..c1153fd51d 100644 --- a/locale/programs/ld-name.c +++ b/locale/programs/ld-name.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-numeric.c b/locale/programs/ld-numeric.c index 594c0c8c1b..a901c4d985 100644 --- a/locale/programs/ld-numeric.c +++ b/locale/programs/ld-numeric.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002,2005,2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -304,7 +302,7 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result, { size_t act = 0; size_t max = 10; - char *grouping = ignore_content ? NULL : xmalloc (max); + char *grouping = xmalloc (max); do { @@ -323,24 +321,20 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result, } if (now->tok == tok_minus1) - { - if (!ignore_content) - grouping[act++] = '\177'; - } + grouping[act++] = '\177'; else if (now->val.num == 0) { /* A value of 0 disables grouping from here on but we must not store a NUL character since this terminates the string. Use something different which must not be used otherwise. */ - if (!ignore_content) - grouping[act++] = '\377'; + grouping[act++] = '\377'; } else if (now->val.num > 126) lr_error (ldfile, _("\ %s: values for field `%s' must be smaller than 127"), "LC_NUMERIC", "grouping"); - else if (!ignore_content) + else grouping[act++] = now->val.num; /* Next must be semicolon. */ @@ -355,13 +349,10 @@ numeric_read (struct linereader *ldfile, struct localedef_t *result, if (now->tok != tok_eol) goto err_label; - if (!ignore_content) - { - grouping[act++] = '\0'; + grouping[act++] = '\0'; - numeric->grouping = xrealloc (grouping, act); - numeric->grouping_len = act; - } + numeric->grouping = xrealloc (grouping, act); + numeric->grouping_len = act; } break; diff --git a/locale/programs/ld-paper.c b/locale/programs/ld-paper.c index 2910954f04..38f9af3e60 100644 --- a/locale/programs/ld-paper.c +++ b/locale/programs/ld-paper.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-telephone.c b/locale/programs/ld-telephone.c index 5a60c016b0..4075a14f46 100644 --- a/locale/programs/ld-telephone.c +++ b/locale/programs/ld-telephone.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001,2002,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include diff --git a/locale/programs/ld-time.c b/locale/programs/ld-time.c index a7dd25c80d..bf5151858a 100644 --- a/locale/programs/ld-time.c +++ b/locale/programs/ld-time.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1995-2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1995-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1995. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -469,10 +467,22 @@ No definition for %s category found"), "LC_TIME")); 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 + 1; - wstr = wstr ? wcschr (wstr + 1, L':') : NULL; /* end name */ - *wstr = L'\0'; - time->era_entries[idx].wformat = (uint32_t *) wstr + 1; + if (wstr != NULL) + { + time->era_entries[idx].wname = (uint32_t *) wstr + 1; + wstr = wcschr (wstr + 1, L':'); /* end name */ + if (wstr != NULL) + { + *wstr = L'\0'; + time->era_entries[idx].wformat = (uint32_t *) wstr + 1; + } + else + time->era_entries[idx].wname = + time->era_entries[idx].wformat = (uint32_t *) L""; + } + else + time->era_entries[idx].wname = + time->era_entries[idx].wformat = (uint32_t *) L""; } } @@ -532,7 +542,7 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap, * (2 + _NL_ITEM_INDEX (_NL_NUM_LC_TIME) + time->num_era - 1 + 2 * 99 - + 2 + time->num_era * 10 - 1)); + + 2 + time->num_era * 10)); struct locale_file data; uint32_t idx[_NL_ITEM_INDEX (_NL_NUM_LC_TIME)]; size_t cnt, last_idx, num, n; @@ -891,6 +901,12 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap, ++cnt; ++last_idx; + /* We must align the following data. */ + iov[2 + cnt].iov_base = (void *) "\0\0"; + iov[2 + cnt].iov_len = -idx[last_idx] & 3; + idx[last_idx] += -idx[last_idx] & 3; + ++cnt; + iov[2 + cnt].iov_base = (void *) time->wdate_fmt; iov[2 + cnt].iov_len = ((wcslen (iov[2 + cnt].iov_base) + 1) * sizeof (uint32_t)); @@ -906,7 +922,7 @@ time_output (struct localedef_t *locale, const struct charmap_t *charmap, assert (cnt == (_NL_ITEM_INDEX (_NL_NUM_LC_TIME) + time->num_era - 1 + 2 * 99 - + 2 + time->num_era * 10 - 1)); + + 2 + time->num_era * 10)); assert (last_idx == _NL_ITEM_INDEX (_NL_NUM_LC_TIME)); write_locale_data (output_path, LC_TIME, "LC_TIME", 2 + cnt, iov); diff --git a/locale/programs/linereader.c b/locale/programs/linereader.c index 233799a87d..6587f7305b 100644 --- a/locale/programs/linereader.c +++ b/locale/programs/linereader.c @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-2001, 2002, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1996-2005, 2006 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include @@ -216,12 +214,6 @@ lr_token (struct linereader *lr, const struct charmap_t *charmap, } while (isspace (ch)); - if (ch == EOF) - { - lr->token.tok = tok_eof; - return &lr->token; - }; - if (ch != lr->comment_char) break; @@ -347,8 +339,8 @@ get_toplvl_escape (struct linereader *lr) /* This is supposed to be a numeric value. We return the numerical value and the number of bytes. */ size_t start_idx = lr->idx - 1; - char *bytes = lr->token.val.charcode.bytes; - int nbytes = 0; + unsigned char *bytes = lr->token.val.charcode.bytes; + size_t nbytes = 0; int ch; do diff --git a/locale/programs/linereader.h b/locale/programs/linereader.h index 27043b2456..d4d7e830a6 100644 --- a/locale/programs/linereader.h +++ b/locale/programs/linereader.h @@ -1,21 +1,19 @@ -/* Copyright (C) 1996-2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper, . - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _LINEREADER_H #define _LINEREADER_H 1 diff --git a/locale/programs/locale-spec.c b/locale/programs/locale-spec.c index a1a3aba47f..6ad3d95efe 100644 --- a/locale/programs/locale-spec.c +++ b/locale/programs/locale-spec.c @@ -1,22 +1,20 @@ /* Handle special requests. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. + This program