From 5f42ef8f5b53aaf0229e30f8114dbed3f164d251 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 14 Aug 2001 08:34:09 +0000 Subject: [PATCH] cleaned up some of the size_t and const mess --- lib/sendf.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/sendf.c b/lib/sendf.c index 0408b1b81..3e496571c 100644 --- a/lib/sendf.c +++ b/lib/sendf.c @@ -122,7 +122,7 @@ void curl_slist_free_all(struct curl_slist *list) /* Curl_infof() is for info message along the way */ -void Curl_infof(struct UrlData *data, char *fmt, ...) +void Curl_infof(struct UrlData *data, const char *fmt, ...) { va_list ap; if(data->bits.verbose) { @@ -136,7 +136,7 @@ void Curl_infof(struct UrlData *data, char *fmt, ...) /* Curl_failf() is for messages stating why we failed, the LAST one will be returned for the user (if requested) */ -void Curl_failf(struct UrlData *data, char *fmt, ...) +void Curl_failf(struct UrlData *data, const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -147,7 +147,7 @@ void Curl_failf(struct UrlData *data, char *fmt, ...) /* Curl_sendf() sends formated data to the server */ size_t Curl_sendf(int sockfd, struct connectdata *conn, - char *fmt, ...) + const char *fmt, ...) { struct UrlData *data = conn->data; size_t bytes_written; @@ -181,14 +181,20 @@ CURLcode Curl_write(struct connectdata *conn, int sockfd, size_t bytes_written; #ifdef USE_SSLEAY + /* SSL_write() is said to return 'int' while write() and send() returns + 'size_t' */ + int ssl_bytes; if (conn->ssl.use) { int loop=100; /* just a precaution to never loop endlessly */ while(loop--) { - bytes_written = SSL_write(conn->ssl.handle, mem, len); - if((-1 != bytes_written) || + ssl_bytes = SSL_write(conn->ssl.handle, mem, len); + if((0 >= ssl_bytes) || (SSL_ERROR_WANT_WRITE != SSL_get_error(conn->ssl.handle, - bytes_written) )) + ssl_bytes) )) { + /* this converts from signed to unsigned... */ + bytes_written = ssl_bytes; break; + } } } else {