Revision: 557
http://www.exim.org/viewvc/pcre2?view=rev&revision=557
Author: ph10
Date: 2016-10-05 17:53:34 +0100 (Wed, 05 Oct 2016)
Log Message:
-----------
Fix callout display bug in pcre2test.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2test.c
code/trunk/testdata/testinput5
code/trunk/testdata/testoutput5
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2016-10-05 16:06:10 UTC (rev 556)
+++ code/trunk/ChangeLog 2016-10-05 16:53:34 UTC (rev 557)
@@ -54,7 +54,11 @@
7. Automatic callouts are no longer generated before and after callouts in the
pattern.
+8. When pcre2test was outputing information from a callout, the caret indicator
+for the current position in the subject line was incorrect if it was after an
+escape sequence for a character whose code point was greater than \x{ff}.
+
Version 10.22 29-July-2016
--------------------------
Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c 2016-10-05 16:06:10 UTC (rev 556)
+++ code/trunk/src/pcre2test.c 2016-10-05 16:53:34 UTC (rev 557)
@@ -2528,6 +2528,8 @@
pchar(uint32_t c, BOOL utf, FILE *f)
{
int n = 0;
+char tempbuffer[16];
+
if (PRINTOK(c))
{
if (f != NULL) fprintf(f, "%c", c);
@@ -2549,6 +2551,8 @@
}
if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
+ else n = sprintf(tempbuffer, "\\x{%02x}", c);
+
return n >= 0 ? n : 0;
}
@@ -5070,7 +5074,7 @@
#ifdef SUPPORT_PCRE2_8
if (test_mode == PCRE8_MODE)
{
- VALGRIND_MAKE_MEM_UNDEFINED(pbuffer8 + valgrind_access_length,
+ VALGRIND_MAKE_MEM_UNDEFINED(pbuffer8 + valgrind_access_length,
pbuffer8_size - valgrind_access_length);
}
#endif
@@ -5360,10 +5364,10 @@
for (i = 0; i < subject_length - pre_start - post_start + 4; i++)
fprintf(outfile, " ");
-if (cb->next_item_length != 0)
+if (cb->next_item_length != 0)
fprintf(outfile, "%.*s", (int)(cb->next_item_length),
pbuffer8 + cb->pattern_position);
-
+
fprintf(outfile, "\n");
first_callout = FALSE;
@@ -7708,14 +7712,14 @@
skipping = FALSE;
setlocale(LC_CTYPE, "C");
}
-
- /* Otherwise, if we are not skipping, and the line is not a data comment
+
+ /* Otherwise, if we are not skipping, and the line is not a data comment
line starting with "\=", process a data line. */
-
+
else if (!skipping && !(p[0] == '\\' && p[1] == '=' && isspace(p[2])))
- {
+ {
rc = process_data();
- }
+ }
}
/* We do not have a pattern set up for testing. Lines starting with # are
Modified: code/trunk/testdata/testinput5
===================================================================
--- code/trunk/testdata/testinput5 2016-10-05 16:06:10 UTC (rev 556)
+++ code/trunk/testdata/testinput5 2016-10-05 16:53:34 UTC (rev 557)
@@ -1735,4 +1735,7 @@
/ab(?<=A\RB)/utf
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+
# End of testinput5
Modified: code/trunk/testdata/testoutput5
===================================================================
--- code/trunk/testdata/testoutput5 2016-10-05 16:06:10 UTC (rev 556)
+++ code/trunk/testdata/testoutput5 2016-10-05 16:53:34 UTC (rev 557)
@@ -4173,4 +4173,13 @@
/ab(?<=A\RB)/utf
Failed: error 125 at offset 2: lookbehind assertion is not fixed length
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+--->\x{0a}\x{123}\x{123}\x{123}\x{123}
+ +0 ^ .
+ +0 ^ .
+ +1 ^ ^ .
+ +2 ^ ^
+ 0: \x{123}\x{123}
+
# End of testinput5