fix datatype mismatch warnings

This commit is contained in:
Anatol Belski 2014-10-28 18:43:22 +01:00
parent abfb30dc67
commit d9d16d2e68
6 changed files with 366 additions and 362 deletions

View file

@ -99,8 +99,8 @@ static void zend_ini_init_string(zval *result)
*/
static void zend_ini_add_string(zval *result, zval *op1, zval *op2)
{
int op1_len = Z_STRLEN_P(op1);
int length = op1_len + Z_STRLEN_P(op2);
int op1_len = (int)Z_STRLEN_P(op1);
int length = op1_len + (int)Z_STRLEN_P(op2);
ZVAL_NEW_STR(result, zend_string_realloc(Z_STR_P(op1), length, 1));
memcpy(Z_STRVAL_P(result)+op1_len, Z_STRVAL_P(op2), Z_STRLEN_P(op2));
@ -168,7 +168,7 @@ static void ini_error(const char *msg)
currently_parsed_filename = zend_ini_scanner_get_filename(TSRMLS_C);
if (currently_parsed_filename) {
error_buf_len = 128 + strlen(msg) + strlen(currently_parsed_filename); /* should be more than enough */
error_buf_len = 128 + (int)strlen(msg) + (int)strlen(currently_parsed_filename); /* should be more than enough */
error_buf = (char *) emalloc(error_buf_len);
sprintf(error_buf, "%s in %s on line %d\n", msg, currently_parsed_filename, zend_ini_scanner_get_lineno(TSRMLS_C));

View file

@ -283,7 +283,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
return FAILURE;
}
yy_scan_buffer(buf, size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
return SUCCESS;
}
@ -293,7 +293,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
*/
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
{
int len = strlen(str);
int len = (int)strlen(str);
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
return FAILURE;

View file

@ -281,7 +281,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
return FAILURE;
}
yy_scan_buffer(buf, size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
return SUCCESS;
}
@ -291,7 +291,7 @@ int zend_ini_open_file_for_scanning(zend_file_handle *fh, int scanner_mode TSRML
*/
int zend_ini_prepare_string_for_scanning(char *str, int scanner_mode TSRMLS_DC)
{
int len = strlen(str);
int len = (int)strlen(str);
if (init_ini_scanner(scanner_mode, NULL TSRMLS_CC) == FAILURE) {
return FAILURE;

View file

@ -1187,7 +1187,7 @@ static YYSIZE_T zend_yytnamerr(char *yyres, const char *yystr)
str = LANG_SCNG(yy_text);
end = memchr(str, '\n', LANG_SCNG(yy_leng));
yystr_len = yystrlen(yystr);
yystr_len = (unsigned int)yystrlen(yystr);
if ((tok1 = memchr(yystr, '(', yystr_len)) != NULL
&& (tok2 = zend_memrchr(yystr, ')', yystr_len)) != NULL) {

File diff suppressed because it is too large Load diff

View file

@ -284,7 +284,8 @@ static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned ch
/* utf-16 or utf-32? */
p = script;
while ((p-script) < script_size) {
assert(p >= script);
while ((size_t)(p-script) < script_size) {
p = memchr(p, 0, script_size-(p-script)-2);
if (!p) {
break;
@ -300,7 +301,8 @@ static const zend_encoding *zend_multibyte_detect_utf_encoding(const unsigned ch
/* BE or LE? */
p = script;
while ((p-script) < script_size) {
assert(p >= script);
while ((size_t)(p-script) < script_size) {
if (*p == '\0' && *(p+wchar_size-1) != '\0') {
/* BE */
le = 0;
@ -520,7 +522,7 @@ ZEND_API int open_file_for_scanning(zend_file_handle *file_handle TSRMLS_DC)
}
}
SCNG(yy_start) = (unsigned char *)buf - offset;
yy_scan_buffer(buf, size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
} else {
zend_error_noreturn(E_COMPILE_ERROR, "zend_stream_mmap() failed");
}
@ -681,7 +683,7 @@ ZEND_API int zend_prepare_string_for_scanning(zval *str, char *filename TSRMLS_D
}
}
yy_scan_buffer(buf, size TSRMLS_CC);
yy_scan_buffer(buf, (unsigned int)size TSRMLS_CC);
new_compiled_filename = zend_string_init(filename, strlen(filename), 0);
zend_set_compiled_filename(new_compiled_filename TSRMLS_CC);
@ -1656,7 +1658,7 @@ inline_char_handler:
yyleng = YYCURSOR - SCNG(yy_text);
if (SCNG(output_filter)) {
int readsize;
size_t readsize;
char *s = NULL;
size_t sz = 0;
// TODO: avoid reallocation ???