Give some offset information for errors in pcre2test hex patterns.

This commit is contained in:
Philip.Hazel 2016-11-22 10:33:13 +00:00
parent 9afb978ae4
commit bc48f4709c
2 changed files with 13 additions and 9 deletions

View File

@ -179,6 +179,8 @@ compliant and unique.
-lpcre2-posix. Also, the CMake build process was building the library with the
wrong name.
27. In pcre2test, give some offset information for errors in hex patterns.
Version 10.22 29-July-2016
--------------------------

View File

@ -4632,12 +4632,14 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
if (c == '\'' || c == '"')
{
uint8_t *pq = pp;
for (;; pp++)
{
d = *pp;
if (d == 0)
{
fprintf(outfile, "** Missing closing quote in hex pattern\n");
fprintf(outfile, "** Missing closing quote in hex pattern: "
"opening quote is at offset %lu.\n", pq - buffer - 2);
return PR_SKIP;
}
if (d == c) break;
@ -4651,8 +4653,8 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
{
if (!isxdigit(c))
{
fprintf(outfile, "** Unexpected non-hex-digit '%c' in hex pattern: "
"quote missing?\n", c);
fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
"in hex pattern: quote missing?\n", c, pp - buffer - 2);
return PR_SKIP;
}
if (*pp == 0)
@ -4663,8 +4665,8 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
d = *pp;
if (!isxdigit(d))
{
fprintf(outfile, "** Unexpected non-hex-digit '%c' in hex pattern: "
"quote missing?\n", d);
fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %lu "
"in hex pattern: quote missing?\n", d, pp - buffer - 1);
return PR_SKIP;
}
c = toupper(c);