Back to index

glibc  2.9
Defines | Functions | Variables
bug-iconv6.c File Reference
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <iconv.h>
#include <locale.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define TEST_FUNCTION   do_test ()


static int do_test (void)


static const char testbuf []

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 51 of file bug-iconv6.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 14 of file bug-iconv6.c.

  setlocale (LC_ALL, "de_DE.UTF-8");
  iconv_t ic = iconv_open ("ISO-2022-JP//TRANSLIT", "UTF-8");
  if (ic == (iconv_t) -1)
      puts ("iconv_open failed");
      return 1;
  size_t outremain = sizeof testbuf;
  char outbuf[outremain];
  char *inp = (char *) testbuf;
  char *outp = outbuf;
  size_t inremain = sizeof testbuf;

  int ret = iconv (ic, &inp, &inremain, &outp, &outremain);

  int result = 0;
  if (ret == (size_t) -1)
      if (errno == E2BIG)
       puts ("buffer too small reported.  OK");
         printf ("iconv failed with %d (%m)\n", errno);
         result = 0;
      printf ("iconv returned %d\n", ret);
      result = 1;

  return result;

Here is the call graph for this function:

Variable Documentation

const char testbuf[] [static]
Initial value:
       0xEF, 0xBE, 0x9F, 0xD0, 0xB4, 0xEF, 0xBE, 0x9F, 0x29, 0xEF, 0xBE, 0x8E,
       0xEF, 0xBE, 0x9F, 0xEF, 0xBD, 0xB6, 0xEF, 0xBD, 0xB0, 0xEF, 0xBE, 0x9D

Definition at line 8 of file bug-iconv6.c.