@@ -126,7 +126,7 @@ static PHP_METHOD(swoole_client, getSocket);
126126SW_EXTERN_C_END
127127
128128#ifdef PHP_SWOOLE_CLIENT_USE_POLL
129- static int client_poll_add (zval *sock_array, int index, struct pollfd *fds, int maxevents, int event);
129+ static uint32_t client_poll_add (zval *sock_array, uint32_t index, struct pollfd *fds, int maxevents, int event);
130130static int client_poll_wait (zval *sock_array, struct pollfd *fds, int maxevents, int n_event, int revent);
131131#else
132132static int client_select_add (zval *sock_array, fd_set *fds, int *max_fd);
@@ -1354,7 +1354,8 @@ static PHP_METHOD(swoole_client, shutdown) {
13541354PHP_FUNCTION (swoole_client_select) {
13551355#ifdef PHP_SWOOLE_CLIENT_USE_POLL
13561356 zval *r_array, *w_array, *e_array;
1357- int retval, index = 0 ;
1357+ int retval;
1358+ uint32_t index = 0 ;
13581359 double timeout = SW_CLIENT_CONNECT_TIMEOUT;
13591360
13601361 if (zend_parse_parameters (ZEND_NUM_ARGS (), " a!a!a!|d" , &r_array, &w_array, &e_array, &timeout) == FAILURE) {
@@ -1374,7 +1375,7 @@ PHP_FUNCTION(swoole_client_select) {
13741375 if (e_array != nullptr && php_swoole_array_length (e_array) > 0 ) {
13751376 index = client_poll_add (e_array, index, fds, maxevents, POLLHUP);
13761377 }
1377- if (index < = 0 ) {
1378+ if (index = = 0 ) {
13781379 efree (fds);
13791380 php_swoole_fatal_error (E_WARNING, " no resource arrays were passed to select" );
13801381 RETURN_FALSE;
@@ -1503,13 +1504,13 @@ static int client_poll_wait(zval *sock_array, struct pollfd *fds, int maxevents,
15031504
15041505 zval_ptr_dtor (sock_array);
15051506 ZVAL_COPY_VALUE (sock_array, &new_array);
1506- return num ? 1 : 0 ;
1507+ return num;
15071508}
15081509
1509- static int client_poll_add (zval *sock_array, int index, struct pollfd *fds, int maxevents, int event) {
1510+ static uint32_t client_poll_add (zval *sock_array, uint32_t index, struct pollfd *fds, int maxevents, int event) {
15101511 zval *element = nullptr ;
15111512 if (!ZVAL_IS_ARRAY (sock_array)) {
1512- return - 1 ;
1513+ return 0 ;
15131514 }
15141515
15151516 int sock;
0 commit comments