This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: BUG REPORT: glibc 2.2 mbrtowc() fails to decode final byte


>>>>> Markus Kuhn writes:

 > The following regression test fails in glibc 2.2 under linux-i386:
 > -------------------------------------------------------------------
 > #include <stdio.h>
 > #include <stdlib.h>
 > #include <errno.h>
 > #include <assert.h>
 > #include <wchar.h>
 > #include <locale.h>

 > int main() {

 >   // UTF-8 single byte feeding test for mbrtowc()
 >   wchar_t wc;
 >   mbstate_t s;
 >   char *locale = "en_GB.UTF-8";
 
 >   if (!setlocale(LC_CTYPE,locale)) {
 >     fprintf(stderr, "locale '%s' not available!\n", locale);
 >     exit(1);
 >   }
 >   wc = 42; /* arbitrary number */
 >   assert(mbrtowc(NULL, NULL, 0, &s) == 0);   /* get s into initial state */
 >   assert(mbrtowc(&wc, "", 1, &s) == 0);  /* test final byte processing */
 >   assert(wc == 0);  /* test final byte decoding */

 >   return 0;
 > }
 > -------------------------------------------------------------------

It seems that this is fixed in the current pre release.  Can I add
your program to the glibc test suite?  I guess it would I can change
the locale to de_DE.UTF-8 (that makes integration in the test suite
easier ;-).

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]