From 2f1e99e04fb1a4b908ee5c36132fa6f3839a6584 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Sat, 4 Feb 2017 16:27:20 +0000 Subject: [PATCH] Don't use %td (use %lu instead) in pcre2test under MSVC. --- ChangeLog | 8 +++++--- src/pcre2test.c | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3f0be06..bd8862e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -219,6 +219,8 @@ compliant and unique. 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 @@ JIT. 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 diff --git a/src/pcre2test.c b/src/pcre2test.c index e1c8d25..241c22c 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -158,6 +158,13 @@ patterns. */ 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 ((pat_patctl.control & CTL_HEXPAT) != 0) 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 ((pat_patctl.control & CTL_HEXPAT) != 0) { 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 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0) 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);