]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Fix recognition of header fields.
authorBruno Haible <bruno@clisp.org>
Tue, 27 May 2008 00:09:10 +0000 (00:09 +0000)
committerBruno Haible <bruno@clisp.org>
Tue, 23 Jun 2009 10:15:43 +0000 (12:15 +0200)
gettext-tools/libgettextpo/ChangeLog
gettext-tools/libgettextpo/gettext-po.c
gettext-tools/src/ChangeLog
gettext-tools/src/msginit.c

index c76bb164fd83981f091497e30cf3e7d141fcd4f7..2470de9f475046c8627b94833eb36bdb6b25c049 100644 (file)
@@ -1,3 +1,9 @@
+2008-05-26  Bruno Haible  <bruno@clisp.org>
+
+       * gettext-po.c (po_header_field, po_header_set_field): Recognize a
+       field also if there is no space after the ':'.
+       Reported by Nacho <nacho.resa@gmail.com>.
+
 2007-11-07  Bruno Haible  <bruno@clisp.org>
 
        * gettext-0.17 released.
index cb5091b3565bc36e3125323b0e3cfce8161c2501..d4610c2e3ccdf80f2e19c7240d53ea25f459091a 100644 (file)
@@ -1,5 +1,5 @@
 /* Public API for GNU gettext PO files.
-   Copyright (C) 2003-2007 Free Software Foundation, Inc.
+   Copyright (C) 2003-2008 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2003.
 
    This program is free software: you can redistribute it and/or modify
@@ -341,14 +341,15 @@ po_header_field (const char *header, const char *field)
 
   for (line = header;;)
     {
-      if (strncmp (line, field, field_len) == 0
-         && line[field_len] == ':' && line[field_len + 1] == ' ')
+      if (strncmp (line, field, field_len) == 0 && line[field_len] == ':')
        {
          const char *value_start;
          const char *value_end;
          char *value;
 
-         value_start = line + field_len + 2;
+         value_start = line + field_len + 1;
+         if (*value_start == ' ')
+           value_start++;
          value_end = strchr (value_start, '\n');
          if (value_end == NULL)
            value_end = value_start + strlen (value_start);
@@ -387,8 +388,7 @@ po_header_set_field (const char *header, const char *field, const char *value)
 
     for (line = header;;)
       {
-       if (strncmp (line, field, field_len) == 0
-           && line[field_len] == ':' && line[field_len + 1] == ' ')
+       if (strncmp (line, field, field_len) == 0 && line[field_len] == ':')
          {
            const char *oldvalue_start;
            const char *oldvalue_end;
@@ -398,7 +398,9 @@ po_header_set_field (const char *header, const char *field, const char *value)
            size_t result_len;
            char *result;
 
-           oldvalue_start = line + field_len + 2;
+           oldvalue_start = line + field_len + 1;
+           if (*oldvalue_start == ' ')
+             oldvalue_start++;
            oldvalue_end = strchr (oldvalue_start, '\n');
            if (oldvalue_end == NULL)
              oldvalue_end = oldvalue_start + strlen (oldvalue_start);
index 5be1915b3f91743396e3a8dde2965d8ff7a0bc3d..0a26be40d9834574de7b88d875b19e3b695e5695 100644 (file)
@@ -1,6 +1,12 @@
+2008-05-26  Bruno Haible  <bruno@clisp.org>
+
+       * msginit.c (get_field, put_field): Recognize a field also if there is
+       no space after the ':'.
+       Reported by Nacho <nacho.resa@gmail.com>.
+
 2008-05-16  Bruno Haible  <bruno@clisp.org>
 
-       * gettext-tools/src/msgl-iconv.c (iconvable_prev_msgid): Fix typo.
+       * msgl-iconv.c (iconvable_prev_msgid): Fix typo.
        Reported by Karl Eichwalder <ke@novell.com>
        via Philipp Thomas <pth@novell.com>
        at <https://bugzilla.novell.com/show_bug.cgi?id=391372>.
index 2589e78a6e982cb39c67a946e8231417ee9a9215..6e211badcfc545fd319a0d8ed3f6ec197e930434 100644 (file)
@@ -1323,14 +1323,15 @@ get_field (const char *header, const char *field)
 
   for (line = header;;)
     {
-      if (strncmp (line, field, len) == 0
-         && line[len] == ':' && line[len + 1] == ' ')
+      if (strncmp (line, field, len) == 0 && line[len] == ':')
        {
          const char *value_start;
          const char *value_end;
          char *value;
 
-         value_start = line + len + 2;
+         value_start = line + len + 1;
+         if (*value_start == ' ')
+           value_start++;
          value_end = strchr (value_start, '\n');
          if (value_end == NULL)
            value_end = value_start + strlen (value_start);
@@ -1363,13 +1364,14 @@ put_field (const char *old_header, const char *field, const char *value)
 
   for (line = old_header;;)
     {
-      if (strncmp (line, field, len) == 0
-         && line[len] == ':' && line[len + 1] == ' ')
+      if (strncmp (line, field, len) == 0 && line[len] == ':')
        {
          const char *value_start;
          const char *value_end;
 
-         value_start = line + len + 2;
+         value_start = line + len + 1;
+         if (*value_start == ' ')
+           value_start++;
          value_end = strchr (value_start, '\n');
          if (value_end == NULL)
            value_end = value_start + strlen (value_start);