X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fsiconvtst.c;h=9f7038ece3b62d255e79c8ebf4be86812068a17b;hb=c7eb63e9060187fbba904c3da9697ff85f919af4;hp=88523911d548def17c1809456c5dba2ce4a7ca0a;hpb=33c972afb7998b7598f72ab1f4c072f92c2d6407;p=yaz-moved-to-github.git diff --git a/util/siconvtst.c b/util/siconvtst.c index 8852391..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.3 2002-08-27 21:45:28 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