From: oleg Date: Thu, 11 Mar 2004 10:09:11 +0000 (+0000) Subject: Fixed error with UTF8 <-> UCS4, UCS4LE encoding (reverse direction for bit operation... X-Git-Tag: YAZ.2.0.16.debian.1~10 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=af30aafd05572139098f984ddf13ba12072afa47 Fixed error with UTF8 <-> UCS4, UCS4LE encoding (reverse direction for bit operation). For Latin-1 charcters the patch has not value, only for characters, which has code greater then xFF in UTF8. --- diff --git a/src/siconv.c b/src/siconv.c index 36f2c2d..a10fd3d 100644 --- a/src/siconv.c +++ b/src/siconv.c @@ -2,7 +2,7 @@ * Copyright (c) 1997-2003, Index Data * See the file LICENSE for details. * - * $Id: siconv.c,v 1.1 2003-10-27 12:21:35 adam Exp $ + * $Id: siconv.c,v 1.2 2004-03-11 10:09:11 oleg Exp $ */ /* mini iconv and wrapper for system iconv library (if present) */ @@ -307,9 +307,9 @@ static size_t yaz_write_UCS4 (yaz_iconv_t cd, unsigned long x, unsigned char *outp = (unsigned char *) *outbuf; if (*outbytesleft >= 4) { - *outp++ = (unsigned char) (x<<24); - *outp++ = (unsigned char) (x<<16); - *outp++ = (unsigned char) (x<<8); + *outp++ = (unsigned char) (x>>24); + *outp++ = (unsigned char) (x>>16); + *outp++ = (unsigned char) (x>>8); *outp++ = (unsigned char) x; (*outbytesleft) -= 4; } @@ -329,9 +329,9 @@ static size_t yaz_write_UCS4LE (yaz_iconv_t cd, unsigned long x, if (*outbytesleft >= 4) { *outp++ = (unsigned char) x; - *outp++ = (unsigned char) (x<<8); - *outp++ = (unsigned char) (x<<16); - *outp++ = (unsigned char) (x<<24); + *outp++ = (unsigned char) (x>>8); + *outp++ = (unsigned char) (x>>16); + *outp++ = (unsigned char) (x>>24); (*outbytesleft) -= 4; } else