diff options
author | Bruno Haible <bruno@clisp.org> | 2001-01-11 13:28:23 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2001-01-11 13:28:23 +0000 |
commit | b479432a465fabfc80e6edfbd5a79b70987c283c (patch) | |
tree | b9e46ba74502e94bdcb58715bbfe9123520453e1 | |
parent | 42f53ec75e7de42861d0e886f347b441ed56f642 (diff) | |
download | external_gettext-b479432a465fabfc80e6edfbd5a79b70987c283c.zip external_gettext-b479432a465fabfc80e6edfbd5a79b70987c283c.tar.gz external_gettext-b479432a465fabfc80e6edfbd5a79b70987c283c.tar.bz2 |
Consistently include the terminating NUL in the size of strings.
-rw-r--r-- | lib/ChangeLog | 4 | ||||
-rw-r--r-- | lib/hash.c | 4 | ||||
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/msgfmt.c | 6 | ||||
-rw-r--r-- | src/xget-lex.c | 16 |
5 files changed, 28 insertions, 8 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 8823b2f..13af124 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -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. @@ -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; } diff --git a/src/ChangeLog b/src/ChangeLog index 28faa9f..7d4beb5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 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". 2000-12-31 Bruno Haible <haible@clisp.cons.org> diff --git a/src/msgfmt.c b/src/msgfmt.c index 931fd22..19b69c1 100644 --- a/src/msgfmt.c +++ b/src/msgfmt.c @@ -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 (¤t_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 (¤t_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, _("\ diff --git a/src/xget-lex.c b/src/xget-lex.c index 1ad1d6f..9be4aa1 100644 --- a/src/xget-lex.c +++ b/src/xget-lex.c @@ -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); } } |