1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

non-ascii: Reduce variable scope

As 'result' isn't used out side the conversion callback code and
previously caused variable shadowing in the libiconv based code.
This commit is contained in:
Steve Holme 2014-12-19 20:29:56 +00:00
parent 3e1625c787
commit f2a5283cbc

View File

@ -82,16 +82,15 @@ CURLcode Curl_convert_clone(struct SessionHandle *data,
CURLcode Curl_convert_to_network(struct SessionHandle *data, CURLcode Curl_convert_to_network(struct SessionHandle *data,
char *buffer, size_t length) char *buffer, size_t length)
{ {
CURLcode result;
if(data->set.convtonetwork) { if(data->set.convtonetwork) {
/* use translation callback */ /* use translation callback */
result = data->set.convtonetwork(buffer, length); CURLcode result = data->set.convtonetwork(buffer, length);
if(result) { if(result) {
failf(data, failf(data,
"CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s", "CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
(int)result, curl_easy_strerror(result)); (int)result, curl_easy_strerror(result));
} }
return result; return result;
} }
else { else {
@ -143,16 +142,15 @@ CURLcode Curl_convert_to_network(struct SessionHandle *data,
CURLcode Curl_convert_from_network(struct SessionHandle *data, CURLcode Curl_convert_from_network(struct SessionHandle *data,
char *buffer, size_t length) char *buffer, size_t length)
{ {
CURLcode result;
if(data->set.convfromnetwork) { if(data->set.convfromnetwork) {
/* use translation callback */ /* use translation callback */
result = data->set.convfromnetwork(buffer, length); CURLcode result = data->set.convfromnetwork(buffer, length);
if(result) { if(result) {
failf(data, failf(data,
"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s", "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
(int)result, curl_easy_strerror(result)); (int)result, curl_easy_strerror(result));
} }
return result; return result;
} }
else { else {
@ -204,16 +202,15 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
CURLcode Curl_convert_from_utf8(struct SessionHandle *data, CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
char *buffer, size_t length) char *buffer, size_t length)
{ {
CURLcode result;
if(data->set.convfromutf8) { if(data->set.convfromutf8) {
/* use translation callback */ /* use translation callback */
result = data->set.convfromutf8(buffer, length); CURLcode result = data->set.convfromutf8(buffer, length);
if(result) { if(result) {
failf(data, failf(data,
"CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s", "CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
(int)result, curl_easy_strerror(result)); (int)result, curl_easy_strerror(result));
} }
return result; return result;
} }
else { else {