Skip to content

Commit

Permalink
Fix [-Wincompatible-pointer-types]
Browse files Browse the repository at this point in the history
  • Loading branch information
remicollet committed Feb 16, 2024
1 parent 8b0bc22 commit 3b841b7
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crypto_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,21 @@ typedef struct {
} php_crypto_stream_data;

/* {{{ php_crypto_stream_write */
#if PHP_VERSION_ID < 70400
static size_t php_crypto_stream_write(php_stream *stream,
#else
static ssize_t php_crypto_stream_write(php_stream *stream,
#endif
const char *buf, size_t count TSRMLS_DC)
{
php_crypto_stream_data *data = (php_crypto_stream_data *) stream->abstract;
int bytes_written = BIO_write(data->bio, buf, count > INT_MAX ? INT_MAX : count);

#if PHP_VERSION_ID < 70400
return bytes_written <= 0 ? 0 : (size_t) bytes_written;
#else
return bytes_written;
#endif
}
/* }}} */

Expand Down Expand Up @@ -256,7 +264,11 @@ static void php_crypto_stream_auth_save_result(php_stream *stream, int ok)
/* }}} */

/* {{{ php_crypto_stream_read */
#if PHP_VERSION_ID < 70400
static size_t php_crypto_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
#else
static ssize_t php_crypto_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
#endif
{
php_crypto_stream_data *data = (php_crypto_stream_data *) stream->abstract;
int bytes_read = BIO_read(data->bio, buf, count > INT_MAX ? INT_MAX : count);
Expand Down

0 comments on commit 3b841b7

Please sign in to comment.