Warning: That file was not part of the compilation database. It may have many parsing errors.

1/* Contributed by Owen Taylor <otaylor@redhat.com>. */
2
3#include <iconv.h>
4#include <errno.h>
5#include <stddef.h>
6#include <stdio.h>
7
8#define BUFSIZE 10000
9
10static int
11do_test (void)
12{
13 char inbuf[BUFSIZE];
14 wchar_t outbuf[BUFSIZE];
15
16 iconv_t cd;
17 int i;
18 char *inptr;
19 char *outptr;
20 size_t inbytes_left, outbytes_left;
21 int count;
22 int result = 0;
23
24 for (i=0; i < BUFSIZE; i++)
25 inbuf[i] = 'a';
26
27 cd = iconv_open ("UCS-4LE", "UTF-8");
28
29 inbytes_left = BUFSIZE;
30 outbytes_left = BUFSIZE * 4;
31 inptr = inbuf;
32 outptr = (char *) outbuf;
33
34 count = iconv (cd, &inptr, &inbytes_left, &outptr, &outbytes_left);
35
36 if (count < 0)
37 {
38 if (errno == E2BIG)
39 printf ("Received E2BIG\n");
40 else
41 printf ("Received something else\n");
42
43 printf ("inptr change: %td\n", inptr - inbuf);
44 printf ("inlen change: %zd\n", BUFSIZE - inbytes_left);
45 printf ("outptr change: %td\n", outptr - (char *) outbuf);
46 printf ("outlen change: %zd\n", BUFSIZE * 4 - outbytes_left);
47 result = 1;
48 }
49 else
50 printf ("Succeeded\n");
51
52 return result;
53}
54
55#define TEST_FUNCTION do_test ()
56#include "../test-skeleton.c"
57

Warning: That file was not part of the compilation database. It may have many parsing errors.