From: Bruno Haible Date: Sun, 18 Jan 2009 17:02:08 +0000 (+0000) Subject: Add the file_name to the catalog reader structure. X-Git-Tag: v0.18~268 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ae04cda9d8955105abd842aed4fbee567e80a26;p=thirdparty%2Fgettext.git Add the file_name to the catalog reader structure. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index d52616e78..3043fe44d 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,13 @@ +2009-01-18 Bruno Haible + + 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 Update after gnulib changed. diff --git a/gettext-tools/src/msgfmt.c b/gettext-tools/src/msgfmt.c index 1037b5a72..558afa9f7 100644 --- a/gettext-tools/src/msgfmt.c +++ b/gettext-tools/src/msgfmt.c @@ -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 , 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) diff --git a/gettext-tools/src/read-catalog.c b/gettext-tools/src/read-catalog.c index f35ceb0d0..ee54345c3 100644 --- a/gettext-tools/src/read-catalog.c +++ b/gettext-tools/src/read-catalog.c @@ -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 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) diff --git a/gettext-tools/src/read-catalog.h b/gettext-tools/src/read-catalog.h index e6f592d3c..64522a24f 100644 --- a/gettext-tools/src/read-catalog.h +++ b/gettext-tools/src/read-catalog.h @@ -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 . 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; \ \ diff --git a/gettext-tools/src/x-po.c b/gettext-tools/src/x-po.c index 9d9317246..50876dd30 100644 --- a/gettext-tools/src/x-po.c +++ b/gettext-tools/src/x-po.c @@ -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 @@ -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,