+2014-05-13 Daiki Ueno <ueno@gnu.org>
+
+ msgfmt: Accumulate errors when parsing the PO header
+ Problem reported by Peter Eisentraut at
+ <https://savannah.gnu.org/bugs/?40262>.
+ * 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 <fsateler@debian.org> (tiny change)
project-id: Add missing quotes around `pwd` for basename
/* 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[] =
};
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)
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;
field);
po_xerror (severity, mp, NULL, 0, 0, true, msg);
free (msg);
+ seen_errors++;
}
}
+ return seen_errors;
}
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;
}