* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: siconv.c,v 1.33 2007-01-18 14:45:05 adam Exp $
+ * $Id: siconv.c,v 1.34 2007-03-09 08:39:38 adam Exp $
*/
/**
* \file siconv.c
for (cd->comb_size = 0; cd->comb_size < 8; cd->comb_size++)
{
int comb = 0;
+ if (inbytesleft == 0 && cd->comb_size)
+ {
+ cd->my_errno = YAZ_ICONV_EINVAL;
+ x = 0;
+ *no_read = 0;
+ break;
+ }
x = yaz_read_marc8_comb(cd, inp, inbytesleft, no_read, &comb);
if (!comb || !x)
break;
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: tsticonv.c,v 1.24 2007-01-03 08:42:16 adam Exp $
+ * $Id: tsticonv.c,v 1.25 2007-03-09 08:39:38 adam Exp $
*/
#if HAVE_CONFIG_H
char outbuf[12];
size_t inbytesleft = strlen(buf);
const char *inp = buf;
- while (inbytesleft)
+ int rounds = 0;
+ for (rounds = 0; inbytesleft && rounds < sizeof(outbuf); rounds++)
{
size_t outbytesleft = sizeof(outbuf);
char *outp = outbuf;
size_t r = yaz_iconv(cd, (char**) &inp, &inbytesleft,
&outp, &outbytesleft);
+ wrbuf_write(b, outbuf, outp - outbuf);
if (r == (size_t) (-1))
{
int e = yaz_iconv_error(cd);
if (e != YAZ_ICONV_E2BIG)
break;
}
- wrbuf_write(b, outbuf, outp - outbuf);
}
if (wrbuf_len(b) == strlen(cmpbuf)
&& !memcmp(cmpbuf, wrbuf_buf(b), wrbuf_len(b)))
/* COMBINING ACUTE ACCENT */
YAZ_CHECK(tst_convert(cd, "Cours de mathâe",
"Cours de mathe\xcc\x81"));
+
+
+ YAZ_CHECK(tst_convert(cd, "a\xea\x1e", "a\x1e\xcc\x8a"));
+
+ YAZ_CHECK(tst_convert(cd, "a\xea", "a"));
yaz_iconv_close(cd);
}
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: yaziconv.c,v 1.6 2007-01-03 08:42:16 adam Exp $
+ * $Id: yaziconv.c,v 1.7 2007-03-09 08:39:38 adam Exp $
*/
#if HAVE_CONFIG_H
}
if (r == 0)
{
- fprintf (stderr, "invalid sequence\n");
+ fprintf (stderr, "invalid sequence due to missing input\n");
return ;
}
inbytesleft += r;