From 6f4ee084694d2c8187ba8cd31c4719d2ed3e0bea Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Tue, 26 Sep 2017 17:01:23 +0000 Subject: [PATCH] Add some casts to avoid compiler warnings. --- ChangeLog | 2 ++ src/pcre2_compile.c | 6 +++--- src/pcre2_match.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d955f0e..998030e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -24,6 +24,8 @@ the public names in pcre2_convert.c. 7. Fixed a small memory leak in pcre2test (convert contexts). +8. Added two casts to compile.c and one to match.c to avoid compiler warnings. + Version 10.30 14-August-2017 ---------------------------- diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 44ee250..3a02756 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -2194,8 +2194,8 @@ manage_callouts(PCRE2_SPTR ptr, uint32_t **pcalloutptr, BOOL auto_callout, { uint32_t *previous_callout = *pcalloutptr; -if (previous_callout != NULL) previous_callout[2] = ptr - cb->start_pattern - - (PCRE2_SIZE)previous_callout[1]; +if (previous_callout != NULL) previous_callout[2] = (uint32_t)(ptr - + cb->start_pattern - (PCRE2_SIZE)previous_callout[1]); if (!auto_callout) previous_callout = NULL; else { @@ -3806,7 +3806,7 @@ while (ptr < ptrend) /* Remember the offset to the next item in the pattern, and set a default length. This should get updated after the next item is read. */ - previous_callout[1] = ptr - cb->start_pattern; + previous_callout[1] = (uint32_t)(ptr - cb->start_pattern); previous_callout[2] = 0; break; /* End callout */ diff --git a/src/pcre2_match.c b/src/pcre2_match.c index 70bf936..9ea6768 100644 --- a/src/pcre2_match.c +++ b/src/pcre2_match.c @@ -729,7 +729,7 @@ for (;;) fprintf(stderr, "++ op=%d\n", *Fecode); #endif - Fop = *Fecode; + Fop = (uint8_t)(*Fecode); /* Cast needed for 16-bit and 32-bit modes */ switch(Fop) { /* ===================================================================== */