diff options
Diffstat (limited to 'lib/non-ascii.c')
-rw-r--r-- | lib/non-ascii.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/non-ascii.c b/lib/non-ascii.c index 28398adf1..3b77ae98d 100644 --- a/lib/non-ascii.c +++ b/lib/non-ascii.c @@ -31,6 +31,7 @@ #include "sendf.h" #include "urldata.h" #include "multiif.h" +#include "strerror.h" #include "curl_memory.h" /* The last #include file should be: */ @@ -104,6 +105,7 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data, iconv_t *cd = &tmpcd; char *input_ptr, *output_ptr; size_t in_bytes, out_bytes, rc; + char ebuffer[STRERROR_LEN]; /* open an iconv conversion descriptor if necessary */ if(data) @@ -112,12 +114,11 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data, *cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_HOST); if(*cd == (iconv_t)-1) { - char buffer[STRERROR_LEN]; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_HOST, - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } } @@ -129,10 +130,9 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data, if(!data) iconv_close(tmpcd); if((rc == ICONV_ERROR) || (in_bytes)) { - char buffer[STRERROR_LEN]; failf(data, "The Curl_convert_to_network iconv call failed with errno %i: %s", - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } #else @@ -172,6 +172,7 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data, iconv_t *cd = &tmpcd; char *input_ptr, *output_ptr; size_t in_bytes, out_bytes, rc; + char ebuffer[STRERROR_LEN]; /* open an iconv conversion descriptor if necessary */ if(data) @@ -180,12 +181,11 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data, *cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_NETWORK); if(*cd == (iconv_t)-1) { - char buffer[STRERROR_LEN]; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_NETWORK, - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } } @@ -197,10 +197,9 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data, if(!data) iconv_close(tmpcd); if((rc == ICONV_ERROR) || (in_bytes)) { - char buffer[STRERROR_LEN]; failf(data, "Curl_convert_from_network iconv call failed with errno %i: %s", - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } #else @@ -241,6 +240,7 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data, char *input_ptr; char *output_ptr; size_t in_bytes, out_bytes, rc; + char ebuffer[STRERROR_LEN]; /* open an iconv conversion descriptor if necessary */ if(data) @@ -249,12 +249,11 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data, *cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_FOR_UTF8); if(*cd == (iconv_t)-1) { - char buffer[STRERROR_LEN]; failf(data, "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_FOR_UTF8, - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } } @@ -266,10 +265,9 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data, if(!data) iconv_close(tmpcd); if((rc == ICONV_ERROR) || (in_bytes)) { - char buffer[STRERROR_LEN]; failf(data, "The Curl_convert_from_utf8 iconv call failed with errno %i: %s", - errno, Curl_strerror(errno, buffer, sizeof(buffer))); + errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer))); return CURLE_CONV_FAILED; } if(output_ptr < input_ptr) { |