From ff04799d904ec2bfcfc3a3ca656549db2dec9068 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 4 Nov 2016 10:25:03 +0000 Subject: [PATCH] Fix some style issues from libssl size_tify review Reviewed-by: Rich Salz --- ssl/packet_locl.h | 12 ++++-------- ssl/record/rec_layer_s3.c | 6 +++--- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ssl/packet_locl.h b/ssl/packet_locl.h index ec31a331d2..94933c1a07 100644 --- a/ssl/packet_locl.h +++ b/ssl/packet_locl.h @@ -164,9 +164,8 @@ __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data) { unsigned int i; - int ret; + int ret = PACKET_get_net_2(pkt, &i); - ret = PACKET_get_net_2(pkt, &i); if (ret) *data = (size_t)i; @@ -206,9 +205,8 @@ __owur static ossl_inline int PACKET_get_net_3(PACKET *pkt, unsigned long *data) __owur static ossl_inline int PACKET_get_net_3_len(PACKET *pkt, size_t *data) { unsigned long i; - int ret; + int ret = PACKET_get_net_3(pkt, &i); - ret = PACKET_get_net_3(pkt, &i); if (ret) *data = (size_t)i; @@ -249,9 +247,8 @@ __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data) __owur static ossl_inline int PACKET_get_net_4_len(PACKET *pkt, size_t *data) { unsigned long i; - int ret; + int ret = PACKET_get_net_4(pkt, &i); - ret = PACKET_get_net_4(pkt, &i); if (ret) *data = (size_t)i; @@ -285,9 +282,8 @@ __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data) __owur static ossl_inline int PACKET_get_1_len(PACKET *pkt, size_t *data) { unsigned int i; - int ret; + int ret = PACKET_get_1(pkt, &i); - ret = PACKET_get_1(pkt, &i); if (ret) *data = (size_t)i; diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c index a20bc3ef21..779a29fddd 100644 --- a/ssl/record/rec_layer_s3.c +++ b/ssl/record/rec_layer_s3.c @@ -276,7 +276,7 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold, /* else we need to read more data */ - if (n > (rb->len - rb->offset)) { /* does not happen */ + if (n > rb->len - rb->offset) { /* does not happen */ SSLerr(SSL_F_SSL3_READ_N, ERR_R_INTERNAL_ERROR); return -1; } @@ -288,7 +288,7 @@ int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold, else { if (max < n) max = n; - if (max > (rb->len - rb->offset)) + if (max > rb->len - rb->offset) max = rb->len - rb->offset; } @@ -610,7 +610,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, size_t len, return i; } - if ((tmpwrit == n) || + if (tmpwrit == n || (type == SSL3_RT_APPLICATION_DATA && (s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE))) { /* -- 2.25.1