]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Consistently include the terminating NUL in the size of strings.
authorBruno Haible <bruno@clisp.org>
Thu, 11 Jan 2001 13:28:23 +0000 (13:28 +0000)
committerBruno Haible <bruno@clisp.org>
Thu, 11 Jan 2001 13:28:23 +0000 (13:28 +0000)
lib/ChangeLog
lib/hash.c
src/ChangeLog
src/msgfmt.c
src/xget-lex.c

index 8823b2fbcf63b697520f5e3799fc161e6b766931..13af1249b8fb0877c781f9dc590f9f15dd0dc6a4 100644 (file)
@@ -1,3 +1,7 @@
+2000-12-31  Bruno Haible  <haible@clisp.cons.org>
+
+       * hash.c (insert_entry): Use obstack_copy instead of obstack_copy0.
+
 2000-12-30  Bruno Haible  <haible@clisp.cons.org>
 
        * system.h (open_po_file): Remove declaration.
index d848d6ecb5d703c554cde00642628c62e53146b8..705848b18e25f9f7a01c04ae8bd774622e408736 100644 (file)
@@ -1,5 +1,5 @@
 /* hash - implement simple hashing table with string based keys.
-   Copyright (C) 1994, 1995, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1994, 1995, 2000, 2001 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, October 1994.
 
    This program is free software; you can redistribute it and/or modify
@@ -141,7 +141,7 @@ insert_entry (htab, key, keylen, data)
   else
     {
       /* An empty bucket has been found.  */
-      insert_entry_2 (htab, obstack_copy0 (&htab->mem_pool, key, keylen),
+      insert_entry_2 (htab, obstack_copy (&htab->mem_pool, key, keylen),
                      keylen, hval, idx, data);
       return 0;
     }
index 28faa9f03ebd9000abe16f38bfd62f35c4ca65ac..7d4beb53194cd02e53cc53d6cf249ec90024b013 100644 (file)
@@ -1,3 +1,9 @@
+2000-12-31  Bruno Haible  <haible@clisp.cons.org>
+
+       * msgfmt.c (format_directive_message): Pass to insert_entry and
+       find_entry the length including the terminating NUL.
+       * xget-lex.c (xgettext_lex, xgettext_lex_keyword): Likewise.
+
 2000-12-31  Bruno Haible  <haible@clisp.cons.org>
 
        * msgunfmt.c (read_mo_file): Recognize "/dev/stdin", not "/dev/stdout".
index 931fd2216f735a0ce3873ae3d50c55c96f86835a..19b69c199bf845cca109852dcf5c770176b4594c 100644 (file)
@@ -1,5 +1,5 @@
 /* Converts Uniforum style .po files to binary .mo files
-   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, April 1995.
 
    This program is free software; you can redistribute it and/or modify
@@ -624,7 +624,7 @@ some header fields still have the initial default value"));
   /* We insert the ID/string pair into the hashing table.  But we have
      to take care for dublicates.  */
   if (insert_entry (&current_domain->symbol_tab, msgid_string,
-                   strlen (msgid_string), entry))
+                   strlen (msgid_string) + 1, entry))
     {
       /* We don't need the just constructed entry.  */
       free (entry);
@@ -635,7 +635,7 @@ some header fields still have the initial default value"));
             translations are different.  Tell the user the old
             definition for reference.  */
          find_entry (&current_domain->symbol_tab, msgid_string,
-                     strlen (msgid_string), (void **) &entry);
+                     strlen (msgid_string) + 1, (void **) &entry);
          if (0 != strcmp(msgstr_string, entry->msgstr))
            {
              po_gram_error_at_line (msgid_pos, _("\
index 1ad1d6f92ce679a87351359dfaacbf9eb03ef320..9be4aa18eeda1ec89159dba256fd397d39661267 100644 (file)
@@ -1,5 +1,5 @@
 /* GNU gettext - internationalization aids
-   Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998, 2000, 2001 Free Software Foundation, Inc.
 
    This file was written by Peter Miller <millerp@canb.auug.org.au>
 
@@ -1208,7 +1208,7 @@ xgettext_lex (tp)
              default_keywords = 0;
            }
 
-         if (find_entry (&keywords, token.string, strlen (token.string),
+         if (find_entry (&keywords, token.string, strlen (token.string) + 1,
                          &keyword_value)
              == 0)
            {
@@ -1277,16 +1277,26 @@ xgettext_lex_keyword (name)
       sp = strchr (name, ':');
       if (sp)
        {
+         /* Make a temporary copy of 'name' up to 'sp', because
+            insert_entry() expects a NUL terminated string.  */
+         char *name_copy;
+
          len = sp - name;
+         name_copy = (char *) alloca (len + 1);
+         memcpy (name_copy, name, len);
+         name_copy[len] = '\0';
+         name = name_copy;
+
          argnum = atoi (sp + 1);
        }
       else
        {
          len = strlen (name);
+
          argnum = 1;
        }
 
-      insert_entry (&keywords, name, len, (void *) (long) argnum);
+      insert_entry (&keywords, name, len + 1, (void *) (long) argnum);
     }
 }