Rework datatypes wrt warnings

This commit is contained in:
Anatol Belski 2018-03-20 22:03:03 +01:00
parent ec5b408d81
commit f9cfc029a5

View File

@ -45,7 +45,7 @@ struct _zend_mb_regex_globals {
HashTable ht_rc;
zval search_str;
zval *search_str_val;
unsigned int search_pos;
size_t search_pos;
php_mb_regex_t *search_re;
OnigRegion *search_regs;
OnigOptionType regex_default_options;
@ -441,7 +441,7 @@ const char *php_mb_regex_get_default_mbctype(void)
* regex cache
*/
/* {{{ php_mbregex_compile_pattern */
static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, int patlen, OnigOptionType options, OnigEncoding enc, OnigSyntaxType *syntax)
static php_mb_regex_t *php_mbregex_compile_pattern(const char *pattern, size_t patlen, OnigOptionType options, OnigEncoding enc, OnigSyntaxType *syntax)
{
int err_code = 0;
php_mb_regex_t *retval = NULL, *rc = NULL;
@ -576,11 +576,11 @@ static size_t _php_mb_regex_get_option_string(char *str, size_t len, OnigOptionT
/* {{{ _php_mb_regex_init_options */
static void
_php_mb_regex_init_options(const char *parg, int narg, OnigOptionType *option, OnigSyntaxType **syntax, int *eval)
_php_mb_regex_init_options(const char *parg, size_t narg, OnigOptionType *option, OnigSyntaxType **syntax, int *eval)
{
int n;
size_t n;
char c;
int optm = 0;
OnigOptionType optm = 0;
*syntax = ONIG_SYNTAX_RUBY;
@ -1096,7 +1096,8 @@ PHP_FUNCTION(mb_split)
OnigUChar *pos, *chunk_pos;
size_t string_len;
int n, err;
int err;
size_t n;
zend_long count = -1;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
@ -1118,16 +1119,16 @@ PHP_FUNCTION(mb_split)
err = 0;
regs = onig_region_new();
/* churn through str, generating array entries as we go */
while (count != 0 && (pos - (OnigUChar *)string) < (ptrdiff_t)string_len) {
int beg, end;
while (count != 0 && (size_t)(pos - (OnigUChar *)string) < string_len) {
size_t beg, end;
err = onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), pos, (OnigUChar *)(string + string_len), regs, 0);
if (err < 0) {
break;
}
beg = regs->beg[0], end = regs->end[0];
/* add it to the array */
if ((pos - (OnigUChar *)string) < end) {
if ((size_t)beg < string_len && beg >= (chunk_pos - (OnigUChar *)string)) {
if ((size_t)(pos - (OnigUChar *)string) < end) {
if (beg < string_len && beg >= (size_t)(chunk_pos - (OnigUChar *)string)) {
add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos));
--count;
} else {
@ -1217,7 +1218,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
char *arg_pattern = NULL, *arg_options = NULL;
size_t arg_pattern_len, arg_options_len;
int n, i, err, pos, len, beg, end;
int err;
size_t n, i, pos, len, beg, end;
OnigOptionType option;
OnigUChar *str;
OnigSyntaxType *syntax;
@ -1341,7 +1343,7 @@ PHP_FUNCTION(mb_ereg_search_regs)
Initialize string and regular expression for search. */
PHP_FUNCTION(mb_ereg_search_init)
{
size_t argc = ZEND_NUM_ARGS();
int argc = ZEND_NUM_ARGS();
zend_string *arg_str;
char *arg_pattern = NULL, *arg_options = NULL;
size_t arg_pattern_len = 0, arg_options_len = 0;
@ -1401,7 +1403,7 @@ PHP_FUNCTION(mb_ereg_search_init)
Get matched substring of the last time */
PHP_FUNCTION(mb_ereg_search_getregs)
{
int n, i, len, beg, end;
size_t n, i, len, beg, end;
OnigUChar *str;
if (MBREX(search_regs) != NULL && Z_TYPE(MBREX(search_str)) == IS_STRING) {