From: Adam Dickmeiss Date: Mon, 19 Mar 2007 22:17:41 +0000 (+0000) Subject: More wrbuf_buf woes. X-Git-Tag: YAZ.before.OID.patch~12 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=aaf2ab15830321d9db33cd2e47f739fb52324110 More wrbuf_buf woes. --- diff --git a/client/client.c b/client/client.c index 5369d52..31e6077 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.329 2007-03-19 14:40:06 adam Exp $ + * $Id: client.c,v 1.330 2007-03-19 22:17:41 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -1017,7 +1017,7 @@ static void display_record(Z_External *r) } w = wrbuf_alloc(); yaz_display_grs1(w, r->u.grs1, 0); - puts (wrbuf_buf(w)); + puts (wrbuf_cstr(w)); wrbuf_destroy(w); } else if (ent && ent->value == VAL_OPAC) @@ -1307,10 +1307,7 @@ static char *encode_SRW_term(ODR o, const char *q) } wrbuf_iconv_write(w, cd, q, strlen(q)); if (wrbuf_len(w)) - { - int len = wrbuf_len(w); - res = odr_strdupn(o, wrbuf_buf(w), len); - } + res = odr_strdup(o, wrbuf_cstr(w)); else res = odr_strdup(o, q); yaz_iconv_close(cd); diff --git a/client/fhistory.c b/client/fhistory.c index b75c03d..7fb5f3f 100644 --- a/client/fhistory.c +++ b/client/fhistory.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: fhistory.c,v 1.2 2007-01-24 23:09:48 adam Exp $ + * $Id: fhistory.c,v 1.3 2007-03-19 22:17:41 adam Exp $ */ /** \file fhistory.c * \brief file history implementation @@ -111,7 +111,7 @@ int file_history_trav(file_history_t fh, void *client_data, if (wrbuf_buf(fh->wr)[i] == '\n') { wrbuf_buf(fh->wr)[i] = '\0'; - callback(client_data, wrbuf_buf(fh->wr) + off); + callback(client_data, wrbuf_cstr(fh->wr) + off); wrbuf_buf(fh->wr)[i] = '\n'; i++; break; diff --git a/src/cclptree.c b/src/cclptree.c index bcdfe71..e984cdf 100644 --- a/src/cclptree.c +++ b/src/cclptree.c @@ -53,7 +53,7 @@ /* CCL print rpn tree - infix notation * Europagate, 1995 * - * $Id: cclptree.c,v 1.7 2007-03-19 14:40:07 adam Exp $ + * $Id: cclptree.c,v 1.8 2007-03-19 22:17:41 adam Exp $ * * Old Europagate Log: * @@ -271,7 +271,6 @@ void ccl_pquery (WRBUF w, struct ccl_rpn_node *p) wrbuf_puts (w, " "); break; } - wrbuf_cstr(w); } /* * Local variables: diff --git a/test/tst_record_conv.c b/test/tst_record_conv.c index 6683b84..8fab94e 100644 --- a/test/tst_record_conv.c +++ b/test/tst_record_conv.c @@ -2,7 +2,7 @@ * Copyright (C) 2005-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tst_record_conv.c,v 1.14 2007-03-19 14:40:07 adam Exp $ + * $Id: tst_record_conv.c,v 1.15 2007-03-19 22:17:41 adam Exp $ * */ #include @@ -182,17 +182,7 @@ static int conv_convert_test(yaz_record_conv_t p, { ret = 0; } - else if (strlen(output_expect_record) != wrbuf_len(output_record)) - { - int expect_len = strlen(output_expect_record); - ret = 0; - printf("output_record expect-len=%d got-len=%d\n", expect_len, - wrbuf_len(output_record)); - printf("got-output_record = %s\n", wrbuf_cstr(output_record)); - printf("output_expect_record = %s\n", output_expect_record); - } - else if (memcmp(output_expect_record, wrbuf_buf(output_record), - strlen(output_expect_record))) + else if (strcmp(output_expect_record, wrbuf_cstr(output_record))) { ret = 0; printf("got-output_record = %s\n", wrbuf_cstr(output_record)); diff --git a/test/tstccl.c b/test/tstccl.c index 6cb694f..f5aac60 100644 --- a/test/tstccl.c +++ b/test/tstccl.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tstccl.c,v 1.14 2007-03-19 14:40:07 adam Exp $ + * $Id: tstccl.c,v 1.15 2007-03-19 22:17:41 adam Exp $ */ /* CCL test */ @@ -36,7 +36,7 @@ static int tst_ccl_query(CCL_bibset bibset, ccl_pquery(wrbuf, rpn); /* check expect a result and that it matches */ - if (result && !strcmp(wrbuf_buf(wrbuf), result)) + if (result && !strcmp(wrbuf_cstr(wrbuf), result)) ret = 1; else ret = 0; diff --git a/test/tstxmlquery.c b/test/tstxmlquery.c index e0c7999..0857804 100644 --- a/test/tstxmlquery.c +++ b/test/tstxmlquery.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: tstxmlquery.c,v 1.15 2007-03-19 14:40:07 adam Exp $ + * $Id: tstxmlquery.c,v 1.16 2007-03-19 22:17:41 adam Exp $ */ #include @@ -83,7 +83,7 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml, else { status = XML_NO_MATCH; - printf("Result: %s\n", wrbuf_buf(w)); + printf("Result: %s\n", wrbuf_cstr(w)); } wrbuf_destroy(w); } diff --git a/util/yaz-xmlquery.c b/util/yaz-xmlquery.c index 9fcab5a..4cc8196 100644 --- a/util/yaz-xmlquery.c +++ b/util/yaz-xmlquery.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: yaz-xmlquery.c,v 1.7 2007-03-19 14:40:08 adam Exp $ + * $Id: yaz-xmlquery.c,v 1.8 2007-03-19 22:17:41 adam Exp $ */ #include @@ -117,7 +117,7 @@ void xmlquerytopqf(const char *xmlstr) { WRBUF w = wrbuf_alloc(); yaz_query_to_wrbuf(w, query); - printf("%s\n", wrbuf_buf(w)); + printf("%s\n", wrbuf_cstr(w)); wrbuf_destroy(w); } odr_destroy(odr);