projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
some const fixes and cleanup
[openssl.git]
/
crypto
/
bio
/
bss_mem.c
diff --git
a/crypto/bio/bss_mem.c
b/crypto/bio/bss_mem.c
index 4fa2cf15a4845d785cc2e430feb84dc41da2b988..a4edb711aec1a37389e7db77726ae89f1f67dd50 100644
(file)
--- a/
crypto/bio/bss_mem.c
+++ b/
crypto/bio/bss_mem.c
@@
-163,11
+163,9
@@
static int mem_read(BIO *b, char *out, int outl)
}
} else if (bm->length == 0)
{
}
} else if (bm->length == 0)
{
- if (b->num != 0)
+ ret = b->num;
+ if (ret != 0)
BIO_set_retry_read(b);
BIO_set_retry_read(b);
- ret= b->num;
- if(ret < 0)
- BIOerr(BIO_F_MEM_READ,BIO_R_EOF_ON_MEMORY_BIO);
}
return(ret);
}
}
return(ret);
}
@@
-192,7
+190,7
@@
static int mem_write(BIO *b, const char *in, int inl)
BIO_clear_retry_flags(b);
blen=bm->length;
BIO_clear_retry_flags(b);
blen=bm->length;
- if (BUF_MEM_grow(bm,blen+inl) != (blen+inl))
+ if (BUF_MEM_grow
_clean
(bm,blen+inl) != (blen+inl))
goto end;
memcpy(&(bm->data[blen]),in,inl);
ret=inl;
goto end;
memcpy(&(bm->data[blen]),in,inl);
ret=inl;
@@
-210,16
+208,20
@@
static long mem_ctrl(BIO *b, int cmd, long num, void *ptr)
switch (cmd)
{
case BIO_CTRL_RESET:
switch (cmd)
{
case BIO_CTRL_RESET:
- if (bm->data != NULL) {
+ if (bm->data != NULL)
+ {
/* For read only case reset to the start again */
if(b->flags & BIO_FLAGS_MEM_RDONLY)
/* For read only case reset to the start again */
if(b->flags & BIO_FLAGS_MEM_RDONLY)
- bm->data -= bm->max - bm->length;
- bm->length = bm->max;
- else {
+ {
+ bm->data -= bm->max - bm->length;
+ bm->length = bm->max;
+ }
+ else
+ {
memset(bm->data,0,bm->max);
bm->length=0;
memset(bm->data,0,bm->max);
bm->length=0;
+ }
}
}
- }
break;
case BIO_CTRL_EOF:
ret=(long)(bm->length == 0);
break;
case BIO_CTRL_EOF:
ret=(long)(bm->length == 0);
@@
-282,7
+284,11
@@
static int mem_gets(BIO *bp, char *buf, int size)
BIO_clear_retry_flags(bp);
j=bm->length;
BIO_clear_retry_flags(bp);
j=bm->length;
- if (j <= 0) return(0);
+ if (j <= 0)
+ {
+ *buf='\0';
+ return 0;
+ }
p=bm->data;
for (i=0; i<j; i++)
{
p=bm->data;
for (i=0; i<j; i++)
{