@@ -237,7 +237,7 @@ static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, bool i
237237 char esbuf [512 ];
238238 smart_str ebuf = {0 };
239239 unsigned long ecode ;
240- int retry = 1 ;
240+ bool retry = true ;
241241
242242 switch (err ) {
243243 case SSL_ERROR_ZERO_RETURN :
@@ -249,7 +249,7 @@ static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, bool i
249249 /* re-negotiation, or perhaps the SSL layer needs more
250250 * packets: retry in next iteration */
251251 errno = EAGAIN ;
252- retry = is_init ? 1 : sslsock -> s .is_blocked ;
252+ retry = is_init ? true : sslsock -> s .is_blocked ;
253253 break ;
254254 case SSL_ERROR_SYSCALL :
255255 if (ERR_peek_error () == 0 ) {
@@ -1806,7 +1806,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
18061806
18071807 if (cparam -> inputs .activate && !sslsock -> ssl_active ) {
18081808 struct timeval start_time , * timeout ;
1809- int blocked = sslsock -> s .is_blocked , has_timeout = 0 ;
1809+ bool blocked = sslsock -> s .is_blocked , has_timeout = false ;
18101810
18111811#ifdef HAVE_TLS_SNI
18121812 if (sslsock -> is_client ) {
@@ -1946,8 +1946,8 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
19461946 int retry = 1 ;
19471947 struct timeval start_time ;
19481948 struct timeval * timeout = NULL ;
1949- int began_blocked = sslsock -> s .is_blocked ;
1950- int has_timeout = 0 ;
1949+ bool began_blocked = sslsock -> s .is_blocked ;
1950+ bool has_timeout = false ;
19511951 int nr_bytes = 0 ;
19521952
19531953 /* prevent overflow in openssl */
@@ -1965,7 +1965,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
19651965 }
19661966
19671967 if (!sslsock -> s .is_blocked && timeout && (timeout -> tv_sec > 0 || (timeout -> tv_sec == 0 && timeout -> tv_usec ))) {
1968- has_timeout = 1 ;
1968+ has_timeout = true ;
19691969 /* gettimeofday is not monotonic; using it here is not strictly correct */
19701970 gettimeofday (& start_time , NULL );
19711971 }
@@ -1987,7 +1987,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
19871987 if (began_blocked ) {
19881988 php_openssl_set_blocking (sslsock , 1 );
19891989 }
1990- sslsock -> s .timeout_event = 1 ;
1990+ sslsock -> s .timeout_event = true ;
19911991 return -1 ;
19921992 }
19931993 }
@@ -2248,7 +2248,7 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
22482248 clisockdata -> s .socket = clisock ;
22492249#ifdef __linux__
22502250 /* O_NONBLOCK is not inherited on Linux */
2251- clisockdata -> s .is_blocked = 1 ;
2251+ clisockdata -> s .is_blocked = true ;
22522252#endif
22532253
22542254 xparam -> outputs .client = php_stream_alloc_rel (stream -> ops , clisockdata , NULL , "r+" );
@@ -2379,8 +2379,8 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
23792379 int retry = 1 ;
23802380 struct timeval start_time ;
23812381 struct timeval * timeout = NULL ;
2382- int began_blocked = sslsock -> s .is_blocked ;
2383- int has_timeout = 0 ;
2382+ bool began_blocked = sslsock -> s .is_blocked ;
2383+ bool has_timeout = false ;
23842384
23852385 /* never use a timeout with non-blocking sockets */
23862386 if (began_blocked ) {
@@ -2392,7 +2392,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
23922392 }
23932393
23942394 if (!sslsock -> s .is_blocked && timeout && (timeout -> tv_sec > 0 || (timeout -> tv_sec == 0 && timeout -> tv_usec ))) {
2395- has_timeout = 1 ;
2395+ has_timeout = true ;
23962396 /* gettimeofday is not monotonic; using it here is not strictly correct */
23972397 gettimeofday (& start_time , NULL );
23982398 }
@@ -2414,7 +2414,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
24142414 if (began_blocked ) {
24152415 php_openssl_set_blocking (sslsock , 1 );
24162416 }
2417- sslsock -> s .timeout_event = 1 ;
2417+ sslsock -> s .timeout_event = true ;
24182418 return PHP_STREAM_OPTION_RETURN_ERR ;
24192419 }
24202420 }
@@ -2438,7 +2438,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
24382438 }
24392439
24402440 /* Don't loop indefinitely in non-blocking mode if no data is available */
2441- if (began_blocked == 0 || !has_timeout ) {
2441+ if (! began_blocked || !has_timeout ) {
24422442 alive = retry ;
24432443 break ;
24442444 }
@@ -2668,7 +2668,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
26682668 sslsock = pemalloc (sizeof (php_openssl_netstream_data_t ), persistent_id ? 1 : 0 );
26692669 memset (sslsock , 0 , sizeof (* sslsock ));
26702670
2671- sslsock -> s .is_blocked = 1 ;
2671+ sslsock -> s .is_blocked = true ;
26722672 /* this timeout is used by standard stream funcs, therefore it should use the default value */
26732673#ifdef _WIN32
26742674 sslsock -> s .timeout .tv_sec = (long )FG (default_socket_timeout );
0 commit comments