const char *name;
size_t len;
}
- known_fields[] =
- {
- { "Project-Id-Version:", sizeof ("Project-Id-Version:") - 1 },
- { "Report-Msgid-Bugs-To:", sizeof ("Report-Msgid-Bugs-To:") - 1 },
- { "POT-Creation-Date:", sizeof ("POT-Creation-Date:") - 1 },
- { "PO-Revision-Date:", sizeof ("PO-Revision-Date:") - 1 },
- { "Last-Translator:", sizeof ("Last-Translator:") - 1 },
- { "Language-Team:", sizeof ("Language-Team:") - 1 },
- { "Language:", sizeof ("Language:") - 1 },
- { "MIME-Version:", sizeof ("MIME-Version:") - 1 },
- { "Content-Type:", sizeof ("Content-Type:") - 1 },
- { "Content-Transfer-Encoding:",
- sizeof ("Content-Transfer-Encoding:") - 1 }
- };
+known_fields[] =
+ {
+ { "Project-Id-Version:", sizeof ("Project-Id-Version:") - 1 },
+ { "Report-Msgid-Bugs-To:", sizeof ("Report-Msgid-Bugs-To:") - 1 },
+ { "POT-Creation-Date:", sizeof ("POT-Creation-Date:") - 1 },
+ { "PO-Revision-Date:", sizeof ("PO-Revision-Date:") - 1 },
+ { "Last-Translator:", sizeof ("Last-Translator:") - 1 },
+ { "Language-Team:", sizeof ("Language-Team:") - 1 },
+ { "Language:", sizeof ("Language:") - 1 },
+ { "MIME-Version:", sizeof ("MIME-Version:") - 1 },
+ { "Content-Type:", sizeof ("Content-Type:") - 1 },
+ { "Content-Transfer-Encoding:", sizeof ("Content-Transfer-Encoding:") - 1 }
+ };
+
void
msgdomain_list_set_header_field (msgdomain_list_ty *mdlp,
message_list_delete_header_field (message_list_ty *mlp,
const char *field)
{
+ size_t field_len = strlen (field);
size_t j;
- int field_index;
- size_t k;
-
- /* Search the field in known_fields[]. */
- field_index = -1;
- for (k = 0; k < SIZEOF (known_fields); k++)
- if (strcmp (known_fields[k].name, field) == 0)
- {
- field_index = k;
- break;
- }
-
- size_t field_len;
- field_len = strlen (field);
/* Search the header entry. */
for (j = 0; j < mlp->nitems; j++)
/* Modify the header entry. */
const char *header = mp->msgstr;
- char *new_header =
- XCALLOC (strlen (header) + 1,
- char);
- /* Test whether the field already occurs in the header entry. */
+ /* Test whether the field occurs in the header entry. */
const char *h;
for (h = header; *h != '\0'; )
}
if (h != NULL && *h != '\0')
{
- /* Replace the field. */
+ /* Delete the field. */
+ char *new_header = XCALLOC (strlen (header) + 1, char);
+
char *p = new_header;
memcpy (p, header, h - header);
p += h - header;
if (h != NULL)
{
h++;
- stpcpy (p, h);
+ strcpy (p, h);
}
+ else
+ *p = '\0';
+
+ mp->msgstr = new_header;
}
- else
- {
- char *p = new_header;
- p = stpcpy (p, header);
- }
-
- mp->msgstr = new_header;
}
}
msgdomain_list_set_header_field (msgdomain_list_ty *mdlp,
const char *field, const char *value);
+/* Remove the given field from the header.
+ The FIELD name ends in a colon. */
extern void
- message_list_delete_header_field (message_list_ty *mlp, const char *field);
+ message_list_delete_header_field (message_list_ty *mlp,
+ const char *field);
#ifdef __cplusplus
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
message_list_delete_header_field (mlp, "POT-Creation-Date:");
-
+
/* Create a temporary directory where we can put the C# file.
A simple temporary file would also be possible but would require us to
define our own variant of mkstemp(): On one hand the functions mktemp(),
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
message_list_delete_header_field (mlp, "POT-Creation-Date:");
-
+
/* Create a single-element operands and run the bulk operation on it. */
operand.language = (char *) locale_name;
operand.mlp = mlp;
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
message_list_delete_header_field (mlp, "POT-Creation-Date:");
if (output_source)
#include "xsize.h"
#include "xalloc.h"
#include "xmalloca.h"
+#include "msgl-header.h"
#include "binary-io.h"
#include "fwriteerror.h"
#include "gettext.h"
-#include "read-catalog.h"
-#include "read-stringtable.h"
-#include "msgl-header.h"
#define _(str) gettext (str)
/* If no entry for this domain don't even create the file. */
if (mlp->nitems != 0)
{
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
+ message_list_delete_header_field (mlp, "POT-Creation-Date:");
+
if (strcmp (domain_name, "-") == 0)
{
output_file = stdout;
if (output_file != NULL)
{
- message_list_delete_header_field (mlp, "POT-Creation-Date:");
write_table (output_file, mlp);
/* Make sure nothing went wrong. */
}
}
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
+ message_list_delete_header_field (mlp, "POT-Creation-Date:");
+
if (strcmp (domain_name, "-") == 0)
{
output_file = stdout;
if (output_file != NULL)
{
- message_list_delete_header_field (mlp, "POT-Creation-Date:");
write_qm (output_file, mlp);
/* Make sure nothing went wrong. */
const char *domain_name,
const char *file_name)
{
- message_list_delete_header_field (mlp, "POT-Creation-Date:");
-
/* If no entry for this domain don't even create the file. */
if (mlp->nitems != 0)
{
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
+ message_list_delete_header_field (mlp, "POT-Creation-Date:");
+
/* Execute the WriteResource program. */
{
const char *args[2];
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
+ message_list_delete_header_field (mlp, "POT-Creation-Date:");
+
/* Now create the file. */
{
size_t len;
return 1;
}
- message_list_delete_header_field (mlp, "POT-Creation-Date:");
write_msg (output_file, mlp, frobbed_locale_name);
/* Make sure nothing went wrong. */
/* Convert the messages to Unicode. */
iconv_message_list (mlp, canon_encoding, po_charset_utf8, NULL);
+ /* Support for "reproducible builds": Delete information that may vary
+ between builds in the same conditions. */
message_list_delete_header_field (mlp, "POT-Creation-Date:");
-
+
/* Create a single-element operands and run the bulk operation on it. */
operand.language = (char *) locale_name;
operand.mlp = mlp;
#! /bin/sh
. "${srcdir=.}/init.sh"; path_prepend_ . ../src
-# Test accelerators.
+# Test that PO files that differ only in the POT-Creation-Date yield the
+# exact same .mo file.
cat <<\EOF > mf-19-1.po
# SOME DESCRIPTIVE TITLE.
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-msgid "pen &File"
-msgstr "pen File"
+msgid "Open &File"
+msgstr "Open File"
-msgid "how _Help"
-msgstr "how Help"
+msgid "Show _Help"
+msgstr "Show Help"
EOF
-
cat <<\EOF > mf-19-2.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-msgid "pen &File"
-msgstr "pen File"
+msgid "Open &File"
+msgstr "Open File"
-msgid "how _Help"
-msgstr "how Help"
+msgid "Show _Help"
+msgstr "Show Help"
EOF
-
: ${MSGFMT=msgfmt}
${MSGFMT} -o mf-19-1.mo mf-19-1.po 2>/dev/null
test $? = 0 || { Exit 1; }