X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fucs4.c;h=3c28b9876f04b83ff14cfb0f0101290b206e60b9;hb=3a3c0ef92f785ff123069ea51ba0f8711b23dbf7;hp=43e9f84b963dc0a2ae18d103bd2271261bc55a9a;hpb=65f1b9fce2d1d86df7d75645fb46fbba32dd01e3;p=yaz-moved-to-github.git diff --git a/src/ucs4.c b/src/ucs4.c index 43e9f84..3c28b98 100644 --- a/src/ucs4.c +++ b/src/ucs4.c @@ -1,7 +1,6 @@ -/* - * Copyright (C) 1995-2008, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data * See the file LICENSE for details. - * */ /** * \file @@ -19,8 +18,9 @@ #include "iconv-p.h" -unsigned long yaz_read_UCS4(yaz_iconv_t cd, unsigned char *inp, - size_t inbytesleft, size_t *no_read) +static unsigned long read_UCS4(yaz_iconv_t cd, yaz_iconv_decoder_t d, + unsigned char *inp, + size_t inbytesleft, size_t *no_read) { unsigned long x = 0; @@ -37,8 +37,9 @@ unsigned long yaz_read_UCS4(yaz_iconv_t cd, unsigned char *inp, return x; } -unsigned long yaz_read_UCS4LE(yaz_iconv_t cd, unsigned char *inp, - size_t inbytesleft, size_t *no_read) +static unsigned long read_UCS4LE(yaz_iconv_t cd, yaz_iconv_decoder_t d, + unsigned char *inp, + size_t inbytesleft, size_t *no_read) { unsigned long x = 0; @@ -113,6 +114,19 @@ yaz_iconv_encoder_t yaz_ucs4_encoder(const char *tocode, return e; } +yaz_iconv_decoder_t yaz_ucs4_decoder(const char *tocode, + yaz_iconv_decoder_t d) + +{ + if (!yaz_matchstr(tocode, "UCS4")) + d->read_handle = read_UCS4; + else if (!yaz_matchstr(tocode, "UCS4LE")) + d->read_handle = read_UCS4LE; + else + return 0; + return d; +} + /*