Don't use %td (use %lu instead) in pcre2test under MSVC.

This commit is contained in:
Philip.Hazel 2017-02-04 16:27:20 +00:00
parent 4311f49d0e
commit 2f1e99e04f
2 changed files with 17 additions and 8 deletions

View File

@ -219,6 +219,8 @@ compliant and unique.
wrong name. wrong name.
27. In pcre2test, give some offset information for errors in hex patterns. 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 28. Implemented pcre2_code_copy_with_tables(), and added pushtablescopy to
pcre2test for testing it. pcre2test for testing it.
@ -329,13 +331,13 @@ JIT.
AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT AC_USE_SYSTEM_EXTENSIONS macro and to test for functions used by the JIT
modules. modules.
52. Minor fixed to pcre2grep from Jason Hood: 52. Minor fixes to pcre2grep from Jason Hood:
* fixed some spacing; * fixed some spacing;
* Windows doesn't usually use single quotes, so I've added a define * Windows doesn't usually use single quotes, so I've added a define
to use appropriate quotes [in an example]; to use appropriate quotes [in an example];
* LC_ALL was displayed as "LCC_ALL"; * LC_ALL was displayed as "LCC_ALL";
* numbers 11, 12 & 13 should end in "th". * numbers 11, 12 & 13 should end in "th";
* use double quotes in usage message * use double quotes in usage message.
Version 10.22 29-July-2016 Version 10.22 29-July-2016

View File

@ -158,6 +158,13 @@ patterns. */
void vms_setsymbol( char *, char *, int ); void vms_setsymbol( char *, char *, int );
#endif #endif
/* VC doesn't support "%td". */
#ifdef _MSC_VER
#define PTR_SPEC "%lu"
#else
#define PTR_SPEC "%td"
#endif
/* ------------------End of system-specific definitions -------------------- */ /* ------------------End of system-specific definitions -------------------- */
/* Glueing macros that are used in several places below. */ /* Glueing macros that are used in several places below. */
@ -4663,7 +4670,7 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
if (d == 0) if (d == 0)
{ {
fprintf(outfile, "** Missing closing quote in hex pattern: " 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; return PR_SKIP;
} }
if (d == c) break; if (d == c) break;
@ -4677,8 +4684,8 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
{ {
if (!isxdigit(c)) if (!isxdigit(c))
{ {
fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td " fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset "
"in hex pattern: quote missing?\n", c, pp - buffer - 2); PTR_SPEC " in hex pattern: quote missing?\n", c, pp - buffer - 2);
return PR_SKIP; return PR_SKIP;
} }
if (*pp == 0) if (*pp == 0)
@ -4689,8 +4696,8 @@ if ((pat_patctl.control & CTL_HEXPAT) != 0)
d = *pp; d = *pp;
if (!isxdigit(d)) if (!isxdigit(d))
{ {
fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset %td " fprintf(outfile, "** Unexpected non-hex-digit '%c' at offset "
"in hex pattern: quote missing?\n", d, pp - buffer - 1); PTR_SPEC " in hex pattern: quote missing?\n", d, pp - buffer - 1);
return PR_SKIP; return PR_SKIP;
} }
c = toupper(c); c = toupper(c);