summaryrefslogtreecommitdiff
path: root/src/iri.c
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:17 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-03-05 10:08:17 +0900
commit6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20 (patch)
tree4936775a0caecb157d619aa6c8f26310c2611c7e /src/iri.c
parent0fd98397eab07f1ec3b1fad9890fd751298e1fe0 (diff)
downloadwget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.tar.gz
wget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.tar.bz2
wget-6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20.zip
Imported Upstream version 1.18upstream/1.18
Diffstat (limited to 'src/iri.c')
-rw-r--r--src/iri.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/iri.c b/src/iri.c
index dc9aa9a..dd156f1 100644
--- a/src/iri.c
+++ b/src/iri.c
@@ -129,8 +129,8 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz
cd = iconv_open (tocode, fromcode);
if (cd == (iconv_t)(-1))
{
- logprintf (LOG_VERBOSE, _("Conversion from %s to UTF-8 isn't supported\n"),
- quote (opt.locale));
+ logprintf (LOG_VERBOSE, _("Conversion from %s to %s isn't supported\n"),
+ quote (fromcode), quote (tocode));
*out = NULL;
return false;
}
@@ -146,7 +146,8 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz
for (;;)
{
- if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1))
+ if (iconv (cd, &in, &inlen, out, &outlen) != (size_t)(-1) &&
+ iconv (cd, NULL, NULL, out, &outlen) != (size_t)(-1))
{
*out = s;
*(s + len - outlen - done) = '\0';
@@ -179,16 +180,10 @@ do_conversion (const char *tocode, const char *fromcode, char const *in_org, siz
}
else if (errno == E2BIG) /* Output buffer full */
{
- char *new;
-
tooshort++;
done = len;
- outlen = done + inlen * 2;
- new = xmalloc (outlen + 1);
- memcpy (new, s, done);
- xfree (s);
- s = new;
- len = outlen;
+ len = outlen = done + inlen * 2;
+ s = xrealloc (s, outlen + 1);
*out = s + done;
}
else /* Weird, we got an unspecified error */