mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
Reduced compiler warnings
This commit is contained in:
parent
d530f23a4f
commit
e9982c06c7
@ -6918,30 +6918,30 @@ mbfl_filt_conv_illegal_output(int c, mbfl_convert_filter *filter TSRMLS_DC)
|
||||
case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
|
||||
if (c >= 0) {
|
||||
if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
|
||||
ret = mbfl_convert_filter_strcat(filter, "U+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"U+" TSRMLS_CC);
|
||||
} else {
|
||||
if (c < MBFL_WCSGROUP_WCHARMAX) {
|
||||
m = c & ~MBFL_WCSPLANE_MASK;
|
||||
switch (m) {
|
||||
case MBFL_WCSPLANE_JIS0208:
|
||||
ret = mbfl_convert_filter_strcat(filter, "JIS+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS+" TSRMLS_CC);
|
||||
break;
|
||||
case MBFL_WCSPLANE_JIS0212:
|
||||
ret = mbfl_convert_filter_strcat(filter, "JIS2+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"JIS2+" TSRMLS_CC);
|
||||
break;
|
||||
case MBFL_WCSPLANE_WINCP932:
|
||||
ret = mbfl_convert_filter_strcat(filter, "W932+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"W932+" TSRMLS_CC);
|
||||
break;
|
||||
case MBFL_WCSPLANE_8859_1:
|
||||
ret = mbfl_convert_filter_strcat(filter, "I8859_1+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"I8859_1+" TSRMLS_CC);
|
||||
break;
|
||||
default:
|
||||
ret = mbfl_convert_filter_strcat(filter, "?+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"?+" TSRMLS_CC);
|
||||
break;
|
||||
}
|
||||
c &= MBFL_WCSPLANE_MASK;
|
||||
} else {
|
||||
ret = mbfl_convert_filter_strcat(filter, "BAD+" TSRMLS_CC);
|
||||
ret = mbfl_convert_filter_strcat(filter, (const unsigned char *)"BAD+" TSRMLS_CC);
|
||||
c &= MBFL_WCSGROUP_MASK;
|
||||
}
|
||||
}
|
||||
@ -7720,7 +7720,7 @@ collector_strpos(int c, void* data TSRMLS_DC)
|
||||
}
|
||||
} else if (pc->needle_pos != 0) {
|
||||
retry:
|
||||
h = pc->needle.buffer;
|
||||
h = (int *)pc->needle.buffer;
|
||||
h++;
|
||||
for (;;) {
|
||||
pc->found_pos++;
|
||||
@ -9100,7 +9100,7 @@ mime_header_decoder_collector(int c, void* data TSRMLS_DC)
|
||||
if (c == 0x3f) { /* ? */
|
||||
/* identify charset */
|
||||
mbfl_memory_device_output('\0', &pd->tmpdev TSRMLS_CC);
|
||||
encoding = mbfl_name2encoding(&pd->tmpdev.buffer[pd->cspos]);
|
||||
encoding = mbfl_name2encoding((const char *)&pd->tmpdev.buffer[pd->cspos]);
|
||||
if (encoding != NULL) {
|
||||
pd->incode = encoding->no_encoding;
|
||||
pd->status = 3;
|
||||
|
@ -496,7 +496,7 @@ enum regexpcode
|
||||
wordbeg, /* Succeeds if at word beginning. */
|
||||
wordend, /* Succeeds if at word end. */
|
||||
wordbound, /* Succeeds if at a word boundary. */
|
||||
notwordbound,/* Succeeds if not at a word boundary. */
|
||||
notwordbound /* Succeeds if not at a word boundary. */
|
||||
};
|
||||
|
||||
|
||||
|
@ -1423,7 +1423,7 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
|
||||
if (identd) {
|
||||
n = 0;
|
||||
while (n < num) {
|
||||
string.val = val_list[n];
|
||||
string.val = (unsigned char *)val_list[n];
|
||||
string.len = len_list[n];
|
||||
if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
|
||||
break;
|
||||
@ -1453,10 +1453,10 @@ php_mbstr_encoding_handler(zval *arg, char *res, char *separator TSRMLS_DC)
|
||||
|
||||
n = 0;
|
||||
while (n < num) {
|
||||
string.val = val_list[n];
|
||||
string.val = (unsigned char *)val_list[n];
|
||||
string.len = len_list[n];
|
||||
if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resvar TSRMLS_CC) != NULL) {
|
||||
var = resvar.val;
|
||||
var = (char *)resvar.val;
|
||||
} else {
|
||||
var = val_list[n];
|
||||
}
|
||||
@ -1738,7 +1738,7 @@ PHP_FUNCTION(mb_parse_str)
|
||||
if (identd != NULL) {
|
||||
n = 0;
|
||||
while (n < num) {
|
||||
string.val = str_list[n];
|
||||
string.val = (unsigned char *)str_list[n];
|
||||
string.len = len_list[n];
|
||||
if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
|
||||
break;
|
||||
@ -1778,7 +1778,7 @@ PHP_FUNCTION(mb_parse_str)
|
||||
string.val = str_list[n];
|
||||
string.len = len_list[n];
|
||||
if (convd != NULL && mbfl_buffer_converter_feed_result(convd, &string, &resvar TSRMLS_CC) != NULL) {
|
||||
var = resvar.val;
|
||||
var = (char *)resvar.val;
|
||||
} else {
|
||||
var = str_list[n];
|
||||
}
|
||||
@ -1890,7 +1890,7 @@ PHP_FUNCTION(mb_output_handler)
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
string.val = arg_string;
|
||||
string.val = (unsigned char *)arg_string;
|
||||
string.len = arg_string_len;
|
||||
mbfl_buffer_converter_feed(MBSTRG(outconv), &string TSRMLS_CC);
|
||||
if (last_feed)
|
||||
@ -1898,7 +1898,7 @@ PHP_FUNCTION(mb_output_handler)
|
||||
|
||||
/* get the converter output, and return it */
|
||||
mbfl_buffer_converter_result(MBSTRG(outconv), &result TSRMLS_CC);
|
||||
RETVAL_STRINGL(result.val, result.len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)result.val, result.len, 0); /* the string is already strdup()'ed */
|
||||
|
||||
/* delete the converter if it is the last feed. */
|
||||
if (last_feed) {
|
||||
@ -1937,7 +1937,7 @@ PHP_FUNCTION(mb_strlen)
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
if (n == 2) {
|
||||
@ -2014,7 +2014,7 @@ PHP_FUNCTION(mb_strpos)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty needle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
haystack.val = Z_STRVAL_PP(arg1);
|
||||
haystack.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
haystack.len = Z_STRLEN_PP(arg1);
|
||||
needle.val = Z_STRVAL_PP(arg2);
|
||||
needle.len = Z_STRLEN_PP(arg2);
|
||||
@ -2089,9 +2089,9 @@ PHP_FUNCTION(mb_strrpos)
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Empty needle");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
haystack.val = Z_STRVAL_PP(arg1);
|
||||
haystack.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
haystack.len = Z_STRLEN_PP(arg1);
|
||||
needle.val = Z_STRVAL_PP(arg2);
|
||||
needle.val = (unsigned char *)Z_STRVAL_PP(arg2);
|
||||
needle.len = Z_STRLEN_PP(arg2);
|
||||
n = mbfl_strpos(&haystack, &needle, 0, 1 TSRMLS_CC);
|
||||
if (n >= 0) {
|
||||
@ -2142,7 +2142,7 @@ PHP_FUNCTION(mb_substr)
|
||||
}
|
||||
|
||||
convert_to_string_ex(arg1);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
convert_to_long_ex(arg2);
|
||||
@ -2182,7 +2182,7 @@ PHP_FUNCTION(mb_substr)
|
||||
|
||||
ret = mbfl_substr(&string, &result, from, len TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -2288,7 +2288,7 @@ PHP_FUNCTION(mb_strwidth)
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
if (n == 2){
|
||||
@ -2353,7 +2353,7 @@ PHP_FUNCTION(mb_strimwidth)
|
||||
}
|
||||
|
||||
convert_to_string_ex(arg1);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
convert_to_long_ex(arg2);
|
||||
@ -2373,13 +2373,13 @@ PHP_FUNCTION(mb_strimwidth)
|
||||
|
||||
if (ZEND_NUM_ARGS() >= 4) {
|
||||
convert_to_string_ex(arg4);
|
||||
marker.val = Z_STRVAL_PP(arg4);
|
||||
marker.val = (unsigned char *)Z_STRVAL_PP(arg4);
|
||||
marker.len = Z_STRLEN_PP(arg4);
|
||||
}
|
||||
|
||||
ret = mbfl_strimwidth(&string, &marker, &result, from, width TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -2418,7 +2418,7 @@ PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_enco
|
||||
from_encoding = MBSTRG(current_internal_encoding);
|
||||
string.no_encoding = from_encoding;
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.val = input;
|
||||
string.val = (unsigned char *)input;
|
||||
string.len = length;
|
||||
|
||||
/* pre-conversion encoding */
|
||||
@ -2463,7 +2463,7 @@ PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_enco
|
||||
if (output_len) {
|
||||
*output_len = ret->len;
|
||||
}
|
||||
output = ret->val;
|
||||
output = (char *)ret->val;
|
||||
}
|
||||
|
||||
mbfl_buffer_converter_delete(convd TSRMLS_CC);
|
||||
@ -2476,8 +2476,8 @@ PHPAPI char * php_mb_convert_encoding(char *input, size_t length, char *_to_enco
|
||||
PHP_FUNCTION(mb_convert_encoding)
|
||||
{
|
||||
pval **arg_str, **arg_new, **arg_old;
|
||||
int size, i;
|
||||
size_t l,n;
|
||||
int i;
|
||||
size_t size, l, n;
|
||||
char *_from_encodings, *ret, *s_free = NULL;
|
||||
|
||||
zval **hash_entry;
|
||||
@ -2675,7 +2675,7 @@ PHP_FUNCTION(mb_detect_encoding)
|
||||
convert_to_string_ex(arg_str);
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.val = Z_STRVAL_PP(arg_str);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg_str);
|
||||
string.len = Z_STRLEN_PP(arg_str);
|
||||
ret = mbfl_identify_encoding_name(&string, elist, size TSRMLS_CC);
|
||||
if (list != NULL) {
|
||||
@ -2751,7 +2751,7 @@ PHP_FUNCTION(mb_encode_mimeheader)
|
||||
string.len = Z_STRLEN_PP(argv[0]);
|
||||
ret = mbfl_mime_header_encode(&string, &result, charset, transenc, linefeed, 0 TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0) /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -2773,11 +2773,11 @@ PHP_FUNCTION(mb_decode_mimeheader)
|
||||
mbfl_string_init(&result);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
string.val = Z_STRVAL_PP(arg_str);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg_str);
|
||||
string.len = Z_STRLEN_PP(arg_str);
|
||||
ret = mbfl_mime_header_decode(&string, &result, MBSTRG(current_internal_encoding) TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0) /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0) /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -2807,7 +2807,7 @@ PHP_FUNCTION(mb_convert_kana)
|
||||
}
|
||||
|
||||
convert_to_string_ex(arg1);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
/* option */
|
||||
@ -2891,7 +2891,7 @@ PHP_FUNCTION(mb_convert_kana)
|
||||
|
||||
ret = mbfl_ja_jp_hantozen(&string, &result, opt TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0); /* the string is already strdup()'ed */
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -3006,7 +3006,7 @@ PHP_FUNCTION(mb_convert_variables)
|
||||
continue;
|
||||
}
|
||||
} else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
|
||||
string.val = Z_STRVAL_PP(hash_entry);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(hash_entry);
|
||||
string.len = Z_STRLEN_PP(hash_entry);
|
||||
if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
|
||||
goto detect_end; /* complete detecting */
|
||||
@ -3015,7 +3015,7 @@ PHP_FUNCTION(mb_convert_variables)
|
||||
}
|
||||
}
|
||||
} else if (Z_TYPE_PP(var) == IS_STRING) {
|
||||
string.val = Z_STRVAL_PP(var);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(var);
|
||||
string.len = Z_STRLEN_PP(var);
|
||||
if (mbfl_encoding_detector_feed(identd, &string TSRMLS_CC)) {
|
||||
goto detect_end; /* complete detecting */
|
||||
@ -3092,24 +3092,24 @@ detect_end:
|
||||
continue;
|
||||
}
|
||||
} else if (Z_TYPE_PP(hash_entry) == IS_STRING) {
|
||||
string.val = Z_STRVAL_PP(hash_entry);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(hash_entry);
|
||||
string.len = Z_STRLEN_PP(hash_entry);
|
||||
ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
STR_FREE(Z_STRVAL_PP(hash_entry));
|
||||
Z_STRVAL_PP(hash_entry) = ret->val;
|
||||
Z_STRVAL_PP(hash_entry) = (char *)ret->val;
|
||||
Z_STRLEN_PP(hash_entry) = ret->len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Z_TYPE_PP(var) == IS_STRING) {
|
||||
string.val = Z_STRVAL_PP(var);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(var);
|
||||
string.len = Z_STRLEN_PP(var);
|
||||
ret = mbfl_buffer_converter_feed_result(convd, &string, &result TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
STR_FREE(Z_STRVAL_PP(var));
|
||||
Z_STRVAL_PP(var) = ret->val;
|
||||
Z_STRVAL_PP(var) = (char *)ret->val;
|
||||
Z_STRLEN_PP(var) = ret->len;
|
||||
}
|
||||
}
|
||||
@ -3152,7 +3152,7 @@ php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
|
||||
mbfl_string_init(&string);
|
||||
string.no_language = MBSTRG(current_language);
|
||||
string.no_encoding = MBSTRG(current_internal_encoding);
|
||||
string.val = Z_STRVAL_PP(arg1);
|
||||
string.val = (unsigned char *)Z_STRVAL_PP(arg1);
|
||||
string.len = Z_STRLEN_PP(arg1);
|
||||
|
||||
/* encoding */
|
||||
@ -3198,7 +3198,7 @@ php_mbstr_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type)
|
||||
|
||||
ret = mbfl_html_numeric_entity(&string, &result, convmap, mapsize, type TSRMLS_CC);
|
||||
if (ret != NULL) {
|
||||
RETVAL_STRINGL(ret->val, ret->len, 0);
|
||||
RETVAL_STRINGL((char *)ret->val, ret->len, 0);
|
||||
} else {
|
||||
RETVAL_FALSE;
|
||||
}
|
||||
@ -3281,7 +3281,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
convert_to_string_ex(argv[1]);
|
||||
if (Z_STRVAL_PP(argv[1])) {
|
||||
orig_str.no_language = MBSTRG(current_language);
|
||||
orig_str.val = Z_STRVAL_PP(argv[1]);
|
||||
orig_str.val = (unsigned char *)Z_STRVAL_PP(argv[1]);
|
||||
orig_str.len = Z_STRLEN_PP(argv[1]);
|
||||
orig_str.no_encoding = mbfl_identify_encoding_no(&orig_str, MBSTRG(current_detect_order_list), MBSTRG(current_detect_order_list_size) TSRMLS_CC);
|
||||
if(orig_str.no_encoding == mbfl_no_encoding_invalid) {
|
||||
@ -3289,7 +3289,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
}
|
||||
pstr = mbfl_mime_header_encode(&orig_str, &conv_str, tran_cs, head_enc, "\n", sizeof("Subject: [PHP-jp nnnnnnnn]") TSRMLS_CC);
|
||||
if (pstr != NULL) {
|
||||
subject_buf = subject = pstr->val;
|
||||
subject_buf = subject = (char *)pstr->val;
|
||||
} else {
|
||||
subject = Z_STRVAL_PP(argv[1]);
|
||||
}
|
||||
@ -3310,7 +3310,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
}
|
||||
pstr = mbfl_convert_encoding(&orig_str, &conv_str, tran_cs TSRMLS_CC);
|
||||
if (pstr != NULL) {
|
||||
message_buf = message = pstr->val;
|
||||
message_buf = message = (char *)pstr->val;
|
||||
} else {
|
||||
message = Z_STRVAL_PP(argv[2]);
|
||||
}
|
||||
@ -3346,7 +3346,7 @@ PHP_FUNCTION(mb_send_mail)
|
||||
}
|
||||
mbfl_memory_device_strcat(&device, p TSRMLS_CC);
|
||||
mbfl_memory_device_output('\0', &device TSRMLS_CC);
|
||||
headers = device.buffer;
|
||||
headers = (char *)device.buffer;
|
||||
|
||||
if (argc == 5) { /* extra options that get passed to the mailer */
|
||||
convert_to_string_ex(argv[4]);
|
||||
|
@ -47,7 +47,7 @@ static void
|
||||
_php_mb_regex_strbuf_init(struct strbuf *pd)
|
||||
{
|
||||
if (pd) {
|
||||
pd->buffer = (char*)0;
|
||||
pd->buffer = (unsigned char*)0;
|
||||
pd->length = 0;
|
||||
pd->pos = 0;
|
||||
pd->allocsz = 64;
|
||||
@ -377,7 +377,7 @@ _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
|
||||
beg = regs.beg[i];
|
||||
end = regs.end[i];
|
||||
if (beg >= 0 && beg < end && end <= string_len) {
|
||||
add_index_stringl(array, i, &str[beg], end - beg, 1);
|
||||
add_index_stringl(array, i, (char *)&str[beg], end - beg, 1);
|
||||
} else {
|
||||
add_index_bool(array, i, 0);
|
||||
}
|
||||
@ -503,7 +503,7 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
|
||||
}
|
||||
#endif
|
||||
/* copy the part of the string before the match */
|
||||
_php_mb_regex_strbuf_ncat(&outdev, &string[pos], regs.beg[0] - pos);
|
||||
_php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], regs.beg[0] - pos);
|
||||
/* copy replacement and backrefs */
|
||||
/* FIXME: this code (\\digit replacement) is not mbyte aware! */
|
||||
i = 0;
|
||||
@ -515,12 +515,12 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
|
||||
}
|
||||
if (n >= 0 && n < regs.num_regs) {
|
||||
if (regs.beg[n] >= 0 && regs.beg[n] < regs.end[n] && regs.end[n] <= string_len) {
|
||||
_php_mb_regex_strbuf_ncat(pdevice, &string[regs.beg[n]], regs.end[n] - regs.beg[n]);
|
||||
_php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)&string[regs.beg[n]], regs.end[n] - regs.beg[n]);
|
||||
}
|
||||
p += 2;
|
||||
i += 2;
|
||||
} else {
|
||||
_php_mb_regex_strbuf_ncat(pdevice, p, 1);
|
||||
_php_mb_regex_strbuf_ncat(pdevice, (const unsigned char *)p, 1);
|
||||
p++;
|
||||
i++;
|
||||
}
|
||||
@ -528,9 +528,9 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
|
||||
if (eval) {
|
||||
zval v;
|
||||
/* null terminate buffer */
|
||||
_php_mb_regex_strbuf_ncat(&evaldev, "\0", 1);
|
||||
_php_mb_regex_strbuf_ncat(&evaldev, (const unsigned char *)"\0", 1);
|
||||
/* do eval */
|
||||
zend_eval_string(evaldev.buffer, &v, description TSRMLS_CC);
|
||||
zend_eval_string((char *)evaldev.buffer, &v, description TSRMLS_CC);
|
||||
/* result of eval */
|
||||
convert_to_string(&v);
|
||||
_php_mb_regex_strbuf_ncat(&outdev, Z_STRVAL(v), Z_STRLEN(v));
|
||||
@ -542,12 +542,12 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
|
||||
if (pos < n) {
|
||||
pos = n;
|
||||
} else {
|
||||
_php_mb_regex_strbuf_ncat(&outdev, &string[pos], 1 );
|
||||
_php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], 1 );
|
||||
pos++;
|
||||
}
|
||||
} else { /* nomatch */
|
||||
/* stick that last bit of string on our output */
|
||||
_php_mb_regex_strbuf_ncat(&outdev, &string[pos], string_len - pos);
|
||||
_php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], string_len - pos);
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,14 +559,14 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
|
||||
efree((void*)evaldev.buffer);
|
||||
}
|
||||
n = outdev.pos;
|
||||
_php_mb_regex_strbuf_ncat(&outdev, "\0", 1);
|
||||
_php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)"\0", 1);
|
||||
if (err <= -2) {
|
||||
if (outdev.buffer) {
|
||||
efree((void*)outdev.buffer);
|
||||
}
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
RETVAL_STRINGL(outdev.buffer, n, 0);
|
||||
RETVAL_STRINGL((char *)outdev.buffer, n, 0);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -633,7 +633,7 @@ PHP_FUNCTION(mb_split)
|
||||
|
||||
/* add it to the array */
|
||||
if ( regs.beg[0] < string_len && regs.beg[0] >= pos) {
|
||||
add_next_index_stringl(return_value, &string[pos], regs.beg[0]-pos, 1);
|
||||
add_next_index_stringl(return_value, (char *)&string[pos], regs.beg[0]-pos, 1);
|
||||
} else {
|
||||
err = -2;
|
||||
break;
|
||||
@ -660,9 +660,9 @@ PHP_FUNCTION(mb_split)
|
||||
/* otherwise we just have one last element to add to the array */
|
||||
n = string_len - pos;
|
||||
if (n > 0) {
|
||||
add_next_index_stringl(return_value, &string[pos], n, 1);
|
||||
add_next_index_stringl(return_value, (char *)&string[pos], n, 1);
|
||||
} else {
|
||||
add_next_index_stringl(return_value, empty_string, 0, 1);
|
||||
add_next_index_stringl(return_value, (char *)empty_string, 0, 1);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@ -771,7 +771,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
str = NULL;
|
||||
len = 0;
|
||||
if (Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING){
|
||||
str = Z_STRVAL_PP(MBSTRG(search_str));
|
||||
str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str));
|
||||
len = Z_STRLEN_PP(MBSTRG(search_str));
|
||||
}
|
||||
|
||||
@ -790,7 +790,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
MBSTRG(search_regs) = (struct mbre_registers*)ecalloc(1, sizeof(struct mbre_registers));
|
||||
}
|
||||
|
||||
err = mbre_search(MBSTRG(search_re), str, len, pos, len - pos, MBSTRG(search_regs));
|
||||
err = mbre_search(MBSTRG(search_re), (const char *)str, len, pos, len - pos, MBSTRG(search_regs));
|
||||
if (err <= -2) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in mbregex_search()");
|
||||
RETVAL_FALSE;
|
||||
@ -819,7 +819,7 @@ _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAMETERS, int mode)
|
||||
beg = MBSTRG(search_regs)->beg[i];
|
||||
end = MBSTRG(search_regs)->end[i];
|
||||
if (beg >= 0 && beg <= end && end <= len) {
|
||||
add_index_stringl(return_value, i, &str[beg], end - beg, 1);
|
||||
add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
|
||||
} else {
|
||||
add_index_bool(return_value, i, 0);
|
||||
}
|
||||
@ -972,14 +972,14 @@ PHP_FUNCTION(mb_ereg_search_getregs)
|
||||
|
||||
if (MBSTRG(search_regs) && Z_TYPE_PP(MBSTRG(search_str)) == IS_STRING &&
|
||||
Z_STRVAL_PP(MBSTRG(search_str)) && array_init(return_value) != FAILURE) {
|
||||
str = Z_STRVAL_PP(MBSTRG(search_str));
|
||||
str = (unsigned char *)Z_STRVAL_PP(MBSTRG(search_str));
|
||||
len = Z_STRLEN_PP(MBSTRG(search_str));
|
||||
n = MBSTRG(search_regs)->num_regs;
|
||||
for (i = 0; i < n; i++) {
|
||||
beg = MBSTRG(search_regs)->beg[i];
|
||||
end = MBSTRG(search_regs)->end[i];
|
||||
if (beg >= 0 && beg <= end && end <= len) {
|
||||
add_index_stringl(return_value, i, &str[beg], end - beg, 1);
|
||||
add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
|
||||
} else {
|
||||
add_index_bool(return_value, i, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user