texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[7859] parsetexi upgrade arguments to XS functions to UTF-8


From: gavinsmith0123
Subject: [7859] parsetexi upgrade arguments to XS functions to UTF-8
Date: Sun, 25 Jun 2017 17:46:27 -0400 (EDT)

Revision: 7859
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7859
Author:   gavin
Date:     2017-06-25 17:46:27 -0400 (Sun, 25 Jun 2017)
Log Message:
-----------
parsetexi upgrade arguments to XS functions to UTF-8

Modified Paths:
--------------
    trunk/tp/parsetexi/Parsetexi.pm
    trunk/tp/parsetexi/api.c
    trunk/tp/parsetexi/input.c

Modified: trunk/tp/parsetexi/Parsetexi.pm
===================================================================
--- trunk/tp/parsetexi/Parsetexi.pm     2017-06-25 19:24:55 UTC (rev 7858)
+++ trunk/tp/parsetexi/Parsetexi.pm     2017-06-25 21:46:27 UTC (rev 7859)
@@ -381,6 +381,11 @@
     return undef if (!defined($text));
 
     $self = parser() if (!defined($self));
+
+    # make sure that internal byte buffer is in UTF-8 before we pass
+    # it in to the XS code.
+    utf8::upgrade($text);
+
     parse_text($text);
     my $tree = build_texinfo_tree ();
     my $INDEX_NAMES = build_index_data ();
@@ -411,6 +416,7 @@
     return undef if (!defined($text));
 
     $self = parser() if (!defined($self));
+    utf8::upgrade($text);
     parse_string($text);
     my $tree = build_texinfo_tree ();
     return $tree;

Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c    2017-06-25 19:24:55 UTC (rev 7858)
+++ trunk/tp/parsetexi/api.c    2017-06-25 21:46:27 UTC (rev 7859)
@@ -79,7 +79,7 @@
 }
 
 /* Set ROOT to root of tree obtained by parsing the Texinfo code in STRING.
-   Used for parse_texi_line. */
+   STRING should be a UTF-8 buffer.  Used for parse_texi_line. */
 void
 parse_string (char *string)
 {
@@ -89,7 +89,7 @@
   Root = parse_texi (root);
 }
 
-/* Used for parse_texi_text. */
+/* Used for parse_texi_text.  STRING should be a UTF-8 buffer. */
 void
 parse_text (char *string)
 {

Modified: trunk/tp/parsetexi/input.c
===================================================================
--- trunk/tp/parsetexi/input.c  2017-06-25 19:24:55 UTC (rev 7858)
+++ trunk/tp/parsetexi/input.c  2017-06-25 21:46:27 UTC (rev 7859)
@@ -348,7 +348,7 @@
 
           line_nr = i->line_nr;
 
-          return convert_to_utf8 (new, 0); // i->input_encoding);
+          return new;
 
           break;
         case IN_file: // 1911
@@ -431,9 +431,9 @@
   input_number++;
 }
 
-/* Store TEXT as a source for Texinfo content.  TEXT will be later free'd
-   and must be allocated on the heap.  MACRO is the name of a macro that
-   the text came from. */
+/* Store TEXT as a source for Texinfo content.  TEXT should be a UTF-8
+   string.  TEXT will be later free'd and must be allocated on the heap.
+   MACRO is the name of a macro that the text came from. */
 void
 input_push_text (char *text, char *macro)
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]