From: Daiki Ueno Date: Tue, 13 May 2014 06:16:39 +0000 (+0900) Subject: msgfmt: Accumulate errors when parsing the PO header X-Git-Tag: v0.19~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4aaaccd2;p=thirdparty%2Fgettext.git msgfmt: Accumulate errors when parsing the PO header Problem reported by Peter Eisentraut at . * msgl-check.c (check_header_entry): Return the number of errors. (check_message): Check the return value of check_header_entry. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index a6a238777..0a3a8a5f6 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,11 @@ +2014-05-13 Daiki Ueno + + msgfmt: Accumulate errors when parsing the PO header + Problem reported by Peter Eisentraut at + . + * msgl-check.c (check_header_entry): Return the number of errors. + (check_message): Check the return value of check_header_entry. + 2014-05-13 Felipe Sateler (tiny change) project-id: Add missing quotes around `pwd` for basename diff --git a/gettext-tools/src/msgl-check.c b/gettext-tools/src/msgl-check.c index f8d2d68f3..8f1ddd0dc 100644 --- a/gettext-tools/src/msgl-check.c +++ b/gettext-tools/src/msgl-check.c @@ -751,7 +751,7 @@ plural handling is a GNU gettext extension")); /* Perform miscellaneous checks on a header entry. */ -static void +static int check_header_entry (const message_ty *mp, const char *msgstr_string) { static const char *required_fields[] = @@ -770,6 +770,7 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) }; const size_t nfields = SIZEOF (required_fields); const size_t nrequiredfields = nfields - 1; + int seen_errors = 0; int cnt; for (cnt = 0; cnt < nfields; ++cnt) @@ -797,11 +798,12 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) p += strlen (default_values[cnt]); if (*p == '\0' || *p == '\n') { - char *msg = - xasprintf (_("header field '%s' still has the initial default value\n"), - field); - po_xerror (severity, mp, NULL, 0, 0, true, msg); - free (msg); + char *msg = + xasprintf (_("header field '%s' still has the initial default value\n"), + field); + po_xerror (severity, mp, NULL, 0, 0, true, msg); + free (msg); + seen_errors++; } } break; @@ -817,8 +819,10 @@ check_header_entry (const message_ty *mp, const char *msgstr_string) field); po_xerror (severity, mp, NULL, 0, 0, true, msg); free (msg); + seen_errors++; } } + return seen_errors; } @@ -834,18 +838,21 @@ check_message (const message_ty *mp, int check_compatibility, int check_accelerators, char accelerator_char) { + int seen_errors = 0; + if (check_header && is_header (mp)) - check_header_entry (mp, mp->msgstr); - - return check_pair (mp, - mp->msgid, msgid_pos, mp->msgid_plural, - mp->msgstr, mp->msgstr_len, - mp->is_format, - check_newlines, - check_format_strings, - distribution, - check_compatibility, - check_accelerators, accelerator_char); + seen_errors += check_header_entry (mp, mp->msgstr); + + seen_errors += check_pair (mp, + mp->msgid, msgid_pos, mp->msgid_plural, + mp->msgstr, mp->msgstr_len, + mp->is_format, + check_newlines, + check_format_strings, + distribution, + check_compatibility, + check_accelerators, accelerator_char); + return seen_errors; }