diff options
Diffstat (limited to 'Utilities/cmcurl/lib/non-ascii.c')
-rw-r--r-- | Utilities/cmcurl/lib/non-ascii.c | 55 |
1 files changed, 25 insertions, 30 deletions
diff --git a/Utilities/cmcurl/lib/non-ascii.c b/Utilities/cmcurl/lib/non-ascii.c index 91d6a54..6ccb449 100644 --- a/Utilities/cmcurl/lib/non-ascii.c +++ b/Utilities/cmcurl/lib/non-ascii.c @@ -5,7 +5,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -82,17 +82,16 @@ CURLcode Curl_convert_clone(struct SessionHandle *data, CURLcode Curl_convert_to_network(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode rc; - if(data->set.convtonetwork) { /* use translation callback */ - rc = data->set.convtonetwork(buffer, length); - if(rc != CURLE_OK) { + CURLcode result = data->set.convtonetwork(buffer, length); + if(result) { failf(data, "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s", - (int)rc, curl_easy_strerror(rc)); + (int)result, curl_easy_strerror(result)); } - return rc; + + return result; } else { #ifdef HAVE_ICONV @@ -143,17 +142,16 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data, CURLcode Curl_convert_from_network(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode rc; - if(data->set.convfromnetwork) { /* use translation callback */ - rc = data->set.convfromnetwork(buffer, length); - if(rc != CURLE_OK) { + CURLcode result = data->set.convfromnetwork(buffer, length); + if(result) { failf(data, "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s", - (int)rc, curl_easy_strerror(rc)); + (int)result, curl_easy_strerror(result)); } - return rc; + + return result; } else { #ifdef HAVE_ICONV @@ -204,17 +202,16 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data, CURLcode Curl_convert_from_utf8(struct SessionHandle *data, char *buffer, size_t length) { - CURLcode rc; - if(data->set.convfromutf8) { /* use translation callback */ - rc = data->set.convfromutf8(buffer, length); - if(rc != CURLE_OK) { + CURLcode result = data->set.convfromutf8(buffer, length); + if(result) { failf(data, "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s", - (int)rc, curl_easy_strerror(rc)); + (int)result, curl_easy_strerror(result)); } - return rc; + + return result; } else { #ifdef HAVE_ICONV @@ -319,24 +316,22 @@ void Curl_convert_close(struct SessionHandle *data) */ CURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form) { - struct FormData *next; - CURLcode rc; - - if(!form) - return CURLE_OK; + CURLcode result; if(!data) return CURLE_BAD_FUNCTION_ARGUMENT; - do { - next=form->next; /* the following form line */ + while(form) { if(form->type == FORM_DATA) { - rc = Curl_convert_to_network(data, form->line, form->length); + result = Curl_convert_to_network(data, form->line, form->length); /* Curl_convert_to_network calls failf if unsuccessful */ - if(rc != CURLE_OK) - return rc; + if(result) + return result; } - } while((form = next) != NULL); /* continue */ + + form = form->next; + } + return CURLE_OK; } |