Edouard G. Parmelan's patch to libraries/clib/native/ByteToCharIconv.c

Ito Kazumitsu kaffe@rufus.w3.org
Sat, 23 Mar 2002 10:10:46 +0900


I would like to express my regret over Edouard G. Parmelan's death.

Hereunder is his message sent to me.  It contained a
patch to libraries/clib/native/ByteToCharIconv.c,
which he could not commit.

I would like this patch to be applied.

Date: Mon, 3 Sep 2001 10:56:01 +0200
From: "Edouard G. Parmelan" <egp@free.fr>
To: Ito Kazumitsu <ito.kazumitsu@hitachi-cable.co.jp>
Subject: Re: kaffe.io.ByteToCharIconv makes wrong results
In-Reply-To: <200109030624.PAA06918@search.hitachi-cable.co.jp>; from ito.kazumitsu@hitachi-cable.co.jp on Mon, Sep 03, 2001 at 03:24:50PM +0900

On Mon, Sep 03, 2001 at 15:24:50 +0900, Ito Kazumitsu wrote:

> 
> kaffe.io.ByteToCharIconv seems to make wrong results.
> 
> I use kaffe-snap-20010819.  In my environment, libiconv was not
> automatically taken into kaffe,  so I did the following:
> Afer ./configure, I edited config/config.h to add "#define HAVE_ICONV 1"
> and edited libraries/clib/native/Makefile to add "-liconv" to LIBS.

I have add this test last week (but not committed).

> This comparison makes me think there is some problem around
> kaffe.io.ByteToCharIconv.

Yep, a little mistake.  Try the following patch:

Index: ByteToCharIconv.c
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/clib/native/ByteToCharIconv.c,v
retrieving revision 1.1
diff -u -u -r1.1 ByteToCharIconv.c
--- ByteToCharIconv.c	2000/11/30 03:42:12	1.1
+++ ByteToCharIconv.c	2001/09/03 08:50:59
@@ -90,7 +90,7 @@
 #endif
     ret = iconv (cd, &icv_in, &icv_inlen, &icv_out, &icv_outlen);
 #ifndef WORDS_BIGENDIAN
-    swab (buffer, jc + toPos, toLen - (icv_outlen / 2));
+    swab (buffer, jc + toPos, toLen * 2 - icv_outlen);
     KFREE (buffer);
 #endif
     if (icv_inlen > 0) {


Hope this helps.
-- 
Edouard G. Parmelan
http://egp.free.fr