X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fucs4.c;h=557799f7cb9edd729da2482b7ebf72fbbcee1104;hp=d298224b57bc15090c00bf5d1fa3346a6fe86cf2;hb=e7e9d6ab325472e8f103409f34ba853cdb314f2e;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/src/ucs4.c b/src/ucs4.c index d298224..557799f 100644 --- a/src/ucs4.c +++ b/src/ucs4.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. */ /** @@ -18,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; @@ -36,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; @@ -112,12 +114,27 @@ 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; +} + /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab */ +