@@ -237,7 +237,7 @@ static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, bool i
237
237
char esbuf [512 ];
238
238
smart_str ebuf = {0 };
239
239
unsigned long ecode ;
240
- int retry = 1 ;
240
+ bool retry = true ;
241
241
242
242
switch (err ) {
243
243
case SSL_ERROR_ZERO_RETURN :
@@ -249,7 +249,7 @@ static int php_openssl_handle_ssl_error(php_stream *stream, int nr_bytes, bool i
249
249
/* re-negotiation, or perhaps the SSL layer needs more
250
250
* packets: retry in next iteration */
251
251
errno = EAGAIN ;
252
- retry = is_init ? 1 : sslsock -> s .is_blocked ;
252
+ retry = is_init ? true : sslsock -> s .is_blocked ;
253
253
break ;
254
254
case SSL_ERROR_SYSCALL :
255
255
if (ERR_peek_error () == 0 ) {
@@ -1806,7 +1806,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
1806
1806
1807
1807
if (cparam -> inputs .activate && !sslsock -> ssl_active ) {
1808
1808
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 ;
1810
1810
1811
1811
#ifdef HAVE_TLS_SNI
1812
1812
if (sslsock -> is_client ) {
@@ -1946,8 +1946,8 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
1946
1946
int retry = 1 ;
1947
1947
struct timeval start_time ;
1948
1948
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 ;
1951
1951
int nr_bytes = 0 ;
1952
1952
1953
1953
/* prevent overflow in openssl */
@@ -1965,7 +1965,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
1965
1965
}
1966
1966
1967
1967
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 ;
1969
1969
/* gettimeofday is not monotonic; using it here is not strictly correct */
1970
1970
gettimeofday (& start_time , NULL );
1971
1971
}
@@ -1987,7 +1987,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
1987
1987
if (began_blocked ) {
1988
1988
php_openssl_set_blocking (sslsock , 1 );
1989
1989
}
1990
- sslsock -> s .timeout_event = 1 ;
1990
+ sslsock -> s .timeout_event = true ;
1991
1991
return -1 ;
1992
1992
}
1993
1993
}
@@ -2248,7 +2248,7 @@ static inline int php_openssl_tcp_sockop_accept(php_stream *stream, php_openssl_
2248
2248
clisockdata -> s .socket = clisock ;
2249
2249
#ifdef __linux__
2250
2250
/* O_NONBLOCK is not inherited on Linux */
2251
- clisockdata -> s .is_blocked = 1 ;
2251
+ clisockdata -> s .is_blocked = true ;
2252
2252
#endif
2253
2253
2254
2254
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
2379
2379
int retry = 1 ;
2380
2380
struct timeval start_time ;
2381
2381
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 ;
2384
2384
2385
2385
/* never use a timeout with non-blocking sockets */
2386
2386
if (began_blocked ) {
@@ -2392,7 +2392,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
2392
2392
}
2393
2393
2394
2394
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 ;
2396
2396
/* gettimeofday is not monotonic; using it here is not strictly correct */
2397
2397
gettimeofday (& start_time , NULL );
2398
2398
}
@@ -2414,7 +2414,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
2414
2414
if (began_blocked ) {
2415
2415
php_openssl_set_blocking (sslsock , 1 );
2416
2416
}
2417
- sslsock -> s .timeout_event = 1 ;
2417
+ sslsock -> s .timeout_event = true ;
2418
2418
return PHP_STREAM_OPTION_RETURN_ERR ;
2419
2419
}
2420
2420
}
@@ -2438,7 +2438,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
2438
2438
}
2439
2439
2440
2440
/* 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 ) {
2442
2442
alive = retry ;
2443
2443
break ;
2444
2444
}
@@ -2668,7 +2668,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
2668
2668
sslsock = pemalloc (sizeof (php_openssl_netstream_data_t ), persistent_id ? 1 : 0 );
2669
2669
memset (sslsock , 0 , sizeof (* sslsock ));
2670
2670
2671
- sslsock -> s .is_blocked = 1 ;
2671
+ sslsock -> s .is_blocked = true ;
2672
2672
/* this timeout is used by standard stream funcs, therefore it should use the default value */
2673
2673
#ifdef _WIN32
2674
2674
sslsock -> s .timeout .tv_sec = (long )FG (default_socket_timeout );
0 commit comments