mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
Rework datatypes wrt warnings
This commit is contained in:
parent
ec5b408d81
commit
f9cfc029a5
@ -45,7 +45,7 @@ struct _zend_mb_regex_globals {
|
|||||||
HashTable ht_rc;
|
HashTable ht_rc;
|
||||||
zval search_str;
|
zval search_str;
|
||||||
zval *search_str_val;
|
zval *search_str_val;
|
||||||
unsigned int search_pos;
|
size_t search_pos;
|
||||||
php_mb_regex_t *search_re;
|
php_mb_regex_t *search_re;
|
||||||
OnigRegion *search_regs;
|
OnigRegion *search_regs;
|
||||||
OnigOptionType regex_default_options;
|
OnigOptionType regex_default_options;
|
||||||
@ -441,7 +441,7 @@ const char *php_mb_regex_get_default_mbctype(void)
|
|||||||
* regex cache
|
* regex cache
|
||||||
*/
|
*/
|
||||||
/* {{{ php_mbregex_compile_pattern */
|
/* {{{ 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;
|
int err_code = 0;
|
||||||
php_mb_regex_t *retval = NULL, *rc = NULL;
|
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 */
|
/* {{{ _php_mb_regex_init_options */
|
||||||
static void
|
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;
|
char c;
|
||||||
int optm = 0;
|
OnigOptionType optm = 0;
|
||||||
|
|
||||||
*syntax = ONIG_SYNTAX_RUBY;
|
*syntax = ONIG_SYNTAX_RUBY;
|
||||||
|
|
||||||
@ -1096,7 +1096,8 @@ PHP_FUNCTION(mb_split)
|
|||||||
OnigUChar *pos, *chunk_pos;
|
OnigUChar *pos, *chunk_pos;
|
||||||
size_t string_len;
|
size_t string_len;
|
||||||
|
|
||||||
int n, err;
|
int err;
|
||||||
|
size_t n;
|
||||||
zend_long count = -1;
|
zend_long count = -1;
|
||||||
|
|
||||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|l", &arg_pattern, &arg_pattern_len, &string, &string_len, &count) == FAILURE) {
|
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;
|
err = 0;
|
||||||
regs = onig_region_new();
|
regs = onig_region_new();
|
||||||
/* churn through str, generating array entries as we go */
|
/* churn through str, generating array entries as we go */
|
||||||
while (count != 0 && (pos - (OnigUChar *)string) < (ptrdiff_t)string_len) {
|
while (count != 0 && (size_t)(pos - (OnigUChar *)string) < string_len) {
|
||||||
int beg, end;
|
size_t beg, end;
|
||||||
err = onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), pos, (OnigUChar *)(string + string_len), regs, 0);
|
err = onig_search(re, (OnigUChar *)string, (OnigUChar *)(string + string_len), pos, (OnigUChar *)(string + string_len), regs, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
beg = regs->beg[0], end = regs->end[0];
|
beg = regs->beg[0], end = regs->end[0];
|
||||||
/* add it to the array */
|
/* add it to the array */
|
||||||
if ((pos - (OnigUChar *)string) < end) {
|
if ((size_t)(pos - (OnigUChar *)string) < end) {
|
||||||
if ((size_t)beg < string_len && beg >= (chunk_pos - (OnigUChar *)string)) {
|
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));
|
add_next_index_stringl(return_value, (char *)chunk_pos, ((OnigUChar *)(string + beg) - chunk_pos));
|
||||||
--count;
|
--count;
|
||||||
} else {
|
} else {
|
||||||
@ -1217,7 +1218,8 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
|||||||
{
|
{
|
||||||
char *arg_pattern = NULL, *arg_options = NULL;
|
char *arg_pattern = NULL, *arg_options = NULL;
|
||||||
size_t arg_pattern_len, arg_options_len;
|
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;
|
OnigOptionType option;
|
||||||
OnigUChar *str;
|
OnigUChar *str;
|
||||||
OnigSyntaxType *syntax;
|
OnigSyntaxType *syntax;
|
||||||
@ -1341,7 +1343,7 @@ PHP_FUNCTION(mb_ereg_search_regs)
|
|||||||
Initialize string and regular expression for search. */
|
Initialize string and regular expression for search. */
|
||||||
PHP_FUNCTION(mb_ereg_search_init)
|
PHP_FUNCTION(mb_ereg_search_init)
|
||||||
{
|
{
|
||||||
size_t argc = ZEND_NUM_ARGS();
|
int argc = ZEND_NUM_ARGS();
|
||||||
zend_string *arg_str;
|
zend_string *arg_str;
|
||||||
char *arg_pattern = NULL, *arg_options = NULL;
|
char *arg_pattern = NULL, *arg_options = NULL;
|
||||||
size_t arg_pattern_len = 0, arg_options_len = 0;
|
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 */
|
Get matched substring of the last time */
|
||||||
PHP_FUNCTION(mb_ereg_search_getregs)
|
PHP_FUNCTION(mb_ereg_search_getregs)
|
||||||
{
|
{
|
||||||
int n, i, len, beg, end;
|
size_t n, i, len, beg, end;
|
||||||
OnigUChar *str;
|
OnigUChar *str;
|
||||||
|
|
||||||
if (MBREX(search_regs) != NULL && Z_TYPE(MBREX(search_str)) == IS_STRING) {
|
if (MBREX(search_regs) != NULL && Z_TYPE(MBREX(search_str)) == IS_STRING) {
|
||||||
|
Loading…
Reference in New Issue
Block a user