Skip to content

Commit e990406

Browse files
committed
fix datatype mismatches and warns
1 parent 11b119d commit e990406

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

main/php_ini.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ static void php_ini_displayer_cb(zend_ini_entry *ini_entry, int type TSRMLS_DC)
8080
ini_entry->displayer(ini_entry, type);
8181
} else {
8282
char *display_string;
83-
uint display_string_length, esc_html=0;
83+
size_t display_string_length;
84+
int esc_html=0;
8485

8586
if (type == ZEND_INI_DISPLAY_ORIG && ini_entry->modified) {
8687
if (ini_entry->orig_value && ini_entry->orig_value->val[0]) {
@@ -281,7 +282,7 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t
281282
/* fprintf(stdout, "ZEND_INI_PARSER_SECTION: %s\n",Z_STRVAL_P(arg1)); */
282283

283284
char *key = NULL;
284-
uint key_len;
285+
size_t key_len;
285286

286287
/* PATH sections */
287288
if (!strncasecmp(Z_STRVAL_P(arg1), "PATH", sizeof("PATH") - 1)) {
@@ -355,14 +356,14 @@ static void php_load_php_extension_cb(void *arg TSRMLS_DC)
355356
static void php_load_zend_extension_cb(void *arg TSRMLS_DC)
356357
{
357358
char *filename = *((char **) arg);
358-
const int length = strlen(filename);
359+
const int length = (int)strlen(filename);
359360

360361
if (IS_ABSOLUTE_PATH(filename, length)) {
361362
zend_load_extension(filename TSRMLS_CC);
362363
} else {
363364
char *libpath;
364365
char *extension_dir = INI_STR("extension_dir");
365-
int extension_dir_len = strlen(extension_dir);
366+
int extension_dir_len = (int)strlen(extension_dir);
366367

367368
if (IS_SLASH(extension_dir[extension_dir_len-1])) {
368369
spprintf(&libpath, 0, "%s%s", extension_dir, filename);
@@ -449,7 +450,7 @@ int php_init_config(TSRMLS_D)
449450
* Prepare search path
450451
*/
451452

452-
search_path_size = MAXPATHLEN * 4 + strlen(env_location) + 3 + 1;
453+
search_path_size = MAXPATHLEN * 4 + (int)strlen(env_location) + 3 + 1;
453454
php_ini_search_path = (char *) emalloc(search_path_size);
454455
free_ini_search_path = 1;
455456
php_ini_search_path[0] = 0;
@@ -608,7 +609,7 @@ int php_init_config(TSRMLS_D)
608609
/* Or fall back using possible --with-config-file-scan-dir setting (defaults to empty string!) */
609610
php_ini_scanned_path = PHP_CONFIG_FILE_SCAN_DIR;
610611
}
611-
php_ini_scanned_path_len = strlen(php_ini_scanned_path);
612+
php_ini_scanned_path_len = (int)strlen(php_ini_scanned_path);
612613

613614
/* Scan and parse any .ini files found in scan path if path not empty. */
614615
if (!sapi_module.php_ini_ignore && php_ini_scanned_path_len) {
@@ -638,7 +639,7 @@ int php_init_config(TSRMLS_D)
638639
to allow "/foo/phd.d:" or ":/foo/php.d" */
639640
debpath = PHP_CONFIG_FILE_SCAN_DIR;
640641
}
641-
lenpath = strlen(debpath);
642+
lenpath = (int)strlen(debpath);
642643

643644
if (lenpath > 0 && (ndir = php_scandir(debpath, &namelist, 0, php_alphasort)) > 0) {
644645

@@ -665,7 +666,7 @@ int php_init_config(TSRMLS_D)
665666

666667
if (zend_parse_ini_file(&fh2, 1, ZEND_INI_SCANNER_NORMAL, (zend_ini_parser_cb_t) php_ini_parser_cb, &configuration_hash TSRMLS_CC) == SUCCESS) {
667668
/* Here, add it to the list of ini files read */
668-
l = strlen(ini_file);
669+
l = (int)strlen(ini_file);
669670
total_l += l + 2;
670671
p = estrndup(ini_file, l);
671672
zend_llist_add_element(&scanned_ini_list, &p);
@@ -681,7 +682,7 @@ int php_init_config(TSRMLS_D)
681682
efree(bufpath);
682683

683684
if (total_l) {
684-
int php_ini_scanned_files_len = (php_ini_scanned_files) ? strlen(php_ini_scanned_files) + 1 : 0;
685+
int php_ini_scanned_files_len = (php_ini_scanned_files) ? (int)strlen(php_ini_scanned_files) + 1 : 0;
685686
php_ini_scanned_files = (char *) realloc(php_ini_scanned_files, php_ini_scanned_files_len + total_l + 1);
686687
if (!php_ini_scanned_files_len) {
687688
*php_ini_scanned_files = '\0';

0 commit comments

Comments
 (0)