[project @ 2006-02-11 18:11:09 by jmb]

Clear cached conversion descriptor if iconv() fails

svn path=/import/netsurf/; revision=2071
This commit is contained in:
John Mark Bell 2006-02-11 18:11:09 +00:00
parent 6b3b19a95b
commit 6b6841f07e

View File

@ -320,6 +320,10 @@ utf8_convert_ret utf8_convert(const char *string, size_t len,
/* perform conversion */
if (iconv(cd, &in, &slen, &out, &rlen) == (size_t)-1) {
free(temp);
/* clear the cached conversion descriptor as it's invalid */
last_cd.from[0] = '\0';
last_cd.to[0] = '\0';
last_cd.cd = 0;
/** \todo handle the various cases properly
* There are 3 possible error cases:
* a) Insufficiently large output buffer