c159c26
From 3caf27da49d315b53783af8e602f6be09b435bc2 Mon Sep 17 00:00:00 2001
c159c26
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
c159c26
Date: Wed, 5 Oct 2016 16:53:34 +0000
c159c26
Subject: [PATCH] Fix callout display bug in pcre2test.
c159c26
MIME-Version: 1.0
c159c26
Content-Type: text/plain; charset=UTF-8
c159c26
Content-Transfer-Encoding: 8bit
c159c26
c159c26
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@557 6239d852-aaf2-0410-a92c-79f79f948069
c159c26
c159c26
Petr Písař: Ported to 10.22.
c159c26
c159c26
Signed-off-by: Petr Písař <ppisar@redhat.com>
c159c26
---
c159c26
 src/pcre2test.c      | 4 ++++
c159c26
 testdata/testinput5  | 3 +++
c159c26
 testdata/testoutput5 | 9 +++++++++
c159c26
 3 files changed, 16 insertions(+)
c159c26
c159c26
diff --git a/src/pcre2test.c b/src/pcre2test.c
c159c26
index a8dffa3..96520e8 100644
c159c26
--- a/src/pcre2test.c
c159c26
+++ b/src/pcre2test.c
c159c26
@@ -2525,6 +2525,8 @@ static int
c159c26
 pchar(uint32_t c, BOOL utf, FILE *f)
c159c26
 {
c159c26
 int n = 0;
c159c26
+char tempbuffer[16];
c159c26
+
c159c26
 if (PRINTOK(c))
c159c26
   {
c159c26
   if (f != NULL) fprintf(f, "%c", c);
c159c26
@@ -2546,6 +2548,8 @@ if (c < 0x100)
c159c26
   }
c159c26
 
c159c26
 if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
c159c26
+  else n = sprintf(tempbuffer, "\\x{%02x}", c);
c159c26
+
c159c26
 return n >= 0 ? n : 0;
c159c26
 }
c159c26
 
c159c26
diff --git a/testdata/testinput5 b/testdata/testinput5
c159c26
index 1f44ceb..461302a 100644
c159c26
--- a/testdata/testinput5
c159c26
+++ b/testdata/testinput5
c159c26
@@ -1724,4 +1724,7 @@
c159c26
 \= Expect no match
c159c26
     \x{10000}
c159c26
 
c159c26
+/../utf,auto_callout
c159c26
+    \n\x{123}\x{123}\x{123}\x{123}
c159c26
+
c159c26
 # End of testinput5 
c159c26
diff --git a/testdata/testoutput5 b/testdata/testoutput5
c159c26
index b670677..e661033 100644
c159c26
--- a/testdata/testoutput5
c159c26
+++ b/testdata/testoutput5
c159c26
@@ -4160,4 +4160,13 @@ No match
c159c26
     \x{10000}
c159c26
 No match
c159c26
 
c159c26
+/../utf,auto_callout
c159c26
+    \n\x{123}\x{123}\x{123}\x{123}
c159c26
+--->\x{0a}\x{123}\x{123}\x{123}\x{123}
c159c26
+ +0 ^                                      .
c159c26
+ +0       ^                                .
c159c26
+ +1       ^      ^                         .
c159c26
+ +2       ^             ^                  
c159c26
+ 0: \x{123}\x{123}
c159c26
+
c159c26
 # End of testinput5 
c159c26
-- 
c159c26
2.7.4
c159c26