memset, memcpy, sizeof consistency fixes
[openssl.git] / ssl / record / rec_layer_s3.c
index de8dac2115e3d400ce45fae1bee9a186a0f230b7..eccb5176ba88f798c13e49bc58076187beb6498e 100644 (file)
@@ -155,7 +155,7 @@ void RECORD_LAYER_clear(RECORD_LAYER *rl)
     rlen = SSL3_BUFFER_get_len(&rl->rbuf);
     wp = SSL3_BUFFER_get_buf(&rl->wbuf);
     wlen = SSL3_BUFFER_get_len(&rl->wbuf);
-    memset(rl, 0, sizeof (RECORD_LAYER));
+    memset(rl, 0, sizeof(*rl));
     SSL3_BUFFER_set_buf(&rl->rbuf, rp);
     SSL3_BUFFER_set_len(&rl->rbuf, rlen);
     SSL3_BUFFER_set_buf(&rl->wbuf, wp);
@@ -170,7 +170,7 @@ void RECORD_LAYER_clear(RECORD_LAYER *rl)
     rl->s = s;
     rl->d = d;
     
-    if(d)
+    if (d)
         DTLS_RECORD_LAYER_clear(rl);
 }
 
@@ -196,7 +196,7 @@ int RECORD_LAYER_write_pending(RECORD_LAYER *rl)
 int RECORD_LAYER_set_data(RECORD_LAYER *rl, const unsigned char *buf, int len)
 {
     rl->packet_length = len;
-    if(len != 0) {
+    if (len != 0) {
         rl->rstate = SSL_ST_READ_HEADER;
         if (!SSL3_BUFFER_is_initialised(&rl->rbuf))
             if (!ssl3_setup_read_buffer(rl->s))
@@ -380,7 +380,7 @@ int ssl3_read_n(SSL *s, int n, int max, int extend)
     }
 
     /* We always act like read_ahead is set for DTLS */
-    if (&s->rlayer.read_ahead && !SSL_IS_DTLS(s))
+    if (!s->rlayer.read_ahead && !SSL_IS_DTLS(s))
         /* ignore max parameter */
         max = n;
     else {
@@ -445,10 +445,10 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
     unsigned int n, nw;
 #if !defined(OPENSSL_NO_MULTIBLOCK) && EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK
     unsigned int max_send_fragment;
+    unsigned int u_len = (unsigned int)len;
 #endif
     SSL3_BUFFER *wb = &s->rlayer.wbuf;
     int i;
-    unsigned int u_len = (unsigned int)len;
 
     if (len < 0) {
         SSLerr(SSL_F_SSL3_WRITE_BYTES, SSL_R_SSL_NEGATIVE_LENGTH);
@@ -531,7 +531,7 @@ int ssl3_write_bytes(SSL *s, int type, const void *buf_, int len)
                 packlen *= 4;
 
             wb->buf = OPENSSL_malloc(packlen);
-            if(!wb->buf) {
+            if (!wb->buf) {
                 SSLerr(SSL_F_SSL3_WRITE_BYTES, ERR_R_MALLOC_FAILURE);
                 return -1;
             }
@@ -1130,7 +1130,7 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
 #ifndef OPENSSL_NO_HEARTBEATS
         else if (SSL3_RECORD_get_type(rr)== TLS1_RT_HEARTBEAT) {
             /* We can ignore 0 return values */
-            if(tls1_process_heartbeat(s, SSL3_RECORD_get_data(rr),
+            if (tls1_process_heartbeat(s, SSL3_RECORD_get_data(rr),
                     SSL3_RECORD_get_length(rr)) < 0) {
                 return -1;
             }