]> gcc.gnu.org Git - gcc.git/commitdiff
re PR libgcj/49314 (md5test, shatest output FAILs on Tru64 UNIX)
authorRainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Tue, 21 Jun 2011 17:09:57 +0000 (17:09 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 21 Jun 2011 17:09:57 +0000 (17:09 +0000)
PR libgcj/49314
* gnu/gcj/convert/natIconv.cc (iconv_init): Pad in[] with NUL byte.

From-SVN: r175266

libjava/ChangeLog
libjava/gnu/gcj/convert/natIconv.cc

index c800bf3aac04fa02531432d6d290449ff8f58d1e..dfaa803c0a116b0314a1dd08044568dc4abd7f05 100644 (file)
@@ -1,3 +1,8 @@
+2011-06-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
+
+       PR libgcj/49314
+       * gnu/gcj/convert/natIconv.cc (iconv_init): Pad in[] with NUL byte.
+
 2011-06-17  Jack Howarth <howarth@bromo.med.uc.edu>
 
        PR target/49461
index ad75a505ff847e55545bc494665f1a2ecd5e8a4b..8042ba86de01421c1f756c0c220b78c1d20690c3 100644 (file)
@@ -1,6 +1,6 @@
 // natIconv.cc -- Java side of iconv() reader.
 
-/* Copyright (C) 2000, 2001, 2003, 2006  Free Software Foundation
+/* Copyright (C) 2000, 2001, 2003, 2006, 2011  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -264,17 +264,19 @@ gnu::gcj::convert::IOConverter::iconv_init (void)
   if (handle != (iconv_t) -1)
     {
       jchar c;
-      unsigned char in[3];
+      unsigned char in[4];
       char *inp, *outp;
       size_t inc, outc, r;
 
-      // This is the UTF-8 encoding of \ufeff.
+      // This is the UTF-8 encoding of \ufeff.  At least Tru64 UNIX libiconv
+      // needs the trailing NUL byte, otherwise iconv fails with EINVAL.
       in[0] = 0xef;
       in[1] = 0xbb;
       in[2] = 0xbf;
+      in[3] = 0x00;
 
       inp = (char *) in;
-      inc = 3;
+      inc = 4;
       outp = (char *) &c;
       outc = 2;
 
This page took 0.063456 seconds and 5 git commands to generate.