1 /* Test case by Akira Higuchi <a@kondara.org>. */
10 const char *dummy_codesets
[] =
12 "ISO_8859-1", "ISO_8859-2", "ISO_8859-3", "ISO_8859-4",
13 "ISO_8859-5", "ISO_8859-6", "ISO_8859-7", "ISO_8859-8"
15 iconv_t dummy_cd
[8], cd_a
;
17 char buffer
[1024], *to
= buffer
;
18 char *from
= (char *) "foobar";
19 size_t to_left
= 1024, from_left
= 6;
21 /* load dummy modules */
22 for (i
= 0; i
< 8; i
++)
23 if ((dummy_cd
[i
] = iconv_open (dummy_codesets
[i
], "UTF8")) == (iconv_t
) -1)
26 /* load a module... */
27 if ((cd_a
= iconv_open ("EUC-JP", "UTF8")) == (iconv_t
) -1)
29 /* and close it once. we'll reload this later */
32 /* unload dummy modules */
33 for (i
= 0; i
< 8; i
++)
34 iconv_close (dummy_cd
[i
]);
36 /* load the module again */
37 if ((cd_a
= iconv_open ("EUC-JP", "UTF8")) == (iconv_t
) -1)
40 puts ("This used to crash");
41 printf ("%zd\n", iconv (cd_a
, &from
, &from_left
, &to
, &to_left
));