diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:17 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:17 +0900 |
commit | 6403e0986cb5d0b8b4cbea66f8f3ff7a68cb4c20 (patch) | |
tree | 4936775a0caecb157d619aa6c8f26310c2611c7e /src/iri.c | |
parent | 0fd98397eab07f1ec3b1fad9890fd751298e1fe0 (diff) | |
download | wget-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.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -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 */ |