diff options
author | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2017-06-08 15:39:03 -0400 |
commit | 5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch) | |
tree | 4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/iconvdata/bug-iconv1.c | |
parent | 199fc19d3aaaf57944ef036e15904febe877fc93 (diff) | |
download | glibc-zack/build-layout-experiment.tar.gz glibc-zack/build-layout-experiment.tar.xz glibc-zack/build-layout-experiment.zip |
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage directory, REORG.TODO, except for files that will certainly still exist in their current form at top level when we're done (COPYING, COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which are moved to the new directory OldChangeLogs, instead), and the generated file INSTALL (which is just deleted; in the new order, there will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/iconvdata/bug-iconv1.c')
-rw-r--r-- | REORG.TODO/iconvdata/bug-iconv1.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/REORG.TODO/iconvdata/bug-iconv1.c b/REORG.TODO/iconvdata/bug-iconv1.c new file mode 100644 index 0000000000..76bcee9183 --- /dev/null +++ b/REORG.TODO/iconvdata/bug-iconv1.c @@ -0,0 +1,40 @@ +/* Test program by Satoru Takabayashi. */ +#include <errno.h> +#include <iconv.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int +main (int argc, char **argv) +{ + const char in[] = "\x41\x42\x43\xa4\xa2\xa4\xa4\xa4\xa6\xa4\xa8\xa4\xaa"; + /* valid eucJP string */ + const char exp[] = "\x41\x42\x43\x82\xa0\x82\xa2\x82\xa4"; + size_t outbufsize = 10; + /* 10 is too small to store full result (intentional) */ + size_t inleft, outleft; + char *in_p = (char *) in; + char out[outbufsize]; + char *out_p = out; + iconv_t cd; + int i; + + inleft = strlen (in); + outleft = outbufsize; + + cd = iconv_open ("SJIS", "eucJP"); + if (cd == (iconv_t) -1) + { + puts ("iconv_open failed"); + exit (1); + } + + iconv (cd, &in_p, &inleft, &out_p, &outleft); /* this returns E2BIG */ + for (i = 0; i < outbufsize - outleft; ++i) + printf (" %02x", (unsigned char) out[i]); + puts (""); + iconv_close (cd); + + return outbufsize - outleft != 9 || memcmp (out, exp, 9) != 0; +} |