Skip to content

Commit a2fedcc

Browse files
committed
Fix data type from long to size_t
1 parent 24a788b commit a2fedcc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/mbstring/mbstring.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2963,8 +2963,8 @@ static zend_string* trim_each_wchar(zend_string *str, zend_string *what, MB_TRIM
29632963
size_t what_out_len = 0;
29642964
size_t what_len = ZSTR_LEN(what);
29652965
unsigned int state = 0;
2966-
long left = 0;
2967-
long right = 0;
2966+
size_t left = 0;
2967+
size_t right = 0;
29682968
size_t total_len = 0;
29692969
bool first = true;
29702970

@@ -3005,7 +3005,7 @@ static zend_string* trim_each_wchar(zend_string *str, zend_string *what, MB_TRIM
30053005
for (size_t j = 0; j < out_len; j++) {
30063006
uint32_t w = wchar_buf[j];
30073007
if (is_trim_wchar(w, &what_ht)) {
3008-
right -= 1;
3008+
right += 1;
30093009
} else {
30103010
right = 0;
30113011
}
@@ -3015,7 +3015,7 @@ static zend_string* trim_each_wchar(zend_string *str, zend_string *what, MB_TRIM
30153015

30163016
zend_hash_destroy(&what_ht);
30173017

3018-
return mb_get_substr(str, left, total_len + (right - left), enc);
3018+
return mb_get_substr(str, left, total_len - (right + left), enc);
30193019
}
30203020

30213021
static zend_string* mb_trim_default_chars(zend_string *str, MB_TRIM_MODE mode, const mbfl_encoding *enc)

0 commit comments

Comments
 (0)