change formatting a bit
[openssl.git] / crypto / bio / bss_bio.c
index e82b2bc51c5a6150e72823669f01ba4e67d1c975..562e9d8de274fc2a4671cacb0d685300d424adab 100644 (file)
@@ -7,6 +7,11 @@
  * for which no specific BIO method is available.
  * See ssl/ssltest.c for some hints on how this can be used. */
 
+#ifndef BIO_PAIR_DEBUG
+# undef NDEBUG /* avoid conflicting definitions */
+# define NDEBUG
+#endif
+
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -57,9 +62,10 @@ struct bio_bio_st
        size_t size;
        char *buf;      /* "size" elements (if != NULL) */
 
-       size_t request; /* valid iff peer != NULL; 0 if len != 0;
+       size_t request; /* valid iff peer != NULL; 0 if len != 0,
                         * otherwise set by peer to number of bytes
-                        * it (unsuccesfully) tried to read. */
+                        * it (unsuccesfully) tried to read,
+                        * never more than buffer space (size-len) warrants. */
 };
 
 static int bio_new(BIO *bio)
@@ -137,9 +143,9 @@ static int bio_read(BIO *bio, char *buf, int size_)
                        if (size <= peer_b->size)
                                peer_b->request = size;
                        else
-                               peer_b->request = peer_b->size; /* don't ask for more than
-                                                                * the peer can deliver
-                                                                * in one write */
+                               /* don't ask for more than the peer can
+                                * deliver in one write */
+                               peer_b->request = peer_b->size;
                        return -1;
                        }
                }
@@ -369,7 +375,7 @@ static long bio_ctrl(BIO *bio, int cmd, long num, void *ptr)
        case BIO_CTRL_PENDING:
                if (b->peer != NULL)
                        {
-                       struct bio_bio_st *peer_b =b->peer->ptr;
+                       struct bio_bio_st *peer_b = b->peer->ptr;
                        
                        ret = (long) peer_b->len;
                        }
@@ -572,11 +578,11 @@ int BIO_new_bio_pair(BIO **bio1_p, size_t writebuf1,
         }
 
 size_t BIO_ctrl_get_write_guarantee(BIO *bio)
-    {
+       {
        return BIO_ctrl(bio, BIO_C_GET_WRITE_GUARANTEE, 0, NULL);
        }
 
 size_t BIO_ctrl_get_read_request(BIO *bio)
-    {
+       {
        return BIO_ctrl(bio, BIO_C_GET_READ_REQUEST, 0, NULL);
        }