* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
* Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
#include <yaz/yaz-util.h>
static int compare_buffers(char *msg, int no,
#include <yaz/yaz-util.h>
static int compare_buffers(char *msg, int no,
- int expect_len, const unsigned char *expect_buf,
- int got_len, const unsigned char *got_buf)
+ int expect_len, const unsigned char *expect_buf,
+ int got_len, const unsigned char *got_buf)
printf("tsticonv test=%s i=%d failed\n", msg, no);
printf("off got exp\n");
for (i = 0; i<got_len || i<expect_len; i++)
{
printf("tsticonv test=%s i=%d failed\n", msg, no);
printf("off got exp\n");
for (i = 0; i<got_len || i<expect_len; i++)
{
- if (i < got_len)
- sprintf(got_char, "%02X", got_buf[i]);
- else
- sprintf(got_char, "? ");
+ if (i < got_len)
+ sprintf(got_char, "%02X", got_buf[i]);
+ else
+ sprintf(got_char, "? ");
- if (i < expect_len)
- sprintf(expect_char, "%02X", expect_buf[i]);
- else
- sprintf(expect_char, "? ");
-
- printf("%02d %s %s %c\n",
- i, got_char, expect_char, got_buf[i] == expect_buf[i] ?
- ' ' : '*');
+ if (i < expect_len)
+ sprintf(expect_char, "%02X", expect_buf[i]);
+ else
+ sprintf(expect_char, "? ");
+
+ printf("%02d %s %s %c\n",
+ i, got_char, expect_char, got_buf[i] == expect_buf[i] ?
+ ' ' : '*');
int e = yaz_iconv_error(cd);
printf ("tsticonv 11 i=%d e=%d\n", i, e);
int e = yaz_iconv_error(cd);
printf ("tsticonv 11 i=%d e=%d\n", i, e);
- compare_buffers("tsticonv 11", i,
- strlen(iso_8859_1_a[i]), iso_8859_1_a[i],
- outbuf - outbuf0, outbuf0);
+ compare_buffers("tsticonv 11", i,
+ strlen(iso_8859_1_a[i]), iso_8859_1_a[i],
+ outbuf - outbuf0, outbuf0);
- "\033$1" "\x6F\x77\x29" /* AE0E */ "\x6F\x52\x7C" /* c0F4 */ "\033(B",
- 8, "\x00\x00\xAE\x0E" "\x00\x00\xC0\xF4",
+ "\033$1" "\x6F\x77\x29" /* AE0E */ "\x6F\x52\x7C" /* c0F4 */ "\033(B",
+ 8, "\x00\x00\xAE\x0E" "\x00\x00\xC0\xF4",
- "\033$1"
- "\x21\x50\x6E" /* UCS 7CFB */
- "\x21\x51\x31" /* UCS 7D71 */
- "\x21\x3A\x67" /* UCS 5B89 */
- "\x21\x33\x22" /* UCS 5168 */
- "\x21\x33\x53" /* UCS 5206 */
- "\x21\x44\x2B" /* UCS 6790 */
- "\033(B",
- 24, "\x00\x00\x7C\xFB"
- "\x00\x00\x7D\x71"
- "\x00\x00\x5B\x89"
- "\x00\x00\x51\x68"
- "\x00\x00\x52\x06"
- "\x00\x00\x67\x90"
+ "\033$1"
+ "\x21\x50\x6E" /* UCS 7CFB */
+ "\x21\x51\x31" /* UCS 7D71 */
+ "\x21\x3A\x67" /* UCS 5B89 */
+ "\x21\x33\x22" /* UCS 5168 */
+ "\x21\x33\x53" /* UCS 5206 */
+ "\x21\x44\x2B" /* UCS 6790 */
+ "\033(B",
+ 24, "\x00\x00\x7C\xFB"
+ "\x00\x00\x7D\x71"
+ "\x00\x00\x5B\x89"
+ "\x00\x00\x51\x68"
+ "\x00\x00\x52\x06"
+ "\x00\x00\x67\x90"
- "\xB0\xB2", /* AYN and oSLASH */
- 8, "\x00\x00\x02\xBB" "\x00\x00\x00\xF8"
+ "\xB0\xB2", /* AYN and oSLASH */
+ 8, "\x00\x00\x02\xBB" "\x00\x00\x00\xF8"
- "\xF6\x61", /* a underscore */
- 8, "\x00\x00\x00\x61" "\x00\x00\x03\x32"
+ "\xF6\x61", /* a underscore */
+ 8, "\x00\x00\x00\x61" "\x00\x00\x03\x32"
- "\x61\xC2", /* a, phonorecord mark */
- 8, "\x00\x00\x00\x61" "\x00\x00\x21\x17"
+ "\x61\xC2", /* a, phonorecord mark */
+ 8, "\x00\x00\x00\x61" "\x00\x00\x21\x17"
r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
if (r == (size_t) (-1))
{
int e = yaz_iconv_error(cd);
r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
if (r == (size_t) (-1))
{
int e = yaz_iconv_error(cd);
- compare_buffers("tsticonv 22", i,
- expect_len, ar[i].ucs4_b,
- outbuf - outbuf0, outbuf0);
+ compare_buffers("tsticonv 22", i,
+ expect_len, ar[i].ucs4_b,
+ outbuf - outbuf0, outbuf0);
- "\x00\x00\xFF\x1F\x00\x00\x00o",
- "\x00\x00\xAE\x0E\x00\x00\xC0\xF4",
- 0
+ "\x00\x00\xFF\x1F\x00\x00\x00o",
+ "\x00\x00\xAE\x0E\x00\x00\xC0\xF4",
+ 0
int e = yaz_iconv_error(cd);
printf ("tsticonv 31 i=%d e=%d\n", i, e);
int e = yaz_iconv_error(cd);
printf ("tsticonv 31 i=%d e=%d\n", i, e);
- compare_buffers("tsticonv 32", i,
- strlen(utf8_c[i]), utf8_c[i],
- outbuf - outbuf0, outbuf0);
+ compare_buffers("tsticonv 32", i,
+ strlen(utf8_c[i]), utf8_c[i],
+ outbuf - outbuf0, outbuf0);
- char *inbuf = (char*) iso_8859_1_a[i];
- size_t inbytesleft = strlen(inbuf);
- char outbuf0[24];
- char outbuf1[10];
- char *outbuf = outbuf0;
- size_t outbytesleft = sizeof(outbuf0);
+ char *inbuf = (char*) iso_8859_1_a[i];
+ size_t inbytesleft = strlen(inbuf);
+ char outbuf0[24];
+ char outbuf1[10];
+ char *outbuf = outbuf0;
+ size_t outbytesleft = sizeof(outbuf0);
- r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
- if (r == (size_t)(-1))
+ r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+ if (r == (size_t)(-1))
{
int e = yaz_iconv_error(cd);
printf ("tsticonv code=%s i=%d 2 e=%d\n", tmpcode, i, e);
{
int e = yaz_iconv_error(cd);
printf ("tsticonv code=%s i=%d 2 e=%d\n", tmpcode, i, e);
- outbuf = outbuf1;
- outbytesleft = sizeof(outbuf1);
- r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
- if (r == (size_t)(-1)) {
+ outbuf = outbuf1;
+ outbytesleft = sizeof(outbuf1);
+ r = yaz_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
+ if (r == (size_t)(-1)) {
int e = yaz_iconv_error(cd);
printf ("tsticonv code=%s i=%d 4 e=%d\n", tmpcode, i, e);
int e = yaz_iconv_error(cd);
printf ("tsticonv code=%s i=%d 4 e=%d\n", tmpcode, i, e);
- exit(4);
- }
- compare_buffers("dconvert", i,
- strlen(iso_8859_1_a[i]), iso_8859_1_a[i],
- sizeof(outbuf1) - outbytesleft, outbuf1);
- yaz_iconv_close(cd);
+ exit(4);
+ }
+ compare_buffers("dconvert", i,
+ strlen(iso_8859_1_a[i]), iso_8859_1_a[i],
+ sizeof(outbuf1) - outbytesleft, outbuf1);
+ yaz_iconv_close(cd);