Skip to content

Commit

Permalink
fix compile openssl error
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Sep 26, 2023
1 parent 6d19e51 commit d5c53e8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/tbox/network/impl/ssl/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static int tb_ssl_bio_method_puts(BIO* bio, char const* data)
tb_assert_and_check_return_val(bio && data, -1);

tb_trace_d("bio: puts: %s", data);
return tb_ssl_bio_method_writ(bio, data, tb_strlen(data));
return tb_ssl_bio_method_writ(bio, data, (tb_int_t)tb_strlen(data));
}
static int tb_ssl_bio_method_gets(BIO* bio, char* data, int size)
{
Expand Down Expand Up @@ -477,7 +477,7 @@ tb_long_t tb_ssl_open_try(tb_ssl_ref_t self)
else
{
// the error
tb_long_t error = SSL_get_error(ssl->ssl, r);
tb_long_t error = SSL_get_error(ssl->ssl, (tb_int_t)r);

// wait?
if (error == SSL_ERROR_WANT_WRITE || error == SSL_ERROR_WANT_READ)
Expand Down Expand Up @@ -563,7 +563,7 @@ tb_long_t tb_ssl_close_try(tb_ssl_ref_t self)
else
{
// the error
tb_long_t error = SSL_get_error(ssl->ssl, r);
tb_long_t error = SSL_get_error(ssl->ssl, (tb_int_t)r);

// wait?
if (error == SSL_ERROR_WANT_WRITE || error == SSL_ERROR_WANT_READ)
Expand Down Expand Up @@ -611,15 +611,15 @@ tb_long_t tb_ssl_read(tb_ssl_ref_t self, tb_byte_t* data, tb_size_t size)
tb_assert_and_check_return_val(ssl && ssl->ssl && ssl->bopened && data, -1);

// read it
tb_long_t real = SSL_read(ssl->ssl, data, size);
tb_long_t real = SSL_read(ssl->ssl, data, (tb_int_t)size);

// trace
tb_trace_d("read: %ld", real);

if (real < 0)
{
// the error
tb_long_t error = SSL_get_error(ssl->ssl, real);
tb_long_t error = SSL_get_error(ssl->ssl, (tb_int_t)real);

// want read? continue it
if (error == SSL_ERROR_WANT_READ)
Expand Down Expand Up @@ -671,7 +671,7 @@ tb_long_t tb_ssl_writ(tb_ssl_ref_t self, tb_byte_t const* data, tb_size_t size)
tb_assert_and_check_return_val(ssl && ssl->ssl && ssl->bopened && data, -1);

// writ it
tb_long_t real = SSL_write(ssl->ssl, data, size);
tb_long_t real = SSL_write(ssl->ssl, data, (tb_int_t)size);

// trace
tb_trace_d("writ: %ld", real);
Expand All @@ -680,7 +680,7 @@ tb_long_t tb_ssl_writ(tb_ssl_ref_t self, tb_byte_t const* data, tb_size_t size)
if (real < 0)
{
// the error
tb_long_t error = SSL_get_error(ssl->ssl, real);
tb_long_t error = SSL_get_error(ssl->ssl, (tb_int_t)real);

// want read? continue it
if (error == SSL_ERROR_WANT_READ)
Expand Down

0 comments on commit d5c53e8

Please sign in to comment.