From: Bruno Haible Date: Sun, 6 Jun 2010 18:59:56 +0000 (+0200) Subject: Bug fixes in libgettextpo. X-Git-Tag: v0.18.2~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97ff63cecd65a951386ef898078bb5a547309714;p=thirdparty%2Fgettext.git Bug fixes in libgettextpo. --- diff --git a/NEWS b/NEWS index e8651a324..549f554e0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +Version 0.18.2 - July 2010 + +* libgettextpo library: + - The initial msgstr of a new message is now "", not NULL. + - Bug fixes in the functions po_message_is_range, po_file_check_all, + po_message_check_all. + Version 0.18.1 - June 2010 * msggrep: A '$' anchor in a regular expression now also matches the end of diff --git a/gettext-tools/libgettextpo/ChangeLog b/gettext-tools/libgettextpo/ChangeLog index 74e29c158..cd0a5c4bd 100644 --- a/gettext-tools/libgettextpo/ChangeLog +++ b/gettext-tools/libgettextpo/ChangeLog @@ -1,3 +1,12 @@ +2010-06-06 Bruno Haible + + Bug fixes in libgettextpo. + * gettext-po.c (po_message_create): Initialize msgstr with the empty + string, not with NULL. + (po_message_is_range): Assign to output parameters correctly. + (po_file_check_all, po_message_check_all): Have check_message_list + ignore untranslated and fuzzy messages. + 2010-06-06 Bruno Haible Avoid link error in programs that use libgettextpo. diff --git a/gettext-tools/libgettextpo/gettext-po.c b/gettext-tools/libgettextpo/gettext-po.c index e574840b4..7eeeaafba 100644 --- a/gettext-tools/libgettextpo/gettext-po.c +++ b/gettext-tools/libgettextpo/gettext-po.c @@ -1,5 +1,5 @@ /* Public API for GNU gettext PO files. - Copyright (C) 2003-2009 Free Software Foundation, Inc. + Copyright (C) 2003-2010 Free Software Foundation, Inc. Written by Bruno Haible , 2003. This program is free software: you can redistribute it and/or modify @@ -522,7 +522,7 @@ po_message_create (void) { lex_pos_ty pos = { NULL, 0 }; - return (po_message_t) message_alloc (NULL, NULL, NULL, NULL, 0, &pos); + return (po_message_t) message_alloc (NULL, NULL, NULL, xstrdup (""), 1, &pos); } @@ -1103,7 +1103,7 @@ po_message_is_range (po_message_t message, int *minp, int *maxp) if (has_range_p (mp->range)) { *minp = mp->range.min; - *minp = mp->range.max; + *maxp = mp->range.max; return 1; } else @@ -1215,7 +1215,7 @@ po_file_check_all (po_file_t file, po_xerror_handler_t handler) mdlp = file->mdlp; for (k = 0; k < mdlp->nitems; k++) - check_message_list (mdlp->item[k]->messages, 1, 1, 1, 0, 0, 0); + check_message_list (mdlp->item[k]->messages, 1, 1, 1, 1, 1, 0, 0, 0); /* Restore error handler. */ po_xerror = textmode_xerror; @@ -1276,7 +1276,7 @@ po_message_check_all (po_message_t message, po_message_iterator_t iterator, if (mp != header) message_list_append (&ml, mp); - check_message_list (&ml, 1, 1, 1, 0, 0, 0); + check_message_list (&ml, 1, 1, 1, 1, 1, 0, 0, 0); } } diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index f3041b8f7..c878f240c 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,11 @@ +2010-06-06 Bruno Haible + + Bug fixes in libgettextpo. + * msgl-check.h (check_message_list): Add ignore_untranslated_messages, + ignore_fuzzy_messages arguments. + * msgl-check.c (check_plural, check_message_list): Likewise. + * msgfmt.c (main): Update. + 2010-06-04 Bruno Haible * gettext-0.18.1 released. diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 740f754b9..447163dd2 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -530,6 +530,10 @@ There is NO WARRANTY, to the extent permitted by law.\n\ for (domain = domain_list; domain != NULL; domain = domain->next) nerrors += check_message_list (domain->mlp, + /* Untranslated and fuzzy messages have already + been dealt with during parsing, see below in + msgfmt_frob_new_message. */ + 0, 0, 1, check_format_strings, check_header, check_compatibility, check_accelerators, accelerator_char); diff --git a/gettext-tools/src/msgl-check.c b/gettext-tools/src/msgl-check.c index cce42af04..dea4c2dfb 100644 --- a/gettext-tools/src/msgl-check.c +++ b/gettext-tools/src/msgl-check.c @@ -1,5 +1,5 @@ /* Checking of messages in PO files. - Copyright (C) 1995-1998, 2000-2008 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2008, 2010 Free Software Foundation, Inc. Written by Ulrich Drepper , April 1995. This program is free software: you can redistribute it and/or modify @@ -280,7 +280,10 @@ plural_help (const char *nullentry) If no errors, returns in *DISTRIBUTION information about the plural_eval values distribution. */ static int -check_plural (message_list_ty *mlp, struct plural_distribution *distributionp) +check_plural (message_list_ty *mlp, + int ignore_untranslated_messages, + int ignore_fuzzy_messages, + struct plural_distribution *distributionp) { int seen_errors = 0; const message_ty *has_plural; @@ -306,7 +309,10 @@ check_plural (message_list_ty *mlp, struct plural_distribution *distributionp) { message_ty *mp = mlp->item[j]; - if (!mp->obsolete && mp->msgid_plural != NULL) + if (!mp->obsolete + && !(ignore_untranslated_messages && mp->msgstr[0] == '\0') + && !(ignore_fuzzy_messages && (mp->is_fuzzy && !is_header (mp))) + && mp->msgid_plural != NULL) { const char *p; const char *p_end; @@ -862,6 +868,8 @@ check_message (const message_ty *mp, Return the number of errors that were seen. */ int check_message_list (message_list_ty *mlp, + int ignore_untranslated_messages, + int ignore_fuzzy_messages, int check_newlines, int check_format_strings, int check_header, @@ -878,13 +886,16 @@ check_message_list (message_list_ty *mlp, distribution.histogram = NULL; if (check_header) - seen_errors += check_plural (mlp, &distribution); + seen_errors += check_plural (mlp, ignore_untranslated_messages, + ignore_fuzzy_messages, &distribution); for (j = 0; j < mlp->nitems; j++) { message_ty *mp = mlp->item[j]; - if (!mp->obsolete) + if (!mp->obsolete + && !(ignore_untranslated_messages && mp->msgstr[0] == '\0') + && !(ignore_fuzzy_messages && (mp->is_fuzzy && !is_header (mp)))) seen_errors += check_message (mp, &mp->pos, check_newlines, check_format_strings, diff --git a/gettext-tools/src/msgl-check.h b/gettext-tools/src/msgl-check.h index a4e1091cb..f03300cc7 100644 --- a/gettext-tools/src/msgl-check.h +++ b/gettext-tools/src/msgl-check.h @@ -1,5 +1,5 @@ /* Checking of messages in PO files. - Copyright (C) 2005, 2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2008, 2010 Free Software Foundation, Inc. Written by Bruno Haible , 2005. This program is free software: you can redistribute it and/or modify @@ -52,6 +52,8 @@ extern int check_message (const message_ty *mp, /* Perform all checks on a message list. Return the number of errors that were seen. */ extern int check_message_list (message_list_ty *mlp, + int ignore_untranslated_messages, + int ignore_fuzzy_messages, int check_newlines, int check_format_strings, int check_header,