X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=crypto%2Fbio%2Fbss_file.c;h=1f770b390f8f5f08efe710b30f9a329b7d9331ec;hb=7d09713d09f41778c92913d57a877a4eb1aebbfc;hp=5068a7ca0d7fb04e1e9aeb088e732f60cfc7db74;hpb=dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c;p=oweals%2Fopenssl.git diff --git a/crypto/bio/bss_file.c b/crypto/bio/bss_file.c index 5068a7ca0d..1f770b390f 100644 --- a/crypto/bio/bss_file.c +++ b/crypto/bio/bss_file.c @@ -68,29 +68,18 @@ #include #include #include "cryptlib.h" -#include "bio.h" -#include "err.h" +#include +#include #if !defined(NO_STDIO) -#ifndef NOPROTO -static int MS_CALLBACK file_write(BIO *h,char *buf,int num); -static int MS_CALLBACK file_read(BIO *h,char *buf,int size); -static int MS_CALLBACK file_puts(BIO *h,char *str); -static int MS_CALLBACK file_gets(BIO *h,char *str,int size); -static long MS_CALLBACK file_ctrl(BIO *h,int cmd,long arg1,char *arg2); +static int MS_CALLBACK file_write(BIO *h, const char *buf, int num); +static int MS_CALLBACK file_read(BIO *h, char *buf, int size); +static int MS_CALLBACK file_puts(BIO *h, const char *str); +static int MS_CALLBACK file_gets(BIO *h, char *str, int size); +static long MS_CALLBACK file_ctrl(BIO *h, int cmd, long arg1, void *arg2); static int MS_CALLBACK file_new(BIO *h); static int MS_CALLBACK file_free(BIO *data); -#else -static int MS_CALLBACK file_write(); -static int MS_CALLBACK file_read(); -static int MS_CALLBACK file_puts(); -static int MS_CALLBACK file_gets(); -static long MS_CALLBACK file_ctrl(); -static int MS_CALLBACK file_new(); -static int MS_CALLBACK file_free(); -#endif - static BIO_METHOD methods_filep= { BIO_TYPE_FILE, @@ -102,11 +91,10 @@ static BIO_METHOD methods_filep= file_ctrl, file_new, file_free, + NULL, }; -BIO *BIO_new_file(filename,mode) -char *filename; -char *mode; +BIO *BIO_new_file(const char *filename, const char *mode) { BIO *ret; FILE *file; @@ -125,9 +113,7 @@ char *mode; return(ret); } -BIO *BIO_new_fp(stream,close_flag) -FILE *stream; -int close_flag; +BIO *BIO_new_fp(FILE *stream, int close_flag) { BIO *ret; @@ -138,13 +124,12 @@ int close_flag; return(ret); } -BIO_METHOD *BIO_s_file() +BIO_METHOD *BIO_s_file(void) { return(&methods_filep); } -static int MS_CALLBACK file_new(bi) -BIO *bi; +static int MS_CALLBACK file_new(BIO *bi) { bi->init=0; bi->num=0; @@ -152,8 +137,7 @@ BIO *bi; return(1); } -static int MS_CALLBACK file_free(a) -BIO *a; +static int MS_CALLBACK file_free(BIO *a) { if (a == NULL) return(0); if (a->shutdown) @@ -168,10 +152,7 @@ BIO *a; return(1); } -static int MS_CALLBACK file_read(b,out,outl) -BIO *b; -char *out; -int outl; +static int MS_CALLBACK file_read(BIO *b, char *out, int outl) { int ret=0; @@ -182,10 +163,7 @@ int outl; return(ret); } -static int MS_CALLBACK file_write(b,in,inl) -BIO *b; -char *in; -int inl; +static int MS_CALLBACK file_write(BIO *b, const char *in, int inl) { int ret=0; @@ -194,18 +172,14 @@ int inl; if (fwrite(in,(int)inl,1,(FILE *)b->ptr)) ret=inl; /* ret=fwrite(in,1,(int)inl,(FILE *)b->ptr); */ - /* acording to Tim Hudson , the commented + /* according to Tim Hudson , the commented * out version above can cause 'inl' write calls under * some stupid stdio implementations (VMS) */ } return(ret); } -static long MS_CALLBACK file_ctrl(b,cmd,num,ptr) -BIO *b; -int cmd; -long num; -char *ptr; +static long MS_CALLBACK file_ctrl(BIO *b, int cmd, long num, void *ptr) { long ret=1; FILE *fp=(FILE *)b->ptr; @@ -227,7 +201,7 @@ char *ptr; break; case BIO_C_SET_FILE_PTR: file_free(b); - b->shutdown=(int)num; + b->shutdown=(int)num&BIO_CLOSE; b->ptr=(char *)ptr; b->init=1; #if defined(MSDOS) || defined(WINDOWS) @@ -309,10 +283,7 @@ char *ptr; return(ret); } -static int MS_CALLBACK file_gets(bp,buf,size) -BIO *bp; -char *buf; -int size; +static int MS_CALLBACK file_gets(BIO *bp, char *buf, int size) { int ret=0; @@ -323,9 +294,7 @@ int size; return(ret); } -static int MS_CALLBACK file_puts(bp,str) -BIO *bp; -char *str; +static int MS_CALLBACK file_puts(BIO *bp, const char *str) { int n,ret;