]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Add the file_name to the catalog reader structure.
authorBruno Haible <bruno@clisp.org>
Sun, 18 Jan 2009 17:02:08 +0000 (17:02 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:58 +0000 (12:15 +0200)
gettext-tools/src/ChangeLog
gettext-tools/src/msgfmt.c
gettext-tools/src/read-catalog.c
gettext-tools/src/read-catalog.h
gettext-tools/src/x-po.c

index d52616e78a1134a003ab96597138c1d5bd60d390..3043fe44d5c2c72345294fa82bc0ac85052413f0 100644 (file)
@@ -1,3 +1,13 @@
+2009-01-18  Bruno Haible  <bruno@clisp.org>
+
+       Fix a '(null)' in an error message. Bug present since gettext-0.16.
+       * read-catalog.h (DEFAULT_CATALOG_READER_TY): Add a file_name field.
+       * read-catalog.c (read_catalog_stream): Initialize it.
+       * x-po.c (extract): Likewise.
+       * msgfmt.c (read_catalog_file_msgfmt): Likewise.
+       (msgfmt_parse_debrief): Use the file_name field from the catalog reader
+       instead of gram_pos.file_name.
+
 2009-01-17  Bruno Haible  <bruno@clisp.org>
 
        Update after gnulib changed.
index 1037b5a729fe4fa8c42221b332b04deb656575d3..558afa9f7ca5f9a16299087e8d1c2eff098c6dda 100644 (file)
@@ -1,5 +1,5 @@
 /* Converts Uniforum style .po files to binary .mo files
-   Copyright (C) 1995-1998, 2000-2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2007, 2009 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
@@ -865,7 +865,7 @@ msgfmt_parse_debrief (abstract_catalog_reader_ty *that)
     {
       if (!this->has_header_entry)
        {
-         multiline_error (xasprintf ("%s: ", gram_pos.file_name),
+         multiline_error (xasprintf ("%s: ", this->file_name),
                           xasprintf (_("\
 warning: PO file header missing or invalid\n")));
          multiline_error (NULL,
@@ -878,7 +878,7 @@ warning: charset conversion will not work\n")));
             ignore a fuzzy header entry and even give an error on it, we
             give a warning, to increase operability with these older
             msgfmt versions.  This warning can go away in January 2003.  */
-         multiline_warning (xasprintf ("%s: ", gram_pos.file_name),
+         multiline_warning (xasprintf ("%s: ", this->file_name),
                             xasprintf (_("warning: PO file header fuzzy\n")));
          multiline_warning (NULL,
                             xasprintf (_("\
@@ -1083,6 +1083,7 @@ read_catalog_file_msgfmt (char *filename, catalog_input_format_ty input_syntax)
   pop->allow_domain_directives = true;
   pop->allow_duplicates = false;
   pop->allow_duplicates_if_same_msgstr = false;
+  pop->file_name = real_filename;
   pop->mdlp = NULL;
   pop->mlp = NULL;
   if (current_domain != NULL)
index f35ceb0d04cf33d06ed2074576c6073f3ed3b592..ee54345c348e11e22b0a976dad9aa499f5aa9788 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading PO files.
-   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
    This program is free software: you can redistribute it and/or modify
@@ -482,6 +482,7 @@ read_catalog_stream (FILE *fp, const char *real_filename,
   pop->allow_domain_directives = true;
   pop->allow_duplicates = allow_duplicates;
   pop->allow_duplicates_if_same_msgstr = false;
+  pop->file_name = real_filename;
   pop->mdlp = msgdomain_list_alloc (!pop->allow_duplicates);
   pop->mlp = msgdomain_list_sublist (pop->mdlp, pop->domain, true);
   if (input_syntax->produces_utf8)
index e6f592d3c3b6c196ad79196a89ba2ee55178ab8f..64522a24fee68ec24124f27a2dd60b7cffb5ab04 100644 (file)
@@ -1,5 +1,5 @@
 /* Reading PO files.
-   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
    This file was written by Bruno Haible <haible@clisp.cons.org>.
 
    This program is free software: you can redistribute it and/or modify
@@ -92,6 +92,9 @@ struct default_catalog_reader_class_ty
   /* If true, allow duplicates if they have the same translation.  */  \
   bool allow_duplicates_if_same_msgstr;                                        \
                                                                        \
+  /* File name used in error messages.  */                             \
+  const char *file_name;                                               \
+                                                                       \
   /* List of messages already appeared in the current file.  */                \
   msgdomain_list_ty *mdlp;                                             \
                                                                        \
index 9d9317246eea7eefe46bf4f92e366a8da6bc58ee..50876dd3008ac85358c87196bc68410ec5f2049c 100644 (file)
@@ -1,5 +1,5 @@
 /* xgettext PO and JavaProperties backends.
-   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -159,6 +159,7 @@ extract (FILE *fp,
   pop->allow_domain_directives = false;
   pop->allow_duplicates = false;
   pop->allow_duplicates_if_same_msgstr = true;
+  pop->file_name = real_filename;
   pop->mdlp = NULL;
   pop->mlp = mdlp->item[0]->messages;
   catalog_reader_parse ((abstract_catalog_reader_ty *) pop, fp, real_filename,