non-ascii: fix build errors from strerror fix

Follow-up to 2f0bb864c1

Closes #7697
This commit is contained in:
Daniel Stenberg 2021-09-10 15:16:21 +02:00
parent 2b99f5e02c
commit 94da56269f
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -31,6 +31,7 @@
#include "sendf.h" #include "sendf.h"
#include "urldata.h" #include "urldata.h"
#include "multiif.h" #include "multiif.h"
#include "strerror.h"
#include "curl_memory.h" #include "curl_memory.h"
/* The last #include file should be: */ /* The last #include file should be: */
@ -104,6 +105,7 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data,
iconv_t *cd = &tmpcd; iconv_t *cd = &tmpcd;
char *input_ptr, *output_ptr; char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc; size_t in_bytes, out_bytes, rc;
char ebuffer[STRERROR_LEN];
/* open an iconv conversion descriptor if necessary */ /* open an iconv conversion descriptor if necessary */
if(data) if(data)
@ -112,12 +114,11 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data,
*cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK, *cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST); CURL_ICONV_CODESET_OF_HOST);
if(*cd == (iconv_t)-1) { if(*cd == (iconv_t)-1) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_HOST,
errno, Curl_strerror(errno, buffer, sizeof(buffer))); errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer)));
return CURLE_CONV_FAILED; return CURLE_CONV_FAILED;
} }
} }
@ -129,10 +130,9 @@ CURLcode Curl_convert_to_network(struct Curl_easy *data,
if(!data) if(!data)
iconv_close(tmpcd); iconv_close(tmpcd);
if((rc == ICONV_ERROR) || (in_bytes)) { if((rc == ICONV_ERROR) || (in_bytes)) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"The Curl_convert_to_network iconv call failed with errno %i: %s", "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; return CURLE_CONV_FAILED;
} }
#else #else
@ -172,6 +172,7 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data,
iconv_t *cd = &tmpcd; iconv_t *cd = &tmpcd;
char *input_ptr, *output_ptr; char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc; size_t in_bytes, out_bytes, rc;
char ebuffer[STRERROR_LEN];
/* open an iconv conversion descriptor if necessary */ /* open an iconv conversion descriptor if necessary */
if(data) if(data)
@ -180,12 +181,11 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data,
*cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, *cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK); CURL_ICONV_CODESET_OF_NETWORK);
if(*cd == (iconv_t)-1) { if(*cd == (iconv_t)-1) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK, CURL_ICONV_CODESET_OF_NETWORK,
errno, Curl_strerror(errno, buffer, sizeof(buffer))); errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer)));
return CURLE_CONV_FAILED; return CURLE_CONV_FAILED;
} }
} }
@ -197,10 +197,9 @@ CURLcode Curl_convert_from_network(struct Curl_easy *data,
if(!data) if(!data)
iconv_close(tmpcd); iconv_close(tmpcd);
if((rc == ICONV_ERROR) || (in_bytes)) { if((rc == ICONV_ERROR) || (in_bytes)) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"Curl_convert_from_network iconv call failed with errno %i: %s", "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; return CURLE_CONV_FAILED;
} }
#else #else
@ -241,6 +240,7 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data,
char *input_ptr; char *input_ptr;
char *output_ptr; char *output_ptr;
size_t in_bytes, out_bytes, rc; size_t in_bytes, out_bytes, rc;
char ebuffer[STRERROR_LEN];
/* open an iconv conversion descriptor if necessary */ /* open an iconv conversion descriptor if necessary */
if(data) if(data)
@ -249,12 +249,11 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data,
*cd = iconv_open(CURL_ICONV_CODESET_OF_HOST, *cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8); CURL_ICONV_CODESET_FOR_UTF8);
if(*cd == (iconv_t)-1) { if(*cd == (iconv_t)-1) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s", "The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST, CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8, CURL_ICONV_CODESET_FOR_UTF8,
errno, Curl_strerror(errno, buffer, sizeof(buffer))); errno, Curl_strerror(errno, ebuffer, sizeof(ebuffer)));
return CURLE_CONV_FAILED; return CURLE_CONV_FAILED;
} }
} }
@ -266,10 +265,9 @@ CURLcode Curl_convert_from_utf8(struct Curl_easy *data,
if(!data) if(!data)
iconv_close(tmpcd); iconv_close(tmpcd);
if((rc == ICONV_ERROR) || (in_bytes)) { if((rc == ICONV_ERROR) || (in_bytes)) {
char buffer[STRERROR_LEN];
failf(data, failf(data,
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s", "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; return CURLE_CONV_FAILED;
} }
if(output_ptr < input_ptr) { if(output_ptr < input_ptr) {