X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fbio%2Fbss_conn.c;h=5c461ae751990c029657aa9950c7175df7f7a0d4;hp=7c6c9a45dfb76e795f5b895cf66df517eefaa5df;hb=1fb6b0bf3e895c6b30f9c95a23284f93e4fa19b0;hpb=208fb891e36f16d20262710c70ef0ff3df0e885c diff --git a/crypto/bio/bss_conn.c b/crypto/bio/bss_conn.c index 7c6c9a45df..5c461ae751 100644 --- a/crypto/bio/bss_conn.c +++ b/crypto/bio/bss_conn.c @@ -32,7 +32,7 @@ typedef struct bio_connect_st { * The callback should return 'ret'. state is for compatibility with the * ssl info_callback */ - int (*info_callback) (const BIO *bio, int state, int ret); + BIO_info_cb *info_callback; } BIO_CONNECT; static int conn_write(BIO *h, const char *buf, int num); @@ -41,7 +41,7 @@ static int conn_puts(BIO *h, const char *str); static long conn_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int conn_new(BIO *h); static int conn_free(BIO *data); -static long conn_callback_ctrl(BIO *h, int cmd, bio_info_cb *); +static long conn_callback_ctrl(BIO *h, int cmd, BIO_info_cb *); static int conn_state(BIO *b, BIO_CONNECT *c); static void conn_close_socket(BIO *data); @@ -65,7 +65,7 @@ static const BIO_METHOD methods_connectp = { bread_conv, conn_read, conn_puts, - NULL, /* connect_gets, */ + NULL, /* conn_gets, */ conn_ctrl, conn_new, conn_free, @@ -75,7 +75,7 @@ static const BIO_METHOD methods_connectp = { static int conn_state(BIO *b, BIO_CONNECT *c) { int ret = -1, i; - int (*cb) (const BIO *, int, int) = NULL; + BIO_info_cb *cb = NULL; if (c->info_callback != NULL) cb = c->info_callback; @@ -216,7 +216,7 @@ static int conn_state(BIO *b, BIO_CONNECT *c) if (cb != NULL) ret = cb((BIO *)b, c->state, ret); end: - return (ret); + return ret; } BIO_CONNECT *BIO_CONNECT_new(void) @@ -224,10 +224,10 @@ BIO_CONNECT *BIO_CONNECT_new(void) BIO_CONNECT *ret; if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) - return (NULL); + return NULL; ret->state = BIO_CONN_S_BEFORE; ret->connect_family = BIO_FAMILY_IPANY; - return (ret); + return ret; } void BIO_CONNECT_free(BIO_CONNECT *a) @@ -243,7 +243,7 @@ void BIO_CONNECT_free(BIO_CONNECT *a) const BIO_METHOD *BIO_s_connect(void) { - return (&methods_connectp); + return &methods_connectp; } static int conn_new(BIO *bi) @@ -252,7 +252,7 @@ static int conn_new(BIO *bi) bi->num = (int)INVALID_SOCKET; bi->flags = 0; if ((bi->ptr = (char *)BIO_CONNECT_new()) == NULL) - return (0); + return 0; else return 1; } @@ -276,7 +276,7 @@ static int conn_free(BIO *a) BIO_CONNECT *data; if (a == NULL) - return (0); + return 0; data = (BIO_CONNECT *)a->ptr; if (a->shutdown) { @@ -298,7 +298,7 @@ static int conn_read(BIO *b, char *out, int outl) if (data->state != BIO_CONN_S_OK) { ret = conn_state(b, data); if (ret <= 0) - return (ret); + return ret; } if (out != NULL) { @@ -310,7 +310,7 @@ static int conn_read(BIO *b, char *out, int outl) BIO_set_retry_read(b); } } - return (ret); + return ret; } static int conn_write(BIO *b, const char *in, int inl) @@ -322,7 +322,7 @@ static int conn_write(BIO *b, const char *in, int inl) if (data->state != BIO_CONN_S_OK) { ret = conn_state(b, data); if (ret <= 0) - return (ret); + return ret; } clear_socket_error(); @@ -332,7 +332,7 @@ static int conn_write(BIO *b, const char *in, int inl) if (BIO_sock_should_retry(ret)) BIO_set_retry_write(b); } - return (ret); + return ret; } static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) @@ -473,8 +473,7 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) * FIXME: the cast of the function seems unlikely to be a good * idea */ - (void)BIO_set_info_callback(dbio, - (bio_info_cb *)data->info_callback); + (void)BIO_set_info_callback(dbio, data->info_callback); } break; case BIO_CTRL_SET_CALLBACK: @@ -482,9 +481,9 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) break; case BIO_CTRL_GET_CALLBACK: { - int (**fptr) (const BIO *bio, int state, int xret); + BIO_info_cb **fptr; - fptr = (int (**)(const BIO *bio, int state, int xret))ptr; + fptr = (BIO_info_cb **)ptr; *fptr = data->info_callback; } break; @@ -492,10 +491,10 @@ static long conn_ctrl(BIO *b, int cmd, long num, void *ptr) ret = 0; break; } - return (ret); + return ret; } -static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) +static long conn_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) { long ret = 1; BIO_CONNECT *data; @@ -505,15 +504,14 @@ static long conn_callback_ctrl(BIO *b, int cmd, bio_info_cb *fp) switch (cmd) { case BIO_CTRL_SET_CALLBACK: { - data->info_callback = - (int (*)(const struct bio_st *, int, int))fp; + data->info_callback = fp; } break; default: ret = 0; break; } - return (ret); + return ret; } static int conn_puts(BIO *bp, const char *str) @@ -522,7 +520,7 @@ static int conn_puts(BIO *bp, const char *str) n = strlen(str); ret = conn_write(bp, str, n); - return (ret); + return ret; } BIO *BIO_new_connect(const char *str) @@ -531,11 +529,11 @@ BIO *BIO_new_connect(const char *str) ret = BIO_new(BIO_s_connect()); if (ret == NULL) - return (NULL); + return NULL; if (BIO_set_conn_hostname(ret, str)) - return (ret); + return ret; BIO_free(ret); - return (NULL); + return NULL; } #endif