[Pcre-svn] [603] code/trunk: Give some offset information fo…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [603] code/trunk: Give some offset information for errors in pcre2test hex patterns.
Revision: 603
          http://www.exim.org/viewvc/pcre2?view=rev&revision=603
Author:   ph10
Date:     2016-11-22 10:33:13 +0000 (Tue, 22 Nov 2016)
Log Message:
-----------
Give some offset information for errors in pcre2test hex patterns.


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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-11-22 10:18:08 UTC (rev 602)
+++ code/trunk/ChangeLog    2016-11-22 10:33:13 UTC (rev 603)
@@ -179,7 +179,9 @@
 -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
--------------------------


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2016-11-22 10:18:08 UTC (rev 602)
+++ code/trunk/src/pcre2test.c    2016-11-22 10:33:13 UTC (rev 603)
@@ -674,7 +674,7 @@
   CTL_POSIX  | CTL_HEXPAT,
   CTL_POSIX  | CTL_PUSH,
   CTL_POSIX  | CTL_PUSHCOPY,
-  CTL_POSIX  | CTL_USE_LENGTH, 
+  CTL_POSIX  | CTL_USE_LENGTH,
   CTL_EXPAND | CTL_HEXPAT };


 /* Data controls that are mutually exclusive. At present these are all in the
@@ -3559,12 +3559,12 @@
         if (len > MAX_NAME_SIZE)
           {
           fprintf(outfile, "** Group name in '%s' is too long\n", m->name);
-          return FALSE;  
-          }   
+          return FALSE;
+          }
         while (*nn != 0) nn += strlen(nn) + 1;
         if (nn + len + 2 - (char *)field > LENCPYGET)
           {
-          fprintf(outfile, "** Too many characters in named '%s' modifiers\n", 
+          fprintf(outfile, "** Too many characters in named '%s' modifiers\n",
             m->name);
           return FALSE;
           }
@@ -4632,12 +4632,14 @@


     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 (!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 @@
       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);