X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fsiconvtst.c;h=9f7038ece3b62d255e79c8ebf4be86812068a17b;hb=574e9d4d7ee5f61adc9db73fafaa2f48e51ec443;hp=cbe4ec2d77986a3b0e971d638e77ceb2dcb70071;hpb=941c141092dc2ea6a2b6f5cc7bac181798113ae7;p=yaz-moved-to-github.git diff --git a/util/siconvtst.c b/util/siconvtst.c index cbe4ec2..9f7038e 100644 --- a/util/siconvtst.c +++ b/util/siconvtst.c @@ -1,8 +1,8 @@ /* - * Copyright (c) 1997-2002, Index Data + * Copyright (c) 1997-2003, Index Data * See the file LICENSE for details. * - * $Id: siconvtst.c,v 1.4 2002-08-28 19:33:53 adam Exp $ + * $Id: siconvtst.c,v 1.8 2003-01-06 08:20:28 adam Exp $ */ #if HAVE_CONFIG_H @@ -15,14 +15,15 @@ #include -#define CHUNK 8 +#define CHUNK_IN 64 +#define CHUNK_OUT 64 -void convert (FILE *inf, yaz_iconv_t cd) +void convert (FILE *inf, yaz_iconv_t cd, int verbose) { - char inbuf0[CHUNK], *inbuf = inbuf0; - char outbuf0[CHUNK], *outbuf = outbuf0; - size_t outbytesleft = CHUNK; - size_t inbytesleft = CHUNK; + char inbuf0[CHUNK_IN], *inbuf = inbuf0; + char outbuf0[CHUNK_OUT], *outbuf = outbuf0; + size_t inbytesleft = CHUNK_IN; + size_t outbytesleft = CHUNK_OUT; int mustread = 1; while (1) @@ -47,6 +48,12 @@ void convert (FILE *inf, yaz_iconv_t cd) inbytesleft = r; } } + if (verbose > 1) + { + fprintf (stderr, "yaz_iconv: inbytesleft=%d outbytesleft=%d\n", + inbytesleft, outbytesleft); + + } r = yaz_iconv (cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); if (r == (size_t)(-1)) { @@ -61,15 +68,30 @@ void convert (FILE *inf, yaz_iconv_t cd) size_t i; for (i = 0; i