Skip to content

Commit dff7994

Browse files
alexdowadkocsismate
authored andcommitted
Avoid compiler warnings in proc_open.c
We are getting a lot of compiler warnings when building on Appveyor CI (Windows). Fix some of them. Closes GH-5629
1 parent 6e52472 commit dff7994

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ext/standard/proc_open.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static php_process_env _php_array_to_envp(zval *environment)
7474
char **ep;
7575
#endif
7676
char *p;
77-
size_t cnt, sizeenv = 0;
77+
size_t sizeenv = 0;
7878
HashTable *env_hash; /* temporary PHP array used as helper */
7979

8080
memset(&env, 0, sizeof(env));
@@ -83,7 +83,7 @@ static php_process_env _php_array_to_envp(zval *environment)
8383
return env;
8484
}
8585

86-
cnt = zend_hash_num_elements(Z_ARRVAL_P(environment));
86+
uint32_t cnt = zend_hash_num_elements(Z_ARRVAL_P(environment));
8787

8888
if (cnt < 1) {
8989
#ifndef PHP_WIN32
@@ -794,7 +794,7 @@ static int set_proc_descriptor_from_array(zval *descitem, descriptorspec_item *d
794794
}
795795

796796
retval = redirect_proc_descriptor(
797-
&descriptors[ndesc], Z_LVAL_P(ztarget), descriptors, ndesc, nindex);
797+
&descriptors[ndesc], (int)Z_LVAL_P(ztarget), descriptors, ndesc, nindex);
798798
} else if (zend_string_equals_literal(ztype, "null")) {
799799
/* Set descriptor to blackhole (discard all data written) */
800800
retval = set_proc_descriptor_to_blackhole(&descriptors[ndesc]);
@@ -829,7 +829,7 @@ static int set_proc_descriptor_from_resource(zval *resource, descriptorspec_item
829829
}
830830

831831
#ifdef PHP_WIN32
832-
php_file_descriptor_t fd_t = (HANDLE)_get_osfhandle(fd);
832+
php_file_descriptor_t fd_t = (php_file_descriptor_t)_get_osfhandle(fd);
833833
#else
834834
php_file_descriptor_t fd_t = fd;
835835
#endif
@@ -991,8 +991,8 @@ PHP_FUNCTION(proc_open)
991991
goto exit_fail;
992992
}
993993
} else if (Z_TYPE_P(descitem) == IS_ARRAY) {
994-
if (set_proc_descriptor_from_array(descitem, descriptors, ndesc, nindex, &pty_master_fd,
995-
&pty_slave_fd) == FAILURE) {
994+
if (set_proc_descriptor_from_array(descitem, descriptors, ndesc, (int)nindex,
995+
&pty_master_fd, &pty_slave_fd) == FAILURE) {
996996
goto exit_fail;
997997
}
998998
} else {

0 commit comments

Comments
 (0)