X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fsiconv.c;h=7e9d0fd67d895cafd5792db3a368bf7ad8e720b1;hb=841e368a9589815fbd5704a8173518b050bc9080;hp=2082781e19a6fcc58d937ea45916aaa55a55161a;hpb=b925ea17d6f146a28d745b0d34e9eec6eafda21f;p=yaz-moved-to-github.git diff --git a/src/siconv.c b/src/siconv.c index 2082781..7e9d0fd 100644 --- a/src/siconv.c +++ b/src/siconv.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2006, Index Data ApS * See the file LICENSE for details. * - * $Id: siconv.c,v 1.27 2006-08-28 12:34:41 adam Exp $ + * $Id: siconv.c,v 1.29 2006-08-31 18:19:53 adam Exp $ */ /** * \file siconv.c @@ -183,20 +183,6 @@ static unsigned long yaz_read_ISO8859_1 (yaz_iconv_t cd, unsigned char *inp, return x; } -static size_t yaz_init_marc8(yaz_iconv_t cd, unsigned char *inp, - size_t inbytesleft, size_t *no_read) -{ - cd->marc8_esc_mode = 'B'; - - cd->comb_offset = cd->comb_size = 0; - cd->compose_char = 0; - - cd->write_marc8_comb_no = 0; - cd->write_marc8_last = 0; - cd->write_marc8_page_chr = "\033(B"; - - return 0; -} static size_t yaz_init_UTF8 (yaz_iconv_t cd, unsigned char *inp, size_t inbytesleft, size_t *no_read) @@ -758,7 +744,7 @@ static unsigned long lookup_marc8(yaz_iconv_t cd, x = yaz_marc8r_9_conv(inp, inbytesleft, &no_read_sub, comb); if (x) { - *page_chr = "\033(1"; + *page_chr = "\033$1"; return x; } cd->my_errno = YAZ_ICONV_EILSEQ; @@ -983,15 +969,9 @@ yaz_iconv_t yaz_iconv_open (const char *tocode, const char *fromcode) else if (!yaz_matchstr(fromcode, "UCS4LE")) cd->read_handle = yaz_read_UCS4LE; else if (!yaz_matchstr(fromcode, "MARC8")) - { cd->read_handle = yaz_read_marc8; - cd->init_handle = yaz_init_marc8; - } else if (!yaz_matchstr(fromcode, "MARC8s")) - { cd->read_handle = yaz_read_marc8s; - cd->init_handle = yaz_init_marc8; - } #if HAVE_WCHAR_H else if (!yaz_matchstr(fromcode, "WCHAR_T")) cd->read_handle = yaz_read_wchar_t; @@ -1006,15 +986,9 @@ yaz_iconv_t yaz_iconv_open (const char *tocode, const char *fromcode) else if (!yaz_matchstr(tocode, "UCS4LE")) cd->write_handle = yaz_write_UCS4LE; else if (!yaz_matchstr(tocode, "MARC8")) - { cd->write_handle = yaz_write_marc8; - cd->init_handle = yaz_init_marc8; - } else if (!yaz_matchstr(tocode, "MARC8s")) - { cd->write_handle = yaz_write_marc8; - cd->init_handle = yaz_init_marc8; - } #if HAVE_WCHAR_H else if (!yaz_matchstr(tocode, "WCHAR_T")) cd->write_handle = yaz_write_wchar_t; @@ -1098,6 +1072,15 @@ size_t yaz_iconv(yaz_iconv_t cd, char **inbuf, size_t *inbytesleft, *inbytesleft -= no_read; *inbuf += no_read; } + cd->marc8_esc_mode = 'B'; + + cd->comb_offset = cd->comb_size = 0; + cd->compose_char = 0; + + cd->write_marc8_comb_no = 0; + cd->write_marc8_last = 0; + cd->write_marc8_page_chr = "\033(B"; + cd->init_flag = 0; cd->unget_x = 0; cd->no_read_x = 0;