diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-12-01 13:39:30 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-12-01 13:44:49 +0900 |
commit | 6aad665c4854f6dd4039bdb592f95037e9c30cb7 (patch) | |
tree | bf4cafa0e218dcde74522c653bf875a84075b603 /gettext-tools | |
parent | a177266e925c28d954c1e181c90507a01b7ff35a (diff) | |
download | external_gettext-6aad665c4854f6dd4039bdb592f95037e9c30cb7.zip external_gettext-6aad665c4854f6dd4039bdb592f95037e9c30cb7.tar.gz external_gettext-6aad665c4854f6dd4039bdb592f95037e9c30cb7.tar.bz2 |
c#: Recognize Unicode surrogate character pair
* x-csharp.c (accumulate_escaped): Change the first argument type
from 'struct string_buffer *' to 'struct mixed_string_buffer *',
for Unicode surrogate character pair handling; all callers
changed. Reported by Petr Kadlec at:
<https://savannah.gnu.org/bugs/?32505>.
Diffstat (limited to 'gettext-tools')
-rw-r--r-- | gettext-tools/src/ChangeLog | 9 | ||||
-rw-r--r-- | gettext-tools/src/x-csharp.c | 22 |
2 files changed, 19 insertions, 12 deletions
diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index e45bbc5..4fb7bdb 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,12 @@ +2014-12-01 Daiki Ueno <ueno@gnu.org> + + c#: Recognize Unicode surrogate character pair + * x-csharp.c (accumulate_escaped): Change the first argument type + from 'struct string_buffer *' to 'struct mixed_string_buffer *', + for Unicode surrogate character pair handling; all callers + changed. Reported by Petr Kadlec at: + <https://savannah.gnu.org/bugs/?32505>. + 2014-11-28 Daiki Ueno <ueno@gnu.org> * msgfilter.c (prepare_read): Simplify the last commit 06e206f5, diff --git a/gettext-tools/src/x-csharp.c b/gettext-tools/src/x-csharp.c index ffadb0d..5091c3b 100644 --- a/gettext-tools/src/x-csharp.c +++ b/gettext-tools/src/x-csharp.c @@ -1491,7 +1491,7 @@ do_getc_escaped () /* Read a regular string literal or character literal. See ECMA-334 sections 9.4.4.4., 9.4.4.5. */ static void -accumulate_escaped (struct string_buffer *literal, int delimiter) +accumulate_escaped (struct mixed_string_buffer *literal, int delimiter) { int c; @@ -1516,7 +1516,8 @@ accumulate_escaped (struct string_buffer *literal, int delimiter) } if (c == '\\') c = do_getc_escaped (); - string_buffer_append_unicode (literal, c); + if (literal) + mixed_string_buffer_append_unicode (literal, c); } } @@ -1637,13 +1638,14 @@ phase6_get (token_ty *tp) case '"': /* Regular string literal. */ { - struct string_buffer literal; + struct mixed_string_buffer *literal; lexical_context = lc_string; - init_string_buffer (&literal); - accumulate_escaped (&literal, '"'); - tp->string = xstrdup (string_buffer_result (&literal)); - free_string_buffer (&literal); + literal = mixed_string_buffer_alloc (lexical_context, + logical_file_name, + logical_line_number); + accumulate_escaped (literal, '"'); + tp->string = mixed_string_buffer_done (literal); tp->comment = add_reference (savable_comment); lexical_context = lc_outside; tp->type = token_type_string_literal; @@ -1653,11 +1655,7 @@ phase6_get (token_ty *tp) case '\'': /* Character literal. */ { - struct string_buffer literal; - - init_string_buffer (&literal); - accumulate_escaped (&literal, '\''); - free_string_buffer (&literal); + accumulate_escaped (NULL, '\''); tp->type = token_type_other; return; } |