Skip to content

Commit e8cdae3

Browse files
committed
Correct an incorrect cast.
1 parent b35a98c commit e8cdae3

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ particular when it is serialized.
135135

136136
25. Remove a duplication typo in pcre2_tables.c
137137

138+
26. Correct an incorrect cast in pcre2_valid_utf.c
139+
138140

139141
Version 10.23 14-February-2017
140142
------------------------------

src/pcre2_valid_utf.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language.
77
88
Written by Philip Hazel
99
Original API code Copyright (c) 1997-2012 University of Cambridge
10-
New API code Copyright (c) 2016 University of Cambridge
10+
New API code Copyright (c) 2016-2017 University of Cambridge
1111
1212
-----------------------------------------------------------------------------
1313
Redistribution and use in source and binary forms, with or without
@@ -142,20 +142,20 @@ for (p = string; length > 0; p++)
142142

143143
if (c < 0xc0) /* Isolated 10xx xxxx byte */
144144
{
145-
*erroroffset = (int)(p - string);
145+
*erroroffset = (PCRE2_SIZE)(p - string);
146146
return PCRE2_ERROR_UTF8_ERR20;
147147
}
148148

149149
if (c >= 0xfe) /* Invalid 0xfe or 0xff bytes */
150150
{
151-
*erroroffset = (int)(p - string);
151+
*erroroffset = (PCRE2_SIZE)(p - string);
152152
return PCRE2_ERROR_UTF8_ERR21;
153153
}
154154

155155
ab = PRIV(utf8_table4)[c & 0x3f]; /* Number of additional bytes (1-5) */
156156
if (length < ab) /* Missing bytes */
157157
{
158-
*erroroffset = (int)(p - string);
158+
*erroroffset = (PCRE2_SIZE)(p - string);
159159
switch(ab - length)
160160
{
161161
case 1: return PCRE2_ERROR_UTF8_ERR1;

0 commit comments

Comments
 (0)