X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fsiconv.c;h=42220e2cb67b2324eee368bc3e217c448e5a7b59;hp=7895db28f17a2f51fff0053e61929b6bbb3389a7;hb=c753bab9ac07a09f1bd7ba1dc363e58310e307a7;hpb=2715f6522ca62ab5dbc886c21ed18945743216f0 diff --git a/src/siconv.c b/src/siconv.c index 7895db2..42220e2 100644 --- a/src/siconv.c +++ b/src/siconv.c @@ -1,5 +1,5 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2011 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ /** @@ -32,12 +32,6 @@ struct yaz_iconv_struct { int my_errno; int init_flag; -#if 0 - size_t (*init_handle)(yaz_iconv_t cd, unsigned char *inbuf, - size_t inbytesleft, size_t *no_read); - unsigned long (*read_handle)(yaz_iconv_t cd, unsigned char *inbuf, - size_t inbytesleft, size_t *no_read); -#endif size_t no_read_x; unsigned long unget_x; #if HAVE_ICONV_H @@ -70,6 +64,8 @@ static int prepare_encoders(yaz_iconv_t cd, const char *tocode) return 1; if (yaz_wchar_encoder(tocode, &cd->encoder)) return 1; + if (yaz_danmarc_encoder(tocode, &cd->encoder)) + return 1; return 0; } @@ -185,10 +181,10 @@ size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, if (cd->init_flag) { cd->my_errno = YAZ_ICONV_UNKNOWN; - + if (cd->encoder.init_handle) (*cd->encoder.init_handle)(&cd->encoder); - + cd->unget_x = 0; cd->no_read_x = 0; @@ -198,7 +194,7 @@ size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, size_t r = (cd->decoder.init_handle)( cd, &cd->decoder, inbuf ? (unsigned char *) *inbuf : 0, - inbytesleft ? *inbytesleft : 0, + inbytesleft ? *inbytesleft : 0, &no_read); if (r) { @@ -249,7 +245,7 @@ size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, break; } x = (*cd->decoder.read_handle)( - cd, &cd->decoder, + cd, &cd->decoder, (unsigned char *) *inbuf, *inbytesleft, &no_read); if (no_read == 0) {