Correct an incorrect cast.

This commit is contained in:
Philip.Hazel 2017-04-14 12:14:41 +00:00
parent b35a98c403
commit e8cdae3c5b
2 changed files with 6 additions and 4 deletions

View File

@ -135,6 +135,8 @@ particular when it is serialized.
25. Remove a duplication typo in pcre2_tables.c 25. Remove a duplication typo in pcre2_tables.c
26. Correct an incorrect cast in pcre2_valid_utf.c
Version 10.23 14-February-2017 Version 10.23 14-February-2017
------------------------------ ------------------------------

View File

@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
Written by Philip Hazel Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge Original API code Copyright (c) 1997-2012 University of Cambridge
New API code Copyright (c) 2016 University of Cambridge New API code Copyright (c) 2016-2017 University of Cambridge
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -142,20 +142,20 @@ for (p = string; length > 0; p++)
if (c < 0xc0) /* Isolated 10xx xxxx byte */ if (c < 0xc0) /* Isolated 10xx xxxx byte */
{ {
*erroroffset = (int)(p - string); *erroroffset = (PCRE2_SIZE)(p - string);
return PCRE2_ERROR_UTF8_ERR20; return PCRE2_ERROR_UTF8_ERR20;
} }
if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */ if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */
{ {
*erroroffset = (int)(p - string); *erroroffset = (PCRE2_SIZE)(p - string);
return PCRE2_ERROR_UTF8_ERR21; return PCRE2_ERROR_UTF8_ERR21;
} }
ab = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes (1-5) */ ab = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes (1-5) */
if (length < ab) /* Missing bytes */ if (length < ab) /* Missing bytes */
{ {
*erroroffset = (int)(p - string); *erroroffset = (PCRE2_SIZE)(p - string);
switch(ab - length) switch(ab - length)
{ {
case 1: return PCRE2_ERROR_UTF8_ERR1; case 1: return PCRE2_ERROR_UTF8_ERR1;