]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Bug fixes in libgettextpo.
authorBruno Haible <bruno@clisp.org>
Sun, 6 Jun 2010 18:59:56 +0000 (20:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 6 Jun 2010 22:46:56 +0000 (00:46 +0200)
NEWS
gettext-tools/libgettextpo/ChangeLog
gettext-tools/libgettextpo/gettext-po.c
gettext-tools/src/ChangeLog
gettext-tools/src/msgfmt.c
gettext-tools/src/msgl-check.c
gettext-tools/src/msgl-check.h

diff --git a/NEWS b/NEWS
index e8651a324a4795545d7dc41d1f19ab637d3eeabb..549f554e0eeb74c7ab81b2817b4cf0b143357f48 100644 (file)
--- 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.
+\f
 Version 0.18.1 - June 2010
 
 * msggrep: A '$' anchor in a regular expression now also matches the end of
index 74e29c158f9f1dee53261f729142aad8af8315dc..cd0a5c4bdf625cc54d030a9f0e8a5ab35b9b4a5a 100644 (file)
@@ -1,3 +1,12 @@
+2010-06-06  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        Avoid link error in programs that use libgettextpo.
index e574840b4aedd7a98b0a7ecb1c8c62b3fb0abcc2..7eeeaafba9e4e844281cb35f8b47c6085bac4ae1 100644 (file)
@@ -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 <bruno@clisp.org>, 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);
     }
   }
 
index f3041b8f7b49ac5b6f2121f794fa20e5cca90d1d..c878f240c668416932656e2725c4aab2ee86f83c 100644 (file)
@@ -1,3 +1,11 @@
+2010-06-06  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        * gettext-0.18.1 released.
index 740f754b907073c3912efbe10fcf192f9b2f8379..447163dd2e3f9f4cb042871086b41e4e3ebb24d6 100644 (file)
@@ -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);
index cce42af0471455e1d20398c12bfc8f5fc9ca39bd..dea4c2dfbe8ddc9c68bd2a5d84a54588c4af9de9 100644 (file)
@@ -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 <drepper@gnu.ai.mit.edu>, 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,
index a4e1091cbd57d8b24ea0b4080555b6c808e0d7bb..f03300cc70c38126edf548f64b07ebbeec226939 100644 (file)
@@ -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 <bruno@clisp.org>, 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,