X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=demos%2Ftunala%2Fbuffer.c;h=c5cd004209ad9a033781e7ff33612985c1e3674d;hp=8142c02281921c767bfcee9d4bb349db5c97b324;hb=fd69886aeda473c97af2b9ae9c52123c45783ded;hpb=beb23252a6125bbb69503dfab91014077d136779 diff --git a/demos/tunala/buffer.c b/demos/tunala/buffer.c index 8142c02281..c5cd004209 100644 --- a/demos/tunala/buffer.c +++ b/demos/tunala/buffer.c @@ -36,6 +36,7 @@ unsigned long buffer_total_out(buffer_t *buf) { * it's not sure when they're called how it should be interpreted. Only the * higher-level "buffer_[to|from]_[fd|SSL|BIO]" functions should alter these * values. */ +#if 0 /* To avoid "unused" warnings */ static unsigned int buffer_adddata(buffer_t *buf, const unsigned char *ptr, unsigned int size) { @@ -50,6 +51,21 @@ static unsigned int buffer_adddata(buffer_t *buf, const unsigned char *ptr, return added; } +static unsigned int buffer_tobuffer(buffer_t *to, buffer_t *from, int cap) +{ + unsigned int moved, tomove = from->used; + if((int)tomove > cap) + tomove = cap; + if(tomove == 0) + return 0; + moved = buffer_adddata(to, from->data, tomove); + if(moved == 0) + return 0; + buffer_takedata(from, NULL, moved); + return moved; +} +#endif + static unsigned int buffer_takedata(buffer_t *buf, unsigned char *ptr, unsigned int size) { @@ -67,25 +83,11 @@ static unsigned int buffer_takedata(buffer_t *buf, unsigned char *ptr, return taken; } -static unsigned int buffer_tobuffer(buffer_t *to, buffer_t *from, int cap) -{ - unsigned int moved, tomove = from->used; - if((int)tomove > cap) - tomove = cap; - if(tomove == 0) - return 0; - moved = buffer_adddata(to, from->data, tomove); - if(moved == 0) - return 0; - buffer_takedata(from, NULL, moved); - return moved; -} - #ifndef NO_IP int buffer_from_fd(buffer_t *buf, int fd) { - unsigned int toread = buffer_unused(buf); + int toread = buffer_unused(buf); if(toread == 0) /* Shouldn't be called in this case! */ abort(); @@ -99,7 +101,7 @@ int buffer_from_fd(buffer_t *buf, int fd) int buffer_to_fd(buffer_t *buf, int fd) { - unsigned int towrite = buffer_used(buf); + int towrite = buffer_used(buf); if(towrite == 0) /* Shouldn't be called in this case! */ abort();