summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-04-24 15:36:53 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2020-04-24 15:36:53 +0000
commit4d848be74dd036959c94a717dfa7dab23035b6df (patch)
treed8cc0dd5bf6beeee7400df8884b32dd912d56f95
parent2d7c5dccc470536bc6bd2186e41b0bf9b240ec5e (diff)
downloadpcre2-4d848be74dd036959c94a717dfa7dab23035b6df.tar.gz
Second attempt at getting rid of gcc 10 warning.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1247 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--src/pcre2test.c38
-rw-r--r--testdata/testinput29
-rw-r--r--testdata/testoutput218
3 files changed, 38 insertions, 27 deletions
diff --git a/src/pcre2test.c b/src/pcre2test.c
index c4b6059..3f4fef4 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -2981,20 +2981,14 @@ return (int)(pp - p);
/* Must handle UTF-8 strings in utf8 mode. Yields number of characters printed.
For printing *MARK strings, a negative length is given, indicating that the
-length is in the previous code unit. We can't use strlen() because the string
-may contain binary zeros. Avoid using [-1] as a suffix because this can provoke
-a compiler warning. If handed a NULL file, this function just counts chars
-without printing (because pchar() does that). */
+length is in the first code unit. If handed a NULL file, this function just
+counts chars without printing (because pchar() does that). */
static int pchars8(PCRE2_SPTR8 p, int length, BOOL utf, FILE *f)
{
uint32_t c = 0;
int yield = 0;
-if (length < 0)
- {
- PCRE2_SPTR8 pp = p - 1;
- length = *pp;
- }
+if (length < 0) length = *p++;
while (length-- > 0)
{
if (utf)
@@ -3024,18 +3018,13 @@ return yield;
/* Must handle UTF-16 strings in utf mode. Yields number of characters printed.
For printing *MARK strings, a negative length is given, indicating that the
-length is in the previous code unit. Avoid using [-1] as a suffix because this
-can provoke a compiler warning. If handed a NULL file, just counts chars
+length is in the first code unit. 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)
- {
- PCRE2_SPTR16 pp = p - 1;
- length = *pp;
- }
+if (length < 0) length = *p++;
while (length-- > 0)
{
uint32_t c = *p++ & 0xffff;
@@ -3064,19 +3053,14 @@ return yield;
/* Must handle UTF-32 strings in utf mode. Yields number of characters printed.
For printing *MARK strings, a negative length is given, indicating that the
-length is in the previous code unit. Avoid using [-1] as a suffix because this
-can provoke a compiler warning. If handed a NULL file, just counts chars
+length is in the first code unit. 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)
- {
- PCRE2_SPTR32 pp = p - 1;
- length = *pp;
- }
+if (length < 0) length = *p++;
while (length-- > 0)
{
uint32_t c = *p++;
@@ -6327,7 +6311,7 @@ if (cb->mark != last_callout_mark)
else
{
fprintf(outfile, "Latest Mark: ");
- PCHARSV(cb->mark, 0, -1, utf, outfile);
+ PCHARSV(cb->mark, -1, -1, utf, outfile);
putc('\n', outfile);
}
last_callout_mark = cb->mark;
@@ -7848,7 +7832,7 @@ for (gmatched = 0;; gmatched++)
TESTFLD(match_data, mark, !=, NULL))
{
fprintf(outfile, "MK: ");
- PCHARSV(CASTFLD(void *, match_data, mark), 0, -1, utf, outfile);
+ PCHARSV(CASTFLD(void *, match_data, mark), -1, -1, utf, outfile);
fprintf(outfile, "\n");
}
@@ -7880,7 +7864,7 @@ for (gmatched = 0;; gmatched++)
TESTFLD(match_data, mark, !=, NULL))
{
fprintf(outfile, ", mark=");
- PCHARS(rubriclength, CASTFLD(void *, match_data, mark), 0, -1, utf,
+ PCHARS(rubriclength, CASTFLD(void *, match_data, mark), -1, -1, utf,
outfile);
rubriclength += 7;
}
@@ -7979,7 +7963,7 @@ for (gmatched = 0;; gmatched++)
TESTFLD(match_data, mark, !=, NULL))
{
fprintf(outfile, ", mark = ");
- PCHARSV(CASTFLD(void *, match_data, mark), 0, -1, utf, outfile);
+ PCHARSV(CASTFLD(void *, match_data, mark), -1, -1, utf, outfile);
}
if ((pat_patctl.control & CTL_JITVERIFY) != 0 && jit_was_used)
fprintf(outfile, " (JIT)");
diff --git a/testdata/testinput2 b/testdata/testinput2
index 3de72f1..c816c5f 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -5855,4 +5855,13 @@ a)"xI
/^\w+/tables=3
École
+/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
+ AB
+ A\=ph
+\= Expect no match
+ A
+
+/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
+ AB
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 886a24d..c90efef 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -17603,6 +17603,24 @@ No match
École
0: \xc3
+/"(*MARK:>" 00 "<).."/hex,mark,no_start_optimize
+ AB
+ 0: AB
+MK: >\x00<
+ A\=ph
+Partial match, mark=>\x00<: A
+\= Expect no match
+ A
+No match, mark = >\x00<
+
+/"(*MARK:>" 00 "<).(?C1)."/hex,mark,no_start_optimize
+ AB
+--->AB
+ 1 ^^ .
+Latest Mark: >\x00<
+ 0: AB
+MK: >\x00<
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data