[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5705] calculate pointer to anchor correctly
From: |
Gavin D. Smith |
Subject: |
[5705] calculate pointer to anchor correctly |
Date: |
Fri, 11 Jul 2014 09:52:24 +0000 |
Revision: 5705
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5705
Author: gavin
Date: 2014-07-11 09:52:22 +0000 (Fri, 11 Jul 2014)
Log Message:
-----------
calculate pointer to anchor correctly
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/info-utils.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2014-07-07 17:45:16 UTC (rev 5704)
+++ trunk/ChangeLog 2014-07-11 09:52:22 UTC (rev 5705)
@@ -1,3 +1,10 @@
+2014-07-11 Gavin Smith <address@hidden>
+
+ * info/info-utils.c (nodestart): Removed.
+ (node_offset): New variable.
+ (scan_node_contents): Initialize node_offset.
+ (copy_input_to_output): Calculate anchor pointer correctly.
+
2014-07-07 Karl Berry <address@hidden>
* util/texi2dvi (run_recode): remove fn (and call) and
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2014-07-07 17:45:16 UTC (rev 5704)
+++ trunk/info/info-utils.c 2014-07-11 09:52:22 UTC (rev 5705)
@@ -590,7 +590,7 @@
/* **************************************************************** */
/* */
-/* Scanning node */
+/* Scanning node */
/* */
/* **************************************************************** */
@@ -607,8 +607,11 @@
struct text_buffer output_buf;
+/* Pointer into a tags table for the file to the anchor we need to adjust as
+ a result of byte counts changing due to character encoding conversion or
+ inserted/deleted text. */
static NODE **anchor_to_adjust;
-static int nodestart;
+static int node_offset; /* Offset within file buffer of first byte of node. */
/* Difference between the number of bytes input in the file and
bytes output. If !rewrite_p, this should stay 0. */
@@ -958,8 +961,8 @@
if (anchor_to_adjust)
{
- char *first_anchor =
- input_start + (*anchor_to_adjust)->nodestart;
+ char *first_anchor = input_start - node_offset
+ + (*anchor_to_adjust)->nodestart;
/* If there is an anchor in the input: */
if (first_anchor <= inptr + bytes_left)
@@ -981,7 +984,7 @@
/* Check if we have gone past any anchors and
adjust with output_bytes_difference. */
if (anchor_to_adjust)
- while ((*anchor_to_adjust)->nodestart - nodestart
+ while ((*anchor_to_adjust)->nodestart - node_offset
<= inptr - input_start)
{
(*anchor_to_adjust)->nodestart -= output_bytes_difference;
@@ -1555,6 +1558,9 @@
anchor_to_adjust = 0;
else if (*anchor_to_adjust && (*anchor_to_adjust)->nodelen != 0)
anchor_to_adjust = 0;
+
+ node_offset = node->nodestart
+ + skip_node_separator (fb->contents + node->nodestart);
}
else
anchor_to_adjust = 0;
@@ -1570,7 +1576,6 @@
inptr = node->contents;
input_start = node->contents;
input_length = node->nodelen;
- nodestart = node->nodestart;
parse_top_node_line (node);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5705] calculate pointer to anchor correctly,
Gavin D. Smith <=