On Fri, Nov 17, 2000 at 06:13:58PM -0500, [EMAIL PROTECTED] wrote:
> With some luck, the end of iconv problems. I'm thinking that all of our
> iconv problems (wv's text.c and Abi's xap_encodingmanager and ispell code)
> stem from compilers treating "char *" differently than "unsigned char *".
> This may be worth looking into for the ispell code and encoding manager
> code. That is, if this patch works for everyone (which, for once, I think it
> will).
The new cvs does not work for me. The reason? obuf != buffer2
and you cannot do 'eachchar = (U16)buffer2'. So bitswap might
be still needed for whatever system that is weird.
Please refer the man 3 iconv to see how obuf is set.
Attached patch fixed my problem with wvHandleCodePage. Since
it created eachchar from buffer with bit shift, I have no idea
if bitswap is needed. You can check that the result of
eachchar = (U16)buffer2
and the way it is assign in the patch are different.
--
Best regard
ha_shao
Index: text.c
===================================================================
RCS file: /cvsroot/wv/text.c,v
retrieving revision 1.57
diff -u -r1.57 text.c
--- text.c 2000/11/18 02:39:06 1.57
+++ text.c 2000/11/18 03:39:24
@@ -242,10 +242,11 @@
p = obuf;
wv_iconv(iconv_handle, &ibuf, &ibuflen, &obuf, &obuflen);
- /* obuf = buffer2; */
+ /* obuf != buffer2; */
- /* legal because 2 * sizeof(U8) == sizeof(U16) */
- eachchar = *(U16*)obuf;
+ /* We might have double byte char here. */
+ eachchar = (U16)buffer2[0] << 8;
+ eachchar |=(U16) buffer2[1];
iconv_close(iconv_handle);
return(eachchar);