[Pcre-svn] [658] code/trunk: Don't use %td (use %lu instead)…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [658] code/trunk: Don't use %td (use %lu instead) in pcre2test under MSVC.
Revision: 658
          http://www.exim.org/viewvc/pcre2?view=rev&revision=658
Author:   ph10
Date:     2017-02-04 16:27:20 +0000 (Sat, 04 Feb 2017)
Log Message:
-----------
Don't use %td (use %lu instead) in pcre2test under MSVC.


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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2017-01-31 17:15:30 UTC (rev 657)
+++ code/trunk/ChangeLog    2017-02-04 16:27:20 UTC (rev 658)
@@ -219,6 +219,8 @@
 wrong name.


27. In pcre2test, give some offset information for errors in hex patterns.
+This uses the C99 formatting sequence %td, except for MSVC which doesn't
+support it - %lu is used instead.

28. Implemented pcre2_code_copy_with_tables(), and added pushtablescopy to
pcre2test for testing it.
@@ -329,13 +331,13 @@
AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT
modules.

-52. Minor fixed to pcre2grep from Jason Hood:
+52. Minor fixes to pcre2grep from Jason Hood:
     * fixed some spacing;
     * Windows doesn't usually use single quotes, so I've added a define
       to use appropriate quotes [in an example];
     * LC_ALL was displayed as "LCC_ALL";
-    * numbers 11, 12 & 13 should end in "th".
-    * use double quotes in usage message
+    * numbers 11, 12 & 13 should end in "th";
+    * use double quotes in usage message.



Version 10.22 29-July-2016

Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2017-01-31 17:15:30 UTC (rev 657)
+++ code/trunk/src/pcre2test.c    2017-02-04 16:27:20 UTC (rev 658)
@@ -158,6 +158,13 @@
 void vms_setsymbol( char *, char *, int );
 #endif


+/* VC doesn't support "%td". */
+#ifdef _MSC_VER
+#define PTR_SPEC "%lu"
+#else
+#define PTR_SPEC "%td"
+#endif
+
/* ------------------End of system-specific definitions -------------------- */

 /* Glueing macros that are used in several places below. */
@@ -4663,7 +4670,7 @@
         if (d == 0)
           {
           fprintf(outfile, "** Missing closing quote in hex pattern: "
-            "opening quote is at offset %td.\n", pq - buffer - 2);
+            "opening quote is at offset " PTR_SPEC ".\n", pq - buffer - 2);
           return PR_SKIP;
           }
         if (d == c) break;
@@ -4677,8 +4684,8 @@
       {
       if (!isxdigit(c))
         {
-        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
-          "in hex pattern: quote missing?\n", c, pp - buffer - 2);
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset "
+          PTR_SPEC " in hex pattern: quote missing?\n", c, pp - buffer - 2);
         return PR_SKIP;
         }
       if (*pp == 0)
@@ -4689,8 +4696,8 @@
       d = *pp;
       if (!isxdigit(d))
         {
-        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td "
-          "in hex pattern: quote missing?\n", d, pp - buffer - 1);
+        fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset "
+          PTR_SPEC " in hex pattern: quote missing?\n", d, pp - buffer - 1);
         return PR_SKIP;
         }
       c = toupper(c);