diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-15 23:15:40 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-15 23:15:40 +0000 |
commit | d322d42380a2008f1373525c306d99467aff87e7 (patch) | |
tree | ddfbfd5347c87c5460a06e3ef93df6cfc3f3a962 | |
parent | 81a25e6335a3885064f4b7db61be52ab2c85721e (diff) | |
download | iconv-d322d42380a2008f1373525c306d99467aff87e7.tar.gz iconv-d322d42380a2008f1373525c306d99467aff87e7.tar.bz2 |
Make *Iconv flush through any remaining shift sequences at the end of the data.
svn path=/trunk/iconv/; revision=5696
-rw-r--r-- | module/module.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/module.c b/module/module.c index d124a27..de9b6af 100644 --- a/module/module.c +++ b/module/module.c @@ -366,10 +366,19 @@ _kernel_oserror *do_iconv(int argc, const char *args) fclose(inf); + /* Convert text */ iconv(cd, &in, &inlen, &out, &outlen); fwrite(output, 1, input_length * 4 - outlen, ofp); + /* Flush through any remaining shift sequences */ + out = output; + outlen = input_length * 4; + + iconv(cd, NULL, NULL, &out, &outlen); + + fwrite(output, 1, input_length * 4 - outlen, ofp); + /* Reset cd */ iconv(cd, NULL, NULL, NULL, NULL); } |