[Pcre-svn] [469] code/trunk: Fix printing of *MARK names con…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [469] code/trunk: Fix printing of *MARK names containing binary zeroes in pcre2test.
Revision: 469
          http://www.exim.org/viewvc/pcre2?view=rev&revision=469
Author:   ph10
Date:     2015-12-16 18:44:24 +0000 (Wed, 16 Dec 2015)
Log Message:
-----------
Fix printing of *MARK names containing binary zeroes in pcre2test.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2test.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-12-15 18:21:49 UTC (rev 468)
+++ code/trunk/ChangeLog    2015-12-16 18:44:24 UTC (rev 469)
@@ -1,8 +1,8 @@
 Change Log for PCRE2
 --------------------


-Version 10.21 xx-xxx-xxxx
--------------------------
+Version 10.21-RC1 15-December-2015
+----------------------------------

1. Improve matching speed of patterns starting with + or * in JIT.

@@ -389,7 +389,9 @@
112. Implemented PCRE2_SUBSTITUTE_UNKNOWN_UNSET and PCRE2_SUBSTITUTE_OVERFLOW_
LENGTH.

+113. Fix printing of *MARK names that contain binary zeroes in pcre2test.

+
Version 10.20 30-June-2015
--------------------------


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2015-12-15 18:21:49 UTC (rev 468)
+++ code/trunk/src/pcre2test.c    2015-12-16 18:44:24 UTC (rev 469)
@@ -2545,13 +2545,14 @@
 *************************************************/


/* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given. If handed a NULL file,
+just counts chars without printing. */

static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f)
{
uint32_t c = 0;
int yield = 0;
-if (length < 0) length = strlen((char *)p);
+if (length < 0) length = p[-1];
while (length-- > 0)
{
if (utf)
@@ -2579,12 +2580,13 @@
*************************************************/

/* Must handle UTF-16 strings in utf mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given. If handed a NULL file,
+just counts chars without printing. */

static int pchars16(PCRE2_SPTR16 p, int length, BOOL utf, FILE *f)
{
int yield = 0;
-if (length < 0) length = strlen16(p);
+if (length < 0) length = p[-1];
while (length-- > 0)
{
uint32_t c = *p++ & 0xffff;
@@ -2612,13 +2614,14 @@
*************************************************/

/* Must handle UTF-32 strings in utf mode. Yields number of characters printed.
-If handed a NULL file, just counts chars without printing. */
+For printing *MARK strings, a negative length is given.If handed a NULL file,
+just counts chars without printing. */

 static int pchars32(PCRE2_SPTR32 p, int length, BOOL utf, FILE *f)
 {
 int yield = 0;
 (void)(utf);  /* Avoid compiler warning */
-if (length < 0) length = strlen32(p);
+if (length < 0) length = p[-1];
 while (length-- > 0)
   {
   uint32_t c = *p++;
@@ -6402,7 +6405,8 @@
          TESTFLD(match_data, mark, !=, NULL))
       {
       fprintf(outfile, ", mark=");
-      PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf, outfile);
+      PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf, 
+        outfile);
       rubriclength += 7;
       }
     fprintf(outfile, ": ");


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2015-12-15 18:21:49 UTC (rev 468)
+++ code/trunk/testdata/testinput2    2015-12-16 18:44:24 UTC (rev 469)
@@ -4786,4 +4786,18 @@
     \=offset_limit=1100000000000000000000 
     \=copy=11000000000 


+/(*MARK:A\x00b)/mark
+    abc
+
+/(*MARK:A\x00b)/mark,alt_verbnames
+    abc
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+    abc
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+    abc
+
 # End of testinput2 


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-12-15 18:21:49 UTC (rev 468)
+++ code/trunk/testdata/testoutput2    2015-12-16 18:44:24 UTC (rev 469)
@@ -15136,4 +15136,26 @@
     \=copy=11000000000 
 ** Invalid value in 'copy=11000000000'


+/(*MARK:A\x00b)/mark
+    abc
+ 0: 
+MK: A\x00b
+
+/(*MARK:A\x00b)/mark,alt_verbnames
+    abc
+ 0: 
+MK: A\x00b
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex
+    abc
+ 0: 
+MK: A\x00b
+
+# /(*MARK:A\x00b)/
+/28 2a 4d 41 52 4b 3a 41 00 62 29/mark,hex,alt_verbnames
+    abc
+ 0: 
+MK: A\x00b
+
 # End of testinput2