X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=test%2Ftstxmlquery.c;h=c1e903402db8ab67d23de84aaee2293aab761707;hp=cd8997afe3cbfa60944fd2dac9a00176263d094e;hb=ffe862e36b8b60b1197b223cec0b78482cbd7763;hpb=200e95a52c5a411bad2a23f2857bb1d7e5512449 diff --git a/test/tstxmlquery.c b/test/tstxmlquery.c index cd8997a..c1e9034 100644 --- a/test/tstxmlquery.c +++ b/test/tstxmlquery.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2010 Index Data * See the file LICENSE for details. - * - * $Id: tstxmlquery.c,v 1.12 2006-07-07 12:09:05 marc Exp $ */ #include @@ -61,7 +59,7 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml, xmlDocDumpMemory(doc, (xmlChar **) &buf_out, &len_out); - if (len_out == strlen(expect_xml) + if (len_out == (int) strlen(expect_xml) && memcmp(buf_out, expect_xml, len_out) == 0) { Z_Query *query2 = 0; @@ -78,14 +76,14 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml, { WRBUF w = wrbuf_alloc(); yaz_query_to_wrbuf(w, query2); - if (!expect_pqf || strcmp(expect_pqf, wrbuf_buf(w)) == 0) + if (!expect_pqf || strcmp(expect_pqf, wrbuf_cstr(w)) == 0) status = XML_MATCH; else { status = XML_NO_MATCH; - printf("Result: %s\n", wrbuf_buf(w)); + printf("Result: %s\n", wrbuf_cstr(w)); } - wrbuf_free(w, 1); + wrbuf_destroy(w); } odr_destroy(odr2); } @@ -95,6 +93,7 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml, status = XML_NO_MATCH; } xmlFreeDoc(doc); + xmlFree(buf_out); } #else status = QUERY2XML_FAILED; @@ -104,7 +103,7 @@ enum pqf2xml_status pqf2xml_text(const char *pqf, const char *expect_xml, return status; } -static void tst() +static void tst(void) { YAZ_CHECK_EQ(pqf2xml_text("@attr 1=4 bad query", "", 0), PQF_FAILED); #if YAZ_HAVE_XML2 @@ -242,6 +241,7 @@ int main (int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab