diff options
author | Mike Hommey <mh@glandium.org> | 2004-11-11 12:53:54 +0000 |
---|---|---|
committer | Mike Hommey <mh@glandium.org> | 2004-11-11 12:53:54 +0000 |
commit | f51dd67f3a3f472af0620391eb588eeca4533689 (patch) | |
tree | 9184c396c489196608427d5fa35814e86a1e479f | |
parent | 9705f1a5e858108d21a0128556f42b25d16833cd (diff) | |
download | libxml2-upstream/2.6.16.tar.gz |
Load /tmp/tmp.n9GTkp/libxml2-2.6.16 intoupstream/2.6.16
packages/libxml2/branches/upstream/current.
105 files changed, 51976 insertions, 600 deletions
@@ -1,3 +1,247 @@ +Wed Nov 10 15:35:25 CET 2004 Daniel Veillard <daniel@veillard.com> + + * NEWS configure.in doc/*: preparing release of libxml2-2.6.16 + +Wed Nov 10 12:55:18 CET 2004 Daniel Veillard <daniel@veillard.com> + + * python/generator.py python/libxml.c python/libxml2class.txt + python/libxml_wrap.h python/types.c: Applied patch from Brent + Hendricks adding support for late DTD validation. + * python/tests/Makefile.am python/tests/dtdvalid.py + python/tests/test.dtd: integrated the provided regression test + +Tue nov 9 19:24:31 CET 2004 Dodji Seketeli <dodji@seketeli.org> + + * configure.in: detect when struct sockaddr_storage + has the __ss_family member instead of ss_family and + behave accordingly. We now can use ipv6 on aix. + +Tue Nov 9 17:15:46 CET 2004 Daniel Veillard <daniel@veillard.com> + + * Makefile.am gentest.py testapi.c: integrated in "make tests" + added -q option, and more conditional features fixes + * catalog.c debugXML.c parser.c testThreads.c xmllint.c + xmlschemastypes.c xmlwriter.cinclude/libxml/catalog.h + include/libxml/debugXML.h: various compilation and conditional + cleanups. + * doc/*: regenerated + +Tue Nov 9 15:59:50 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: better handling of conditional features + * HTMLparser.c SAX2.c parserInternals.c xmlwriter.c: more testing + on parser contexts closed leaks, error messages + +Tue Nov 9 10:21:37 GMT 2004 William Brack <wbrack@mmm.com.hk> + + * xpath.c: fixed problem concerning XPath context corruption + during function argument evaluation (bug 157652) + +Mon Nov 8 18:54:52 CET 2004 Daniel Veillard <daniel@veillard.com> + + * testapi.c: more types. + * parserInternals.c xpath.c: more fixes + +Mon Nov 8 18:16:43 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: better parser options coverage + * SAX2.c xpath.c: more cleanups. + +Tue Nov 9 01:50:08 CET 2004 Daniel Veillard <daniel@veillard.com> + + * testapi.c: trying to fix some optional support brokenness + +Mon Nov 8 17:25:27 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more coverage + * debugXML.c parser.c xmlregexp.c xpath.c: more fixes + +Mon Nov 8 15:02:39 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more coverage + * SAX2.c parser.c parserInternals.c: more fixes + +Mon Nov 8 12:55:16 CET 2004 Daniel Veillard <daniel@veillard.com> + + * parser.c testapi.c xmlIO.c xmlstring.c: more fixes. + +Mon Nov 8 11:24:57 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more types, more coverage + * parser.c parserInternals.c relaxng.c valid.c xmlIO.c + xmlschemastypes.c: more problems fixed + +Mon Nov 8 10:24:28 HKT 2004 William Brack <wbrack@mmm.com.hk> + + * gentest.py: fixed test file corruption problem + +Sun Nov 7 13:18:05 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: fixed typos and avoid Catalogs verbosity + +Sat Nov 6 23:25:16 CET 2004 Daniel Veillard <daniel@veillard.com> + + * testapi.c: augmented the number of types + +Sat Nov 6 20:24:07 CET 2004 Daniel Veillard <daniel@veillard.com> + + * HTMLtree.c tree.c xmlreader.c xmlwriter.c: a number of new + bug fixes and documentation updates. + +Sat Nov 6 15:50:11 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: augmented type autogeneration for enums + * xpath.c include/libxml/xpath.h: removed direct error reporting. + +Sat Nov 6 14:27:18 CET 2004 Daniel Veillard <daniel@veillard.com> + + * encoding.c: fixed a regression in iconv support. + +Fri Nov 5 18:19:23 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: autogenerate a minimal NULL value sequence + for unknown pointer types + * HTMLparser.c SAX2.c chvalid.c encoding.c entities.c parser.c + parserInternals.c relaxng.c valid.c xmlIO.c xmlreader.c + xmlsave.c xmlschemas.c xmlschemastypes.c xmlstring.c xpath.c + xpointer.c: This uncovered an impressive amount of entry points + not checking for NULL pointers when they ought to, closing all + the open gaps. + +Fri Nov 5 16:26:28 UTC 2004 William Brack <wbrack@mmm.com.hk> + + * catalog.c: fixed problem with NULL entry (bug 157407) + * xpath.c: fixed a couple of warnings (no change to logic) + +Fri Nov 5 15:30:43 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more coverage + * xmlunicode.c: one fix + +Fri Nov 5 23:15:51 CET 2004 Daniel Veillard <daniel@veillard.com> + + * entities.c: fixed a compilation problem on a recent change + +Fri Nov 5 12:50:09 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more coverage + * nanoftp.c tree.c: more fixes + +Fri Nov 5 11:02:28 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: fixed the way the generator works, + extended the testing, especially with more real trees and nodes. + * HTMLtree.c tree.c valid.c xinclude.c xmlIO.c xmlsave.c: a bunch + of real problems found and fixed. + * entities.c: fix error reporting to go through the new handlers + +Thu Nov 4 18:44:56 CET 2004 Daniel Veillard <daniel@veillard.com> + + * parser.c: dohh ... stupid change killing xmlParseDoc() + +Thu Nov 4 18:32:22 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: changing the way the .c is generated, + extending the tests coverage + * include/libxml/nanoftp.h nanoftp.c elfgcchack.h doc/*: fixing some + function signatures, regenerating stuff + * SAX2.c parser.c xmlIO.c: another set of bug fixes and API hardening + +Thu Nov 4 13:32:19 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: extending the tests coverage + +Thu Nov 4 11:52:28 CET 2004 Daniel Veillard <daniel@veillard.com> + + * Makefile.am: gentest.py was missing from the EXTRA_DIST + +Thu Nov 4 11:48:47 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: extending the tests coverage + * HTMLtree.c tree.c xmlsave.c xpointer.c: more fixes and cleanups + +Thu Nov 4 00:25:36 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more fixes and extending the tests coverage + * nanoftp.c xmlIO.c: more fixes and hardening + +Wed Nov 3 20:16:24 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more fixes and extending the tests coverage + * valid.c: bunch of cleanups and 2 leaks removed + +Wed Nov 3 18:06:44 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more fixes and extending the tests coverage + * list.c tree.c: more fixes and hardening + +Wed Nov 3 15:19:22 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more fixes and extending the tests coverage + * relaxng.c include/libxml/relaxng.h: adding a type init interface + * include/libxml/xmlerror.h parser.c xmlreader.c xmlwriter.c: more + cleanups and bug fixes raised by the regression tests + +Wed Nov 3 12:49:30 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more fixes and extending the tests coverage + * xmlwriter.c list.c: more hardeing of APIs + * doc/apibuild.py: skip testapi.c when scanning the C files. + +Tue Nov 2 23:09:06 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more testing and coverage + * elfgcchack.h xmlstring.c include/libxml/xmlstring.h: more cleanups + * doc/*: rebuilt + +Tue Nov 2 19:44:32 CET 2004 Daniel Veillard <daniel@veillard.com> + + * gentest.py testapi.c: more developments on the API testing + * HTMLparser.c tree.c: more cleanups + * doc/*: rebuilt + +Tue Nov 2 15:49:34 CET 2004 Daniel Veillard <daniel@veillard.com> + + * xmlmemory.c include/libxml/xmlmemory.h: adding xmlMemBlocks() + * Makefile.am gentest.py testapi.c: work on generator of an + automatic API regression test tool. + * SAX2.c nanoftp.c parser.c parserInternals.c tree.c xmlIO.c + xmlstring.c: various API hardeing changes as a result of running + teh first set of automatic API regression tests. + * test/slashdot16.xml: apparently missing from CVS, commited it + +Mon Nov 1 15:54:18 CET 2004 Daniel Veillard <daniel@veillard.com> + + * xpath.c: fixed an UTF-8 parsing bug reported by Markus Bertheau + on #fedora-devel + +Sun Oct 31 22:03:38 CET 2004 Daniel Veillard <daniel@veillard.com> + + * parser.c: fixed a bug reported by Petr Pajas on the list and + affecting XML::Libxml + +Sun Oct 31 16:33:54 CET 2004 Daniel Veillard <daniel@veillard.com> + + * encoding.c doc/examples/testWriter.c: Fixed bug #153937, making + sure the conversion functions return the number of byte written. + Had to fix one of the examples. + +Fri Oct 29 14:16:56 CEST 2004 Daniel Veillard <daniel@veillard.com> + + * doc/xmllint.1 doc/xmllint.xml: indicate - means stdin closing #156626 + +Fri Oct 29 14:03:36 CEST 2004 Daniel Veillard <daniel@veillard.com> + + * python/libxml.c: register xmlSchemaSetValidErrors, patch from + Brent Hendricks in the mailing-list + * include/libxml/valid.h HTMLparser.c SAX2.c valid.c + parserInternals.c: fix #156626 and more generally how to find out + if a validation contect is part of a parsing context or not. This + can probably be improved to make 100% sure that vctxt->userData + is the parser context too. It's a bit hairy because we can't + change the xmlValidCtxt structure without breaking the ABI since + this change xmlParserCtxt information indexes. + Wed Oct 27 19:26:20 CEST 2004 Daniel Veillard <daniel@veillard.com> * ChangeLog NEWS configure.in doc/*: preparing release 2.6.15 diff --git a/HTMLparser.c b/HTMLparser.c index 947e4aa..4f84d7c 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -109,13 +109,15 @@ htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; - ctxt->errNo = error; + if (ctxt != NULL) + ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); - ctxt->wellFormed = 0; + if (ctxt != NULL) + ctxt->wellFormed = 0; } /** @@ -134,11 +136,13 @@ htmlParseErrInt(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; - ctxt->errNo = error; + if (ctxt != NULL) + ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, XML_ERR_ERROR, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); - ctxt->wellFormed = 0; + if (ctxt != NULL) + ctxt->wellFormed = 0; } /************************************************************************ @@ -394,13 +398,15 @@ encoding_error: * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ - htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, - "Input is not proper UTF-8, indicate encoding !\n", - NULL, NULL); - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + { + char buffer[150]; + + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", ctxt->input->cur[0], ctxt->input->cur[1], ctxt->input->cur[2], ctxt->input->cur[3]); + htmlParseErr(ctxt, XML_ERR_INVALID_ENCODING, + "Input is not proper UTF-8, indicate encoding !\n", + BAD_CAST buffer, NULL); } ctxt->charset = XML_CHAR_ENCODING_8859_1; @@ -1788,6 +1794,7 @@ UTF8ToHtml(unsigned char* out, int *outlen, unsigned int c, d; int trailing; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1); if (in == NULL) { /* * initialization nothing to do @@ -1882,13 +1889,17 @@ int htmlEncodeEntities(unsigned char* out, int *outlen, const unsigned char* in, int *inlen, int quoteChar) { const unsigned char* processed = in; - const unsigned char* outend = out + (*outlen); + const unsigned char* outend; const unsigned char* outstart = out; const unsigned char* instart = in; - const unsigned char* inend = in + (*inlen); + const unsigned char* inend; unsigned int c, d; int trailing; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) + return(-1); + outend = out + (*outlen); + inend = in + (*inlen); while (in < inend) { d = *in++; if (d < 0x80) { c= d; trailing= 0; } @@ -2417,7 +2428,9 @@ const htmlEntityDesc * htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { const xmlChar *name; const htmlEntityDesc * ent = NULL; - *str = NULL; + + if (str != NULL) *str = NULL; + if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); if (CUR == '&') { NEXT; @@ -2428,7 +2441,8 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { } else { GROW; if (CUR == ';') { - *str = name; + if (str != NULL) + *str = name; /* * Lookup the entity in the table. @@ -2440,7 +2454,8 @@ htmlParseEntityRef(htmlParserCtxtPtr ctxt, const xmlChar **str) { htmlParseErr(ctxt, XML_ERR_ENTITYREF_SEMICOL_MISSING, "htmlParseEntityRef: expecting ';'\n", NULL, NULL); - *str = name; + if (str != NULL) + *str = name; } } } @@ -3018,6 +3033,12 @@ int htmlParseCharRef(htmlParserCtxtPtr ctxt) { int val = 0; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseCharRef: context error\n", + NULL, NULL); + return(0); + } if ((CUR == '&') && (NXT(1) == '#') && ((NXT(2) == 'x') || NXT(2) == 'X')) { SKIP(3); @@ -3341,6 +3362,11 @@ htmlParseStartTag(htmlParserCtxtPtr ctxt) { int meta = 0; int i; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseStartTag: context error\n", NULL, NULL); + return; + } if (CUR != '<') return; NEXT; @@ -3822,9 +3848,15 @@ htmlParseElement(htmlParserCtxtPtr ctxt) { const htmlElemDesc * info; htmlParserNodeInfo node_info; const xmlChar *oldname; - int depth = ctxt->nameNr; + int depth; const xmlChar *oldptr; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseStartTag: context error\n", NULL, NULL); + return; + } + depth = ctxt->nameNr; /* Capture start position */ if (ctxt->record_info) { node_info.begin_pos = ctxt->input->consumed + @@ -3947,8 +3979,13 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) { xmlInitParser(); htmlDefaultSAXHandlerInit(); - ctxt->html = 1; + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseDocument: context error\n", NULL, NULL); + return(XML_ERR_INTERNAL_ERROR); + } + ctxt->html = 1; GROW; /* * SAX: beginning of the document processing. @@ -4136,6 +4173,7 @@ htmlInitParserCtxt(htmlParserCtxtPtr ctxt) ctxt->replaceEntities = 0; ctxt->linenumbers = xmlLineNumbersDefaultValue; ctxt->html = 1; + ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0; ctxt->vctxt.userData = ctxt; ctxt->vctxt.error = xmlParserValidityError; ctxt->vctxt.warning = xmlParserValidityWarning; @@ -5131,6 +5169,11 @@ done: int htmlParseChunk(htmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate) { + if ((ctxt == NULL) || (ctxt->input == NULL)) { + htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, + "htmlParseChunk: context error\n", NULL, NULL); + return(XML_ERR_INTERNAL_ERROR); + } if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { int base = ctxt->input->base - ctxt->input->buf->buffer->content; @@ -5360,6 +5403,9 @@ htmlCreateFileParserCtxt(const char *filename, const char *encoding) /* htmlCharEncoding enc; */ xmlChar *content, *content_line = (xmlChar *) "charset="; + if (filename == NULL) + return(NULL); + ctxt = htmlNewParserCtxt(); if (ctxt == NULL) { return(NULL); @@ -5615,7 +5661,12 @@ void htmlCtxtReset(htmlParserCtxtPtr ctxt) { xmlParserInputPtr input; - xmlDictPtr dict = ctxt->dict; + xmlDictPtr dict; + + if (ctxt == NULL) + return; + + dict = ctxt->dict; while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ xmlFreeInputStream(input); @@ -5624,8 +5675,12 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) ctxt->input = NULL; ctxt->spaceNr = 0; - ctxt->spaceTab[0] = -1; - ctxt->space = &ctxt->spaceTab[0]; + if (ctxt->spaceTab != NULL) { + ctxt->spaceTab[0] = -1; + ctxt->space = &ctxt->spaceTab[0]; + } else { + ctxt->space = NULL; + } ctxt->nodeNr = 0; @@ -5695,6 +5750,9 @@ htmlCtxtReset(htmlParserCtxtPtr ctxt) int htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options) { + if (ctxt == NULL) + return(-1); + if (options & HTML_PARSE_NOWARNING) { ctxt->sax->warning = NULL; ctxt->vctxt.warning = NULL; @@ -522,6 +522,8 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { xmlInitParser(); + if ((mem == NULL) || (size == NULL)) + return; if (cur == NULL) { *mem = NULL; *size = 0; @@ -745,7 +747,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlInitParser(); - if (cur == NULL) { + if ((cur == NULL) || (buf == NULL)) { return; } /* @@ -753,7 +755,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, */ if (cur->type == XML_DTD_NODE) return; - if (cur->type == XML_HTML_DOCUMENT_NODE) { + if ((cur->type == XML_HTML_DOCUMENT_NODE) || + (cur->type == XML_DOCUMENT_NODE)){ htmlDocContentDumpOutput(buf, (xmlDocPtr) cur, encoding); return; } @@ -944,6 +947,9 @@ htmlDocContentDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr cur, xmlInitParser(); + if ((buf == NULL) || (cur == NULL)) + return; + /* * force to output the stuff as HTML, especially for entities */ @@ -997,7 +1003,7 @@ htmlDocDump(FILE *f, xmlDocPtr cur) { xmlInitParser(); - if (cur == NULL) { + if ((cur == NULL) || (f == NULL)) { return(-1); } @@ -1053,6 +1059,9 @@ htmlSaveFile(const char *filename, xmlDocPtr cur) { const char *encoding; int ret; + if ((cur == NULL) || (filename == NULL)) + return(-1); + xmlInitParser(); encoding = (const char *) htmlGetMetaEncoding(cur); @@ -1113,6 +1122,9 @@ htmlSaveFileFormat(const char *filename, xmlDocPtr cur, xmlCharEncodingHandlerPtr handler = NULL; int ret; + if ((cur == NULL) || (filename == NULL)) + return(-1); + xmlInitParser(); if (encoding != NULL) { diff --git a/Makefile.am b/Makefile.am index 583e812..b186b45 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ INCLUDES = -I$(top_builddir)/include -I@srcdir@/include @THREAD_CFLAGS@ @Z_CFLAG noinst_PROGRAMS=testSchemas testRelax testSAX testHTML testXPath testURI \ testThreads testC14N testAutomata testRegexp \ - testReader + testReader testapi bin_PROGRAMS = xmllint xmlcatalog @@ -113,6 +113,14 @@ testReader_LDFLAGS = testReader_DEPENDENCIES = $(DEPS) testReader_LDADD= $(LDADDS) +testapi.c: gentest.py doc/libxml2-api.xml + -@(if [ "$(PYTHON)" != "" ] ; then $(PYTHON) gentest.py ; fi ) + +testapi_SOURCES=testapi.c +testapi_LDFLAGS = +testapi_DEPENDENCIES = $(DEPS) +testapi_LDADD= $(LDADDS) + #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c #testOOM_LDFLAGS = #testOOM_DEPENDENCIES = $(DEPS) @@ -122,7 +130,7 @@ check-local: all tests testall : tests SVGtests SAXtests -tests: XMLtests XMLenttests NStests IDtests Errtests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@ @PYTHON_TESTS@ +tests: XMLtests XMLenttests NStests IDtests Errtests APItests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@ @PYTHON_TESTS@ @(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; \ $(MAKE) MAKEFLAGS+=--silent tests ; fi) @(cd doc/examples ; $(MAKE) MAKEFLAGS+=--silent tests) @@ -132,6 +140,10 @@ valgrind: @echo '## Go get a cup of coffee it is gonna take a while ...' $(MAKE) CHECKER='valgrind -q' tests +APItests: testapi$(EXEEXT) + @echo "## Running the API regression tests this may take a little while" + -@($(CHECKER) $(top_builddir)/testapi -q) + HTMLtests : testHTML$(EXEEXT) @(echo > .memdump) @echo "## HTML regression tests" @@ -1008,7 +1020,7 @@ confexecdir=$(libdir) confexec_DATA = xml2Conf.sh CVS_EXTRA_DIST= EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \ - libxml.m4 Copyright check-xml-test-suite.py \ + libxml.m4 Copyright check-xml-test-suite.py gentest.py \ check-relaxng-test-suite.py check-relaxng-test-suite2.py \ check-xsddata-test-suite.py check-xinclude-test-suite.py \ example/Makefile.am example/gjobread.c example/gjobs.xml \ diff --git a/Makefile.in b/Makefile.in index 5481aa7..abb22ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -17,7 +17,7 @@ -SOURCES = $(libxml2_la_SOURCES) $(testAutomata_SOURCES) $(testC14N_SOURCES) $(testHTML_SOURCES) $(testReader_SOURCES) $(testRegexp_SOURCES) $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) $(xmlcatalog_SOURCES) $(xmllint_SOURCES) +SOURCES = $(libxml2_la_SOURCES) $(testAutomata_SOURCES) $(testC14N_SOURCES) $(testHTML_SOURCES) $(testReader_SOURCES) $(testRegexp_SOURCES) $(testRelax_SOURCES) $(testSAX_SOURCES) $(testSchemas_SOURCES) $(testThreads_SOURCES) $(testURI_SOURCES) $(testXPath_SOURCES) $(testapi_SOURCES) $(xmlcatalog_SOURCES) $(xmllint_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ @@ -43,7 +43,8 @@ host_triplet = @host@ noinst_PROGRAMS = testSchemas$(EXEEXT) testRelax$(EXEEXT) \ testSAX$(EXEEXT) testHTML$(EXEEXT) testXPath$(EXEEXT) \ testURI$(EXEEXT) testThreads$(EXEEXT) testC14N$(EXEEXT) \ - testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) + testAutomata$(EXEEXT) testRegexp$(EXEEXT) testReader$(EXEEXT) \ + testapi$(EXEEXT) bin_PROGRAMS = xmllint$(EXEEXT) xmlcatalog$(EXEEXT) DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ @@ -133,6 +134,8 @@ am_testURI_OBJECTS = testURI.$(OBJEXT) testURI_OBJECTS = $(am_testURI_OBJECTS) am_testXPath_OBJECTS = testXPath.$(OBJEXT) testXPath_OBJECTS = $(am_testXPath_OBJECTS) +am_testapi_OBJECTS = testapi.$(OBJEXT) +testapi_OBJECTS = $(am_testapi_OBJECTS) am_xmlcatalog_OBJECTS = xmlcatalog.$(OBJEXT) xmlcatalog_OBJECTS = $(am_xmlcatalog_OBJECTS) am_xmllint_OBJECTS = xmllint.$(OBJEXT) @@ -162,12 +165,13 @@ am__depfiles_maybe = depfiles @AMDEP_TRUE@ ./$(DEPDIR)/testSAX.Po ./$(DEPDIR)/testSchemas.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/testThreads@THREADS_W32@.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/testURI.Po ./$(DEPDIR)/testXPath.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/threads.Plo ./$(DEPDIR)/tree.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/trio.Plo ./$(DEPDIR)/triostr.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/uri.Plo ./$(DEPDIR)/valid.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xinclude.Plo ./$(DEPDIR)/xlink.Plo \ -@AMDEP_TRUE@ ./$(DEPDIR)/xmlIO.Plo ./$(DEPDIR)/xmlcatalog.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/xmllint.Po ./$(DEPDIR)/xmlmemory.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/testapi.Po ./$(DEPDIR)/threads.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/tree.Plo ./$(DEPDIR)/trio.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/triostr.Plo ./$(DEPDIR)/uri.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/valid.Plo ./$(DEPDIR)/xinclude.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xlink.Plo ./$(DEPDIR)/xmlIO.Plo \ +@AMDEP_TRUE@ ./$(DEPDIR)/xmlcatalog.Po ./$(DEPDIR)/xmllint.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/xmlmemory.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/xmlreader.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/xmlregexp.Plo ./$(DEPDIR)/xmlsave.Plo \ @AMDEP_TRUE@ ./$(DEPDIR)/xmlschemas.Plo \ @@ -188,14 +192,14 @@ SOURCES = $(libxml2_la_SOURCES) $(testAutomata_SOURCES) \ $(testC14N_SOURCES) $(testHTML_SOURCES) $(testReader_SOURCES) \ $(testRegexp_SOURCES) $(testRelax_SOURCES) $(testSAX_SOURCES) \ $(testSchemas_SOURCES) $(testThreads_SOURCES) \ - $(testURI_SOURCES) $(testXPath_SOURCES) $(xmlcatalog_SOURCES) \ - $(xmllint_SOURCES) + $(testURI_SOURCES) $(testXPath_SOURCES) $(testapi_SOURCES) \ + $(xmlcatalog_SOURCES) $(xmllint_SOURCES) DIST_SOURCES = $(am__libxml2_la_SOURCES_DIST) $(testAutomata_SOURCES) \ $(testC14N_SOURCES) $(testHTML_SOURCES) $(testReader_SOURCES) \ $(testRegexp_SOURCES) $(testRelax_SOURCES) $(testSAX_SOURCES) \ $(testSchemas_SOURCES) $(testThreads_SOURCES) \ - $(testURI_SOURCES) $(testXPath_SOURCES) $(xmlcatalog_SOURCES) \ - $(xmllint_SOURCES) + $(testURI_SOURCES) $(testXPath_SOURCES) $(testapi_SOURCES) \ + $(xmlcatalog_SOURCES) $(xmllint_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-exec-recursive install-info-recursive \ @@ -506,12 +510,16 @@ testReader_SOURCES = testReader.c testReader_LDFLAGS = testReader_DEPENDENCIES = $(DEPS) testReader_LDADD = $(LDADDS) +testapi_SOURCES = testapi.c +testapi_LDFLAGS = +testapi_DEPENDENCIES = $(DEPS) +testapi_LDADD = $(LDADDS) CLEANFILES = xml2Conf.sh confexecdir = $(libdir) confexec_DATA = xml2Conf.sh CVS_EXTRA_DIST = EXTRA_DIST = xml2-config.in xml2Conf.sh.in libxml.spec.in libxml2.spec \ - libxml.m4 Copyright check-xml-test-suite.py \ + libxml.m4 Copyright check-xml-test-suite.py gentest.py \ check-relaxng-test-suite.py check-relaxng-test-suite2.py \ check-xsddata-test-suite.py check-xinclude-test-suite.py \ example/Makefile.am example/gjobread.c example/gjobs.xml \ @@ -691,6 +699,9 @@ testURI$(EXEEXT): $(testURI_OBJECTS) $(testURI_DEPENDENCIES) testXPath$(EXEEXT): $(testXPath_OBJECTS) $(testXPath_DEPENDENCIES) @rm -f testXPath$(EXEEXT) $(LINK) $(testXPath_LDFLAGS) $(testXPath_OBJECTS) $(testXPath_LDADD) $(LIBS) +testapi$(EXEEXT): $(testapi_OBJECTS) $(testapi_DEPENDENCIES) + @rm -f testapi$(EXEEXT) + $(LINK) $(testapi_LDFLAGS) $(testapi_OBJECTS) $(testapi_LDADD) $(LIBS) xmlcatalog$(EXEEXT): $(xmlcatalog_OBJECTS) $(xmlcatalog_DEPENDENCIES) @rm -f xmlcatalog$(EXEEXT) $(LINK) $(xmlcatalog_LDFLAGS) $(xmlcatalog_OBJECTS) $(xmlcatalog_LDADD) $(LIBS) @@ -757,6 +768,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testThreads@THREADS_W32@.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testURI.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testXPath.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testapi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threads.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tree.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trio.Plo@am__quote@ @@ -1337,6 +1349,9 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man1 uninstall-man3 uninstall-pkgconfigDATA +testapi.c: gentest.py doc/libxml2-api.xml + -@(if [ "$(PYTHON)" != "" ] ; then $(PYTHON) gentest.py ; fi ) + #testOOM_SOURCES=testOOM.c testOOMlib.h testOOMlib.c #testOOM_LDFLAGS = #testOOM_DEPENDENCIES = $(DEPS) @@ -1346,7 +1361,7 @@ check-local: all tests testall : tests SVGtests SAXtests -tests: XMLtests XMLenttests NStests IDtests Errtests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@ @PYTHON_TESTS@ +tests: XMLtests XMLenttests NStests IDtests Errtests APItests @READER_TEST@ @TEST_SAX@ @TEST_PUSH@ @TEST_HTML@ @TEST_PHTML@ @TEST_VALID@ URItests @TEST_XPATH@ @TEST_XPTR@ @TEST_XINCLUDE@ @TEST_C14N@ @TEST_DEBUG@ @TEST_CATALOG@ @TEST_REGEXPS@ @TEST_SCHEMAS@ @TEST_THREADS@ Timingtests @TEST_VTIME@ @PYTHON_TESTS@ @(if [ "@PYTHON_SUBDIR@" != "" ] ; then cd python ; \ $(MAKE) MAKEFLAGS+=--silent tests ; fi) @(cd doc/examples ; $(MAKE) MAKEFLAGS+=--silent tests) @@ -1356,6 +1371,10 @@ valgrind: @echo '## Go get a cup of coffee it is gonna take a while ...' $(MAKE) CHECKER='valgrind -q' tests +APItests: testapi$(EXEEXT) + @echo "## Running the API regression tests this may take a little while" + -@($(CHECKER) $(top_builddir)/testapi -q) + HTMLtests : testHTML$(EXEEXT) @(echo > .memdump) @echo "## HTML regression tests" @@ -14,7 +14,22 @@ ChangeLog.html describes the recents commits to the CVS at http://cvs.gnome.org/viewcvs/libxml2/ - code base.There is the list of public releases:2.6.15: Oct 27 2004 - security fixes on the nanoftp and nanohttp modules + code base.There is the list of public releases: +2.6.16: Nov 10 2004: + - general hardening and bug fixing crossing all the API based on new + automated regression testing + - build fix: IPv6 build and test on AIX (Dodji Seketeli) + - bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding + conversion functions return values, UTF-8 bug affecting XPath reported by + Markus Bertheau, catalog problem with NULL entries (William Brack) + - documentation: fix to xmllint man page, some API function descritpion + were updated. + - improvements: DTD validation APIs provided at the Python level (Brent + Hendricks) + + +2.6.15: Oct 27 2004: + - security fixes on the nanoftp and nanohttp modules - build fixes: xmllint detection bug in configure, building outside the source tree (Thomas Fitzsimmons) - bug fixes: HTML parser on broken ASCII chars in names (William), Python @@ -51,11 +51,13 @@ */ static void xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) { - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) - ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); - ctxt->errNo = XML_ERR_NO_MEMORY; - ctxt->instate = XML_PARSER_EOF; - ctxt->disableSAX = 1; + if (ctxt != NULL) { + if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) + ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg); + ctxt->errNo = XML_ERR_NO_MEMORY; + ctxt->instate = XML_PARSER_EOF; + ctxt->disableSAX = 1; + } } /** @@ -77,16 +79,19 @@ xmlErrValid(xmlParserCtxtPtr ctxt, xmlParserErrors error, if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; - ctxt->errNo = error; - if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) - schannel = ctxt->sax->serror; + if (ctxt != NULL) { + ctxt->errNo = error; + if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC)) + schannel = ctxt->sax->serror; + } __xmlRaiseError(schannel, ctxt->vctxt.error, ctxt->vctxt.userData, ctxt, NULL, XML_FROM_DTD, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, (const char *) str1, (const char *) str2); - ctxt->valid = 0; + if (ctxt != NULL) + ctxt->valid = 0; } /** @@ -117,6 +122,7 @@ const xmlChar * xmlSAX2GetSystemId(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctx == NULL) || (ctxt->input == NULL)) return(0); return((const xmlChar *) ctxt->input->filename); } @@ -132,6 +138,7 @@ int xmlSAX2GetLineNumber(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctx == NULL) || (ctxt->input == NULL)) return(0); return(ctxt->input->line); } @@ -147,6 +154,7 @@ int xmlSAX2GetColumnNumber(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctx == NULL) || (ctxt->input == NULL)) return(0); return(ctxt->input->col); } @@ -162,6 +170,7 @@ int xmlSAX2IsStandalone(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctx == NULL) || (ctxt->myDoc == NULL)) return(0); return(ctxt->myDoc->standalone == 1); } @@ -177,6 +186,7 @@ int xmlSAX2HasInternalSubset(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); return(ctxt->myDoc->intSubset != NULL); } @@ -192,6 +202,7 @@ int xmlSAX2HasExternalSubset(void *ctx) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if ((ctxt == NULL) || (ctxt->myDoc == NULL)) return(0); return(ctxt->myDoc->extSubset != NULL); } @@ -210,6 +221,7 @@ xmlSAX2InternalSubset(void *ctx, const xmlChar *name, { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlDtdPtr dtd; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2InternalSubset(%s, %s, %s)\n", @@ -246,6 +258,7 @@ xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2ExternalSubset(%s, %s, %s)\n", @@ -366,6 +379,7 @@ xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId xmlChar *URI; const char *base = NULL; + if (ctx == NULL) return(NULL); if (ctxt->input != NULL) base = ctxt->input->filename; if (base == NULL) @@ -400,6 +414,7 @@ xmlSAX2GetEntity(void *ctx, const xmlChar *name) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlEntityPtr ret = NULL; + if (ctx == NULL) return(NULL); #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2GetEntity(%s)\n", name); @@ -479,6 +494,7 @@ xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlEntityPtr ret; + if (ctx == NULL) return(NULL); #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2GetParameterEntity(%s)\n", name); @@ -507,6 +523,7 @@ xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, xmlEntityPtr ent; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EntityDecl(%s, %d, %s, %s, %s)\n", @@ -578,6 +595,7 @@ xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, xmlAttributePtr attr; xmlChar *name = NULL, *prefix = NULL; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2AttributeDecl(%s, %s, %d, %d, %s, ...)\n", @@ -641,6 +659,7 @@ xmlSAX2ElementDecl(void *ctx, const xmlChar * name, int type, xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlElementPtr elem = NULL; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2ElementDecl(%s, %d, ...)\n", name, type); @@ -685,6 +704,7 @@ xmlSAX2NotationDecl(void *ctx, const xmlChar *name, xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNotationPtr nota = NULL; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2NotationDecl(%s, %s, %s)\n", name, publicId, systemId); @@ -735,6 +755,7 @@ xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, { xmlEntityPtr ent; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2UnparsedEntityDecl(%s, %s, %s, %s)\n", @@ -817,6 +838,8 @@ xmlSAX2StartDocument(void *ctx) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlDocPtr doc; + if (ctx == NULL) return; + #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2StartDocument()\n"); @@ -876,6 +899,7 @@ xmlSAX2EndDocument(void *ctx) xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndDocument()\n"); #endif + if (ctx == NULL) return; #ifdef LIBXML_VALID_ENABLED if (ctxt->validate && ctxt->wellFormed && ctxt->myDoc && ctxt->myDoc->intSubset) @@ -890,7 +914,9 @@ xmlSAX2EndDocument(void *ctx) ctxt->myDoc->encoding = ctxt->encoding; ctxt->encoding = NULL; } - if ((ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && + if ((ctxt->inputTab != NULL) && + (ctxt->inputNr > 0) && (ctxt->inputTab[0] != NULL) && + (ctxt->inputTab[0]->encoding != NULL) && (ctxt->myDoc != NULL) && (ctxt->myDoc->encoding == NULL)) { ctxt->myDoc->encoding = xmlStrdup(ctxt->inputTab[0]->encoding); } @@ -1387,7 +1413,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret; - xmlNodePtr parent = ctxt->node; + xmlNodePtr parent; xmlNsPtr ns; xmlChar *name; xmlChar *prefix; @@ -1395,6 +1421,8 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) const xmlChar *value; int i; + if ((ctx == NULL) || (fullname == NULL) || (ctxt->myDoc == NULL)) return; + parent = ctxt->node; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2StartElement(%s)\n", fullname); @@ -1562,7 +1590,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) * If it's the Document root, finish the DTD validation and * check the document root element for validity */ - if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) { + if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { int chk; chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); @@ -1571,7 +1599,7 @@ xmlSAX2StartElement(void *ctx, const xmlChar *fullname, const xmlChar **atts) if (chk < 0) ctxt->wellFormed = 0; ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); - ctxt->vctxt.finishDtd = 1; + ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; } #endif /* LIBXML_VALID_ENABLED */ @@ -1592,8 +1620,10 @@ xmlSAX2EndElement(void *ctx, const xmlChar *name ATTRIBUTE_UNUSED) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserNodeInfo node_info; - xmlNodePtr cur = ctxt->node; + xmlNodePtr cur; + if (ctx == NULL) return; + cur = ctxt->node; #ifdef DEBUG_SAX if (name == NULL) xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2EndElement(NULL)\n"); @@ -1983,11 +2013,13 @@ xmlSAX2StartElementNs(void *ctx, { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret; - xmlNodePtr parent = ctxt->node; + xmlNodePtr parent; xmlNsPtr last = NULL, ns; const xmlChar *uri, *pref; int i, j; + if (ctx == NULL) return; + parent = ctxt->node; /* * First check on validity: */ @@ -2132,7 +2164,7 @@ xmlSAX2StartElementNs(void *ctx, * If it's the Document root, finish the DTD validation and * check the document root element for validity */ - if ((ctxt->validate) && (ctxt->vctxt.finishDtd == 0)) { + if ((ctxt->validate) && (ctxt->vctxt.finishDtd == XML_CTXT_FINISH_DTD_0)) { int chk; chk = xmlValidateDtdFinal(&ctxt->vctxt, ctxt->myDoc); @@ -2141,7 +2173,7 @@ xmlSAX2StartElementNs(void *ctx, if (chk < 0) ctxt->wellFormed = 0; ctxt->valid &= xmlValidateRoot(&ctxt->vctxt, ctxt->myDoc); - ctxt->vctxt.finishDtd = 1; + ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_1; } #endif /* LIBXML_VALID_ENABLED */ } @@ -2164,8 +2196,10 @@ xmlSAX2EndElementNs(void *ctx, { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlParserNodeInfo node_info; - xmlNodePtr cur = ctxt->node; + xmlNodePtr cur; + if (ctx == NULL) return; + cur = ctxt->node; /* Capture end position and add node */ if ((ctxt->record_info) && (cur != NULL)) { node_info.end_pos = ctxt->input->cur - ctxt->input->base; @@ -2200,6 +2234,7 @@ xmlSAX2Reference(void *ctx, const xmlChar *name) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Reference(%s)\n", name); @@ -2229,6 +2264,7 @@ xmlSAX2Characters(void *ctx, const xmlChar *ch, int len) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr lastChild; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Characters(%.30s, %d)\n", ch, len); @@ -2357,8 +2393,10 @@ xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret; - xmlNodePtr parent = ctxt->node; + xmlNodePtr parent; + if (ctx == NULL) return; + parent = ctxt->node; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2ProcessingInstruction(%s, %s)\n", target, data); @@ -2411,8 +2449,10 @@ xmlSAX2Comment(void *ctx, const xmlChar *value) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret; - xmlNodePtr parent = ctxt->node; + xmlNodePtr parent; + if (ctx == NULL) return; + parent = ctxt->node; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.xmlSAX2Comment(%s)\n", value); #endif @@ -2464,6 +2504,7 @@ xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlNodePtr ret, lastChild; + if (ctx == NULL) return; #ifdef DEBUG_SAX xmlGenericError(xmlGenericErrorContext, "SAX.pcdata(%.10s, %d)\n", value, len); @@ -2610,7 +2651,7 @@ xmlDefaultSAXHandlerInit(void) void xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr) { - if(hdlr->initialized != 0) + if ((hdlr == NULL) || (hdlr->initialized != 0)) return; hdlr->internalSubset = xmlSAX2InternalSubset; @@ -2668,7 +2709,7 @@ htmlDefaultSAXHandlerInit(void) void xmlSAX2InitDocbDefaultSAXHandler(xmlSAXHandler *hdlr) { - if(hdlr->initialized != 0) + if ((hdlr == NULL) || (hdlr->initialized != 0)) return; hdlr->internalSubset = xmlSAX2InternalSubset; @@ -878,9 +878,11 @@ xmlParseCatalogFile(const char *filename) { ctxt = xmlNewParserCtxt(); if (ctxt == NULL) { +#ifdef LIBXML_SAX1_ENABLED if (xmlDefaultSAXHandler.error != NULL) { xmlDefaultSAXHandler.error(NULL, "out of memory\n"); } +#endif return(NULL); } @@ -1262,25 +1264,27 @@ xmlParseXMLCatalogNode(xmlNodePtr cur, xmlCatalogPrefer prefer, BAD_CAST "nextCatalog", NULL, BAD_CAST "catalog", prefer, cgroup); } - if ((entry != NULL) && (parent != NULL)) { - entry->parent = parent; - if (parent->children == NULL) - parent->children = entry; - else { - xmlCatalogEntryPtr prev; + if (entry != NULL) { + if (parent != NULL) { + entry->parent = parent; + if (parent->children == NULL) + parent->children = entry; + else { + xmlCatalogEntryPtr prev; - prev = parent->children; - while (prev->next != NULL) - prev = prev->next; - prev->next = entry; + prev = parent->children; + while (prev->next != NULL) + prev = prev->next; + prev->next = entry; + } + } + if (entry->type == XML_CATA_GROUP) { + /* + * Recurse to propagate prefer to the subtree + * (xml:base handling is automated) + */ + xmlParseXMLCatalogNodeList(cur->children, prefer, parent, entry); } - } - if (entry->type == XML_CATA_GROUP) { - /* - * Recurse to propagate prefer to the subtree - * (xml:base handling is automated) - */ - xmlParseXMLCatalogNodeList(cur->children, prefer, parent, entry); } if (base != NULL) xmlFree(base); @@ -166,6 +166,8 @@ xmlCharInRange (unsigned int val, const xmlChRangeGroupPtr rptr) { int low, high, mid; xmlChSRangePtr sptr; xmlChLRangePtr lptr; + + if (rptr == NULL) return(0); if (val < 0x10000) { /* is val in 'short' or 'long' array? */ if (rptr->nbShortRange == 0) return 0; diff --git a/config.h.in b/config.h.in index 8a65287..590e0ce 100644 --- a/config.h.in +++ b/config.h.in @@ -25,6 +25,9 @@ /* Define to 1 if you have the <arpa/nameser.h> header file. */ #undef HAVE_ARPA_NAMESER_H +/* Whether struct sockaddr::__ss_family exists */ +#undef HAVE_BROKEN_SS_FAMILY + /* Define to 1 if you have the `class' function. */ #undef HAVE_CLASS @@ -279,5 +282,8 @@ /* Win32 Std C name mangling work-around */ #undef snprintf +/* ss_family is not defined here, use __ss_family instead */ +#undef ss_family + /* Win32 Std C name mangling work-around */ #undef vsnprintf @@ -1616,7 +1616,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=15 +LIBXML_MICRO_VERSION=16 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -25855,6 +25855,75 @@ cat >>confdefs.h <<\_ACEOF #define SUPPORT_IP6 _ACEOF + have_broken_ss_family=no + + echo "$as_me:$LINENO: checking broken struct sockaddr::ss_family" >&5 +echo $ECHO_N "checking broken struct sockaddr::ss_family... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <sys/socket.h> + #include <sys/types.h> +int +main () +{ + + struct sockaddr_storage ss ; + ss.__ss_family = 0 ; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + have_broken_ss_family=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +have_broken_ss_family=no + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: result: $have_broken_ss_family" >&5 +echo "${ECHO_T}$have_broken_ss_family" >&6 + if test x$have_broken_ss_family = xyes ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_BROKEN_SS_FAMILY +_ACEOF + + +cat >>confdefs.h <<\_ACEOF +#define ss_family __ss_family +_ACEOF + + fi have_getaddrinfo=no echo "$as_me:$LINENO: checking for getaddrinfo" >&5 @@ -26418,7 +26487,7 @@ else CFLAGS="${CFLAGS} -fexceptions" fi - CFLAGS="${CFLAGS} -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" + CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" case "${host}" in alpha*-*-linux* ) CFLAGS="${CFLAGS} -mieee" @@ -26600,7 +26669,9 @@ if [ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ] || \ with_docbook="yes" fi fi - CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" + if test "${CC}" = "gcc" ; then + CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" + fi STATIC_BINARIES="-static" else STATIC_BINARIES= diff --git a/configure.in b/configure.in index 64a6c0e..026e9b1 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_CANONICAL_HOST LIBXML_MAJOR_VERSION=2 LIBXML_MINOR_VERSION=6 -LIBXML_MICRO_VERSION=15 +LIBXML_MICRO_VERSION=16 LIBXML_MICRO_VERSION_SUFFIX= LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION @@ -243,6 +243,28 @@ if test $enable_ipv6 = yes; then if test $have_ipv6 = yes; then AC_DEFINE([SUPPORT_IP6], [], [Support for IPv6]) + have_broken_ss_family=no + + dnl ********************************************************************* + dnl on some platforms (like AIX 5L), the structure sockaddr doesn't have + dnl a ss_family member, but rather __ss_family. Let's detect that + dnl and define the HAVE_BROKEN_SS_FAMILY when we are on one of these platforms. + dnl ******************************************************************** + AC_MSG_CHECKING([broken struct sockaddr::ss_family]) + AC_TRY_COMPILE([ + #include <sys/socket.h> + #include <sys/types.h>], [ + struct sockaddr_storage ss ; + ss.__ss_family = 0 ; + ], + have_broken_ss_family=yes, + have_broken_ss_family=no + ) + AC_MSG_RESULT($have_broken_ss_family) + if test x$have_broken_ss_family = xyes ; then + AC_DEFINE(HAVE_BROKEN_SS_FAMILY, [], [Whether struct sockaddr::__ss_family exists]) + AC_DEFINE(ss_family, __ss_family, [ss_family is not defined here, use __ss_family instead]) + fi have_getaddrinfo=no AC_CHECK_FUNC(getaddrinfo, have_getaddrinfo=yes) @@ -309,7 +331,7 @@ else CFLAGS="${CFLAGS} -fexceptions" fi - CFLAGS="${CFLAGS} -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" + CFLAGS="${CFLAGS} -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls" case "${host}" in alpha*-*-linux* ) CFLAGS="${CFLAGS} -mieee" @@ -446,7 +468,9 @@ if [[ "${LOGNAME}" = "veillard" -a "`pwd`" = "/u/veillard/XML" ]] || \ with_docbook="yes" fi fi - CFLAGS="-g -O -pedantic -W -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" + if test "${CC}" = "gcc" ; then + CFLAGS="-g -O -pedantic -W -Wformat -Wunused -Wimplicit -Wreturn-type -Wswitch -Wcomment -Wtrigraphs -Wformat -Wchar-subscripts -Wuninitialized -Wparentheses -Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wredundant-decls -Wall" + fi STATIC_BINARIES="-static" dnl -Wcast-qual -ansi else @@ -1151,6 +1151,7 @@ xmlCtxtDumpDocHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) static void xmlCtxtDumpDocumentHead(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) { + if (doc == NULL) return; xmlCtxtDumpDocHead(ctxt, doc); if (!ctxt->check) { if (doc->name != NULL) { @@ -1258,6 +1259,7 @@ xmlCtxtDumpEntityCallback(xmlEntityPtr cur, xmlDebugCtxtPtr ctxt) static void xmlCtxtDumpEntities(xmlDebugCtxtPtr ctxt, xmlDocPtr doc) { + if (doc == NULL) return; xmlCtxtDumpDocHead(ctxt, doc); if ((doc->intSubset != NULL) && (doc->intSubset->entities != NULL)) { xmlEntitiesTablePtr table = (xmlEntitiesTablePtr) @@ -1354,6 +1356,7 @@ void xmlDebugDumpAttr(FILE *output, xmlAttrPtr attr, int depth) { xmlDebugCtxt ctxt; + if (output == NULL) return; xmlCtxtDumpInitCtxt(&ctxt); ctxt.output = output; ctxt.depth = depth; @@ -1374,6 +1377,7 @@ xmlDebugDumpEntities(FILE * output, xmlDocPtr doc) { xmlDebugCtxt ctxt; + if (output == NULL) return; xmlCtxtDumpInitCtxt(&ctxt); ctxt.output = output; xmlCtxtDumpEntities(&ctxt, doc); @@ -1393,6 +1397,7 @@ xmlDebugDumpAttrList(FILE * output, xmlAttrPtr attr, int depth) { xmlDebugCtxt ctxt; + if (output == NULL) return; xmlCtxtDumpInitCtxt(&ctxt); ctxt.output = output; ctxt.depth = depth; @@ -1413,6 +1418,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth) { xmlDebugCtxt ctxt; + if (output == NULL) return; xmlCtxtDumpInitCtxt(&ctxt); ctxt.output = output; ctxt.depth = depth; @@ -1628,6 +1634,7 @@ xmlLsCountNode(xmlNodePtr node) { */ void xmlLsOneNode(FILE *output, xmlNodePtr node) { + if (output == NULL) return; if (node == NULL) { fprintf(output, "NULL\n"); return; @@ -1765,6 +1772,7 @@ xmlBoolToText(int boolval) return("False"); } +#ifdef LIBXML_XPATH_ENABLED /**************************************************************** * * * The XML shell related functions * @@ -1834,9 +1842,11 @@ xmlShellPrintXPathError(int errorType, const char *arg) "%s is an XSLT value tree\n", arg); break; } +#if 0 xmlGenericError(xmlGenericErrorContext, "Try casting the result string function (xpath builtin)\n", arg); +#endif } @@ -2391,6 +2401,7 @@ xmlShellLoad(xmlShellCtxtPtr ctxt, char *filename, xmlDocPtr doc; int html = 0; + if ((ctxt == NULL) || (filename == NULL)) return(-1); if (ctxt->doc != NULL) html = (ctxt->doc->type == XML_HTML_DOCUMENT_NODE); @@ -2445,8 +2456,6 @@ xmlShellWrite(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node, if (node == NULL) return (-1); if ((filename == NULL) || (filename[0] == 0)) { - xmlGenericError(xmlGenericErrorContext, - "Write command requires a filename argument\n"); return (-1); } #ifdef W_OK @@ -2512,10 +2521,12 @@ xmlShellSave(xmlShellCtxtPtr ctxt, char *filename, xmlNodePtr node ATTRIBUTE_UNUSED, xmlNodePtr node2 ATTRIBUTE_UNUSED) { - if (ctxt->doc == NULL) + if ((ctxt == NULL) || (ctxt->doc == NULL)) return (-1); if ((filename == NULL) || (filename[0] == 0)) filename = ctxt->filename; + if (filename == NULL) + return (-1); #ifdef W_OK if (access((char *) filename, W_OK)) { xmlGenericError(xmlGenericErrorContext, @@ -2575,6 +2586,7 @@ xmlShellValidate(xmlShellCtxtPtr ctxt, char *dtd, xmlValidCtxt vctxt; int res = -1; + if ((ctxt == NULL) || (ctxt->doc == NULL)) return(-1); vctxt.userData = stderr; vctxt.error = (xmlValidityErrorFunc) fprintf; vctxt.warning = (xmlValidityWarningFunc) fprintf; @@ -2697,7 +2709,7 @@ xmlShellPwd(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, char *buffer, { xmlChar *path; - if (node == NULL) + if ((node == NULL) || (buffer == NULL)) return (-1); path = xmlGetNodePath(node); @@ -2873,7 +2885,11 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, } else if (!strcmp(command, "save")) { xmlShellSave(ctxt, arg, NULL, NULL); } else if (!strcmp(command, "write")) { - xmlShellWrite(ctxt, arg, NULL, NULL); + if ((arg == NULL) || (arg[0] == 0)) + xmlGenericError(xmlGenericErrorContext, + "Write command requires a filename argument\n"); + else + xmlShellWrite(ctxt, arg, NULL, NULL); #endif /* LIBXML_OUTPUT_ENABLED */ } else if (!strcmp(command, "grep")) { xmlShellGrep(ctxt, arg, ctxt->node, NULL); @@ -3183,4 +3199,5 @@ xmlShell(xmlDocPtr doc, char *filename, xmlShellReadlineFunc input, free(cmdline); /* not xmlFree here ! */ } +#endif /* LIBXML_XPATH_ENABLED */ #endif /* LIBXML_DEBUG_ENABLED */ diff --git a/doc/APIchunk10.html b/doc/APIchunk10.html index c5625ef..65f6f7b 100644 --- a/doc/APIchunk10.html +++ b/doc/APIchunk10.html @@ -45,9 +45,12 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-entities.html#xmlInitializePredefinedEntities">xmlInitializePredefinedEntities</a><br /> <a href="html/libxml-nanoftp.html#xmlNanoFTPRead">xmlNanoFTPRead</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPRead">xmlNanoHTTPRead</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriterPushParser">xmlNewTextWriterPushParser</a><br /> <a href="html/libxml-parserInternals.html#xmlParseReference">xmlParseReference</a><br /> <a href="html/libxml-parser.html#xmlSAXUserParseFile">xmlSAXUserParseFile</a><br /> <a href="html/libxml-parser.html#xmlSAXUserParseMemory">xmlSAXUserParseMemory</a><br /> +<a href="html/libxml-tree.html#xmlSaveFileTo">xmlSaveFileTo</a><br /> <a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> <a href="html/libxml-parserInternals.html#xmlSetEntityReferenceFunc">xmlSetEntityReferenceFunc</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a><br /> @@ -290,10 +293,10 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlsave.html#xmlSaveToIO">xmlSaveToIO</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderClose">xmlTextReaderClose</a><br /> </dd><dt>closed</dt><dd><a href="html/libxml-parser.html#xmlCtxtReadFd">xmlCtxtReadFd</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> <a href="html/libxml-parser.html#xmlReadFd">xmlReadFd</a><br /> <a href="html/libxml-xmlreader.html#xmlReaderForFd">xmlReaderForFd</a><br /> <a href="html/libxml-xmlreader.html#xmlReaderNewFd">xmlReaderNewFd</a><br /> -<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> <a href="html/libxml-xmlwriter.html#xmlTextWriterEndDocument">xmlTextWriterEndDocument</a><br /> </dd><dt>closes</dt><dd><a href="html/libxml-nanohttp.html#xmlNanoHTTPClose">xmlNanoHTTPClose</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPSave">xmlNanoHTTPSave</a><br /> @@ -795,6 +798,7 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>cur</dt><dd><a href="html/libxml-xpath.html#xmlXPathAxisFunc">xmlXPathAxisFunc</a><br /> </dd><dt>currently</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_INCLUDING_CONVERT_NS">XML_SCHEMAS_INCLUDING_CONVERT_NS</a><br /> <a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a><br /> <a href="html/libxml-xmlIO.html#xmlOutputBufferCreateFilename">xmlOutputBufferCreateFilename</a><br /> diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html index e24a542..ef399a3 100644 --- a/doc/APIchunk11.html +++ b/doc/APIchunk11.html @@ -54,6 +54,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-entities.html#xmlEncodeSpecialChars">xmlEncodeSpecialChars</a><br /> <a href="html/libxml-parser.html#xmlGetFeaturesList">xmlGetFeaturesList</a><br /> <a href="html/libxml-hash.html#xmlHashFree">xmlHashFree</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> <a href="html/libxml-uri.html#xmlSaveUri">xmlSaveUri</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderConstBaseUri">xmlTextReaderConstBaseUri</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderConstEncoding">xmlTextReaderConstEncoding</a><br /> diff --git a/doc/APIchunk12.html b/doc/APIchunk12.html index 030c8f7..2e5756f 100644 --- a/doc/APIchunk12.html +++ b/doc/APIchunk12.html @@ -100,6 +100,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-encoding.html#isolat1ToUTF8">isolat1ToUTF8</a><br /> <a href="html/libxml-encoding.html#xmlCharEncodingInputFunc">xmlCharEncodingInputFunc</a><br /> <a href="html/libxml-encoding.html#xmlCharEncodingOutputFunc">xmlCharEncodingOutputFunc</a><br /> +</dd><dt>embedded</dt><dd><a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> </dd><dt>emitted</dt><dd><a href="html/libxml-xmlerror.html#xmlSetGenericErrorFunc">xmlSetGenericErrorFunc</a><br /> </dd><dt>empty-element</dt><dd><a href="html/libxml-parserInternals.html#xmlParseStartTag">xmlParseStartTag</a><br /> </dd><dt>enable</dt><dd><a href="html/libxml-catalog.html#xmlCatalogSetDebug">xmlCatalogSetDebug</a><br /> diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html index 19d36a9..8b5c459 100644 --- a/doc/APIchunk13.html +++ b/doc/APIchunk13.html @@ -89,6 +89,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlDocDump">xmlDocDump</a><br /> <a href="html/libxml-tree.html#xmlDocFormatDump">xmlDocFormatDump</a><br /> <a href="html/libxml-xmlIO.html#xmlFileOpen">xmlFileOpen</a><br /> +<a href="html/libxml-xmlIO.html#xmlFileRead">xmlFileRead</a><br /> <a href="html/libxml-list.html#xmlListAppend">xmlListAppend</a><br /> <a href="html/libxml-list.html#xmlListInsert">xmlListInsert</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPFetch">xmlNanoHTTPFetch</a><br /> @@ -141,6 +142,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-parser.html#xmlCreatePushParserCtxt">xmlCreatePushParserCtxt</a><br /> <a href="html/libxml-xmlstring.html#xmlUTF8Strpos">xmlUTF8Strpos</a><br /> </dd><dt>field</dt><dd><a href="html/libxml-parser.html#XML_COMPLETE_ATTRS">XML_COMPLETE_ATTRS</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> <a href="html/libxml-parser.html#XML_DETECT_IDS">XML_DETECT_IDS</a><br /> <a href="html/libxml-parser.html#XML_SKIP_IDS">XML_SKIP_IDS</a><br /> <a href="html/libxml-parserInternals.html#xmlParseMisc">xmlParseMisc</a><br /> @@ -182,6 +185,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-nanohttp.html#xmlNanoHTTPScanProxy">xmlNanoHTTPScanProxy</a><br /> </dd><dt>finds</dt><dd><a href="html/libxml-tree.html#xmlSearchNs">xmlSearchNs</a><br /> <a href="html/libxml-tree.html#xmlSearchNsByHref">xmlSearchNsByHref</a><br /> +</dd><dt>finishDtd</dt><dd><a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> </dd><dt>finished</dt><dd><a href="html/libxml-valid.html#_xmlValidCtxt">_xmlValidCtxt</a><br /> <a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br /> <a href="html/libxml-parserInternals.html#xmlSkipBlankChars">xmlSkipBlankChars</a><br /> diff --git a/doc/APIchunk14.html b/doc/APIchunk14.html index 11e6f70..c31732d 100644 --- a/doc/APIchunk14.html +++ b/doc/APIchunk14.html @@ -35,7 +35,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="APIchunk25.html">w-w</a> <a href="APIchunk26.html">x-x</a> <a href="APIchunk27.html">y-z</a> -</h2><h2>Letter g:</h2><dl><dt>garbage</dt><dd><a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br /> +</h2><h2>Letter g:</h2><dl><dt>garanteed</dt><dd><a href="html/libxml-xmlstring.html#xmlUTF8Strsize">xmlUTF8Strsize</a><br /> +</dd><dt>garbage</dt><dd><a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br /> <a href="html/libxml-xmlmemory.html#xmlGcMemSetup">xmlGcMemSetup</a><br /> </dd><dt>genChRanges</dt><dd><a href="html/libxml-chvalid.html#xmlIsBaseCharQ">xmlIsBaseCharQ</a><br /> <a href="html/libxml-chvalid.html#xmlIsBaseChar_ch">xmlIsBaseChar_ch</a><br /> diff --git a/doc/APIchunk15.html b/doc/APIchunk15.html index 31bb8f1..41093c0 100644 --- a/doc/APIchunk15.html +++ b/doc/APIchunk15.html @@ -395,27 +395,6 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlNewPI">xmlNewPI</a><br /> <a href="html/libxml-SAX2.html#xmlSAX2ProcessingInstruction">xmlSAX2ProcessingInstruction</a><br /> </dd><dt>insufficient</dt><dd><a href="html/libxml-uri.html#xmlCanonicPath">xmlCanonicPath</a><br /> -</dd><dt>int</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br /> -<a href="">c</a><br /> -<a href="html/libxml-SAX.html#getColumnNumber">getColumnNumber</a><br /> -<a href="html/libxml-SAX.html#getLineNumber">getLineNumber</a><br /> -<a href="html/libxml-HTMLparser.html#htmlHandleOmittedElem">htmlHandleOmittedElem</a><br /> -<a href="html/libxml-HTMLparser.html#htmlParseCharRef">htmlParseCharRef</a><br /> -<a href="html/libxml-parserInternals.html#xmlIsLetter">xmlIsLetter</a><br /> -<a href="html/libxml-parser.html#xmlKeepBlanksDefault">xmlKeepBlanksDefault</a><br /> -<a href="html/libxml-parser.html#xmlLineNumbersDefault">xmlLineNumbersDefault</a><br /> -<a href="html/libxml-xmlmemory.html#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a><br /> -<a href="html/libxml-xmlmemory.html#xmlMallocLoc">xmlMallocLoc</a><br /> -<a href="html/libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a><br /> -<a href="html/libxml-parserInternals.html#xmlParseCharData">xmlParseCharData</a><br /> -<a href="html/libxml-parserInternals.html#xmlParseCharRef">xmlParseCharRef</a><br /> -<a href="html/libxml-parser.html#xmlPedanticParserDefault">xmlPedanticParserDefault</a><br /> -<a href="html/libxml-xmlmemory.html#xmlReallocLoc">xmlReallocLoc</a><br /> -<a href="html/libxml-SAX2.html#xmlSAX2GetColumnNumber">xmlSAX2GetColumnNumber</a><br /> -<a href="html/libxml-SAX2.html#xmlSAX2GetLineNumber">xmlSAX2GetLineNumber</a><br /> -<a href="html/libxml-debugXML.html#xmlShellCmd">xmlShellCmd</a><br /> -<a href="html/libxml-tree.html#xmlSplitQName3">xmlSplitQName3</a><br /> -<a href="html/libxml-parser.html#xmlSubstituteEntitiesDefault">xmlSubstituteEntitiesDefault</a><br /> </dd><dt>integer</dt><dd><a href="html/libxml-xmlstring.html#xmlStrcasecmp">xmlStrcasecmp</a><br /> <a href="html/libxml-xmlstring.html#xmlStrcmp">xmlStrcmp</a><br /> <a href="html/libxml-xmlstring.html#xmlStrncasecmp">xmlStrncasecmp</a><br /> diff --git a/doc/APIchunk16.html b/doc/APIchunk16.html index 214b8e1..bfea7cf 100644 --- a/doc/APIchunk16.html +++ b/doc/APIchunk16.html @@ -188,6 +188,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlValidateQName">xmlValidateQName</a><br /> </dd><dt>lib</dt><dd><a href="html/libxml-xmlversion.html#xmlCheckVersion">xmlCheckVersion</a><br /> </dd><dt>libc</dt><dd><a href="html/libxml-xmlmemory.html#DEBUG_MEMORY">DEBUG_MEMORY</a><br /> +</dd><dt>libraries</dt><dd><a href="html/libxml-relaxng.html#xmlRelaxNGInitTypes">xmlRelaxNGInitTypes</a><br /> </dd><dt>library</dt><dd><a href="html/libxml-xmlerror.html#_xmlError">_xmlError</a><br /> <a href="html/libxml-schemasInternals.html#_xmlSchema">_xmlSchema</a><br /> <a href="html/libxml-parser.html#xmlCleanupParser">xmlCleanupParser</a><br /> diff --git a/doc/APIchunk21.html b/doc/APIchunk21.html index 13d61f5..e36896a 100644 --- a/doc/APIchunk21.html +++ b/doc/APIchunk21.html @@ -399,7 +399,8 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>represented</dt><dd><a href="html/libxml-parserInternals.html#xmlParseCharData">xmlParseCharData</a><br /> <a href="html/libxml-xpathInternals.html#xmlXPathStringFunction">xmlXPathStringFunction</a><br /> </dd><dt>represented:</dt><dd><a href="html/libxml-HTMLparser.html#_htmlElemDesc">_htmlElemDesc</a><br /> -</dd><dt>representing</dt><dd><a href="html/libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a><br /> +</dd><dt>representing</dt><dd><a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a><br /> </dd><dt>request</dt><dd><a href="html/libxml-xmlIO.html#xmlIOHTTPOpenW">xmlIOHTTPOpenW</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPMethod">xmlNanoHTTPMethod</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPMethodRedir">xmlNanoHTTPMethodRedir</a><br /> diff --git a/doc/APIchunk22.html b/doc/APIchunk22.html index 175b72e..0765be4 100644 --- a/doc/APIchunk22.html +++ b/doc/APIchunk22.html @@ -723,6 +723,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xinclude.html#xmlXIncludeProcessNode">xmlXIncludeProcessNode</a><br /> <a href="html/libxml-xinclude.html#xmlXIncludeProcessTree">xmlXIncludeProcessTree</a><br /> <a href="html/libxml-xinclude.html#xmlXIncludeProcessTreeFlags">xmlXIncludeProcessTreeFlags</a><br /> +</dd><dt>succeed</dt><dd><a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> </dd><dt>succeeded</dt><dd><a href="html/libxml-hash.html#xmlHashAddEntry">xmlHashAddEntry</a><br /> <a href="html/libxml-hash.html#xmlHashAddEntry2">xmlHashAddEntry2</a><br /> <a href="html/libxml-hash.html#xmlHashAddEntry3">xmlHashAddEntry3</a><br /> @@ -734,6 +735,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-hash.html#xmlHashUpdateEntry3">xmlHashUpdateEntry3</a><br /> <a href="html/libxml-xpathInternals.html#xmlXPathCompareValues">xmlXPathCompareValues</a><br /> </dd><dt>succeeds</dt><dd><a href="html/libxml-xmlIO.html#xmlCheckFilename">xmlCheckFilename</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriterPushParser">xmlNewTextWriterPushParser</a><br /> </dd><dt>successful</dt><dd><a href="html/libxml-catalog.html#xmlACatalogAdd">xmlACatalogAdd</a><br /> <a href="html/libxml-catalog.html#xmlACatalogRemove">xmlACatalogRemove</a><br /> <a href="html/libxml-tree.html#xmlBufferAdd">xmlBufferAdd</a><br /> diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html index 4aa21d1..ac3ff8b 100644 --- a/doc/APIchunk25.html +++ b/doc/APIchunk25.html @@ -243,6 +243,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlsave.html#xmlSaveToIO">xmlSaveToIO</a><br /> <a href="html/libxml-debugXML.html#xmlShellWrite">xmlShellWrite</a><br /> </dd><dt>writer</dt><dd><a href="html/libxml-xmlwriter.html#xmlFreeTextWriter">xmlFreeTextWriter</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriterPushParser">xmlNewTextWriterPushParser</a><br /> </dd><dt>writes</dt><dd><a href="html/libxml-tree.html#xmlBufferWriteQuotedString">xmlBufferWriteQuotedString</a><br /> <a href="html/libxml-xmlIO.html#xmlOutputBufferWrite">xmlOutputBufferWrite</a><br /> <a href="html/libxml-xmlIO.html#xmlOutputBufferWriteEscape">xmlOutputBufferWriteEscape</a><br /> diff --git a/doc/APIchunk26.html b/doc/APIchunk26.html index bfde6d1..7f88fd3 100644 --- a/doc/APIchunk26.html +++ b/doc/APIchunk26.html @@ -278,6 +278,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlCopyNamespace">xmlCopyNamespace</a><br /> <a href="html/libxml-tree.html#xmlCopyNamespaceList">xmlCopyNamespaceList</a><br /> <a href="html/libxml-tree.html#xmlGetNsList">xmlGetNsList</a><br /> +</dd><dt>xmlOutputBufferClose</dt><dd><a href="html/libxml-tree.html#xmlSaveFileTo">xmlSaveFileTo</a><br /> +<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> </dd><dt>xmlOutputBufferPtr</dt><dd><a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> </dd><dt>xmlOutputCloseCallback</dt><dd><a href="html/libxml-xmlIO.html#xmlRegisterOutputCallbacks">xmlRegisterOutputCallbacks</a><br /> </dd><dt>xmlOutputMatchCallback</dt><dd><a href="html/libxml-xmlIO.html#xmlRegisterOutputCallbacks">xmlRegisterOutputCallbacks</a><br /> @@ -292,6 +294,8 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>xmlParseFile</dt><dd><a href="html/libxml-catalog.html#xmlParseCatalogFile">xmlParseCatalogFile</a><br /> </dd><dt>xmlParseNamespace:</dt><dd><a href="html/libxml-parserInternals.html#xmlParseNamespace">xmlParseNamespace</a><br /> </dd><dt>xmlParseURI</dt><dd><a href="html/libxml-uri.html#xmlURIEscape">xmlURIEscape</a><br /> +</dd><dt>xmlParserCtxt</dt><dd><a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> </dd><dt>xmlParserCtxtPtr</dt><dd><a href="html/libxml-parser.html#xmlNewParserCtxt">xmlNewParserCtxt</a><br /> <a href="html/libxml-xmlwriter.html#xmlNewTextWriterPushParser">xmlNewTextWriterPushParser</a><br /> </dd><dt>xmlParserError</dt><dd><a href="html/libxml-xmlerror.html#_xmlError">_xmlError</a><br /> diff --git a/doc/APIchunk3.html b/doc/APIchunk3.html index 5849049..0ac8f21 100644 --- a/doc/APIchunk3.html +++ b/doc/APIchunk3.html @@ -308,6 +308,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xpathInternals.html#xmlXPathRoot">xmlXPathRoot</a><br /> </dd><dt>Initially</dt><dd><a href="html/libxml-parser.html#xmlSubstituteEntitiesDefault">xmlSubstituteEntitiesDefault</a><br /> </dd><dt>Initiate</dt><dd><a href="html/libxml-nanoftp.html#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a><br /> +</dd><dt>Initilize</dt><dd><a href="html/libxml-relaxng.html#xmlRelaxNGInitTypes">xmlRelaxNGInitTypes</a><br /> </dd><dt>Input</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br /> <a href="html/libxml-parser.html#xmlIOParseDTD">xmlIOParseDTD</a><br /> <a href="html/libxml-xmlIO.html#xmlInputCloseCallback">xmlInputCloseCallback</a><br /> diff --git a/doc/APIchunk4.html b/doc/APIchunk4.html index 6558fd0..f830b7b 100644 --- a/doc/APIchunk4.html +++ b/doc/APIchunk4.html @@ -197,10 +197,11 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlNewDocNode">xmlNewDocNode</a><br /> <a href="html/libxml-tree.html#xmlNewDocNodeEatName">xmlNewDocNodeEatName</a><br /> <a href="html/libxml-tree.html#xmlNewTextChild">xmlNewTextChild</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a><br /> +<a href="html/libxml-xmlwriter.html#xmlNewTextWriterPushParser">xmlNewTextWriterPushParser</a><br /> <a href="html/libxml-parserInternals.html#xmlParseExternalID">xmlParseExternalID</a><br /> <a href="html/libxml-parserInternals.html#xmlParsePEReference">xmlParsePEReference</a><br /> <a href="html/libxml-parserInternals.html#xmlParserHandlePEReference">xmlParserHandlePEReference</a><br /> -<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderCurrentDoc">xmlTextReaderCurrentDoc</a><br /> </dd><dt>NRK</dt><dd><a href="html/libxml-HTMLparser.html#_htmlElemDesc">_htmlElemDesc</a><br /> </dd><dt>NSDef</dt><dd><a href="html/libxml-parserInternals.html#xmlNamespaceParseNSDef">xmlNamespaceParseNSDef</a><br /> diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html index dbed0af..d3cc136 100644 --- a/doc/APIchunk5.html +++ b/doc/APIchunk5.html @@ -190,6 +190,7 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>Provides</dt><dd><a href="html/libxml-SAX.html#getPublicId">getPublicId</a><br /> <a href="html/libxml-SAX.html#getSystemId">getSystemId</a><br /> <a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemUsed">xmlMemUsed</a><br /> <a href="html/libxml-nanohttp.html#xmlNanoHTTPContentLength">xmlNanoHTTPContentLength</a><br /> diff --git a/doc/APIchunk6.html b/doc/APIchunk6.html index a760e36..668cd2d 100644 --- a/doc/APIchunk6.html +++ b/doc/APIchunk6.html @@ -440,7 +440,9 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xpathInternals.html#xmlXPathNodeSetSort">xmlXPathNodeSetSort</a><br /> </dd><dt>SpacingModifierLetters</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsSpacingModifierLetters">xmlUCSIsSpacingModifierLetters</a><br /> </dd><dt>Spec</dt><dd><a href="html/libxml-parserInternals.html#xmlParseStartTag">xmlParseStartTag</a><br /> -</dd><dt>Special</dt><dd><a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br /> +</dd><dt>Special</dt><dd><a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> +<a href="html/libxml-parser.html#XML_SAX2_MAGIC">XML_SAX2_MAGIC</a><br /> </dd><dt>Specials</dt><dd><a href="html/libxml-xmlunicode.html#xmlUCSIsSpecials">xmlUCSIsSpecials</a><br /> </dd><dt>Speed</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br /> </dd><dt>Standalone</dt><dd><a href="html/libxml-parserInternals.html#xmlParseSDDecl">xmlParseSDDecl</a><br /> diff --git a/doc/APIchunk8.html b/doc/APIchunk8.html index 443d438..4287db3 100644 --- a/doc/APIchunk8.html +++ b/doc/APIchunk8.html @@ -85,6 +85,8 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>WWW-Authenticate</dt><dd><a href="html/libxml-nanohttp.html#xmlNanoHTTPAuthHeader">xmlNanoHTTPAuthHeader</a><br /> </dd><dt>Walk</dt><dd><a href="html/libxml-list.html#xmlListReverseWalk">xmlListReverseWalk</a><br /> <a href="html/libxml-list.html#xmlListWalk">xmlListWalk</a><br /> +</dd><dt>Warning</dt><dd><a href="html/libxml-tree.html#xmlSaveFileTo">xmlSaveFileTo</a><br /> +<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> </dd><dt>Was</dt><dd><a href="html/libxml-parser.html#_xmlParserInput">_xmlParserInput</a><br /> </dd><dt>Well</dt><dd><a href="html/libxml-parser.html#xmlParseBalancedChunkMemory">xmlParseBalancedChunkMemory</a><br /> <a href="html/libxml-parser.html#xmlParseBalancedChunkMemoryRecover">xmlParseBalancedChunkMemoryRecover</a><br /> @@ -397,6 +399,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-nanoftp.html#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a><br /> <a href="html/libxml-nanoftp.html#xmlNanoFTPGetResponse">xmlNanoFTPGetResponse</a><br /> <a href="html/libxml-tree.html#xmlReconciliateNs">xmlReconciliateNs</a><br /> +<a href="html/libxml-tree.html#xmlSaveFileTo">xmlSaveFileTo</a><br /> +<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> <a href="html/libxml-valid.html#xmlValidGetValidElements">xmlValidGetValidElements</a><br /> <a href="html/libxml-xpathInternals.html#xmlXPathNextFollowing">xmlXPathNextFollowing</a><br /> <a href="html/libxml-xpathInternals.html#xmlXPathStringFunction">xmlXPathStringFunction</a><br /> @@ -637,6 +641,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlmemory.html#xmlReallocLoc">xmlReallocLoc</a><br /> </dd><dt>areas</dt><dd><a href="html/libxml-xmlmemory.html#xmlGcMemGet">xmlGcMemGet</a><br /> <a href="html/libxml-xmlmemory.html#xmlGcMemSetup">xmlGcMemSetup</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemShow">xmlMemShow</a><br /> </dd><dt>args</dt><dd><a href="html/libxml-xpathInternals.html#CHECK_ARITY">CHECK_ARITY</a><br /> <a href="">x</a><br /> diff --git a/doc/APIchunk9.html b/doc/APIchunk9.html index 7a05689..29a0da4 100644 --- a/doc/APIchunk9.html +++ b/doc/APIchunk9.html @@ -121,6 +121,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-tree.html#xmlNodeSetSpacePreserve">xmlNodeSetSpacePreserve</a><br /> <a href="html/libxml-SAX2.html#xmlSAX2ResolveEntity">xmlSAX2ResolveEntity</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderSetParserProp">xmlTextReaderSetParserProp</a><br /> +<a href="html/libxml-xmlstring.html#xmlUTF8Strsize">xmlUTF8Strsize</a><br /> </dd><dt>below</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br /> <a href="html/libxml-parserInternals.html#xmlParseExternalID">xmlParseExternalID</a><br /> </dd><dt>better</dt><dd><a href="html/libxml-SAX.html#resolveEntity">resolveEntity</a><br /> @@ -162,6 +163,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-SAX.html#initdocbDefaultSAXHandler">initdocbDefaultSAXHandler</a><br /> <a href="html/libxml-SAX.html#inithtmlDefaultSAXHandler">inithtmlDefaultSAXHandler</a><br /> <a href="html/libxml-SAX.html#initxmlDefaultSAXHandler">initxmlDefaultSAXHandler</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemDisplay">xmlMemDisplay</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemoryDump">xmlMemoryDump</a><br /> </dd><dt>book1</dt><dd><a href="html/libxml-uri.html#xmlBuildRelativeURI">xmlBuildRelativeURI</a><br /> @@ -186,6 +188,8 @@ A:link, A:visited, A:active { text-decoration: underline } </dd><dt>breaks</dt><dd><a href="html/libxml-parserInternals.html#xmlCurrentChar">xmlCurrentChar</a><br /> </dd><dt>broken</dt><dd><a href="html/libxml-parser.html#xmlParseBalancedChunkMemoryRecover">xmlParseBalancedChunkMemoryRecover</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderNormalization">xmlTextReaderNormalization</a><br /> +</dd><dt>buf</dt><dd><a href="html/libxml-tree.html#xmlSaveFileTo">xmlSaveFileTo</a><br /> +<a href="html/libxml-tree.html#xmlSaveFormatFileTo">xmlSaveFormatFileTo</a><br /> </dd><dt>buffered</dt><dd><a href="html/libxml-xmlIO.html#xmlAllocOutputBuffer">xmlAllocOutputBuffer</a><br /> <a href="html/libxml-xmlIO.html#xmlAllocParserInputBuffer">xmlAllocParserInputBuffer</a><br /> <a href="html/libxml-xmlIO.html#xmlFreeParserInputBuffer">xmlFreeParserInputBuffer</a><br /> diff --git a/doc/APIconstructors.html b/doc/APIconstructors.html index e00c5c4..fbe9e0c 100644 --- a/doc/APIconstructors.html +++ b/doc/APIconstructors.html @@ -42,6 +42,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlreader.html#xmlTextReaderConstValue">xmlTextReaderConstValue</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderConstXmlLang">xmlTextReaderConstXmlLang</a><br /> <a href="html/libxml-xmlreader.html#xmlTextReaderConstXmlVersion">xmlTextReaderConstXmlVersion</a><br /> +<a href="html/libxml-xmlstring.html#xmlUTF8Strpos">xmlUTF8Strpos</a><br /> <a href="html/libxml-xpathInternals.html#xmlXPathNsLookup">xmlXPathNsLookup</a><br /> </p><h2>Type const xmlParserNodeInfo *:</h2><p><a href="html/libxml-parser.html#xmlParserFindNodeInfo">xmlParserFindNodeInfo</a><br /> </p><h2>Type docbDocPtr:</h2><p><a href="html/libxml-DOCBparser.html#docbParseDoc">docbParseDoc</a><br /> @@ -233,7 +234,6 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-uri.html#xmlURIEscape">xmlURIEscape</a><br /> <a href="html/libxml-uri.html#xmlURIEscapeStr">xmlURIEscapeStr</a><br /> <a href="html/libxml-xmlstring.html#xmlUTF8Strndup">xmlUTF8Strndup</a><br /> -<a href="html/libxml-xmlstring.html#xmlUTF8Strpos">xmlUTF8Strpos</a><br /> <a href="html/libxml-xmlstring.html#xmlUTF8Strsub">xmlUTF8Strsub</a><br /> <a href="html/libxml-valid.html#xmlValidCtxtNormalizeAttributeValue">xmlValidCtxtNormalizeAttributeValue</a><br /> <a href="html/libxml-valid.html#xmlValidNormalizeAttributeValue">xmlValidNormalizeAttributeValue</a><br /> diff --git a/doc/APIfiles.html b/doc/APIfiles.html index 3dc6559..cc09f7d 100644 --- a/doc/APIfiles.html +++ b/doc/APIfiles.html @@ -910,6 +910,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-relaxng.html#xmlRelaxNGFreeValidCtxt">xmlRelaxNGFreeValidCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGGetParserErrors">xmlRelaxNGGetParserErrors</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGGetValidErrors">xmlRelaxNGGetValidErrors</a><br /> +<a href="html/libxml-relaxng.html#xmlRelaxNGInitTypes">xmlRelaxNGInitTypes</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewDocParserCtxt">xmlRelaxNGNewDocParserCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewMemParserCtxt">xmlRelaxNGNewMemParserCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewParserCtxt">xmlRelaxNGNewParserCtxt</a><br /> @@ -1433,7 +1434,9 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-uri.html#xmlURIEscapeStr">xmlURIEscapeStr</a><br /> <a href="html/libxml-uri.html#xmlURIPtr">xmlURIPtr</a><br /> <a href="html/libxml-uri.html#xmlURIUnescapeString">xmlURIUnescapeString</a><br /> -</p><h2><a name="valid" id="valid">Module valid</a>:</h2><p><a href="html/libxml-valid.html#_xmlValidCtxt">_xmlValidCtxt</a><br /> +</p><h2><a name="valid" id="valid">Module valid</a>:</h2><p><a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> +<a href="html/libxml-valid.html#_xmlValidCtxt">_xmlValidCtxt</a><br /> <a href="html/libxml-valid.html#xmlAddAttributeDecl">xmlAddAttributeDecl</a><br /> <a href="html/libxml-valid.html#xmlAddElementDecl">xmlAddElementDecl</a><br /> <a href="html/libxml-valid.html#xmlAddID">xmlAddID</a><br /> @@ -1856,6 +1859,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASV">XML_FROM_SCHEMASV</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_TREE">XML_FROM_TREE</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_VALID">XML_FROM_VALID</a><br /> +<a href="html/libxml-xmlerror.html#XML_FROM_WRITER">XML_FROM_WRITER</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XINCLUDE">XML_FROM_XINCLUDE</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XPATH">XML_FROM_XPATH</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XPOINTER">XML_FROM_XPOINTER</a><br /> @@ -2407,6 +2411,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlmemory.html#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a><br /> <a href="html/libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a><br /> <a href="html/libxml-xmlmemory.html#xmlMallocLoc">xmlMallocLoc</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemDisplay">xmlMemDisplay</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemFree">xmlMemFree</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a><br /> @@ -2964,6 +2969,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xpath.html#XPATH_EXPR_ERROR">XPATH_EXPR_ERROR</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_ARITY">XPATH_INVALID_ARITY</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CHAR_ERROR">XPATH_INVALID_CHAR_ERROR</a><br /> +<a href="html/libxml-xpath.html#XPATH_INVALID_CTXT">XPATH_INVALID_CTXT</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CTXT_POSITION">XPATH_INVALID_CTXT_POSITION</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CTXT_SIZE">XPATH_INVALID_CTXT_SIZE</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_OPERAND">XPATH_INVALID_OPERAND</a><br /> diff --git a/doc/APIsymbols.html b/doc/APIsymbols.html index 19a0caa..b1fd6a6 100644 --- a/doc/APIsymbols.html +++ b/doc/APIsymbols.html @@ -223,6 +223,8 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlerror.html#XML_CHECK_X">XML_CHECK_X</a><br /> <a href="html/libxml-tree.html#XML_COMMENT_NODE">XML_COMMENT_NODE</a><br /> <a href="html/libxml-parser.html#XML_COMPLETE_ATTRS">XML_COMPLETE_ATTRS</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a><br /> +<a href="html/libxml-valid.html#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a><br /> <a href="html/libxml-parser.html#XML_DEFAULT_VERSION">XML_DEFAULT_VERSION</a><br /> <a href="html/libxml-parser.html#XML_DETECT_IDS">XML_DETECT_IDS</a><br /> <a href="html/libxml-tree.html#XML_DOCB_DOCUMENT_NODE">XML_DOCB_DOCUMENT_NODE</a><br /> @@ -413,6 +415,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlerror.html#XML_FROM_SCHEMASV">XML_FROM_SCHEMASV</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_TREE">XML_FROM_TREE</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_VALID">XML_FROM_VALID</a><br /> +<a href="html/libxml-xmlerror.html#XML_FROM_WRITER">XML_FROM_WRITER</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XINCLUDE">XML_FROM_XINCLUDE</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XPATH">XML_FROM_XPATH</a><br /> <a href="html/libxml-xmlerror.html#XML_FROM_XPOINTER">XML_FROM_XPOINTER</a><br /> @@ -1251,6 +1254,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xpath.html#XPATH_EXPR_ERROR">XPATH_EXPR_ERROR</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_ARITY">XPATH_INVALID_ARITY</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CHAR_ERROR">XPATH_INVALID_CHAR_ERROR</a><br /> +<a href="html/libxml-xpath.html#XPATH_INVALID_CTXT">XPATH_INVALID_CTXT</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CTXT_POSITION">XPATH_INVALID_CTXT_POSITION</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_CTXT_SIZE">XPATH_INVALID_CTXT_SIZE</a><br /> <a href="html/libxml-xpath.html#XPATH_INVALID_OPERAND">XPATH_INVALID_OPERAND</a><br /> @@ -2022,6 +2026,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-xmlmemory.html#xmlMallocAtomicLoc">xmlMallocAtomicLoc</a><br /> <a href="html/libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a><br /> <a href="html/libxml-xmlmemory.html#xmlMallocLoc">xmlMallocLoc</a><br /> +<a href="html/libxml-xmlmemory.html#xmlMemBlocks">xmlMemBlocks</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemDisplay">xmlMemDisplay</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemFree">xmlMemFree</a><br /> <a href="html/libxml-xmlmemory.html#xmlMemGet">xmlMemGet</a><br /> @@ -2364,6 +2369,7 @@ A:link, A:visited, A:active { text-decoration: underline } <a href="html/libxml-relaxng.html#xmlRelaxNGFreeValidCtxt">xmlRelaxNGFreeValidCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGGetParserErrors">xmlRelaxNGGetParserErrors</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGGetValidErrors">xmlRelaxNGGetValidErrors</a><br /> +<a href="html/libxml-relaxng.html#xmlRelaxNGInitTypes">xmlRelaxNGInitTypes</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewDocParserCtxt">xmlRelaxNGNewDocParserCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewMemParserCtxt">xmlRelaxNGNewMemParserCtxt</a><br /> <a href="html/libxml-relaxng.html#xmlRelaxNGNewParserCtxt">xmlRelaxNGNewParserCtxt</a><br /> diff --git a/doc/apibuild.py b/doc/apibuild.py index 059d0bb..2cbf32f 100755 --- a/doc/apibuild.py +++ b/doc/apibuild.py @@ -32,6 +32,7 @@ ignored_files = { "rngparser.c": "not yet integrated", "rngparser.h": "not yet integrated", "elfgcchack.h": "not a normal header", + "testapi.c": "generated regression tests", } ignored_words = { diff --git a/doc/examples/examples.xml b/doc/examples/examples.xml index 96534fc..bded118 100644 --- a/doc/examples/examples.xml +++ b/doc/examples/examples.xml @@ -100,7 +100,7 @@ <macro line='67' file='xmlversion' name='LIBXML_TEST_VERSION'/> <enum line='36' file='tree' name='XML_ELEMENT_NODE'/> <function line='79' file='tree' name='xmlFreeDoc'/> - <function line='67' file='parser' name='xmlParseFile'/> + <function line='67' file='parser' name='xmlReadFile'/> <function line='74' file='tree' name='xmlDocGetRootElement'/> </uses> </example> @@ -567,7 +567,6 @@ </symbol> <symbol name='xmlParseFile'> <ref filename='xpath1.c'/> - <ref filename='tree1.c'/> <ref filename='xpath2.c'/> </symbol> <symbol name='xmlParserCtxtPtr'> @@ -576,6 +575,7 @@ </symbol> <symbol name='xmlReadFile'> <ref filename='parse1.c'/> + <ref filename='tree1.c'/> </symbol> <symbol name='xmlReadMemory'> <ref filename='io1.c'/> diff --git a/doc/examples/reader3.c b/doc/examples/reader3.c index 2da7532..acbff4f 100644 --- a/doc/examples/reader3.c +++ b/doc/examples/reader3.c @@ -15,7 +15,7 @@ #include <stdio.h> #include <libxml/xmlreader.h> -#ifdef LIBXML_READER_ENABLED +#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED) /** * streamFile: @@ -113,7 +113,7 @@ int main(int argc, char **argv) { #else int main(void) { - fprintf(stderr, "XInclude support not compiled in\n"); + fprintf(stderr, "Reader or Pattern support not compiled in\n"); exit(1); } #endif diff --git a/doc/examples/testWriter.c b/doc/examples/testWriter.c index c5e9c39..e158f97 100644 --- a/doc/examples/testWriter.c +++ b/doc/examples/testWriter.c @@ -1168,8 +1168,8 @@ ConvertInput(const char *in, const char *encoding) if (out != 0) { temp = size - 1; ret = handler->input(out, &out_size, (const xmlChar *) in, &temp); - if (ret || temp - size + 1) { - if (ret) { + if ((ret < 0) || (temp - size + 1)) { + if (ret < 0) { printf("ConvertInput: conversion wasn't successful.\n"); } else { printf diff --git a/doc/examples/tree1.c b/doc/examples/tree1.c index 8a303e2..8644cf1 100644 --- a/doc/examples/tree1.c +++ b/doc/examples/tree1.c @@ -64,10 +64,10 @@ main(int argc, char **argv) LIBXML_TEST_VERSION /*parse the file and get the DOM */ - doc = xmlParseFile(argv[1]); + doc = xmlReadFile(argv[1], NULL, 0); if (doc == NULL) { - printf("error: could not parse file file.xml\n"); + printf("error: could not parse file %s\n", argv[1]); } /*Get the root element node */ diff --git a/doc/html/libxml-list.html b/doc/html/libxml-list.html index 627047d..004a7a7 100644 --- a/doc/html/libxml-list.html +++ b/doc/html/libxml-list.html @@ -78,7 +78,7 @@ void xmlListDeallocator (<a href="libxml-list.html#xmlLinkPtr">xmlLinkPtr</a> l </pre><p>Duplicate the list</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>old</tt></i>:</span></td><td>the list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new copy of the list or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlListEmpty" id="xmlListEmpty"></a>Function: xmlListEmpty</h3><pre class="programlisting">int xmlListEmpty (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> </pre><p>Is the list empty ?</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the list is empty, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlListEnd" id="xmlListEnd"></a>Function: xmlListEnd</h3><pre class="programlisting"><a href="libxml-list.html#xmlLinkPtr">xmlLinkPtr</a> xmlListEnd (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if the list is empty, 0 if not empty and -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlListEnd" id="xmlListEnd"></a>Function: xmlListEnd</h3><pre class="programlisting"><a href="libxml-list.html#xmlLinkPtr">xmlLinkPtr</a> xmlListEnd (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> </pre><p>Get the last element in the list</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the last element in the list, or NULL</td></tr></tbody></table></div><h3><a name="xmlListFront" id="xmlListFront"></a>Function: xmlListFront</h3><pre class="programlisting"><a href="libxml-list.html#xmlLinkPtr">xmlLinkPtr</a> xmlListFront (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> </pre><p>Get the first element in the list</p> @@ -110,7 +110,7 @@ void xmlListDeallocator (<a href="libxml-list.html#xmlLinkPtr">xmlLinkPtr</a> l </pre><p>Search the list for an existing value of @data</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>data</tt></i>:</span></td><td>a search value</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the value associated to @data or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlListSize" id="xmlListSize"></a>Function: xmlListSize</h3><pre class="programlisting">int xmlListSize (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> </pre><p>Get the number of elements in the list</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements in the list</td></tr></tbody></table></div><h3><a name="xmlListSort" id="xmlListSort"></a>Function: xmlListSort</h3><pre class="programlisting">void xmlListSort (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of elements in the list or -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlListSort" id="xmlListSort"></a>Function: xmlListSort</h3><pre class="programlisting">void xmlListSort (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l)<br /> </pre><p>Sort all the elements in the list</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>l</tt></i>:</span></td><td>a list</td></tr></tbody></table></div><h3><a name="xmlListWalk" id="xmlListWalk"></a>Function: xmlListWalk</h3><pre class="programlisting">void xmlListWalk (<a href="libxml-list.html#xmlListPtr">xmlListPtr</a> l, <br /> <a href="libxml-list.html#xmlListWalker">xmlListWalker</a> walker, <br /> const void * user)<br /> </pre><p>Walk all the element of the first from first to last and apply the walker function to it</p> diff --git a/doc/html/libxml-nanoftp.html b/doc/html/libxml-nanoftp.html index 9fc521b..7c71162 100644 --- a/doc/html/libxml-nanoftp.html +++ b/doc/html/libxml-nanoftp.html @@ -22,15 +22,15 @@ void <a href="#ftpListCallback">ftpListCallback</a> (void * userData, <br /> <pre class="programlisting">int <a href="#xmlNanoFTPCloseConnection">xmlNanoFTPCloseConnection</a> (void * ctx)</pre> <pre class="programlisting">int <a href="#xmlNanoFTPConnect">xmlNanoFTPConnect</a> (void * ctx)</pre> <pre class="programlisting">void * <a href="#xmlNanoFTPConnectTo">xmlNanoFTPConnectTo</a> (const char * server, <br /> int port)</pre> -<pre class="programlisting">int <a href="#xmlNanoFTPCwd">xmlNanoFTPCwd</a> (void * ctx, <br /> char * directory)</pre> -<pre class="programlisting">int <a href="#xmlNanoFTPDele">xmlNanoFTPDele</a> (void * ctx, <br /> char * file)</pre> +<pre class="programlisting">int <a href="#xmlNanoFTPCwd">xmlNanoFTPCwd</a> (void * ctx, <br /> const char * directory)</pre> +<pre class="programlisting">int <a href="#xmlNanoFTPDele">xmlNanoFTPDele</a> (void * ctx, <br /> const char * file)</pre> <pre class="programlisting">void <a href="#xmlNanoFTPFreeCtxt">xmlNanoFTPFreeCtxt</a> (void * ctx)</pre> <pre class="programlisting">int <a href="#xmlNanoFTPGet">xmlNanoFTPGet</a> (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpDataCallback">ftpDataCallback</a> callback, <br /> void * userData, <br /> const char * filename)</pre> <pre class="programlisting">int <a href="#xmlNanoFTPGetConnection">xmlNanoFTPGetConnection</a> (void * ctx)</pre> <pre class="programlisting">int <a href="#xmlNanoFTPGetResponse">xmlNanoFTPGetResponse</a> (void * ctx)</pre> <pre class="programlisting">int <a href="#xmlNanoFTPGetSocket">xmlNanoFTPGetSocket</a> (void * ctx, <br /> const char * filename)</pre> <pre class="programlisting">void <a href="#xmlNanoFTPInit">xmlNanoFTPInit</a> (void)</pre> -<pre class="programlisting">int <a href="#xmlNanoFTPList">xmlNanoFTPList</a> (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br /> void * userData, <br /> char * filename)</pre> +<pre class="programlisting">int <a href="#xmlNanoFTPList">xmlNanoFTPList</a> (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br /> void * userData, <br /> const char * filename)</pre> <pre class="programlisting">void * <a href="#xmlNanoFTPNewCtxt">xmlNanoFTPNewCtxt</a> (const char * URL)</pre> <pre class="programlisting">void * <a href="#xmlNanoFTPOpen">xmlNanoFTPOpen</a> (const char * URL)</pre> <pre class="programlisting">void <a href="#xmlNanoFTPProxy">xmlNanoFTPProxy</a> (const char * host, <br /> int port, <br /> const char * user, <br /> const char * passwd, <br /> int type)</pre> @@ -57,9 +57,9 @@ void ftpListCallback (void * userData, <br /> const char * filename, <br </pre><p>Tries to open a control connection</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlNanoFTPConnectTo" id="xmlNanoFTPConnectTo"></a>Function: xmlNanoFTPConnectTo</h3><pre class="programlisting">void * xmlNanoFTPConnectTo (const char * server, <br /> int port)<br /> </pre><p>Tries to open a control connection to the given server/port</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>server</tt></i>:</span></td><td>an FTP server name</td></tr><tr><td><span class="term"><i><tt>port</tt></i>:</span></td><td>the port (use 21 if 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an fTP context or NULL if it failed</td></tr></tbody></table></div><h3><a name="xmlNanoFTPCwd" id="xmlNanoFTPCwd"></a>Function: xmlNanoFTPCwd</h3><pre class="programlisting">int xmlNanoFTPCwd (void * ctx, <br /> char * directory)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>server</tt></i>:</span></td><td>an FTP server name</td></tr><tr><td><span class="term"><i><tt>port</tt></i>:</span></td><td>the port (use 21 if 0)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an fTP context or NULL if it failed</td></tr></tbody></table></div><h3><a name="xmlNanoFTPCwd" id="xmlNanoFTPCwd"></a>Function: xmlNanoFTPCwd</h3><pre class="programlisting">int xmlNanoFTPCwd (void * ctx, <br /> const char * directory)<br /> </pre><p>Tries to change the remote directory</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>directory</tt></i>:</span></td><td>a directory on the server</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 incase of error, 1 if CWD worked, 0 if it failed</td></tr></tbody></table></div><h3><a name="xmlNanoFTPDele" id="xmlNanoFTPDele"></a>Function: xmlNanoFTPDele</h3><pre class="programlisting">int xmlNanoFTPDele (void * ctx, <br /> char * file)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>directory</tt></i>:</span></td><td>a directory on the server</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 incase of error, 1 if CWD worked, 0 if it failed</td></tr></tbody></table></div><h3><a name="xmlNanoFTPDele" id="xmlNanoFTPDele"></a>Function: xmlNanoFTPDele</h3><pre class="programlisting">int xmlNanoFTPDele (void * ctx, <br /> const char * file)<br /> </pre><p>Tries to delete an item (file or directory) from server</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>a file or directory on the server</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 incase of error, 1 if DELE worked, 0 if it failed</td></tr></tbody></table></div><h3><a name="xmlNanoFTPFreeCtxt" id="xmlNanoFTPFreeCtxt"></a>Function: xmlNanoFTPFreeCtxt</h3><pre class="programlisting">void xmlNanoFTPFreeCtxt (void * ctx)<br /> </pre><p>Frees the context after closing the connection.</p> @@ -73,7 +73,7 @@ void ftpListCallback (void * userData, <br /> const char * filename, <br </pre><p>Initiate fetch of the given file from the server.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the file to retrieve (or NULL if path is in context).</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the socket for the data connection, or <0 in case of error</td></tr></tbody></table></div><h3><a name="xmlNanoFTPInit" id="xmlNanoFTPInit"></a>Function: xmlNanoFTPInit</h3><pre class="programlisting">void xmlNanoFTPInit (void)<br /> </pre><p>Initialize the FTP protocol layer. Currently it just checks for proxy informations, and get the hostname</p> -<h3><a name="xmlNanoFTPList" id="xmlNanoFTPList"></a>Function: xmlNanoFTPList</h3><pre class="programlisting">int xmlNanoFTPList (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br /> void * userData, <br /> char * filename)<br /> +<h3><a name="xmlNanoFTPList" id="xmlNanoFTPList"></a>Function: xmlNanoFTPList</h3><pre class="programlisting">int xmlNanoFTPList (void * ctx, <br /> <a href="libxml-nanoftp.html#ftpListCallback">ftpListCallback</a> callback, <br /> void * userData, <br /> const char * filename)<br /> </pre><p>Do a listing on the server. All files info are passed back in the callbacks.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>an FTP context</td></tr><tr><td><span class="term"><i><tt>callback</tt></i>:</span></td><td>the user callback</td></tr><tr><td><span class="term"><i><tt>userData</tt></i>:</span></td><td>the user callback data</td></tr><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>optional files to list</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 incase of error, 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlNanoFTPNewCtxt" id="xmlNanoFTPNewCtxt"></a>Function: xmlNanoFTPNewCtxt</h3><pre class="programlisting">void * xmlNanoFTPNewCtxt (const char * URL)<br /> </pre><p>Allocate and initialize a new FTP context.</p> diff --git a/doc/html/libxml-relaxng.html b/doc/html/libxml-relaxng.html index 6e20a12..d611ce1 100644 --- a/doc/html/libxml-relaxng.html +++ b/doc/html/libxml-relaxng.html @@ -29,6 +29,7 @@ The content of this structure is not made public by the API. <pre class="programlisting">void <a href="#xmlRelaxNGFreeValidCtxt">xmlRelaxNGFreeValidCtxt</a> (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt)</pre> <pre class="programlisting">int <a href="#xmlRelaxNGGetParserErrors">xmlRelaxNGGetParserErrors</a> (<a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> ctxt, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityErrorFunc">xmlRelaxNGValidityErrorFunc</a> * err, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityWarningFunc">xmlRelaxNGValidityWarningFunc</a> * warn, <br /> void ** ctx)</pre> <pre class="programlisting">int <a href="#xmlRelaxNGGetValidErrors">xmlRelaxNGGetValidErrors</a> (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityErrorFunc">xmlRelaxNGValidityErrorFunc</a> * err, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityWarningFunc">xmlRelaxNGValidityWarningFunc</a> * warn, <br /> void ** ctx)</pre> +<pre class="programlisting">int <a href="#xmlRelaxNGInitTypes">xmlRelaxNGInitTypes</a> (void)</pre> <pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> <a href="#xmlRelaxNGNewDocParserCtxt">xmlRelaxNGNewDocParserCtxt</a> (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)</pre> <pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> <a href="#xmlRelaxNGNewMemParserCtxt">xmlRelaxNGNewMemParserCtxt</a> (const char * buffer, <br /> int size)</pre> <pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> <a href="#xmlRelaxNGNewParserCtxt">xmlRelaxNGNewParserCtxt</a> (const char * URL)</pre> @@ -118,7 +119,9 @@ The content of this structure is not made public by the API. </pre><p>Get the callback information used to handle errors for a validation context</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a Relax-NG validation context</td></tr><tr><td><span class="term"><i><tt>err</tt></i>:</span></td><td>the error callback result</td></tr><tr><td><span class="term"><i><tt>warn</tt></i>:</span></td><td>the warning callback result</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>contextual data for the callbacks result</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of failure, 0 otherwise.</td></tr></tbody></table></div><h3><a name="xmlRelaxNGGetValidErrors" id="xmlRelaxNGGetValidErrors"></a>Function: xmlRelaxNGGetValidErrors</h3><pre class="programlisting">int xmlRelaxNGGetValidErrors (<a href="libxml-relaxng.html#xmlRelaxNGValidCtxtPtr">xmlRelaxNGValidCtxtPtr</a> ctxt, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityErrorFunc">xmlRelaxNGValidityErrorFunc</a> * err, <br /> <a href="libxml-relaxng.html#xmlRelaxNGValidityWarningFunc">xmlRelaxNGValidityWarningFunc</a> * warn, <br /> void ** ctx)<br /> </pre><p>Get the error and warning callback informations</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a Relax-NG validation context</td></tr><tr><td><span class="term"><i><tt>err</tt></i>:</span></td><td>the error function result</td></tr><tr><td><span class="term"><i><tt>warn</tt></i>:</span></td><td>the warning function result</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the functions context result</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error and 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlRelaxNGNewDocParserCtxt" id="xmlRelaxNGNewDocParserCtxt"></a>Function: xmlRelaxNGNewDocParserCtxt</h3><pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> xmlRelaxNGNewDocParserCtxt (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td>a Relax-NG validation context</td></tr><tr><td><span class="term"><i><tt>err</tt></i>:</span></td><td>the error function result</td></tr><tr><td><span class="term"><i><tt>warn</tt></i>:</span></td><td>the warning function result</td></tr><tr><td><span class="term"><i><tt>ctx</tt></i>:</span></td><td>the functions context result</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error and 0 otherwise</td></tr></tbody></table></div><h3><a name="xmlRelaxNGInitTypes" id="xmlRelaxNGInitTypes"></a>Function: xmlRelaxNGInitTypes</h3><pre class="programlisting">int xmlRelaxNGInitTypes (void)<br /> +</pre><p>Initilize the default type libraries.</p> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>0 in case of success and -1 in case of error.</td></tr></tbody></table></div><h3><a name="xmlRelaxNGNewDocParserCtxt" id="xmlRelaxNGNewDocParserCtxt"></a>Function: xmlRelaxNGNewDocParserCtxt</h3><pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> xmlRelaxNGNewDocParserCtxt (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc)<br /> </pre><p>Create an XML RelaxNGs parser context for that document. Note: since the process of compiling a RelaxNG schemas modifies the document, the @doc parameter is duplicated internally.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>a preparsed document tree</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the parser context or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlRelaxNGNewMemParserCtxt" id="xmlRelaxNGNewMemParserCtxt"></a>Function: xmlRelaxNGNewMemParserCtxt</h3><pre class="programlisting"><a href="libxml-relaxng.html#xmlRelaxNGParserCtxtPtr">xmlRelaxNGParserCtxtPtr</a> xmlRelaxNGNewMemParserCtxt (const char * buffer, <br /> int size)<br /> </pre><p>Create an XML RelaxNGs parse context for that memory buffer expected to contain an XML RelaxNGs file.</p> diff --git a/doc/html/libxml-tree.html b/doc/html/libxml-tree.html index 99c4bd9..f5d4241 100644 --- a/doc/html/libxml-tree.html +++ b/doc/html/libxml-tree.html @@ -833,13 +833,13 @@ A:link, A:visited, A:active { text-decoration: underline } <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the filename (or URL)</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="xmlSaveFileEnc" id="xmlSaveFileEnc"></a>Function: xmlSaveFileEnc</h3><pre class="programlisting">int xmlSaveFileEnc (const char * filename, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br /> const char * encoding)<br /> </pre><p>Dump an XML document, converting it to the given encoding</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the filename (or URL)</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>:</span></td><td>the name of an encoding (or NULL)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="xmlSaveFileTo" id="xmlSaveFileTo"></a>Function: xmlSaveFileTo</h3><pre class="programlisting">int xmlSaveFileTo (<a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br /> const char * encoding)<br /> -</pre><p>Dump an XML document to an I/O buffer.</p> +</pre><p>Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>an output I/O buffer</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>:</span></td><td>the encoding if any assuming the I/O layer handles the trancoding</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="xmlSaveFormatFile" id="xmlSaveFormatFile"></a>Function: xmlSaveFormatFile</h3><pre class="programlisting">int xmlSaveFormatFile (const char * filename, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br /> int format)<br /> </pre><p>Dump an XML document to a file. Will use compression if compiled in and enabled. If @filename is "-" the stdout file is used. If @format is set then the document will be indented on output. Note that @format = 1 provide node indenting only if <a href="libxml-globals.html#xmlIndentTreeOutput">xmlIndentTreeOutput</a> = 1 or xmlKeepBlanksDefault(0) was called</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the filename (or URL)</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>format</tt></i>:</span></td><td>should formatting spaces been added</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="xmlSaveFormatFileEnc" id="xmlSaveFormatFileEnc"></a>Function: xmlSaveFormatFileEnc</h3><pre class="programlisting">int xmlSaveFormatFileEnc (const char * filename, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br /> const char * encoding, <br /> int format)<br /> </pre><p>Dump an XML document to a file or an URL.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the filename or URL to output</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document being saved</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>:</span></td><td>the name of the encoding to use or NULL.</td></tr><tr><td><span class="term"><i><tt>format</tt></i>:</span></td><td>should formatting spaces be added.</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of error. Note that @format = 1 provide node indenting only if <a href="libxml-globals.html#xmlIndentTreeOutput">xmlIndentTreeOutput</a> = 1 or xmlKeepBlanksDefault(0) was called</td></tr></tbody></table></div><h3><a name="xmlSaveFormatFileTo" id="xmlSaveFormatFileTo"></a>Function: xmlSaveFormatFileTo</h3><pre class="programlisting">int xmlSaveFormatFileTo (<a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> buf, <br /> <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> cur, <br /> const char * encoding, <br /> int format)<br /> -</pre><p>Dump an XML document to an I/O buffer. NOTE: the I/O buffer is closed as part of the call.</p> +</pre><p>Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td>an output I/O buffer</td></tr><tr><td><span class="term"><i><tt>cur</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>encoding</tt></i>:</span></td><td>the encoding if any assuming the I/O layer handles the trancoding</td></tr><tr><td><span class="term"><i><tt>format</tt></i>:</span></td><td>should formatting spaces been added</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or -1 in case of failure.</td></tr></tbody></table></div><h3><a name="xmlSearchNs" id="xmlSearchNs"></a>Function: xmlSearchNs</h3><pre class="programlisting"><a href="libxml-tree.html#xmlNsPtr">xmlNsPtr</a> xmlSearchNs (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * nameSpace)<br /> </pre><p>Search a Ns registered under a given name space for a document. recurse on the parents until it finds the defined namespace or return NULL otherwise. @nameSpace can be NULL, this is a search for the default namespace. We don't allow to cross entities boundaries. If you don't declare the namespace within those you will be in troubles !!! A warning is generated to cover this case.</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>the document</td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>the current node</td></tr><tr><td><span class="term"><i><tt>nameSpace</tt></i>:</span></td><td>the namespace prefix</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the namespace pointer or NULL.</td></tr></tbody></table></div><h3><a name="xmlSearchNsByHref" id="xmlSearchNsByHref"></a>Function: xmlSearchNsByHref</h3><pre class="programlisting"><a href="libxml-tree.html#xmlNsPtr">xmlNsPtr</a> xmlSearchNsByHref (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * href)<br /> diff --git a/doc/html/libxml-valid.html b/doc/html/libxml-valid.html index bc18015..e26d184 100644 --- a/doc/html/libxml-valid.html +++ b/doc/html/libxml-valid.html @@ -10,7 +10,7 @@ A:link, A:visited, A:active { text-decoration: underline } </style><style type="text/css"> div.deprecated pre.programlisting {border-style: double;border-color:red} pre.programlisting {border-style: double;background: #EECFA1} - </style><title>Module valid from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module valid from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-uri.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-uri.html">uri</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-xinclude.html">xinclude</a></th><td><a accesskey="n" href="libxml-xinclude.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>API for the DTD handling and the validity checking </p><h2>Table of Contents</h2><pre class="programlisting">Structure <a href="#xmlAttributeTable">xmlAttributeTable</a><br />struct _xmlHashTable + </style><title>Module valid from libxml2</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"><table border="0" width="100%" cellpadding="5" cellspacing="0" align="center"><tr><td width="120"><a href="http://swpat.ffii.org/"><img src="../epatents.png" alt="Action against software patents" /></a></td><td width="180"><a href="http://www.gnome.org/"><img src="../gnome2.png" alt="Gnome2 Logo" /></a><a href="http://www.w3.org/Status"><img src="../w3c.png" alt="W3C Logo" /></a><a href="http://www.redhat.com/"><img src="../redhat.gif" alt="Red Hat Logo" /></a><div align="left"><a href="http://xmlsoft.org/"><img src="../Libxml2-Logo-180x168.gif" alt="Made with Libxml2 Logo" /></a></div></td><td><table border="0" width="90%" cellpadding="2" cellspacing="0" align="center" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#fffacd"><tr><td align="center"><h1></h1><h2>Module valid from libxml2</h2></td></tr></table></td></tr></table></td></tr></table><table border="0" cellpadding="4" cellspacing="0" width="100%" align="center"><tr><td bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="2" width="100%"><tr><td valign="top" width="200" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Menu</b></center></td></tr><tr><td bgcolor="#fffacd"><form action="../search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form><ul><li><a style="font-weight:bold" href="../index.html">Main Menu</a></li><li><a style="font-weight:bold" href="../docs.html">Developer Menu</a></li><li><a style="font-weight:bold" href="../examples/index.html">Code Examples</a></li><li><a style="font-weight:bold" href="index.html">API Menu</a></li><li><a href="libxml-parser.html">Parser API</a></li><li><a href="libxml-tree.html">Tree API</a></li><li><a href="libxml-xmlreader.html">Reader API</a></li><li><a href="../guidelines.html">XML Guidelines</a></li><li><a href="../ChangeLog.html">ChangeLog</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>API Indexes</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="../APIchunk0.html">Alphabetic</a></li><li><a href="../APIconstructors.html">Constructors</a></li><li><a href="../APIfunctions.html">Functions/Types</a></li><li><a href="../APIfiles.html">Modules</a></li><li><a href="../APIsymbols.html">Symbols</a></li></ul></td></tr></table><table width="100%" border="0" cellspacing="1" cellpadding="3"><tr><td colspan="1" bgcolor="#eecfa1" align="center"><center><b>Related links</b></center></td></tr><tr><td bgcolor="#fffacd"><ul><li><a href="http://mail.gnome.org/archives/xml/">Mail archive</a></li><li><a href="http://xmlsoft.org/XSLT/">XSLT libxslt</a></li><li><a href="http://phd.cs.unibo.it/gdome2/">DOM gdome2</a></li><li><a href="http://www.aleksey.com/xmlsec/">XML-DSig xmlsec</a></li><li><a href="ftp://xmlsoft.org/">FTP</a></li><li><a href="http://www.zlatkovic.com/projects/libxml/">Windows binaries</a></li><li><a href="http://garypennington.net/libxml2/">Solaris binaries</a></li><li><a href="http://www.zveno.com/open_source/libxml2xslt.html">MacOsX binaries</a></li><li><a href="http://sourceforge.net/projects/libxml2-pas/">Pascal bindings</a></li><li><a href="http://bugzilla.gnome.org/buglist.cgi?product=libxml2">Bug Tracker</a></li></ul></td></tr></table></td></tr></table></td><td valign="top" bgcolor="#8b7765"><table border="0" cellspacing="0" cellpadding="1" width="100%"><tr><td><table border="0" cellspacing="0" cellpadding="1" width="100%" bgcolor="#000000"><tr><td><table border="0" cellpadding="3" cellspacing="1" width="100%"><tr><td bgcolor="#fffacd"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="libxml-uri.html"><img src="left.png" width="24" height="24" border="0" alt="Prev" /></a></td><th align="left"><a href="libxml-uri.html">uri</a></th><td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up" /></a></td><th align="left"><a href="index.html">API documentation</a></th><td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home" /></a></td><th align="center"><a href="../index.html">The XML C parser and toolkit of Gnome</a></th><th align="right"><a href="libxml-xinclude.html">xinclude</a></th><td><a accesskey="n" href="libxml-xinclude.html"><img src="right.png" width="24" height="24" border="0" alt="Next" /></a></td></tr></table><p>API for the DTD handling and the validity checking </p><h2>Table of Contents</h2><pre class="programlisting">#define <a href="#XML_CTXT_FINISH_DTD_0">XML_CTXT_FINISH_DTD_0</a></pre><pre class="programlisting">#define <a href="#XML_CTXT_FINISH_DTD_1">XML_CTXT_FINISH_DTD_1</a></pre><pre class="programlisting">Structure <a href="#xmlAttributeTable">xmlAttributeTable</a><br />struct _xmlHashTable The content of this structure is not made public by the API. </pre><pre class="programlisting">Typedef <a href="libxml-valid.html#xmlAttributeTable">xmlAttributeTable</a> * <a name="xmlAttributeTablePtr" id="xmlAttributeTablePtr">xmlAttributeTablePtr</a> </pre><pre class="programlisting">Structure <a href="#xmlElementTable">xmlElementTable</a><br />struct _xmlHashTable @@ -104,6 +104,8 @@ void <a href="#xmlValidityErrorFunc">xmlValidityErrorFunc</a> (void * ctx, <br void <a href="#xmlValidityWarningFunc">xmlValidityWarningFunc</a> (void * ctx, <br /> const char * msg, <br /> ... ...) </pre> <h2>Description</h2> +<h3><a name="XML_CTXT_FINISH_DTD_0" id="XML_CTXT_FINISH_DTD_0"></a>Macro: XML_CTXT_FINISH_DTD_0</h3><pre>#define XML_CTXT_FINISH_DTD_0</pre><p>Special value for finishDtd field when embedded in an <a href="libxml-tree.html#xmlParserCtxt">xmlParserCtxt</a></p> +<h3><a name="XML_CTXT_FINISH_DTD_1" id="XML_CTXT_FINISH_DTD_1"></a>Macro: XML_CTXT_FINISH_DTD_1</h3><pre>#define XML_CTXT_FINISH_DTD_1</pre><p>Special value for finishDtd field when embedded in an <a href="libxml-tree.html#xmlParserCtxt">xmlParserCtxt</a></p> <h3><a name="xmlAttributeTable" id="xmlAttributeTable">Structure xmlAttributeTable</a></h3><pre class="programlisting">Structure xmlAttributeTable<br />struct _xmlHashTable { The content of this structure is not made public by the API. }</pre><h3><a name="xmlElementTable" id="xmlElementTable">Structure xmlElementTable</a></h3><pre class="programlisting">Structure xmlElementTable<br />struct _xmlHashTable { @@ -122,7 +124,7 @@ The content of this structure is not made public by the API. int nodeNr : Depth of the parsing stack int nodeMax : Max depth of the parsing stack <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> * nodeTab : array of nodes - int finishDtd : finished validating the Dtd ? + unsigned int finishDtd : finished validating the Dtd ? <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc : the document int valid : temporary validity check result state s <a href="libxml-valid.html#xmlValidState">xmlValidState</a> * vstate : current state diff --git a/doc/html/libxml-xmlIO.html b/doc/html/libxml-xmlIO.html index 1e3b3c3..1aaf3cd 100644 --- a/doc/html/libxml-xmlIO.html +++ b/doc/html/libxml-xmlIO.html @@ -102,7 +102,7 @@ int <a href="#xmlOutputWriteCallback">xmlOutputWriteCallback</a> (void * contex </pre><p>Wrapper around xmlFileOpen_real that try it with an unescaped version of @filename, if this fails fallback to @filename</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>filename</tt></i>:</span></td><td>the URI for matching</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a handler or NULL in case or failure</td></tr></tbody></table></div><h3><a name="xmlFileRead" id="xmlFileRead"></a>Function: xmlFileRead</h3><pre class="programlisting">int xmlFileRead (void * context, <br /> char * buffer, <br /> int len)<br /> </pre><p>Read @len bytes to @buffer from the I/O channel.</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>context</tt></i>:</span></td><td>the I/O context</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>where to drop data</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>number of bytes to write</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written</td></tr></tbody></table></div><h3><a name="xmlFreeParserInputBuffer" id="xmlFreeParserInputBuffer"></a>Function: xmlFreeParserInputBuffer</h3><pre class="programlisting">void xmlFreeParserInputBuffer (<a href="libxml-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a> in)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>context</tt></i>:</span></td><td>the I/O context</td></tr><tr><td><span class="term"><i><tt>buffer</tt></i>:</span></td><td>where to drop data</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>number of bytes to write</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the number of bytes written or < 0 in case of failure</td></tr></tbody></table></div><h3><a name="xmlFreeParserInputBuffer" id="xmlFreeParserInputBuffer"></a>Function: xmlFreeParserInputBuffer</h3><pre class="programlisting">void xmlFreeParserInputBuffer (<a href="libxml-tree.html#xmlParserInputBufferPtr">xmlParserInputBufferPtr</a> in)<br /> </pre><p>Free up the memory used by a buffered parser input</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>in</tt></i>:</span></td><td>a buffered parser input</td></tr></tbody></table></div><h3><a name="xmlIOFTPClose" id="xmlIOFTPClose"></a>Function: xmlIOFTPClose</h3><pre class="programlisting">int xmlIOFTPClose (void * context)<br /> </pre><p>Close an FTP I/O channel</p> diff --git a/doc/html/libxml-xmlerror.html b/doc/html/libxml-xmlerror.html index 93aaa79..a0bfb49 100644 --- a/doc/html/libxml-xmlerror.html +++ b/doc/html/libxml-xmlerror.html @@ -77,6 +77,7 @@ void <a href="#xmlStructuredErrorFunc">xmlStructuredErrorFunc</a> (void * userD <a name="XML_FROM_XSLT" id="XML_FROM_XSLT">XML_FROM_XSLT</a> = 22 : The XSLT engine from libxslt <a name="XML_FROM_VALID" id="XML_FROM_VALID">XML_FROM_VALID</a> = 23 : The XML DTD validation with valid context <a name="XML_FROM_CHECK" id="XML_FROM_CHECK">XML_FROM_CHECK</a> = 24 : The error checking module + <a name="XML_FROM_WRITER" id="XML_FROM_WRITER">XML_FROM_WRITER</a> = 25 : The xmlwriter module } </pre><h3>Enum <a name="xmlErrorLevel" id="xmlErrorLevel">xmlErrorLevel</a></h3><pre class="programlisting">Enum xmlErrorLevel { <a name="XML_ERR_NONE" id="XML_ERR_NONE">XML_ERR_NONE</a> = 0 diff --git a/doc/html/libxml-xmlmemory.html b/doc/html/libxml-xmlmemory.html index 90f9167..23d3416 100644 --- a/doc/html/libxml-xmlmemory.html +++ b/doc/html/libxml-xmlmemory.html @@ -30,6 +30,7 @@ void <a href="#xmlFreeFunc">xmlFreeFunc</a> (void * mem) void * <a href="#xmlMallocFunc">xmlMallocFunc</a> (size_t size) </pre> <pre class="programlisting">void * <a href="#xmlMallocLoc">xmlMallocLoc</a> (size_t size, <br /> const char * file, <br /> int line)</pre> +<pre class="programlisting">int <a href="#xmlMemBlocks">xmlMemBlocks</a> (void)</pre> <pre class="programlisting">void <a href="#xmlMemDisplay">xmlMemDisplay</a> (FILE * fp)</pre> <pre class="programlisting">void <a href="#xmlMemFree">xmlMemFree</a> (void * ptr)</pre> <pre class="programlisting">int <a href="#xmlMemGet">xmlMemGet</a> (<a href="libxml-xmlmemory.html#xmlFreeFunc">xmlFreeFunc</a> * freeFunc, <br /> <a href="libxml-xmlmemory.html#xmlMallocFunc">xmlMallocFunc</a> * mallocFunc, <br /> <a href="libxml-xmlmemory.html#xmlReallocFunc">xmlReallocFunc</a> * reallocFunc, <br /> <a href="libxml-xmlmemory.html#xmlStrdupFunc">xmlStrdupFunc</a> * strdupFunc)</pre> @@ -68,7 +69,9 @@ void * xmlMallocFunc (size_t size) </pre><p>Signature for a malloc() implementation.</p><div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>the size requested in bytes</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the newly allocated block or NULL in case of error.</td></tr></tbody></table></div><br /> <h3><a name="xmlMallocLoc" id="xmlMallocLoc"></a>Function: xmlMallocLoc</h3><pre class="programlisting">void * xmlMallocLoc (size_t size, <br /> const char * file, <br /> int line)<br /> </pre><p>a malloc() equivalent, with logging of the allocation info.</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div><h3><a name="xmlMemDisplay" id="xmlMemDisplay"></a>Function: xmlMemDisplay</h3><pre class="programlisting">void xmlMemDisplay (FILE * fp)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>size</tt></i>:</span></td><td>an int specifying the size in byte to allocate.</td></tr><tr><td><span class="term"><i><tt>file</tt></i>:</span></td><td>the file name or NULL</td></tr><tr><td><span class="term"><i><tt>line</tt></i>:</span></td><td>the line number</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the allocated area or NULL in case of lack of memory.</td></tr></tbody></table></div><h3><a name="xmlMemBlocks" id="xmlMemBlocks"></a>Function: xmlMemBlocks</h3><pre class="programlisting">int xmlMemBlocks (void)<br /> +</pre><p>Provides the number of memory areas currently allocated</p> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>an int representing the number of blocks</td></tr></tbody></table></div><h3><a name="xmlMemDisplay" id="xmlMemDisplay"></a>Function: xmlMemDisplay</h3><pre class="programlisting">void xmlMemDisplay (FILE * fp)<br /> </pre><p>show in-extenso the memory blocks allocated</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>fp</tt></i>:</span></td><td>a FILE descriptor used as the output file, if NULL, the result is written to the file .memorylist</td></tr></tbody></table></div><h3><a name="xmlMemFree" id="xmlMemFree"></a>Function: xmlMemFree</h3><pre class="programlisting">void xmlMemFree (void * ptr)<br /> </pre><p></p> diff --git a/doc/html/libxml-xmlstring.html b/doc/html/libxml-xmlstring.html index 490df42..9b29924 100644 --- a/doc/html/libxml-xmlstring.html +++ b/doc/html/libxml-xmlstring.html @@ -38,7 +38,7 @@ A:link, A:visited, A:active { text-decoration: underline } <pre class="programlisting">int <a href="#xmlUTF8Strlen">xmlUTF8Strlen</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf)</pre> <pre class="programlisting">int <a href="#xmlUTF8Strloc">xmlUTF8Strloc</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utfchar)</pre> <pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strndup">xmlUTF8Strndup</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)</pre> -<pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strpos">xmlUTF8Strpos</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)</pre> +<pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strpos">xmlUTF8Strpos</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)</pre> <pre class="programlisting">int <a href="#xmlUTF8Strsize">xmlUTF8Strsize</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)</pre> <pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * <a href="#xmlUTF8Strsub">xmlUTF8Strsub</a> (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int start, <br /> int len)</pre> <h2>Description</h2> @@ -97,10 +97,10 @@ A:link, A:visited, A:active { text-decoration: underline } </pre><p>a function to provide the relative location of a UTF8 char</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>utfchar</tt></i>:</span></td><td>the UTF8 character to be found</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the relative character position of the desired char or -1 if not found</td></tr></tbody></table></div><h3><a name="xmlUTF8Strndup" id="xmlUTF8Strndup"></a>Function: xmlUTF8Strndup</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strndup (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)<br /> </pre><p>a strndup for array of UTF8's</p> -<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the len of @utf (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new UTF8 * or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strpos" id="xmlUTF8Strpos"></a>Function: xmlUTF8Strpos</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strpos (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)<br /> +<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the len of @utf (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a new UTF8 * or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strpos" id="xmlUTF8Strpos"></a>Function: xmlUTF8Strpos</h3><pre class="programlisting">const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strpos (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int pos)<br /> </pre><p>a function to provide the equivalent of fetching a character from a string array</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>the input UTF8 *</td></tr><tr><td><span class="term"><i><tt>pos</tt></i>:</span></td><td>the position of the desired UTF8 char (in chars)</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the UTF8 character or NULL</td></tr></tbody></table></div><h3><a name="xmlUTF8Strsize" id="xmlUTF8Strsize"></a>Function: xmlUTF8Strsize</h3><pre class="programlisting">int xmlUTF8Strsize (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int len)<br /> -</pre><p>storage size of an UTF8 string</p> +</pre><p>storage size of an UTF8 string the behaviour is not garanteed if the input string is not UTF-8</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>a sequence of UTF-8 encoded bytes</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>the number of <a href="libxml-SAX.html#characters">characters</a> in the array</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the storage size of the first 'len' <a href="libxml-SAX.html#characters">characters</a> of ARRAY</td></tr></tbody></table></div><h3><a name="xmlUTF8Strsub" id="xmlUTF8Strsub"></a>Function: xmlUTF8Strsub</h3><pre class="programlisting"><a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * xmlUTF8Strsub (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * utf, <br /> int start, <br /> int len)<br /> </pre><p>Create a substring from a given UTF-8 string Note: positions are given in units of UTF-8 chars</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>utf</tt></i>:</span></td><td>a sequence of UTF-8 encoded bytes</td></tr><tr><td><span class="term"><i><tt>start</tt></i>:</span></td><td>relative pos of first char</td></tr><tr><td><span class="term"><i><tt>len</tt></i>:</span></td><td>total number to copy</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to a newly created string or NULL if any problem</td></tr></tbody></table></div><p><a href="../bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html> diff --git a/doc/html/libxml-xmlwriter.html b/doc/html/libxml-xmlwriter.html index 071ced6..3127a8b 100644 --- a/doc/html/libxml-xmlwriter.html +++ b/doc/html/libxml-xmlwriter.html @@ -100,7 +100,7 @@ The content of this structure is not made public by the API. }</pre><h3><a name="xmlFreeTextWriter" id="xmlFreeTextWriter"></a>Function: xmlFreeTextWriter</h3><pre class="programlisting">void xmlFreeTextWriter (<a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer)<br /> </pre><p>Deallocate all the resources associated to the writer</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>writer</tt></i>:</span></td><td>the <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a></td></tr></tbody></table></div><h3><a name="xmlNewTextWriter" id="xmlNewTextWriter"></a>Function: xmlNewTextWriter</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriter (<a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> out)<br /> -</pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure using an <a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a></p> +</pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure using an <a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a> NOTE: the @out parameter will be deallocated when the writer is closed (if the call succeed.)</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>out</tt></i>:</span></td><td>an <a href="libxml-tree.html#xmlOutputBufferPtr">xmlOutputBufferPtr</a></td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlNewTextWriterDoc" id="xmlNewTextWriterDoc"></a>Function: xmlNewTextWriterDoc</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriterDoc (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> * doc, <br /> int compression)<br /> </pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure with @*doc as output</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td>address of a <a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> to hold the new XML document tree</td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>compress the output?</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlNewTextWriterFilename" id="xmlNewTextWriterFilename"></a>Function: xmlNewTextWriterFilename</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriterFilename (const char * uri, <br /> int compression)<br /> @@ -108,7 +108,7 @@ The content of this structure is not made public by the API. <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>uri</tt></i>:</span></td><td>the URI of the resource for the output</td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>compress the output?</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlNewTextWriterMemory" id="xmlNewTextWriterMemory"></a>Function: xmlNewTextWriterMemory</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriterMemory (<a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a> buf, <br /> int compression)<br /> </pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure with @buf as output TODO: handle compression</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>buf</tt></i>:</span></td><td><a href="libxml-tree.html#xmlBufferPtr">xmlBufferPtr</a></td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>compress the output?</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlNewTextWriterPushParser" id="xmlNewTextWriterPushParser"></a>Function: xmlNewTextWriterPushParser</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriterPushParser (<a href="libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> ctxt, <br /> int compression)<br /> -</pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure with @ctxt as output TODO: handle compression</p> +</pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure with @ctxt as output NOTE: the @ctxt context will be freed with the resulting writer (if the call succeeds). TODO: handle compression</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>ctxt</tt></i>:</span></td><td><a href="libxml-tree.html#xmlParserCtxtPtr">xmlParserCtxtPtr</a> to hold the new XML document tree</td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>compress the output?</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlNewTextWriterTree" id="xmlNewTextWriterTree"></a>Function: xmlNewTextWriterTree</h3><pre class="programlisting"><a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> xmlNewTextWriterTree (<a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a> doc, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node, <br /> int compression)<br /> </pre><p>Create a new <a href="libxml-xmlwriter.html#xmlNewTextWriter">xmlNewTextWriter</a> structure with @doc as output starting at @node</p> <div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>doc</tt></i>:</span></td><td><a href="libxml-tree.html#xmlDocPtr">xmlDocPtr</a></td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td><a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> or NULL for doc->children</td></tr><tr><td><span class="term"><i><tt>compression</tt></i>:</span></td><td>compress the output?</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the new <a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlTextWriterEndAttribute" id="xmlTextWriterEndAttribute"></a>Function: xmlTextWriterEndAttribute</h3><pre class="programlisting">int xmlTextWriterEndAttribute (<a href="libxml-xmlwriter.html#xmlTextWriterPtr">xmlTextWriterPtr</a> writer)<br /> diff --git a/doc/html/libxml-xpath.html b/doc/html/libxml-xpath.html index 5594973..0fccabf 100644 --- a/doc/html/libxml-xpath.html +++ b/doc/html/libxml-xpath.html @@ -159,6 +159,7 @@ The content of this structure is not made public by the API. <a name="XPATH_UNDEF_PREFIX_ERROR" id="XPATH_UNDEF_PREFIX_ERROR">XPATH_UNDEF_PREFIX_ERROR</a> = 19 <a name="XPATH_ENCODING_ERROR" id="XPATH_ENCODING_ERROR">XPATH_ENCODING_ERROR</a> = 20 <a name="XPATH_INVALID_CHAR_ERROR" id="XPATH_INVALID_CHAR_ERROR">XPATH_INVALID_CHAR_ERROR</a> = 21 + <a name="XPATH_INVALID_CTXT" id="XPATH_INVALID_CTXT">XPATH_INVALID_CTXT</a> = 22 } </pre><h3><a name="xmlXPathFunct" id="xmlXPathFunct">Structure xmlXPathFunct</a></h3><pre class="programlisting">Structure xmlXPathFunct<br />struct _xmlXPathFunct { const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name : the function name diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 3da8dbe..6a93755 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -1023,6 +1023,7 @@ <exports symbol='xmlRelaxNGGetValidErrors' type='function'/> <exports symbol='xmlRelaxNGNewMemParserCtxt' type='function'/> <exports symbol='xmlRelaxNGDump' type='function'/> + <exports symbol='xmlRelaxNGInitTypes' type='function'/> <exports symbol='xmlRelaxNGValidityErrorFunc' type='function'/> <exports symbol='xmlRelaxNGParse' type='function'/> <exports symbol='xmlRelaxNGDumpTree' type='function'/> @@ -1557,6 +1558,8 @@ <summary>The DTD validation</summary> <description>API for the DTD handling and the validity checking </description> <author>Daniel Veillard </author> + <exports symbol='XML_CTXT_FINISH_DTD_0' type='macro'/> + <exports symbol='XML_CTXT_FINISH_DTD_1' type='macro'/> <exports symbol='xmlElementTable' type='typedef'/> <exports symbol='xmlValidStatePtr' type='typedef'/> <exports symbol='xmlIDTablePtr' type='typedef'/> @@ -1992,6 +1995,7 @@ <exports symbol='XML_SCHEMAP_INVALID_ATTR_COMBINATION' type='enum'/> <exports symbol='XML_RNGP_PARAM_FORBIDDEN' type='enum'/> <exports symbol='XML_SCHEMAP_UNKNOWN_PROCESSCONTENT_CHILD' type='enum'/> + <exports symbol='XML_FROM_WRITER' type='enum'/> <exports symbol='XML_ERR_UNSUPPORTED_ENCODING' type='enum'/> <exports symbol='XML_RNGP_PAT_NSNAME_EXCEPT_ANYNAME' type='enum'/> <exports symbol='XML_ERR_ENTITYREF_IN_PROLOG' type='enum'/> @@ -2578,6 +2582,7 @@ <exports symbol='xmlReallocFunc' type='function'/> <exports symbol='xmlMallocFunc' type='function'/> <exports symbol='xmlMemDisplay' type='function'/> + <exports symbol='xmlMemBlocks' type='function'/> <exports symbol='xmlGcMemSetup' type='function'/> <exports symbol='xmlMemShow' type='function'/> <exports symbol='xmlMemoryStrdup' type='function'/> @@ -3177,6 +3182,7 @@ <exports symbol='XPATH_RANGE' type='enum'/> <exports symbol='XPTR_SYNTAX_ERROR' type='enum'/> <exports symbol='XPATH_LOCATIONSET' type='enum'/> + <exports symbol='XPATH_INVALID_CTXT' type='enum'/> <exports symbol='XPATH_INVALID_CHAR_ERROR' type='enum'/> <exports symbol='XPATH_UNDEF_VARIABLE_ERROR' type='enum'/> <exports symbol='XPATH_UNCLOSED_ERROR' type='enum'/> @@ -3191,9 +3197,9 @@ <exports symbol='XPATH_EXPR_ERROR' type='enum'/> <exports symbol='XPATH_VARIABLE_REF_ERROR' type='enum'/> <exports symbol='XPATH_INVALID_TYPE' type='enum'/> - <exports symbol='XPATH_INVALID_CTXT_SIZE' type='enum'/> - <exports symbol='XPATH_INVALID_CTXT_POSITION' type='enum'/> <exports symbol='XPATH_UNDEFINED' type='enum'/> + <exports symbol='XPATH_INVALID_CTXT_POSITION' type='enum'/> + <exports symbol='XPATH_INVALID_CTXT_SIZE' type='enum'/> <exports symbol='XPATH_MEMORY_ERROR' type='enum'/> <exports symbol='XPATH_UNFINISHED_LITERAL_ERROR' type='enum'/> <exports symbol='XPATH_NUMBER' type='enum'/> @@ -3751,6 +3757,12 @@ <macro name='XML_COMPLETE_ATTRS' file='parser'> <info>Bit in the loadsubset context field to tell to do complete the elements attributes lists with the ones defaulted from the DTDs. Use it to initialize xmlLoadExtDtdDefaultValue.</info> </macro> + <macro name='XML_CTXT_FINISH_DTD_0' file='valid'> + <info>Special value for finishDtd field when embedded in an xmlParserCtxt</info> + </macro> + <macro name='XML_CTXT_FINISH_DTD_1' file='valid'> + <info>Special value for finishDtd field when embedded in an xmlParserCtxt</info> + </macro> <macro name='XML_DEFAULT_VERSION' file='parser'> <info>The default version of XML used: 1.0</info> </macro> @@ -4465,7 +4477,7 @@ <enum name='XML_EXTERNAL_PARAMETER_ENTITY' file='entities' value='5' type='xmlEntityType'/> <enum name='XML_FROM_C14N' file='xmlerror' value='21' type='xmlErrorDomain' info='The Canonicalization module'/> <enum name='XML_FROM_CATALOG' file='xmlerror' value='20' type='xmlErrorDomain' info='The Catalog module'/> - <enum name='XML_FROM_CHECK' file='xmlerror' value='24' type='xmlErrorDomain' info=' The error checking module'/> + <enum name='XML_FROM_CHECK' file='xmlerror' value='24' type='xmlErrorDomain' info='The error checking module'/> <enum name='XML_FROM_DATATYPE' file='xmlerror' value='15' type='xmlErrorDomain' info='The W3C XML Schemas Datatype module'/> <enum name='XML_FROM_DTD' file='xmlerror' value='4' type='xmlErrorDomain' info='The XML DTD validation with parser contex'/> <enum name='XML_FROM_FTP' file='xmlerror' value='9' type='xmlErrorDomain' info='The FTP module'/> @@ -4484,6 +4496,7 @@ <enum name='XML_FROM_SCHEMASV' file='xmlerror' value='17' type='xmlErrorDomain' info='The W3C XML Schemas validation module'/> <enum name='XML_FROM_TREE' file='xmlerror' value='2' type='xmlErrorDomain' info='The tree module'/> <enum name='XML_FROM_VALID' file='xmlerror' value='23' type='xmlErrorDomain' info='The XML DTD validation with valid context'/> + <enum name='XML_FROM_WRITER' file='xmlerror' value='25' type='xmlErrorDomain' info=' The xmlwriter module'/> <enum name='XML_FROM_XINCLUDE' file='xmlerror' value='11' type='xmlErrorDomain' info='The XInclude processing'/> <enum name='XML_FROM_XPATH' file='xmlerror' value='12' type='xmlErrorDomain' info='The XPath module'/> <enum name='XML_FROM_XPOINTER' file='xmlerror' value='13' type='xmlErrorDomain' info='The XPointer module'/> @@ -5244,6 +5257,7 @@ <enum name='XPATH_EXPR_ERROR' file='xpath' value='7' type='xmlXPathError'/> <enum name='XPATH_INVALID_ARITY' file='xpath' value='12' type='xmlXPathError'/> <enum name='XPATH_INVALID_CHAR_ERROR' file='xpath' value='21' type='xmlXPathError'/> + <enum name='XPATH_INVALID_CTXT' file='xpath' value='22' type='xmlXPathError'/> <enum name='XPATH_INVALID_CTXT_POSITION' file='xpath' value='14' type='xmlXPathError'/> <enum name='XPATH_INVALID_CTXT_SIZE' file='xpath' value='13' type='xmlXPathError'/> <enum name='XPATH_INVALID_OPERAND' file='xpath' value='10' type='xmlXPathError'/> @@ -6125,7 +6139,7 @@ actually an xmlCharEncoding'/> <field name='nodeNr' type='int' info=' Depth of the parsing stack'/> <field name='nodeMax' type='int' info=' Max depth of the parsing stack'/> <field name='nodeTab' type='xmlNodePtr *' info=' array of nodes'/> - <field name='finishDtd' type='int' info=' finished validating the Dtd ?'/> + <field name='finishDtd' type='unsigned int' info=' finished validating the Dtd ?'/> <field name='doc' type='xmlDocPtr' info=' the document'/> <field name='valid' type='int' info=' temporary validity check result state state used for non-determinist content validation'/> <field name='vstate' type='xmlValidState *' info=' current state'/> @@ -8866,7 +8880,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlFileRead' file='xmlIO'> <info>Read @len bytes to @buffer from the I/O channel.</info> - <return type='int' info='the number of bytes written'/> + <return type='int' info='the number of bytes written or < 0 in case of failure'/> <arg name='context' type='void *' info='the I/O context'/> <arg name='buffer' type='char *' info='where to drop data'/> <arg name='len' type='int' info='number of bytes to write'/> @@ -9735,7 +9749,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlListEmpty' file='list'> <info>Is the list empty ?</info> - <return type='int' info='1 if the list is empty, 0 otherwise'/> + <return type='int' info='1 if the list is empty, 0 if not empty and -1 in case of error'/> <arg name='l' type='xmlListPtr' info='a list'/> </function> <function name='xmlListEnd' file='list'> @@ -9826,7 +9840,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlListSize' file='list'> <info>Get the number of elements in the list</info> - <return type='int' info='the number of elements in the list'/> + <return type='int' info='the number of elements in the list or -1 in case of error'/> <arg name='l' type='xmlListPtr' info='a list'/> </function> <function name='xmlListSort' file='list'> @@ -9914,6 +9928,10 @@ actually an xmlCharEncoding'/> <arg name='file' type='const char *' info='the file name or NULL'/> <arg name='line' type='int' info='the line number'/> </function> + <function name='xmlMemBlocks' file='xmlmemory'> + <info>Provides the number of memory areas currently allocated</info> + <return type='int' info='an int representing the number of blocks'/> + </function> <function name='xmlMemDisplay' file='xmlmemory'> <info>show in-extenso the memory blocks allocated</info> <return type='void'/> @@ -10044,14 +10062,14 @@ actually an xmlCharEncoding'/> <info>Tries to change the remote directory</info> <return type='int' info='-1 incase of error, 1 if CWD worked, 0 if it failed'/> <arg name='ctx' type='void *' info='an FTP context'/> - <arg name='directory' type='char *' info='a directory on the server'/> + <arg name='directory' type='const char *' info='a directory on the server'/> </function> <function name='xmlNanoFTPDele' file='nanoftp'> <cond>LIBXML_FTP_ENABLED</cond> <info>Tries to delete an item (file or directory) from server</info> <return type='int' info='-1 incase of error, 1 if DELE worked, 0 if it failed'/> <arg name='ctx' type='void *' info='an FTP context'/> - <arg name='file' type='char *' info='a file or directory on the server'/> + <arg name='file' type='const char *' info='a file or directory on the server'/> </function> <function name='xmlNanoFTPFreeCtxt' file='nanoftp'> <cond>LIBXML_FTP_ENABLED</cond> @@ -10099,7 +10117,7 @@ actually an xmlCharEncoding'/> <arg name='ctx' type='void *' info='an FTP context'/> <arg name='callback' type='ftpListCallback' info='the user callback'/> <arg name='userData' type='void *' info='the user callback data'/> - <arg name='filename' type='char *' info='optional files to list'/> + <arg name='filename' type='const char *' info='optional files to list'/> </function> <function name='xmlNanoFTPNewCtxt' file='nanoftp'> <cond>LIBXML_FTP_ENABLED</cond> @@ -10533,7 +10551,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlNewTextWriter' file='xmlwriter'> <cond>LIBXML_WRITER_ENABLED</cond> - <info>Create a new xmlNewTextWriter structure using an xmlOutputBufferPtr</info> + <info>Create a new xmlNewTextWriter structure using an xmlOutputBufferPtr NOTE: the @out parameter will be deallocated when the writer is closed (if the call succeed.)</info> <return type='xmlTextWriterPtr' info='the new xmlTextWriterPtr or NULL in case of error'/> <arg name='out' type='xmlOutputBufferPtr' info='an xmlOutputBufferPtr'/> </function> @@ -10560,7 +10578,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlNewTextWriterPushParser' file='xmlwriter'> <cond>LIBXML_WRITER_ENABLED</cond> - <info>Create a new xmlNewTextWriter structure with @ctxt as output TODO: handle compression</info> + <info>Create a new xmlNewTextWriter structure with @ctxt as output NOTE: the @ctxt context will be freed with the resulting writer (if the call succeeds). TODO: handle compression</info> <return type='xmlTextWriterPtr' info='the new xmlTextWriterPtr or NULL in case of error'/> <arg name='ctxt' type='xmlParserCtxtPtr' info='xmlParserCtxtPtr to hold the new XML document tree'/> <arg name='compression' type='int' info='compress the output?'/> @@ -11767,6 +11785,11 @@ actually an xmlCharEncoding'/> <arg name='warn' type='xmlRelaxNGValidityWarningFunc *' info='the warning function result'/> <arg name='ctx' type='void **' info='the functions context result'/> </function> + <function name='xmlRelaxNGInitTypes' file='relaxng'> + <cond>LIBXML_SCHEMAS_ENABLED</cond> + <info>Initilize the default type libraries.</info> + <return type='int' info='0 in case of success and -1 in case of error.'/> + </function> <function name='xmlRelaxNGNewDocParserCtxt' file='relaxng'> <cond>LIBXML_SCHEMAS_ENABLED</cond> <info>Create an XML RelaxNGs parser context for that document. Note: since the process of compiling a RelaxNG schemas modifies the document, the @doc parameter is duplicated internally.</info> @@ -12244,7 +12267,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlSaveFileTo' file='tree'> <cond>LIBXML_OUTPUT_ENABLED</cond> - <info>Dump an XML document to an I/O buffer.</info> + <info>Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.</info> <return type='int' info='the number of bytes written or -1 in case of failure.'/> <arg name='buf' type='xmlOutputBufferPtr' info='an output I/O buffer'/> <arg name='cur' type='xmlDocPtr' info='the document'/> @@ -12275,7 +12298,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlSaveFormatFileTo' file='tree'> <cond>LIBXML_OUTPUT_ENABLED</cond> - <info>Dump an XML document to an I/O buffer. NOTE: the I/O buffer is closed as part of the call.</info> + <info>Dump an XML document to an I/O buffer. Warning ! This call xmlOutputBufferClose() on buf which is not available after this call.</info> <return type='int' info='the number of bytes written or -1 in case of failure.'/> <arg name='buf' type='xmlOutputBufferPtr' info='an output I/O buffer'/> <arg name='cur' type='xmlDocPtr' info='the document'/> @@ -12735,6 +12758,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShell' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell This allow to load, validate, view, modify and save a document using a environment similar to a UNIX commandline.</info> <return type='void'/> <arg name='doc' type='xmlDocPtr' info='the initial document'/> @@ -12744,6 +12768,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellBase' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "base" dumps the current XML base of the node</info> <return type='int' info='0'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12753,6 +12778,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellCat' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "cat" dumps the serialization node content (XML or HTML).</info> <return type='int' info='0'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12762,6 +12788,7 @@ actually an xmlCharEncoding'/> </function> <functype name='xmlShellCmd' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>This is a generic signature for the XML shell functions.</info> <return type='int' info='an int, negative returns indicating errors.'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='a shell context'/> @@ -12771,6 +12798,7 @@ actually an xmlCharEncoding'/> </functype> <function name='xmlShellDir' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "dir" dumps informations about the node (namespace, attributes, content).</info> <return type='int' info='0'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12780,6 +12808,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellDu' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "du" show the structure of the subtree under node @tree If @tree is null, the command works on the current node.</info> <return type='int' info='0 or -1 in case of error'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12789,6 +12818,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellList' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "ls" Does an Unix like listing of the given node (like a directory)</info> <return type='int' info='0'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12798,6 +12828,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellLoad' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "load" loads a new document specified by the filename</info> <return type='int' info='0 or -1 if loading failed'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12807,12 +12838,14 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellPrintNode' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Print node to the output FILE</info> <return type='void'/> <arg name='node' type='xmlNodePtr' info='a non-null node to print to the output FILE'/> </function> <function name='xmlShellPrintXPathError' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Print the xpath error to libxml default error channel</info> <return type='void'/> <arg name='errorType' type='int' info='valid xpath error id'/> @@ -12820,12 +12853,14 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellPrintXPathResult' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Prints result to the output FILE</info> <return type='void'/> <arg name='list' type='xmlXPathObjectPtr' info='a valid result generated by an xpath evaluation'/> </function> <function name='xmlShellPwd' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "pwd" Show the full path from the root to the node, if needed building thumblers when similar elements exists at a given ancestor level. The output is compatible with XPath commands.</info> <return type='int' info='0 or -1 in case of error'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12835,12 +12870,14 @@ actually an xmlCharEncoding'/> </function> <functype name='xmlShellReadlineFunc' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>This is a generic signature for the XML shell input function.</info> <return type='char *' info='a string which will be freed by the Shell.'/> <arg name='prompt' type='char *' info='a string prompt'/> </functype> <function name='xmlShellSave' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <cond>LIBXML_OUTPUT_ENABLED</cond> <info>Implements the XML shell function "save" Write the current document to the filename, or it's original name</info> <return type='int' info='0 or -1 in case of error'/> @@ -12851,6 +12888,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellValidate' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <info>Implements the XML shell function "validate" Validate the document, if a DTD path is provided, then the validation is done against the given DTD.</info> <return type='int' info='0 or -1 in case of error'/> <arg name='ctxt' type='xmlShellCtxtPtr' info='the shell context'/> @@ -12860,6 +12898,7 @@ actually an xmlCharEncoding'/> </function> <function name='xmlShellWrite' file='debugXML'> <cond>LIBXML_DEBUG_ENABLED</cond> + <cond>LIBXML_XPATH_ENABLED</cond> <cond>LIBXML_OUTPUT_ENABLED</cond> <info>Implements the XML shell function "write" Write the current node to the filename, it saves the serialization of the subtree under the @node specified</info> <return type='int' info='0 or -1 in case of error'/> @@ -15263,12 +15302,12 @@ actually an xmlCharEncoding'/> </function> <function name='xmlUTF8Strpos' file='xmlstring'> <info>a function to provide the equivalent of fetching a character from a string array</info> - <return type='xmlChar *' info='a pointer to the UTF8 character or NULL'/> + <return type='const xmlChar *' info='a pointer to the UTF8 character or NULL'/> <arg name='utf' type='const xmlChar *' info='the input UTF8 *'/> <arg name='pos' type='int' info='the position of the desired UTF8 char (in chars)'/> </function> <function name='xmlUTF8Strsize' file='xmlstring'> - <info>storage size of an UTF8 string</info> + <info>storage size of an UTF8 string the behaviour is not garanteed if the input string is not UTF-8</info> <return type='int' info='the storage size of the first 'len' characters of ARRAY'/> <arg name='utf' type='const xmlChar *' info='a sequence of UTF-8 encoded bytes'/> <arg name='len' type='int' info='the number of characters in the array'/> diff --git a/doc/libxml2.xsa b/doc/libxml2.xsa index d093fb7..a4def81 100644 --- a/doc/libxml2.xsa +++ b/doc/libxml2.xsa @@ -8,19 +8,24 @@ </vendor> <product id="libxml2"> <name>libxml2</name> - <version>2.6.13</version> - <last-release> Aug 31 2004</last-release> + <version>2.6.15</version> + <last-release> Oct 27 2004</last-release> <info-url>http://xmlsoft.org/</info-url> - <changes> - build fixes: Windows and zlib (Igor Zlatkovic), -O flag with gcc, - Solaris compiler warning, fixing RPM BuildRequires, - - fixes: DTD loading on Windows (Igor), Schemas error reports APIs - (Kasimier Buchcik), Schemas validation crash, xmlCheckUTF8 (William Brack - and Julius Mittenzwei), Schemas facet check (Kasimier), default namespace - problem (William), Schemas hexbinary empty values, encoding error could - genrate a serialization loop. - - Improvements: Schemas validity improvements (Kasimier), added --path - and --load-trace options to xmllint - - documentation: tutorial update (John Fleck) + <changes> - security fixes on the nanoftp and nanohttp modules + - build fixes: xmllint detection bug in configure, building outside the + source tree (Thomas Fitzsimmons) + - bug fixes: HTML parser on broken ASCII chars in names (William), Python + paths (Malcolm Tredinnick), xmlHasNsProp and default namespace (William), + saving to python file objects (Malcolm Tredinnick), DTD lookup fix + (Malcolm), save back <group> in catalogs (William), tree build + fixes (DV and Rob Richards), Schemas memory bug, structured error handler + on Python 64bits, thread local memory deallocation, memory leak reported + by Volker Roth, xmlValidateDtd in the presence of an internal subset, + entities and _private problem (William), xmlBuildRelativeURI error + (William). + - improvements: better XInclude error reports (William), tree debugging + module and tests, convenience functions at the Reader API (Graham + Bennett), add support for PI in the HTML parser. </changes> </product> diff --git a/doc/news.html b/doc/news.html index d625f1d..6cbd423 100644 --- a/doc/news.html +++ b/doc/news.html @@ -12,7 +12,17 @@ to help those</p><ul><li>More testing on RelaxNG</li> <li>Finishing up <a href="http://www.w3.org/TR/xmlschema-1/">XML Schemas</a></li> </ul><p>The <a href="ChangeLog.html">change log</a> describes the recents commits -to the <a href="http://cvs.gnome.org/viewcvs/libxml2/">CVS</a> code base.</p><p>There is the list of public releases:</p><p>2.6.15: Oct 27 2004</p><ul><li>security fixes on the nanoftp and nanohttp modules</li> +to the <a href="http://cvs.gnome.org/viewcvs/libxml2/">CVS</a> code base.</p><p>There is the list of public releases:</p><h3>2.6.16: Nov 10 2004</h3><ul><li>general hardening and bug fixing crossing all the API based on new + automated regression testing</li> + <li>build fix: IPv6 build and test on AIX (Dodji Seketeli)</li> + <li>bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding + conversion functions return values, UTF-8 bug affecting XPath reported by + Markus Bertheau, catalog problem with NULL entries (William Brack)</li> + <li>documentation: fix to xmllint man page, some API function descritpion + were updated.</li> + <li>improvements: DTD validation APIs provided at the Python level (Brent + Hendricks) </li> +</ul><h3>2.6.15: Oct 27 2004</h3><ul><li>security fixes on the nanoftp and nanohttp modules</li> <li>build fixes: xmllint detection bug in configure, building outside the source tree (Thomas Fitzsimmons)</li> <li>bug fixes: HTML parser on broken ASCII chars in names (William), Python diff --git a/doc/xml.html b/doc/xml.html index c373b2d..e0e484f 100644 --- a/doc/xml.html +++ b/doc/xml.html @@ -680,7 +680,21 @@ to the <a href="http://cvs.gnome.org/viewcvs/libxml2/">CVS</a> code base.</p> <p>There is the list of public releases:</p> -<p>2.6.15: Oct 27 2004</p> +<h3>2.6.16: Nov 10 2004</h3> +<ul> + <li>general hardening and bug fixing crossing all the API based on new + automated regression testing</li> + <li>build fix: IPv6 build and test on AIX (Dodji Seketeli)</li> + <li>bug fixes: problem with XML::Libxml reported by Petr Pajas, encoding + conversion functions return values, UTF-8 bug affecting XPath reported by + Markus Bertheau, catalog problem with NULL entries (William Brack)</li> + <li>documentation: fix to xmllint man page, some API function descritpion + were updated.</li> + <li>improvements: DTD validation APIs provided at the Python level (Brent + Hendricks) </li> +</ul> + +<h3>2.6.15: Oct 27 2004</h3> <ul> <li>security fixes on the nanoftp and nanohttp modules</li> <li>build fixes: xmllint detection bug in configure, building outside the diff --git a/doc/xmllint.1 b/doc/xmllint.1 index 7d2a513..3875961 100644 --- a/doc/xmllint.1 +++ b/doc/xmllint.1 @@ -31,7 +31,7 @@ xmllint \- command line XML tool .SH "INTRODUCTION" .PP -The xmllint program parses one or more XML files, specified on the command line as \fIxmlfile\fR\&. It prints various types of output, depending upon the options selected\&. It is useful for detecting errors both in XML code and in the XML parser itself\&. +The xmllint program parses one or more XML files, specified on the command line as \fIxmlfile\fR (or the standard input if the filename provided is \- )\&. It prints various types of output, depending upon the options selected\&. It is useful for detecting errors both in XML code and in the XML parser itself\&. .PP It is included in libxml2\&. diff --git a/doc/xmllint.xml b/doc/xmllint.xml index e0ba0ee..8ab468f 100644 --- a/doc/xmllint.xml +++ b/doc/xmllint.xml @@ -104,7 +104,8 @@ <title>Introduction</title> <para> The xmllint program parses one or more XML files, specified on the - command line as <replaceable>xmlfile</replaceable>. It prints various + command line as <replaceable>xmlfile</replaceable> (or the standard + input if the filename provided is - ). It prints various types of output, depending upon the options selected. It is useful for detecting errors both in <acronym>XML</acronym> code and in the <acronym>XML</acronym> parser itself. diff --git a/elfgcchack.h b/elfgcchack.h index 2fd2ee4..3f430fe 100644 --- a/elfgcchack.h +++ b/elfgcchack.h @@ -2154,6 +2154,10 @@ extern __typeof (xmlMallocLoc) xmlMallocLoc__internal_alias __attribute((visibil extern __typeof (xmlMallocLoc) xmlMallocLoc __attribute((alias("xmlMallocLoc__internal_alias"))); #define xmlMallocLoc xmlMallocLoc__internal_alias +extern __typeof (xmlMemBlocks) xmlMemBlocks__internal_alias __attribute((visibility("hidden"))); +extern __typeof (xmlMemBlocks) xmlMemBlocks __attribute((alias("xmlMemBlocks__internal_alias"))); +#define xmlMemBlocks xmlMemBlocks__internal_alias + extern __typeof (xmlMemDisplay) xmlMemDisplay__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlMemDisplay) xmlMemDisplay __attribute((alias("xmlMemDisplay__internal_alias"))); #define xmlMemDisplay xmlMemDisplay__internal_alias @@ -3479,6 +3483,12 @@ extern __typeof (xmlRelaxNGGetValidErrors) xmlRelaxNGGetValidErrors __attribute( #endif #ifdef LIBXML_SCHEMAS_ENABLED +extern __typeof (xmlRelaxNGInitTypes) xmlRelaxNGInitTypes__internal_alias __attribute((visibility("hidden"))); +extern __typeof (xmlRelaxNGInitTypes) xmlRelaxNGInitTypes __attribute((alias("xmlRelaxNGInitTypes__internal_alias"))); +#define xmlRelaxNGInitTypes xmlRelaxNGInitTypes__internal_alias +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED extern __typeof (xmlRelaxNGNewDocParserCtxt) xmlRelaxNGNewDocParserCtxt__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlRelaxNGNewDocParserCtxt) xmlRelaxNGNewDocParserCtxt __attribute((alias("xmlRelaxNGNewDocParserCtxt__internal_alias"))); #define xmlRelaxNGNewDocParserCtxt xmlRelaxNGNewDocParserCtxt__internal_alias @@ -4167,92 +4177,120 @@ extern __typeof (xmlSetupParserForBuffer) xmlSetupParserForBuffer __attribute((a #define xmlSetupParserForBuffer xmlSetupParserForBuffer__internal_alias #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShell) xmlShell__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShell) xmlShell __attribute((alias("xmlShell__internal_alias"))); #define xmlShell xmlShell__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellBase) xmlShellBase__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellBase) xmlShellBase __attribute((alias("xmlShellBase__internal_alias"))); #define xmlShellBase xmlShellBase__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellCat) xmlShellCat__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellCat) xmlShellCat __attribute((alias("xmlShellCat__internal_alias"))); #define xmlShellCat xmlShellCat__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellDir) xmlShellDir__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellDir) xmlShellDir __attribute((alias("xmlShellDir__internal_alias"))); #define xmlShellDir xmlShellDir__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellDu) xmlShellDu__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellDu) xmlShellDu __attribute((alias("xmlShellDu__internal_alias"))); #define xmlShellDu xmlShellDu__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellList) xmlShellList__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellList) xmlShellList __attribute((alias("xmlShellList__internal_alias"))); #define xmlShellList xmlShellList__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellLoad) xmlShellLoad__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellLoad) xmlShellLoad __attribute((alias("xmlShellLoad__internal_alias"))); #define xmlShellLoad xmlShellLoad__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellPrintNode) xmlShellPrintNode__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellPrintNode) xmlShellPrintNode __attribute((alias("xmlShellPrintNode__internal_alias"))); #define xmlShellPrintNode xmlShellPrintNode__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellPrintXPathError) xmlShellPrintXPathError__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellPrintXPathError) xmlShellPrintXPathError __attribute((alias("xmlShellPrintXPathError__internal_alias"))); #define xmlShellPrintXPathError xmlShellPrintXPathError__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellPrintXPathResult) xmlShellPrintXPathResult__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellPrintXPathResult) xmlShellPrintXPathResult __attribute((alias("xmlShellPrintXPathResult__internal_alias"))); #define xmlShellPrintXPathResult xmlShellPrintXPathResult__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellPwd) xmlShellPwd__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellPwd) xmlShellPwd __attribute((alias("xmlShellPwd__internal_alias"))); #define xmlShellPwd xmlShellPwd__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_OUTPUT_ENABLED extern __typeof (xmlShellSave) xmlShellSave__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellSave) xmlShellSave __attribute((alias("xmlShellSave__internal_alias"))); #define xmlShellSave xmlShellSave__internal_alias #endif #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED extern __typeof (xmlShellValidate) xmlShellValidate__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellValidate) xmlShellValidate __attribute((alias("xmlShellValidate__internal_alias"))); #define xmlShellValidate xmlShellValidate__internal_alias #endif +#endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED #ifdef LIBXML_OUTPUT_ENABLED extern __typeof (xmlShellWrite) xmlShellWrite__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlShellWrite) xmlShellWrite __attribute((alias("xmlShellWrite__internal_alias"))); #define xmlShellWrite xmlShellWrite__internal_alias #endif #endif +#endif extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars__internal_alias __attribute((visibility("hidden"))); extern __typeof (xmlSkipBlankChars) xmlSkipBlankChars __attribute((alias("xmlSkipBlankChars__internal_alias"))); @@ -125,7 +125,7 @@ asciiToUTF8(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = processed - base; - return(0); + return(*outlen); } #ifdef LIBXML_OUTPUT_ENABLED @@ -155,6 +155,7 @@ UTF8Toascii(unsigned char* out, int *outlen, unsigned int c, d; int trailing; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1); if (in == NULL) { /* * initialization nothing to do @@ -209,7 +210,7 @@ UTF8Toascii(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = processed - instart; - return(0); + return(*outlen); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -232,10 +233,14 @@ isolat1ToUTF8(unsigned char* out, int *outlen, const unsigned char* in, int *inlen) { unsigned char* outstart = out; const unsigned char* base = in; - unsigned char* outend = out + *outlen; + unsigned char* outend; const unsigned char* inend; const unsigned char* instop; + if ((out == NULL) || (in == NULL) || (outlen == NULL) || (inlen == NULL)) + return(-1); + + outend = out + *outlen; inend = in + (*inlen); instop = inend; @@ -255,7 +260,7 @@ isolat1ToUTF8(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = in - base; - return(0); + return(*outlen); } /** @@ -291,7 +296,7 @@ UTF8ToUTF8(unsigned char* out, int *outlen, *outlen = len; *inlenb = len; - return(0); + return(*outlen); } @@ -322,6 +327,7 @@ UTF8Toisolat1(unsigned char* out, int *outlen, unsigned int c, d; int trailing; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1); if (in == NULL) { /* * initialization nothing to do @@ -381,7 +387,7 @@ UTF8Toisolat1(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = processed - instart; - return(0); + return(*outlen); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -470,7 +476,7 @@ UTF16LEToUTF8(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlenb = processed - inb; - return(0); + return(*outlen); } #ifdef LIBXML_OUTPUT_ENABLED @@ -503,6 +509,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen, unsigned short tmp1, tmp2; /* UTF16LE encoding has no BOM */ + if ((out == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1); if (in == NULL) { *outlen = 0; *inlen = 0; @@ -578,7 +585,7 @@ UTF8ToUTF16LE(unsigned char* outb, int *outlen, } *outlen = (out - outstart) * 2; *inlen = processed - instart; - return(0); + return(*outlen); } /** @@ -710,7 +717,7 @@ UTF16BEToUTF8(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlenb = processed - inb; - return(0); + return(*outlen); } #ifdef LIBXML_OUTPUT_ENABLED @@ -743,6 +750,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen, unsigned short tmp1, tmp2; /* UTF-16BE has no BOM */ + if ((outb == NULL) || (outlen == NULL) || (inlen == NULL)) return(-1); if (in == NULL) { *outlen = 0; *inlen = 0; @@ -815,7 +823,7 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen, } *outlen = (out - outstart) * 2; *inlen = processed - instart; - return(0); + return(*outlen); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -839,6 +847,8 @@ UTF8ToUTF16BE(unsigned char* outb, int *outlen, xmlCharEncoding xmlDetectCharEncoding(const unsigned char* in, int len) { + if (in == NULL) + return(XML_CHAR_ENCODING_NONE); if (len >= 4) { if ((in[0] == 0x00) && (in[1] == 0x00) && (in[2] == 0x00) && (in[3] == 0x3C)) @@ -1653,15 +1663,19 @@ xmlFindCharEncodingHandler(const char *name) { * The value of @outlen after return is the number of ocetes consumed. */ static int -xmlIconvWrapper(iconv_t cd, - unsigned char *out, int *outlen, - const unsigned char *in, int *inlen) { - - size_t icv_inlen = *inlen, icv_outlen = *outlen; +xmlIconvWrapper(iconv_t cd, unsigned char *out, int *outlen, + const unsigned char *in, int *inlen) { + size_t icv_inlen, icv_outlen; const char *icv_in = (const char *) in; char *icv_out = (char *) out; int ret; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || (in == NULL)) { + if (outlen != NULL) *outlen = 0; + return(-1); + } + icv_inlen = *inlen; + icv_outlen = *outlen; ret = iconv(cd, (char **) &icv_in, &icv_inlen, &icv_out, &icv_outlen); if (in != NULL) { *inlen -= icv_inlen; @@ -2154,7 +2168,7 @@ xmlByteConsumed(xmlParserCtxtPtr ctxt) { written = 32000; ret = xmlIconvWrapper(handler->iconv_out, &convbuf[0], &written, cur, &toconv); - if (ret == -1) { + if (ret < 0) { if (written > 0) ret = -2; else @@ -2203,6 +2217,9 @@ UTF8ToISO8859x(unsigned char* out, int *outlen, const unsigned char* inend; const unsigned char* instart = in; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || + (xlattable == NULL)) + return(-1); if (in == NULL) { /* * initialization nothing to do @@ -2290,7 +2307,7 @@ UTF8ToISO8859x(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = in - instart; - return(0); + return(*outlen); } /** @@ -2311,12 +2328,18 @@ ISO8859xToUTF8(unsigned char* out, int *outlen, const unsigned char* in, int *inlen, unsigned short const *unicodetable) { unsigned char* outstart = out; - unsigned char* outend = out + *outlen; + unsigned char* outend; const unsigned char* instart = in; - const unsigned char* inend = in + *inlen; + const unsigned char* inend; const unsigned char* instop = inend; - unsigned int c = *in; + unsigned int c; + if ((out == NULL) || (outlen == NULL) || (inlen == NULL) || + (in == NULL) || (xlattable == NULL)) + return(-1); + outend = out + *outlen; + inend = in + *inlen; + c = *in; while (in < inend && out < outend - 1) { if (c >= 0x80) { c = unicodetable [c - 0x80]; @@ -2350,7 +2373,7 @@ ISO8859xToUTF8(unsigned char* out, int *outlen, } *outlen = out - outstart; *inlen = in - instart; - return (0); + return (*outlen); } @@ -61,6 +61,31 @@ static xmlEntity xmlEntityApos = { NULL, NULL, NULL, NULL, 0 }; +/** + * xmlEntitiesErrMemory: + * @extra: extra informations + * + * Handle an out of memory condition + */ +static void +xmlEntitiesErrMemory(const char *extra) +{ + __xmlSimpleError(XML_FROM_TREE, XML_ERR_NO_MEMORY, NULL, NULL, extra); +} + +/** + * xmlEntitiesErr: + * @code: the error code + * @msg: the message + * + * Handle an out of memory condition + */ +static void +xmlEntitiesErr(xmlParserErrors code, const char *msg) +{ + __xmlSimpleError(XML_FROM_TREE, code, NULL, msg, NULL); +} + /* * xmlFreeEntity : clean-up an entity record. */ @@ -118,8 +143,7 @@ xmlAddEntity(xmlDtdPtr dtd, const xmlChar *name, int type, return(NULL); ret = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlAddEntity: out of memory\n"); + xmlEntitiesErrMemory("xmlAddEntity:: malloc failed"); return(NULL); } memset(ret, 0, sizeof(xmlEntity)); @@ -213,13 +237,13 @@ xmlAddDtdEntity(xmlDocPtr doc, const xmlChar *name, int type, xmlDtdPtr dtd; if (doc == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlAddDtdEntity: doc == NULL !\n"); + xmlEntitiesErr(XML_DTD_NO_DOC, + "xmlAddDtdEntity: document is NULL"); return(NULL); } if (doc->extSubset == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlAddDtdEntity: document without external subset !\n"); + xmlEntitiesErr(XML_DTD_NO_DTD, + "xmlAddDtdEntity: document without external subset"); return(NULL); } dtd = doc->extSubset; @@ -262,13 +286,13 @@ xmlAddDocEntity(xmlDocPtr doc, const xmlChar *name, int type, xmlDtdPtr dtd; if (doc == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlAddDocEntity: document is NULL !\n"); + xmlEntitiesErr(XML_DTD_NO_DOC, + "xmlAddDocEntity: document is NULL"); return(NULL); } if (doc->intSubset == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlAddDocEntity: document without internal subset !\n"); + xmlEntitiesErr(XML_DTD_NO_DTD, + "xmlAddDocEntity: document without internal subset"); return(NULL); } dtd = doc->intSubset; @@ -404,7 +428,7 @@ xmlGetDocEntity(xmlDocPtr doc, const xmlChar *name) { buffer = (xmlChar *) \ xmlRealloc(buffer, buffer_size * sizeof(xmlChar)); \ if (buffer == NULL) { \ - xmlGenericError(xmlGenericErrorContext, "realloc failed\n"); \ + xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: realloc failed");\ return(NULL); \ } \ } @@ -440,7 +464,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { buffer_size = 1000; buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); if (buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed\n"); + xmlEntitiesErrMemory("xmlEncodeEntitiesReentrant: malloc failed"); return(NULL); } out = buffer; @@ -498,8 +522,8 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { int val = 0, l = 1; if (*cur < 0xC0) { - xmlGenericError(xmlGenericErrorContext, - "xmlEncodeEntitiesReentrant : input not UTF-8\n"); + xmlEntitiesErr(XML_CHECK_NOT_UTF8, + "xmlEncodeEntitiesReentrant : input not UTF-8"); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); snprintf(buf, sizeof(buf), "&#%d;", *cur); @@ -531,7 +555,7 @@ xmlEncodeEntitiesReentrant(xmlDocPtr doc, const xmlChar *input) { l = 4; } if ((l == 1) || (!IS_CHAR(val))) { - xmlGenericError(xmlGenericErrorContext, + xmlEntitiesErr(XML_ERR_INVALID_CHAR, "xmlEncodeEntitiesReentrant : char out of range\n"); if (doc != NULL) doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1"); @@ -593,7 +617,7 @@ xmlEncodeSpecialChars(xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *input) { buffer_size = 1000; buffer = (xmlChar *) xmlMalloc(buffer_size * sizeof(xmlChar)); if (buffer == NULL) { - xmlGenericError(xmlGenericErrorContext, "malloc failed\n"); + xmlEntitiesErrMemory("xmlEncodeSpecialChars: malloc failed"); return(NULL); } out = buffer; @@ -703,8 +727,7 @@ xmlCopyEntity(xmlEntityPtr ent) { cur = (xmlEntityPtr) xmlMalloc(sizeof(xmlEntity)); if (cur == NULL) { - xmlGenericError(xmlGenericErrorContext, - "xmlCopyEntity: out of memory !\n"); + xmlEntitiesErrMemory("xmlCopyEntity:: malloc failed"); return(NULL); } memset(cur, 0, sizeof(xmlEntity)); @@ -792,6 +815,7 @@ xmlDumpEntityContent(xmlBufferPtr buf, const xmlChar *content) { */ void xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) { + if ((buf == NULL) || (ent == NULL)) return; switch (ent->etype) { case XML_INTERNAL_GENERAL_ENTITY: xmlBufferWriteChar(buf, "<!ENTITY "); @@ -863,9 +887,8 @@ xmlDumpEntityDecl(xmlBufferPtr buf, xmlEntityPtr ent) { xmlBufferWriteChar(buf, ">\n"); break; default: - xmlGenericError(xmlGenericErrorContext, - "xmlDumpEntitiesDecl: internal: unknown type %d\n", - ent->etype); + xmlEntitiesErr(XML_DTD_UNKNOWN_ENTITY, + "xmlDumpEntitiesDecl: internal: unknown type entity type"); } } diff --git a/gentest.py b/gentest.py new file mode 100755 index 0000000..8975cd9 --- /dev/null +++ b/gentest.py @@ -0,0 +1,889 @@ +#!/usr/bin/python -u +# +# generate a tester program for the API +# +import sys +import os +import string +try: + import libxml2 +except: + print "libxml2 python bindings not available, skipping testapi.c generation" + sys.exit(0) + +# +# Modules we don't want skip in API test +# +skipped_modules = [ "SAX", "xlink", "threads", "globals", + "xmlmemory", "xmlversion", "xmlexports", + #deprecated + "DOCBparser", +] + +# +# defines for each module +# +modules_defines = { + "HTMLparser": "LIBXML_HTML_ENABLED", + "catalog": "LIBXML_CATALOG_ENABLED", + "xmlreader": "LIBXML_READER_ENABLED", + "relaxng": "LIBXML_SCHEMAS_ENABLED", + "schemasInternals": "LIBXML_SCHEMAS_ENABLED", + "xmlschemas": "LIBXML_SCHEMAS_ENABLED", + "xmlschemastypes": "LIBXML_SCHEMAS_ENABLED", + "xpath": "LIBXML_XPATH_ENABLED", + "xpathInternals": "LIBXML_XPATH_ENABLED", + "xinclude": "LIBXML_XINCLUDE_ENABLED", + "xpointer": "LIBXML_XPTR_ENABLED", + "xmlregexp" : "LIBXML_REGEXP_ENABLED", + "xmlautomata" : "LIBXML_AUTOMATA_ENABLED", + "xmlsave" : "LIBXML_OUTPUT_ENABLED", + "DOCBparser" : "LIBXML_DOCB_ENABLED", +} + +# +# defines for specific functions +# +function_defines = { + "htmlDefaultSAXHandlerInit": "LIBXML_HTML_ENABLED", + "xmlSAX2EndElement" : "LIBXML_SAX1_ENABLED", + "xmlSAX2StartElement" : "LIBXML_SAX1_ENABLED", + "xmlSAXDefaultVersion" : "LIBXML_SAX1_ENABLED", + "UTF8Toisolat1" : "LIBXML_OUTPUT_ENABLED", + "xmlCleanupPredefinedEntities": "LIBXML_LEGACY_ENABLED", + "xmlInitializePredefinedEntities": "LIBXML_LEGACY_ENABLED", + "xmlSetFeature": "LIBXML_LEGACY_ENABLED", + "xmlGetFeature": "LIBXML_LEGACY_ENABLED", + "xmlGetFeaturesList": "LIBXML_LEGACY_ENABLED", + "xmlIOParseDTD": "LIBXML_VALID_ENABLED", + "xmlParseDTD": "LIBXML_VALID_ENABLED", + "xmlParseDoc": "LIBXML_SAX1_ENABLED", + "xmlParseMemory": "LIBXML_SAX1_ENABLED", + "xmlRecoverDoc": "LIBXML_SAX1_ENABLED", + "xmlParseFile": "LIBXML_SAX1_ENABLED", + "xmlRecoverFile": "LIBXML_SAX1_ENABLED", + "xmlRecoverMemory": "LIBXML_SAX1_ENABLED", + "xmlSAXParseFileWithData": "LIBXML_SAX1_ENABLED", + "xmlSAXParseMemory": "LIBXML_SAX1_ENABLED", + "xmlSAXUserParseMemory": "LIBXML_SAX1_ENABLED", + "xmlSAXParseDoc": "LIBXML_SAX1_ENABLED", + "xmlSAXParseDTD": "LIBXML_SAX1_ENABLED", + "xmlSAXUserParseFile": "LIBXML_SAX1_ENABLED", + "xmlParseEntity": "LIBXML_SAX1_ENABLED", + "xmlParseExternalEntity": "LIBXML_SAX1_ENABLED", + "xmlSAXParseMemoryWithData": "LIBXML_SAX1_ENABLED", + "xmlParseBalancedChunkMemory": "LIBXML_SAX1_ENABLED", + "xmlParseBalancedChunkMemoryRecover": "LIBXML_SAX1_ENABLED", + "xmlSetupParserForBuffer": "LIBXML_SAX1_ENABLED", + "xmlStopParser": "LIBXML_PUSH_ENABLED", + "xmlAttrSerializeTxtContent": "LIBXML_OUTPUT_ENABLED", + "xmlSAXParseFile": "LIBXML_SAX1_ENABLED", + "xmlSAXParseEntity": "LIBXML_SAX1_ENABLED", + "xmlNewTextChild": "LIBXML_TREE_ENABLED", + "xmlNewDocRawNode": "LIBXML_TREE_ENABLED", + "xmlNewProp": "LIBXML_TREE_ENABLED", + "xmlReconciliateNs": "LIBXML_TREE_ENABLED", + "xmlValidateNCName": "LIBXML_TREE_ENABLED", + "xmlValidateNMToken": "LIBXML_TREE_ENABLED", + "xmlValidateName": "LIBXML_TREE_ENABLED", + "xmlNewChild": "LIBXML_TREE_ENABLED", + "xmlValidateQName": "LIBXML_TREE_ENABLED", + "xmlSprintfElementContent": "LIBXML_OUTPUT_ENABLED", + "xmlValidGetPotentialChildren" : "LIBXML_VALID_ENABLED", + "xmlValidGetValidElements" : "LIBXML_VALID_ENABLED", + "docbDefaultSAXHandlerInit" : "LIBXML_DOCB_ENABLED", + "xmlTextReaderPreservePattern" : "LIBXML_PATTERN_ENABLED", +} + +# +# Some function really need to be skipped for the tests. +# +skipped_functions = [ +# block on I/O +"xmlFdRead", "xmlReadFd", "xmlCtxtReadFd", +"htmlFdRead", "htmlReadFd", "htmlCtxtReadFd", +"xmlReaderNewFd", "xmlReaderForFd", +"xmlIORead", "xmlReadIO", "xmlCtxtReadIO", +"htmlIORead", "htmlReadIO", "htmlCtxtReadIO", +"xmlReaderNewIO", "xmlBufferDump", "xmlNanoFTPConnect", +"xmlNanoFTPConnectTo", +# Complex I/O APIs +"xmlCreateIOParserCtxt", "xmlParserInputBufferCreateIO", +"xmlRegisterInputCallbacks", "xmlReaderForIO", +"xmlOutputBufferCreateIO", "xmlRegisterOutputCallbacks", +"xmlSaveToIO", +# library state cleanup, generate false leak informations and other +# troubles, heavillyb tested otherwise. +"xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc", +"xmlSetTreeDoc", "xmlUnlinkNode", +# hard to avoid leaks in the tests +"xmlStrcat", "xmlStrncat", "xmlCatalogAddLocal", "xmlNewTextWriterDoc", +"xmlXPathNewValueTree", "xmlXPathWrapString", +# unimplemented +"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml", +"xmlTextReaderReadString", +# destructor +"xmlListDelete", "xmlOutputBufferClose", "xmlNanoFTPClose", +# deprecated +"xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities", +"xmlNewGlobalNs", "xmlHandleEntity", "xmlNamespaceParseNCName", +"xmlNamespaceParseNSDef", "xmlNamespaceParseQName", +"xmlParseNamespace", "xmlParseQuotedString", "xmlParserHandleReference", +"xmlScanName", +"xmlDecodeEntities", +# allocators +"xmlMemFree", +# verbosity +"xmlCatalogSetDebug", "xmlShellPrintXPathError", "xmlShellPrintNode", +# Internal functions, no user space should really call them +"xmlParseAttribute", "xmlParseAttributeListDecl", "xmlParseName", +"xmlParseNmtoken", "xmlParseEntityValue", "xmlParseAttValue", +"xmlParseSystemLiteral", "xmlParsePubidLiteral", "xmlParseCharData", +"xmlParseExternalID", "xmlParseComment", "xmlParsePITarget", "xmlParsePI", +"xmlParseNotationDecl", "xmlParseEntityDecl", "xmlParseDefaultDecl", +"xmlParseNotationType", "xmlParseEnumerationType", "xmlParseEnumeratedType", +"xmlParseAttributeType", "xmlParseAttributeListDecl", +"xmlParseElementMixedContentDecl", "xmlParseElementChildrenContentDecl", +"xmlParseElementContentDecl", "xmlParseElementDecl", "xmlParseMarkupDecl", +"xmlParseCharRef", "xmlParseEntityRef", "xmlParseReference", +"xmlParsePEReference", "xmlParseDocTypeDecl", "xmlParseAttribute", +"xmlParseStartTag", "xmlParseEndTag", "xmlParseCDSect", "xmlParseContent", +"xmlParseElement", "xmlParseVersionNum", "xmlParseVersionInfo", +"xmlParseEncName", "xmlParseEncodingDecl", "xmlParseSDDecl", +"xmlParseXMLDecl", "xmlParseTextDecl", "xmlParseMisc", +"xmlParseExternalSubset", "xmlParserHandlePEReference", +"xmlSkipBlankChars", +] + +# +# Those functions have side effect on the global state +# and hence generate errors on memory allocation tests +# +skipped_memcheck = [ "xmlLoadCatalog", "xmlAddEncodingAlias", + "xmlSchemaInitTypes", "xmlNanoFTPProxy", "xmlNanoFTPScanProxy", + "xmlNanoHTTPScanProxy", "xmlResetLastError", "xmlCatalogConvert", + "xmlCatalogRemove", "xmlLoadCatalogs", "xmlCleanupCharEncodingHandlers", + "xmlInitCharEncodingHandlers", "xmlCatalogCleanup", + "xmlSchemaGetBuiltInType", + "htmlParseFile", # loads the catalogs +] + +# +# Extra code needed for some test cases +# +extra_pre_call = { + "xmlSAXUserParseFile": """ +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif +""", + "xmlSAXUserParseMemory": """ +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif +""", + "xmlParseBalancedChunkMemory": """ +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif +""", + "xmlParseBalancedChunkMemoryRecover": """ +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif +""", + "xmlParserInputBufferCreateFd": + "if (fd >= 0) fd = -1;", +} +extra_post_call = { + "xmlAddChild": + "if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }", + "xmlAddChildList": + "if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }", + "xmlAddSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlAddNextSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlAddPrevSibling": + "if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }", + "xmlDocSetRootElement": + "if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }", + "xmlReplaceNode": + """if (cur != NULL) { + xmlUnlinkNode(cur); + xmlFreeNode(cur) ; cur = NULL ; } + if (old != NULL) { + xmlUnlinkNode(old); + xmlFreeNode(old) ; old = NULL ; } + ret_val = NULL;""", + "xmlTextMerge": + """if ((first != NULL) && (first->type != XML_TEXT_NODE)) { + xmlUnlinkNode(second); + xmlFreeNode(second) ; second = NULL ; }""", + "xmlBuildQName": + """if ((ret_val != NULL) && (ret_val != ncname) && + (ret_val != prefix) && (ret_val != memory)) + xmlFree(ret_val); + ret_val = NULL;""", + "xmlDictReference": "xmlDictFree(dict);", + # Functions which deallocates one of their parameters + "xmlXPathConvertBoolean": """val = NULL;""", + "xmlXPathConvertNumber": """val = NULL;""", + "xmlXPathConvertString": """val = NULL;""", + "xmlSaveFileTo": """buf = NULL;""", + "xmlSaveFormatFileTo": """buf = NULL;""", + "xmlIOParseDTD": "input = NULL;", + "xmlRemoveProp": "cur = NULL;", + "xmlNewNs": "if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);", + "xmlCopyNamespace": "if (ret_val != NULL) xmlFreeNs(ret_val);", + "xmlCopyNamespaceList": "if (ret_val != NULL) xmlFreeNsList(ret_val);", + "xmlNewTextWriter": "if (ret_val != NULL) out = NULL;", + "xmlNewTextWriterPushParser": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;", + "xmlNewIOInputStream": "if (ret_val != NULL) input = NULL;", + "htmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", + "htmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", + "xmlParseDocument": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", + "xmlParseChunk": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", + "xmlParseExtParsedEnt": "if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}", +} + +modules = [] + +def is_skipped_module(name): + for mod in skipped_modules: + if mod == name: + return 1 + return 0 + +def is_skipped_function(name): + for fun in skipped_functions: + if fun == name: + return 1 + # Do not test destructors + if string.find(name, 'Free') != -1: + return 1 + return 0 + +def is_skipped_memcheck(name): + for fun in skipped_memcheck: + if fun == name: + return 1 + return 0 + +missing_types = {} +def add_missing_type(name, func): + try: + list = missing_types[name] + list.append(func) + except: + missing_types[name] = [func] + +generated_param_types = [] +def add_generated_param_type(name): + generated_param_types.append(name) + +generated_return_types = [] +def add_generated_return_type(name): + generated_return_types.append(name) + +missing_functions = {} +missing_functions_nr = 0 +def add_missing_functions(name, module): + global missing_functions_nr + + missing_functions_nr = missing_functions_nr + 1 + try: + list = missing_functions[module] + list.append(name) + except: + missing_functions[module] = [name] + +# +# Provide the type generators and destructors for the parameters +# + +def type_convert(str, name, info, module, function, pos): +# res = string.replace(str, " ", " ") +# res = string.replace(str, " ", " ") +# res = string.replace(str, " ", " ") + res = string.replace(str, " *", "_ptr") +# res = string.replace(str, "*", "_ptr") + res = string.replace(res, " ", "_") + if res == 'const_char_ptr': + if string.find(name, "file") != -1 or \ + string.find(name, "uri") != -1 or \ + string.find(name, "URI") != -1 or \ + string.find(info, "filename") != -1 or \ + string.find(info, "URI") != -1 or \ + string.find(info, "URL") != -1: + if string.find(function, "Save") != -1 or \ + string.find(function, "Create") != -1 or \ + string.find(function, "Write") != -1: + return('fileoutput') + return('filepath') + if res == 'void_ptr': + if module == 'nanoftp' and name == 'ctx': + return('xmlNanoFTPCtxtPtr') + if function == 'xmlNanoFTPNewCtxt': + return('xmlNanoFTPCtxtPtr') + if module == 'nanohttp' and name == 'ctx': + return('xmlNanoHTTPCtxtPtr') + if function == 'xmlIOHTTPOpenW': + return('xmlNanoHTTPCtxtPtr') + if string.find(name, "data") != -1: + return('userdata'); + if string.find(name, "user") != -1: + return('userdata'); + if res == 'xmlDoc_ptr': + res = 'xmlDocPtr'; + if res == 'xmlNode_ptr': + res = 'xmlNodePtr'; + if res == 'xmlDict_ptr': + res = 'xmlDictPtr'; + if res == 'xmlNodePtr' and pos != 0: + if (function == 'xmlAddChild' and pos == 2) or \ + (function == 'xmlAddChildList' and pos == 2) or \ + (function == 'xmlAddNextSibling' and pos == 2) or \ + (function == 'xmlAddSibling' and pos == 2) or \ + (function == 'xmlDocSetRootElement' and pos == 2) or \ + (function == 'xmlReplaceNode' and pos == 2) or \ + (function == 'xmlTextMerge') or \ + (function == 'xmlAddPrevSibling' and pos == 2): + return('xmlNodePtr_in'); + if res == 'const xmlBufferPtr': + res = 'xmlBufferPtr'; + if res == 'xmlChar_ptr' and name == 'name' and \ + string.find(function, "EatName") != -1: + return('eaten_name') + if res == 'void_ptr*': + res = 'void_ptr_ptr' + if res == 'char_ptr*': + res = 'char_ptr_ptr' + if res == 'xmlChar_ptr*': + res = 'xmlChar_ptr_ptr' + if res == 'const_xmlChar_ptr*': + res = 'const_xmlChar_ptr_ptr' + if res == 'const_char_ptr*': + res = 'const_char_ptr_ptr' + if res == 'FILE_ptr' and module == 'debugXML': + res = 'debug_FILE_ptr'; + if res == 'int' and name == 'options': + if module == 'parser' or module == 'xmlreader': + res = 'parseroptions' + + return res + +known_param_types = [] + +def is_known_param_type(name, rtype): + global test + for type in known_param_types: + if type == name: + return 1 + for type in generated_param_types: + if type == name: + return 1 + + if name[-3:] == 'Ptr' or name[-4:] == '_ptr': + if rtype[0:6] == 'const ': + crtype = rtype[6:] + else: + crtype = rtype + + define = 0 + if modules_defines.has_key(module): + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 + test.write(""" +#define gen_nb_%s 1 +static %s gen_%s(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +""" % (name, crtype, name, name, rtype)) + if define == 1: + test.write("#endif\n\n") + add_generated_param_type(name) + return 1 + + return 0 + +# +# Provide the type destructors for the return values +# + +known_return_types = [] + +def is_known_return_type(name): + for type in known_return_types: + if type == name: + return 1 + return 0 + +# +# Copy the beginning of the C test program result +# + +input = open("testapi.c", "r") +test = open('testapi.c.new', 'w') + +def compare_and_save(): + global test + + test.close() + input = open("testapi.c", "r").read() + test = open('testapi.c.new', "r").read() + if input != test: + os.system("rm testapi.c ; mv testapi.c.new testapi.c") + print("Updated testapi.c") + else: + print("Generated testapi.c is identical") + +line = input.readline() +while line != "": + if line == "/* CUT HERE: everything below that line is generated */\n": + break; + if line[0:15] == "#define gen_nb_": + type = string.split(line[15:])[0] + known_param_types.append(type) + if line[0:19] == "static void desret_": + type = string.split(line[19:], '(')[0] + known_return_types.append(type) + test.write(line) + line = input.readline() +input.close() + +if line == "": + print "Could not find the CUT marker in testapi.c skipping generation" + test.close() + sys.exit(0) + +print("Scanned testapi.c: found %d parameters types and %d return types\n" % ( + len(known_param_types), len(known_return_types))) +test.write("/* CUT HERE: everything below that line is generated */\n") + + +# +# Open the input API description +# +doc = libxml2.readFile('doc/libxml2-api.xml', None, 0) +if doc == None: + print "Failed to load doc/libxml2-api.xml" + sys.exit(1) +ctxt = doc.xpathNewContext() + +# +# Generate constructors and return type handling for all enums +# +enums = ctxt.xpathEval("/api/symbols/typedef[@type='enum']") +for enum in enums: + name = enum.xpathEval('string(@name)') + if name == None: + continue; + module = enum.xpathEval('string(@file)') + define = 0 + + if is_known_param_type(name, name) == 0: + values = ctxt.xpathEval("/api/symbols/enum[@type='%s']" % name) + i = 0 + vals = [] + for value in values: + vname = value.xpathEval('string(@name)') + if vname == None: + continue; + i = i + 1 + if i >= 5: + break; + vals.append(vname) + if vals == []: + print "Didn't found any value for enum %s" % (name) + continue + if modules_defines.has_key(module): + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 + test.write("#define gen_nb_%s %d\n" % (name, len(vals))) + test.write("""static %s gen_%s(int no, int nr ATTRIBUTE_UNUSED) {\n""" % + (name, name)) + i = 1 + for value in vals: + test.write(" if (no == %d) return(%s);\n" % (i, value)) + i = i + 1 + test.write(""" return(0); +} +"""); + known_param_types.append(name) + + if is_known_return_type(name) == 0: + if define == 0 and modules_defines.has_key(module): + test.write("#ifdef %s\n" % (modules_defines[module])) + define = 1 + test.write("""static void des_%s(int no ATTRIBUTE_UNUSED, %s val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_%s(%s val ATTRIBUTE_UNUSED) { +} + +""" % (name, name, name, name)) + known_return_types.append(name) + if define == 1: + test.write("#endif\n\n") + +# +# Load the interfaces +# +headers = ctxt.xpathEval("/api/files/file") +for file in headers: + name = file.xpathEval('string(@name)') + if (name == None) or (name == ''): + continue + + # + # Some module may be skipped because they don't really consists + # of user callable APIs + # + if is_skipped_module(name): + continue + + # + # do not test deprecated APIs + # + desc = file.xpathEval('string(description)') + if string.find(desc, 'DEPRECATED') != -1: + print "Skipping deprecated interface %s" % name + continue; + + test.write("#include <libxml/%s.h>\n" % name) + modules.append(name) + +# +# Generate the callers signatures +# +for module in modules: + test.write("static int test_%s(void);\n" % module); + +# +# Generate the top caller +# + +test.write(""" +/** + * testlibxml2: + * + * Main entry point of the tester for the full libxml2 module, + * it calls all the tester entry point for each module. + * + * Returns the number of error found + */ +static int +testlibxml2(void) +{ + int test_ret = 0; + +""") + +for module in modules: + test.write(" test_ret += test_%s();\n" % module) + +test.write(""" + printf("Total: %d functions, %d tests, %d errors\\n", + function_tests, call_tests, test_ret); + return(test_ret); +} + +""") + +# +# How to handle a function +# +nb_tests = 0 + +def generate_test(module, node): + global test + global nb_tests + nb_cond = 0 + no_gen = 0 + + name = node.xpathEval('string(@name)') + if is_skipped_function(name): + return + + # + # check we know how to handle the args and return values + # and store the informations for the generation + # + try: + args = node.xpathEval("arg") + except: + args = [] + t_args = [] + n = 0 + for arg in args: + n = n + 1 + rtype = arg.xpathEval("string(@type)") + if rtype == 'void': + break; + info = arg.xpathEval("string(@info)") + nam = arg.xpathEval("string(@name)") + type = type_convert(rtype, nam, info, module, name, n) + if is_known_param_type(type, rtype) == 0: + add_missing_type(type, name); + no_gen = 1 + t_args.append((nam, type, rtype, info)) + + try: + rets = node.xpathEval("return") + except: + rets = [] + t_ret = None + for ret in rets: + rtype = ret.xpathEval("string(@type)") + info = ret.xpathEval("string(@info)") + type = type_convert(rtype, 'return', info, module, name, 0) + if rtype == 'void': + break + if is_known_return_type(type) == 0: + add_missing_type(type, name); + no_gen = 1 + t_ret = (type, rtype, info) + break + + test.write(""" +static int +test_%s(void) { + int test_ret = 0; + +""" % (name)) + + if no_gen == 1: + add_missing_functions(name, module) + test.write(""" + /* missing type support */ + return(test_ret); +} + +""") + return + + try: + conds = node.xpathEval("cond") + for cond in conds: + test.write("#ifdef %s\n" % (cond.get_content())) + nb_cond = nb_cond + 1 + except: + pass + + define = 0 + if function_defines.has_key(name): + test.write("#ifdef %s\n" % (function_defines[name])) + define = 1 + + # Declare the memory usage counter + no_mem = is_skipped_memcheck(name) + if no_mem == 0: + test.write(" int mem_base;\n"); + + # Declare the return value + if t_ret != None: + test.write(" %s ret_val;\n" % (t_ret[1])) + + # Declare the arguments + for arg in t_args: + (nam, type, rtype, info) = arg; + if (type[-3:] == 'Ptr' or type[-4:] == '_ptr') and \ + rtype[0:6] == 'const ': + crtype = rtype[6:] + else: + crtype = rtype + # add declaration + test.write(" %s %s; /* %s */\n" % (crtype, nam, info)) + test.write(" int n_%s;\n" % (nam)) + test.write("\n") + + # Cascade loop on of each argument list of values + for arg in t_args: + (nam, type, rtype, info) = arg; + # + test.write(" for (n_%s = 0;n_%s < gen_nb_%s;n_%s++) {\n" % ( + nam, nam, type, nam)) + + # log the memory usage + if no_mem == 0: + test.write(" mem_base = xmlMemBlocks();\n"); + + # prepare the call + i = 0; + for arg in t_args: + (nam, type, rtype, info) = arg; + # + test.write(" %s = gen_%s(n_%s, %d);\n" % (nam, type, nam, i)) + i = i + 1; + + # do the call, and clanup the result + if extra_pre_call.has_key(name): + test.write(" %s\n"% (extra_pre_call[name])) + if t_ret != None: + test.write("\n ret_val = %s(" % (name)) + need = 0 + for arg in t_args: + (nam, type, rtype, info) = arg + if need: + test.write(", ") + else: + need = 1 + test.write("%s" % nam); + test.write(");\n") + if extra_post_call.has_key(name): + test.write(" %s\n"% (extra_post_call[name])) + test.write(" desret_%s(ret_val);\n" % t_ret[0]) + else: + test.write("\n %s(" % (name)); + need = 0; + for arg in t_args: + (nam, type, rtype, info) = arg; + if need: + test.write(", ") + else: + need = 1 + test.write("%s" % nam) + test.write(");\n") + if extra_post_call.has_key(name): + test.write(" %s\n"% (extra_post_call[name])) + + test.write(" call_tests++;\n"); + + # Free the arguments + i = 0; + for arg in t_args: + (nam, type, rtype, info) = arg; + # + test.write(" des_%s(n_%s, %s, %d);\n" % (type, nam, nam, i)) + i = i + 1; + + test.write(" xmlResetLastError();\n"); + # Check the memory usage + if no_mem == 0: + test.write(""" if (mem_base != xmlMemBlocks()) { + printf("Leak of %%d blocks found in %s", + xmlMemBlocks() - mem_base); + test_ret++; +""" % (name)); + for arg in t_args: + (nam, type, rtype, info) = arg; + test.write(""" printf(" %%d", n_%s);\n""" % (nam)) + test.write(""" printf("\\n");\n""") + test.write(" }\n") + + for arg in t_args: + test.write(" }\n") + + test.write(" function_tests++;\n") + # + # end of conditional + # + while nb_cond > 0: + test.write("#endif\n") + nb_cond = nb_cond -1 + if define == 1: + test.write("#endif\n") + + nb_tests = nb_tests + 1; + + test.write(""" + return(test_ret); +} + +""") + +# +# Generate all module callers +# +for module in modules: + # gather all the functions exported by that module + try: + functions = ctxt.xpathEval("/api/symbols/function[@file='%s']" % (module)) + except: + print "Failed to gather functions from module %s" % (module) + continue; + + # iterate over all functions in the module generating the test + i = 0 + nb_tests_old = nb_tests + for function in functions: + i = i + 1 + generate_test(module, function); + + # header + test.write("""static int +test_%s(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing %s : %d of %d functions ...\\n"); +""" % (module, module, nb_tests - nb_tests_old, i)) + + # iterate over all functions in the module generating the call + for function in functions: + name = function.xpathEval('string(@name)') + if is_skipped_function(name): + continue + test.write(" test_ret += test_%s();\n" % (name)) + + # footer + test.write(""" + if (test_ret != 0) + printf("Module %s: %%d errors\\n", test_ret); + return(test_ret); +} +""" % (module)) + +# +# Generate direct module caller +# +test.write("""static int +test_module(const char *module) { +"""); +for module in modules: + test.write(""" if (!strcmp(module, "%s")) return(test_%s());\n""" % ( + module, module)) +test.write(""" return(0); +} +"""); + +print "Generated test for %d modules and %d functions" %(len(modules), nb_tests) + +compare_and_save() + +missing_list = [] +for missing in missing_types.keys(): + if missing == 'va_list' or missing == '...': + continue; + + n = len(missing_types[missing]) + missing_list.append((n, missing)) + +def compare_missing(a, b): + return b[0] - a[0] + +missing_list.sort(compare_missing) +print "Missing support for %d functions and %d types see missing.lst" % (missing_functions_nr, len(missing_list)) +lst = open("missing.lst", "w") +lst.write("Missing support for %d types" % (len(missing_list))) +lst.write("\n") +for miss in missing_list: + lst.write("%s: %d :" % (miss[1], miss[0])) + i = 0 + for n in missing_types[miss[1]]: + i = i + 1 + if i > 5: + lst.write(" ...") + break + lst.write(" %s" % (n)) + lst.write("\n") +lst.write("\n") +lst.write("\n") +lst.write("Missing support per module"); +for module in missing_functions.keys(): + lst.write("module %s:\n %s\n" % (module, missing_functions[module])) + +lst.close() + + diff --git a/include/libxml/catalog.h b/include/libxml/catalog.h index 2996330..b444137 100644 --- a/include/libxml/catalog.h +++ b/include/libxml/catalog.h @@ -21,6 +21,7 @@ #include <libxml/xmlversion.h> #include <libxml/xmlstring.h> +#include <libxml/tree.h> #ifdef LIBXML_CATALOG_ENABLED diff --git a/include/libxml/debugXML.h b/include/libxml/debugXML.h index d3b123c..733ccd4 100644 --- a/include/libxml/debugXML.h +++ b/include/libxml/debugXML.h @@ -91,6 +91,7 @@ XMLPUBFUN const char * XMLCALL * * ****************************************************************/ +#ifdef LIBXML_XPATH_ENABLED /** * xmlShellReadlineFunc: * @prompt: a string prompt @@ -204,6 +205,8 @@ XMLPUBFUN void XMLCALL xmlShellReadlineFunc input, FILE *output); +#endif /* LIBXML_XPATH_ENABLED */ + #ifdef __cplusplus } #endif diff --git a/include/libxml/nanoftp.h b/include/libxml/nanoftp.h index 95280db..e3c28a0 100644 --- a/include/libxml/nanoftp.h +++ b/include/libxml/nanoftp.h @@ -109,10 +109,10 @@ XMLPUBFUN int XMLCALL */ XMLPUBFUN int XMLCALL xmlNanoFTPCwd (void *ctx, - char *directory); + const char *directory); XMLPUBFUN int XMLCALL xmlNanoFTPDele (void *ctx, - char *file); + const char *file); XMLPUBFUN int XMLCALL xmlNanoFTPGetConnection (void *ctx); @@ -122,7 +122,7 @@ XMLPUBFUN int XMLCALL xmlNanoFTPList (void *ctx, ftpListCallback callback, void *userData, - char *filename); + const char *filename); XMLPUBFUN int XMLCALL xmlNanoFTPGetSocket (void *ctx, const char *filename); diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h index 3254400..ca3c13b 100644 --- a/include/libxml/relaxng.h +++ b/include/libxml/relaxng.h @@ -94,6 +94,12 @@ typedef enum { XML_RELAXNGP_FREE_DOC = 1, XML_RELAXNGP_CRNG = 2 } xmlRelaxNGParserFlag; + +XMLPUBFUN int XMLCALL + xmlRelaxNGInitTypes (void); +XMLPUBFUN void XMLCALL + xmlRelaxNGCleanupTypes (void); + /* * Interfaces for parsing. */ @@ -153,8 +159,6 @@ XMLPUBFUN void XMLCALL XMLPUBFUN int XMLCALL xmlRelaxNGValidateDoc (xmlRelaxNGValidCtxtPtr ctxt, xmlDocPtr doc); -XMLPUBFUN void XMLCALL - xmlRelaxNGCleanupTypes (void); /* * Interfaces for progressive validation when possible */ diff --git a/include/libxml/valid.h b/include/libxml/valid.h index a734902..99777d1 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -58,6 +58,21 @@ typedef void (*xmlValidityWarningFunc) (void *ctx, const char *msg, ...); +#ifdef IN_LIBXML +/** + * XML_CTXT_FINISH_DTD_0: + * + * Special value for finishDtd field when embedded in an xmlParserCtxt + */ +#define XML_CTXT_FINISH_DTD_0 0xabcd1234 +/** + * XML_CTXT_FINISH_DTD_1: + * + * Special value for finishDtd field when embedded in an xmlParserCtxt + */ +#define XML_CTXT_FINISH_DTD_1 0xabcd1235 +#endif + /* * xmlValidCtxt: * An xmlValidCtxt is used for error reporting when validating. @@ -75,7 +90,7 @@ struct _xmlValidCtxt { int nodeMax; /* Max depth of the parsing stack */ xmlNodePtr *nodeTab; /* array of nodes */ - int finishDtd; /* finished validating the Dtd ? */ + unsigned int finishDtd; /* finished validating the Dtd ? */ xmlDocPtr doc; /* the document */ int valid; /* temporary validity check result */ diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index d893369..29fe748 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -58,7 +58,8 @@ typedef enum { XML_FROM_C14N, /* The Canonicalization module */ XML_FROM_XSLT, /* The XSLT engine from libxslt */ XML_FROM_VALID, /* The XML DTD validation with valid context */ - XML_FROM_CHECK /* The error checking module */ + XML_FROM_CHECK, /* The error checking module */ + XML_FROM_WRITER /* The xmlwriter module */ } xmlErrorDomain; /** diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h index 0e6a767..235721c 100644 --- a/include/libxml/xmlmemory.h +++ b/include/libxml/xmlmemory.h @@ -139,6 +139,8 @@ XMLPUBFUN void XMLCALL */ XMLPUBFUN int XMLCALL xmlMemUsed (void); +XMLPUBFUN int XMLCALL + xmlMemBlocks (void); XMLPUBFUN void XMLCALL xmlMemDisplay (FILE *fp); XMLPUBFUN void XMLCALL diff --git a/include/libxml/xmlstring.h b/include/libxml/xmlstring.h index 74ae405..39f846e 100644 --- a/include/libxml/xmlstring.h +++ b/include/libxml/xmlstring.h @@ -117,7 +117,7 @@ XMLPUBFUN int XMLCALL XMLPUBFUN xmlChar * XMLCALL xmlUTF8Strndup (const xmlChar *utf, int len); -XMLPUBFUN xmlChar * XMLCALL +XMLPUBFUN const xmlChar * XMLCALL xmlUTF8Strpos (const xmlChar *utf, int pos); XMLPUBFUN int XMLCALL diff --git a/include/libxml/xmlversion.h b/include/libxml/xmlversion.h index 5939cba..5814bf9 100644 --- a/include/libxml/xmlversion.h +++ b/include/libxml/xmlversion.h @@ -29,28 +29,28 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * * the version string like "1.2.3" */ -#define LIBXML_DOTTED_VERSION "2.6.15" +#define LIBXML_DOTTED_VERSION "2.6.16" /** * LIBXML_VERSION: * * the version number: 1.2.3 value is 1002003 */ -#define LIBXML_VERSION 20615 +#define LIBXML_VERSION 20616 /** * LIBXML_VERSION_STRING: * * the version number string, 1.2.3 value is "1002003" */ -#define LIBXML_VERSION_STRING "20615" +#define LIBXML_VERSION_STRING "20616" /** * LIBXML_VERSION_EXTRA: * * extra version information, used to show a CVS compilation */ -#define LIBXML_VERSION_EXTRA "-CVS2214" +#define LIBXML_VERSION_EXTRA "-CVS2257" /** * LIBXML_TEST_VERSION: @@ -58,7 +58,7 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version); * Macro to check that the libxml version in use is compatible with * the version the software has been compiled against */ -#define LIBXML_TEST_VERSION xmlCheckVersion(20615); +#define LIBXML_TEST_VERSION xmlCheckVersion(20616); #ifndef VMS #if 0 diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index 20426e7..19a2354 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -62,7 +62,8 @@ typedef enum { XPTR_SUB_RESOURCE_ERROR, XPATH_UNDEF_PREFIX_ERROR, XPATH_ENCODING_ERROR, - XPATH_INVALID_CHAR_ERROR + XPATH_INVALID_CHAR_ERROR, + XPATH_INVALID_CTXT } xmlXPathError; /* diff --git a/include/libxml/xpathInternals.h b/include/libxml/xpathInternals.h index 88ee27c..dcd5243 100644 --- a/include/libxml/xpathInternals.h +++ b/include/libxml/xpathInternals.h @@ -40,7 +40,7 @@ extern "C" { */ #define xmlXPathSetError(ctxt, err) \ { xmlXPatherror((ctxt), __FILE__, __LINE__, (err)); \ - (ctxt)->error = (err); } + if ((ctxt) != NULL) (ctxt)->error = (err); } /** * xmlXPathSetArityError: @@ -294,6 +294,7 @@ XMLPUBFUN void * XMLCALL * Macro to check that the number of args passed to an XPath function matches. */ #define CHECK_ARITY(x) \ + if (ctxt == NULL) return; \ if (nargs != (x)) \ XP_ERROR(XPATH_INVALID_ARITY); diff --git a/libxml2.spec b/libxml2.spec index 50d386f..7a3234e 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Summary: Library providing XML and HTML support Name: libxml2 -Version: 2.6.15 +Version: 2.6.16 Release: 1 License: MIT Group: Development/Libraries @@ -159,8 +159,8 @@ rm -fr %{buildroot} %doc doc/python.html %changelog -* Wed Oct 27 2004 Daniel Veillard <veillard@redhat.com> -- upstream release 2.6.15 see http://xmlsoft.org/news.html +* Wed Nov 10 2004 Daniel Veillard <veillard@redhat.com> +- upstream release 2.6.16 see http://xmlsoft.org/news.html * Thu Jan 2 2003 Daniel Veillard <veillard@redhat.com> - integrated drv_libxml2 xml.sax driver from Stéphane Bidoul @@ -99,6 +99,8 @@ xmlListLowerSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); for(lk = l->sentinel->next;lk != l->sentinel && l->linkCompare(lk->data, data) <0 ;lk = lk->next); return lk; } @@ -117,6 +119,8 @@ xmlListHigherSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); for(lk = l->sentinel->prev;lk != l->sentinel && l->linkCompare(lk->data, data) >0 ;lk = lk->prev); return lk; } @@ -134,6 +138,8 @@ static xmlLinkPtr xmlListLinkSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); lk = xmlListLowerSearch(l, data); if (lk == l->sentinel) return NULL; @@ -157,6 +163,8 @@ static xmlLinkPtr xmlListLinkReverseSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); lk = xmlListHigherSearch(l, data); if (lk == l->sentinel) return NULL; @@ -223,6 +231,8 @@ void * xmlListSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); lk = xmlListLinkSearch(l, data); if (lk) return (lk->data); @@ -242,6 +252,8 @@ void * xmlListReverseSearch(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(NULL); lk = xmlListLinkReverseSearch(l, data); if (lk) return (lk->data); @@ -262,6 +274,8 @@ xmlListInsert(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; + if (l == NULL) + return(1); lkPlace = xmlListLowerSearch(l, data); /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); @@ -292,6 +306,8 @@ int xmlListAppend(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; + if (l == NULL) + return(1); lkPlace = xmlListHigherSearch(l, data); /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); @@ -316,6 +332,9 @@ int xmlListAppend(xmlListPtr l, void *data) */ void xmlListDelete(xmlListPtr l) { + if (l == NULL) + return; + xmlListClear(l); xmlFree(l->sentinel); xmlFree(l); @@ -335,6 +354,8 @@ xmlListRemoveFirst(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(0); /*Find the first instance of this data */ lk = xmlListLinkSearch(l, data); if (lk != NULL) { @@ -358,6 +379,8 @@ xmlListRemoveLast(xmlListPtr l, void *data) { xmlLinkPtr lk; + if (l == NULL) + return(0); /*Find the last instance of this data */ lk = xmlListLinkReverseSearch(l, data); if (lk != NULL) { @@ -381,6 +404,8 @@ xmlListRemoveAll(xmlListPtr l, void *data) { int count=0; + if (l == NULL) + return(0); while(xmlListRemoveFirst(l, data)) count++; @@ -396,8 +421,11 @@ xmlListRemoveAll(xmlListPtr l, void *data) void xmlListClear(xmlListPtr l) { - xmlLinkPtr lk = l->sentinel->next; + xmlLinkPtr lk; + if (l == NULL) + return; + lk = l->sentinel->next; while(lk != l->sentinel) { xmlLinkPtr next = lk->next; @@ -412,11 +440,13 @@ xmlListClear(xmlListPtr l) * * Is the list empty ? * - * Returns 1 if the list is empty, 0 otherwise + * Returns 1 if the list is empty, 0 if not empty and -1 in case of error */ int xmlListEmpty(xmlListPtr l) { + if (l == NULL) + return(-1); return (l->sentinel->next == l->sentinel); } @@ -431,6 +461,8 @@ xmlListEmpty(xmlListPtr l) xmlLinkPtr xmlListFront(xmlListPtr l) { + if (l == NULL) + return(NULL); return (l->sentinel->next); } @@ -445,6 +477,8 @@ xmlListFront(xmlListPtr l) xmlLinkPtr xmlListEnd(xmlListPtr l) { + if (l == NULL) + return(NULL); return (l->sentinel->prev); } @@ -454,7 +488,7 @@ xmlListEnd(xmlListPtr l) * * Get the number of elements in the list * - * Returns the number of elements in the list + * Returns the number of elements in the list or -1 in case of error */ int xmlListSize(xmlListPtr l) @@ -462,6 +496,8 @@ xmlListSize(xmlListPtr l) xmlLinkPtr lk; int count=0; + if (l == NULL) + return(-1); /* TODO: keep a counter in xmlList instead */ for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next, count++); return count; @@ -507,6 +543,8 @@ xmlListPushFront(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; + if (l == NULL) + return(0); lkPlace = l->sentinel; /* Add the new link */ lkNew = (xmlLinkPtr) xmlMalloc(sizeof(xmlLink)); @@ -537,6 +575,8 @@ xmlListPushBack(xmlListPtr l, void *data) { xmlLinkPtr lkPlace, lkNew; + if (l == NULL) + return(0); lkPlace = l->sentinel->prev; /* Add the new link */ if (NULL ==(lkNew = (xmlLinkPtr )xmlMalloc(sizeof(xmlLink)))) { @@ -563,6 +603,8 @@ xmlListPushBack(xmlListPtr l, void *data) void * xmlLinkGetData(xmlLinkPtr lk) { + if (lk == NULL) + return(NULL); return lk->data; } @@ -573,18 +615,22 @@ xmlLinkGetData(xmlLinkPtr lk) * Reverse the order of the elements in the list */ void -xmlListReverse(xmlListPtr l) { - xmlLinkPtr lk; - xmlLinkPtr lkPrev = l->sentinel; - - for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) { +xmlListReverse(xmlListPtr l) +{ + xmlLinkPtr lk; + xmlLinkPtr lkPrev; + + if (l == NULL) + return; + lkPrev = l->sentinel; + for (lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) { + lkPrev->next = lkPrev->prev; + lkPrev->prev = lk; + lkPrev = lk; + } + /* Fix up the last node */ lkPrev->next = lkPrev->prev; lkPrev->prev = lk; - lkPrev = lk; - } - /* Fix up the last node */ - lkPrev->next = lkPrev->prev; - lkPrev->prev = lk; } /** @@ -598,6 +644,8 @@ xmlListSort(xmlListPtr l) { xmlListPtr lTemp; + if (l == NULL) + return; if(xmlListEmpty(l)) return; @@ -628,6 +676,8 @@ void xmlListWalk(xmlListPtr l, xmlListWalker walker, const void *user) { xmlLinkPtr lk; + if ((l == NULL) || (walker == NULL)) + return; for(lk = l->sentinel->next; lk != l->sentinel; lk = lk->next) { if((walker(lk->data, user)) == 0) break; @@ -647,6 +697,8 @@ void xmlListReverseWalk(xmlListPtr l, xmlListWalker walker, const void *user) { xmlLinkPtr lk; + if ((l == NULL) || (walker == NULL)) + return; for(lk = l->sentinel->prev; lk != l->sentinel; lk = lk->prev) { if((walker(lk->data, user)) == 0) break; @@ -680,6 +732,9 @@ xmlListPtr xmlListDup(const xmlListPtr old) { xmlListPtr cur; + + if (old == NULL) + return(NULL); /* Hmmm, how to best deal with allocation issues when copying * lists. If there is a de-allocator, should responsibility lie with * the new list or the old list. Surely not both. I'll arbitrarily @@ -708,6 +763,8 @@ xmlListCopy(xmlListPtr cur, const xmlListPtr old) /* Walk the old tree and insert the data into the new one */ xmlLinkPtr lk; + if ((old == NULL) || (cur == NULL)) + return(1); for(lk = old->sentinel->next; lk != old->sentinel; lk = lk->next) { if (0 !=xmlListInsert(cur, lk->data)) { xmlListDelete(cur); @@ -260,12 +260,18 @@ xmlNanoFTPCleanup(void) { void xmlNanoFTPProxy(const char *host, int port, const char *user, const char *passwd, int type) { - if (proxy != NULL) + if (proxy != NULL) { xmlFree(proxy); - if (proxyUser != NULL) + proxy = NULL; + } + if (proxyUser != NULL) { xmlFree(proxyUser); - if (proxyPasswd != NULL) + proxyUser = NULL; + } + if (proxyPasswd != NULL) { xmlFree(proxyPasswd); + proxyPasswd = NULL; + } if (host) proxy = xmlMemStrdup(host); if (user) @@ -697,11 +703,11 @@ xmlNanoFTPNewCtxt(const char *URL) { ret->controlFd = -1; unescaped = xmlURIUnescapeString(URL, 0, NULL); - if (unescaped != NULL) + if (unescaped != NULL) { xmlNanoFTPScanURL(ret, unescaped); - else if (URL != NULL) + xmlFree(unescaped); + } else if (URL != NULL) xmlNanoFTPScanURL(ret, URL); - xmlFree(unescaped); return(ret); } @@ -777,6 +783,8 @@ xmlNanoFTPGetMore(void *ctx) { int len; int size; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) { #ifdef DEBUG_FTP xmlGenericError(xmlGenericErrorContext, @@ -856,6 +864,8 @@ xmlNanoFTPReadResponse(void *ctx) { int len; int res = -1, cur = -1; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + get_more: /* * Assumes everything up to controlBuf[controlBufIndex] has been read @@ -943,6 +953,7 @@ xmlNanoFTPCheckResponse(void *ctx) { fd_set rfd; struct timeval tv; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); tv.tv_sec = 0; tv.tv_usec = 0; FD_ZERO(&rfd); @@ -1031,6 +1042,8 @@ xmlNanoFTPQuit(void *ctx) { char buf[200]; int len, res; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + snprintf(buf, sizeof(buf), "QUIT\r\n"); len = strlen(buf); #ifdef DEBUG_FTP @@ -1442,6 +1455,8 @@ xmlNanoFTPConnectTo(const char *server, int port) { xmlNanoFTPInit(); if (server == NULL) return(NULL); + if (port <= 0) + return(NULL); ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL); ctxt->hostname = xmlMemStrdup(server); if (port != 0) @@ -1465,12 +1480,14 @@ xmlNanoFTPConnectTo(const char *server, int port) { */ int -xmlNanoFTPCwd(void *ctx, char *directory) { +xmlNanoFTPCwd(void *ctx, const char *directory) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[400]; int len; int res; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + /* * Expected response code for CWD: * @@ -1511,12 +1528,14 @@ xmlNanoFTPCwd(void *ctx, char *directory) { */ int -xmlNanoFTPDele(void *ctx, char *file) { +xmlNanoFTPDele(void *ctx, const char *file) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[400]; int len; int res; + if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1); + /* * Expected response code for DELE: * @@ -1572,6 +1591,8 @@ xmlNanoFTPGetConnection(void *ctx) { #endif SOCKLEN_T dataAddrLen; + if (ctxt == NULL) return(-1); + memset (&dataAddr, 0, sizeof(dataAddr)); #ifdef SUPPORT_IP6 if ((ctxt->ftpAddr).ss_family == AF_INET6) { @@ -1735,6 +1756,8 @@ xmlNanoFTPCloseConnection(void *ctx) { fd_set rfd, efd; struct timeval tv; + if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1); + closesocket(ctxt->dataFd); ctxt->dataFd = -1; tv.tv_sec = 15; tv.tv_usec = 0; @@ -1907,7 +1930,7 @@ xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData) int xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData, - char *filename) { + const char *filename) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[4096 + 1]; int len, res; @@ -2019,6 +2042,8 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) { xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; char buf[300]; int res, len; + if (ctx == NULL) + return(-1); if ((filename == NULL) && (ctxt->path == NULL)) return(-1); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); @@ -949,6 +949,8 @@ mem_error: int inputPush(xmlParserCtxtPtr ctxt, xmlParserInputPtr value) { + if ((ctxt == NULL) || (value == NULL)) + return(0); if (ctxt->inputNr >= ctxt->inputMax) { ctxt->inputMax *= 2; ctxt->inputTab = @@ -977,6 +979,8 @@ inputPop(xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret; + if (ctxt == NULL) + return(NULL); if (ctxt->inputNr <= 0) return (0); ctxt->inputNr--; @@ -1000,16 +1004,19 @@ inputPop(xmlParserCtxtPtr ctxt) int nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) { + if (ctxt == NULL) return(0); if (ctxt->nodeNr >= ctxt->nodeMax) { - ctxt->nodeMax *= 2; - ctxt->nodeTab = - (xmlNodePtr *) xmlRealloc(ctxt->nodeTab, - ctxt->nodeMax * + xmlNodePtr *tmp; + + tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab, + ctxt->nodeMax * 2 * sizeof(ctxt->nodeTab[0])); - if (ctxt->nodeTab == NULL) { + if (tmp == NULL) { xmlErrMemory(ctxt, NULL); return (0); } + ctxt->nodeTab = tmp; + ctxt->nodeMax *= 2; } if (((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) { xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, @@ -1035,8 +1042,9 @@ nodePop(xmlParserCtxtPtr ctxt) { xmlNodePtr ret; + if (ctxt == NULL) return(NULL); if (ctxt->nodeNr <= 0) - return (0); + return (NULL); ctxt->nodeNr--; if (ctxt->nodeNr > 0) ctxt->node = ctxt->nodeTab[ctxt->nodeNr - 1]; @@ -1132,6 +1140,8 @@ nameNsPop(xmlParserCtxtPtr ctxt) int namePush(xmlParserCtxtPtr ctxt, const xmlChar * value) { + if (ctxt == NULL) return (-1); + if (ctxt->nameNr >= ctxt->nameMax) { const xmlChar * *tmp; ctxt->nameMax *= 2; @@ -1164,8 +1174,8 @@ namePop(xmlParserCtxtPtr ctxt) { const xmlChar *ret; - if (ctxt->nameNr <= 0) - return (0); + if ((ctxt == NULL) || (ctxt->nameNr <= 0)) + return (NULL); ctxt->nameNr--; if (ctxt->nameNr > 0) ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; @@ -1412,7 +1422,7 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) { */ xmlChar xmlPopInput(xmlParserCtxtPtr ctxt) { - if (ctxt->inputNr == 1) return(0); /* End of main Input */ + if ((ctxt == NULL) || (ctxt->inputNr <= 1)) return(0); if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "Popping input %d\n", ctxt->inputNr); @@ -1926,7 +1936,7 @@ xmlStringLenDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int len, int c,l; int nbchars = 0; - if ((str == NULL) || (len < 0)) + if ((ctxt == NULL) || (str == NULL) || (len < 0)) return(NULL); last = str + len; @@ -2068,6 +2078,7 @@ mem_error: xmlChar * xmlStringDecodeEntities(xmlParserCtxtPtr ctxt, const xmlChar *str, int what, xmlChar end, xmlChar end2, xmlChar end3) { + if ((ctxt == NULL) || (str == NULL)) return(NULL); return(xmlStringLenDecodeEntities(ctxt, str, xmlStrlen(str), what, end, end2, end3)); } @@ -2180,6 +2191,7 @@ xmlSplitQName(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlChar **prefix) { const xmlChar *cur = name; int c; + if (prefix == NULL) return(NULL); *prefix = NULL; if (cur == NULL) return(NULL); @@ -2992,6 +3004,7 @@ mem_error: xmlChar * xmlParseAttValue(xmlParserCtxtPtr ctxt) { + if ((ctxt == NULL) || (ctxt->input == NULL)) return(NULL); return(xmlParseAttValueInternal(ctxt, NULL, NULL, 0)); } @@ -3199,15 +3212,17 @@ get_more_space: const xmlChar *tmp = ctxt->input->cur; ctxt->input->cur = in; - if (ctxt->sax->ignorableWhitespace != - ctxt->sax->characters) { + if ((ctxt->sax != NULL) && + (ctxt->sax->ignorableWhitespace != + ctxt->sax->characters)) { if (areBlanks(ctxt, tmp, nbchar, 1)) { ctxt->sax->ignorableWhitespace(ctxt->userData, tmp, nbchar); } else if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, tmp, nbchar); - } else if (ctxt->sax->characters != NULL) { + } else if ((ctxt->sax != NULL) && + (ctxt->sax->characters != NULL)) { ctxt->sax->characters(ctxt->userData, tmp, nbchar); } @@ -3241,7 +3256,8 @@ get_more: } nbchar = in - ctxt->input->cur; if (nbchar > 0) { - if ((ctxt->sax->ignorableWhitespace != + if ((ctxt->sax != NULL) && + (ctxt->sax->ignorableWhitespace != ctxt->sax->characters) && (IS_BLANK_CH(*ctxt->input->cur))) { const xmlChar *tmp = ctxt->input->cur; @@ -3255,7 +3271,7 @@ get_more: tmp, nbchar); line = ctxt->input->line; col = ctxt->input->col; - } else { + } else if (ctxt->sax != NULL) { if (ctxt->sax->characters != NULL) ctxt->sax->characters(ctxt->userData, ctxt->input->cur, nbchar); @@ -8541,6 +8557,9 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) { xmlInitParser(); + if ((ctxt == NULL) || (ctxt->input == NULL)) + return(-1); + GROW; /* @@ -8700,6 +8719,9 @@ xmlParseExtParsedEnt(xmlParserCtxtPtr ctxt) { xmlChar start[4]; xmlCharEncoding enc; + if ((ctxt == NULL) || (ctxt->input == NULL)) + return(-1); + xmlDefaultSAXHandlerInit(); xmlDetectSAX2(ctxt); @@ -8942,6 +8964,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) { xmlChar cur, next; const xmlChar *lastlt, *lastgt; + if (ctxt->input == NULL) + return(0); + #ifdef DEBUG_PUSH switch (ctxt->instate) { case XML_PARSER_EOF: @@ -9801,6 +9826,8 @@ done: int xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate) { + if (ctxt == NULL) + return(XML_ERR_INTERNAL_ERROR); if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) return(ctxt->errNo); if (ctxt->instate == XML_PARSER_START) @@ -9849,13 +9876,16 @@ xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size, /* * Check for termination */ - int avail = 0; + int avail = 0; + + if (ctxt->input != NULL) { if (ctxt->input->buf == NULL) - avail = ctxt->input->length - - (ctxt->input->cur - ctxt->input->base); - else - avail = ctxt->input->buf->buffer->use - - (ctxt->input->cur - ctxt->input->base); + avail = ctxt->input->length - + (ctxt->input->cur - ctxt->input->base); + else + avail = ctxt->input->buf->buffer->use - + (ctxt->input->cur - ctxt->input->base); + } if ((ctxt->instate != XML_PARSER_EOF) && (ctxt->instate != XML_PARSER_EPILOG)) { @@ -9957,7 +9987,11 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data, xmlFreeParserCtxt(ctxt); return(NULL); } - memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); + memset(ctxt->sax, 0, sizeof(xmlSAXHandler)); + if (sax->initialized == XML_SAX2_MAGIC) + memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); + else + memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1)); if (user_data != NULL) ctxt->userData = user_data; } @@ -10038,6 +10072,8 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data, xmlParserCtxtPtr ctxt; xmlParserInputPtr inputStream; xmlParserInputBufferPtr buf; + + if (ioread == NULL) return(NULL); buf = xmlParserInputBufferCreateIO(ioread, ioclose, ioctx, enc); if (buf == NULL) return(NULL); @@ -10058,7 +10094,11 @@ xmlCreateIOParserCtxt(xmlSAXHandlerPtr sax, void *user_data, xmlFree(ctxt); return(NULL); } - memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); + memset(ctxt->sax, 0, sizeof(xmlSAXHandler)); + if (sax->initialized == XML_SAX2_MAGIC) + memcpy(ctxt->sax, sax, sizeof(xmlSAXHandler)); + else + memcpy(ctxt->sax, sax, sizeof(xmlSAXHandlerV1)); if (user_data != NULL) ctxt->userData = user_data; } @@ -10253,7 +10293,8 @@ xmlSAXParseDTD(xmlSAXHandlerPtr sax, const xmlChar *ExternalID, if (input == NULL) { if (sax != NULL) ctxt->sax = NULL; xmlFreeParserCtxt(ctxt); - xmlFree(systemIdCanonic); + if (systemIdCanonic != NULL) + xmlFree(systemIdCanonic); return(NULL); } @@ -10362,6 +10403,8 @@ xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx, const xmlChar *URL, xmlChar start[4]; xmlCharEncoding enc; + if (ctx == NULL) return(-1); + if (ctx->depth > 40) { return(XML_ERR_ENTITY_LOOP); } @@ -11163,7 +11206,7 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlParserCtxtPtr ctxt; xmlDocPtr newDoc; xmlSAXHandlerPtr oldsax = NULL; - xmlNodePtr content; + xmlNodePtr content, newRoot; int size; int ret = 0; @@ -11193,14 +11236,23 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlFreeParserCtxt(ctxt); return(-1); } - newDoc->dict = ctxt->dict; - xmlDictReference(newDoc->dict); + if ((doc != NULL) && (doc->dict != NULL)) { + xmlDictFree(ctxt->dict); + ctxt->dict = doc->dict; + xmlDictReference(ctxt->dict); + ctxt->str_xml = xmlDictLookup(ctxt->dict, BAD_CAST "xml", 3); + ctxt->str_xmlns = xmlDictLookup(ctxt->dict, BAD_CAST "xmlns", 5); + ctxt->str_xml_ns = xmlDictLookup(ctxt->dict, XML_XML_NAMESPACE, 36); + ctxt->dictNames = 1; + } else { + xmlCtxtUseOptions(ctxt, XML_PARSE_NODICT); + } if (doc != NULL) { newDoc->intSubset = doc->intSubset; newDoc->extSubset = doc->extSubset; } - newDoc->children = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL); - if (newDoc->children == NULL) { + newRoot = xmlNewDocNode(newDoc, NULL, BAD_CAST "pseudoroot", NULL); + if (newRoot == NULL) { if (sax != NULL) ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); @@ -11209,7 +11261,8 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, xmlFreeDoc(newDoc); return(-1); } - nodePush(ctxt, newDoc->children); + xmlAddChild((xmlNodePtr) newDoc, newRoot); + nodePush(ctxt, newRoot); if (doc == NULL) { ctxt->myDoc = newDoc; } else { @@ -11253,21 +11306,22 @@ xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc, xmlSAXHandlerPtr sax, ret = 0; } - if (lst != NULL && (ret == 0 || recover == 1)) { - xmlNodePtr cur; + if ((lst != NULL) && ((ret == 0) || (recover == 1))) { + xmlNodePtr cur; - /* - * Return the newly created nodeset after unlinking it from - * they pseudo parent. - */ - cur = newDoc->children->children; - *lst = cur; - while (cur != NULL) { - cur->parent = NULL; - cur = cur->next; - } - newDoc->children->children = NULL; + /* + * Return the newly created nodeset after unlinking it from + * they pseudo parent. + */ + cur = newDoc->children->children; + *lst = cur; + while (cur != NULL) { + xmlSetTreeDoc(cur, doc); + cur->parent = NULL; + cur = cur->next; } + newDoc->children->children = NULL; + } if (sax != NULL) ctxt->sax = oldsax; @@ -11627,10 +11681,13 @@ xmlSetupParserForBuffer(xmlParserCtxtPtr ctxt, const xmlChar* buffer, { xmlParserInputPtr input; + if ((ctxt == NULL) || (buffer == NULL)) + return; + input = xmlNewInputStream(ctxt); if (input == NULL) { xmlErrMemory(NULL, "parsing new buffer: out of memory\n"); - xmlFree(ctxt); + xmlClearParserCtxt(ctxt); return; } @@ -11684,6 +11741,10 @@ xmlSAXUserParseFile(xmlSAXHandlerPtr sax, void *user_data, } if (sax != NULL) ctxt->sax = NULL; + if (ctxt->myDoc != NULL) { + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } xmlFreeParserCtxt(ctxt); return ret; @@ -11886,6 +11947,10 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data, ret = -1; } ctxt->sax = oldsax; + if (ctxt->myDoc != NULL) { + xmlFreeDoc(ctxt->myDoc); + ctxt->myDoc = NULL; + } xmlFreeParserCtxt(ctxt); return ret; @@ -11929,6 +11994,7 @@ xmlDocPtr xmlSAXParseDoc(xmlSAXHandlerPtr sax, xmlChar *cur, int recovery) { xmlDocPtr ret; xmlParserCtxtPtr ctxt; + xmlSAXHandlerPtr oldsax = NULL; if (cur == NULL) return(NULL); @@ -11936,6 +12002,7 @@ xmlSAXParseDoc(xmlSAXHandlerPtr sax, xmlChar *cur, int recovery) { ctxt = xmlCreateDocParserCtxt(cur); if (ctxt == NULL) return(NULL); if (sax != NULL) { + oldsax = ctxt->sax; ctxt->sax = sax; ctxt->userData = NULL; } @@ -11948,8 +12015,8 @@ xmlSAXParseDoc(xmlSAXHandlerPtr sax, xmlChar *cur, int recovery) { xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL; } - if (sax != NULL) - ctxt->sax = NULL; + if (sax != NULL) + ctxt->sax = oldsax; xmlFreeParserCtxt(ctxt); return(ret); @@ -12083,6 +12150,10 @@ xmlCleanupParser(void) { #ifdef LIBXML_OUTPUT_ENABLED xmlCleanupOutputCallbacks(); #endif +#ifdef LIBXML_SCHEMAS_ENABLED + xmlSchemaCleanupTypes(); + xmlRelaxNGCleanupTypes(); +#endif xmlCleanupGlobals(); xmlResetLastError(); xmlCleanupThreads(); /* must be last if called not from the main thread */ @@ -12118,7 +12189,12 @@ void xmlCtxtReset(xmlParserCtxtPtr ctxt) { xmlParserInputPtr input; - xmlDictPtr dict = ctxt->dict; + xmlDictPtr dict; + + if (ctxt == NULL) + return; + + dict = ctxt->dict; while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ xmlFreeInputStream(input); @@ -12314,6 +12390,8 @@ xmlCtxtResetPush(xmlParserCtxtPtr ctxt, const char *chunk, int xmlCtxtUseOptions(xmlParserCtxtPtr ctxt, int options) { + if (ctxt == NULL) + return(-1); if (options & XML_PARSE_RECOVER) { ctxt->recovery = 1; options -= XML_PARSE_RECOVER; diff --git a/parserInternals.c b/parserInternals.c index 09f8bb8..994aaa2 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -281,6 +281,7 @@ xmlParserInputRead(xmlParserInputPtr in, int len) { int used; int indx; + if (in == NULL) return(-1); #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, "Read\n"); #endif @@ -330,6 +331,7 @@ xmlParserInputGrow(xmlParserInputPtr in, int len) { int ret; int indx; + if (in == NULL) return(-1); #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, "Grow\n"); #endif @@ -388,6 +390,7 @@ xmlParserInputShrink(xmlParserInputPtr in) { #ifdef DEBUG_INPUT xmlGenericError(xmlGenericErrorContext, "Shrink\n"); #endif + if (in == NULL) return; if (in->buf == NULL) return; if (in->base == NULL) return; if (in->cur == NULL) return; @@ -444,7 +447,8 @@ xmlParserInputShrink(xmlParserInputPtr in) { void xmlNextChar(xmlParserCtxtPtr ctxt) { - if (ctxt->instate == XML_PARSER_EOF) + if ((ctxt == NULL) || (ctxt->instate == XML_PARSER_EOF) || + (ctxt->input == NULL)) return; if (ctxt->charset == XML_CHAR_ENCODING_UTF8) { @@ -570,14 +574,20 @@ encoding_error: * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ - __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, - "Input is not proper UTF-8, indicate encoding !\n", - NULL, NULL); - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, - "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", - ctxt->input->cur[0], ctxt->input->cur[1], - ctxt->input->cur[2], ctxt->input->cur[3]); + if ((ctxt == NULL) || (ctxt->input == NULL) || + (ctxt->input->end - ctxt->input->cur < 4)) { + __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, + "Input is not proper UTF-8, indicate encoding !\n", + NULL, NULL); + } else { + char buffer[150]; + + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + ctxt->input->cur[0], ctxt->input->cur[1], + ctxt->input->cur[2], ctxt->input->cur[3]); + __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, + "Input is not proper UTF-8, indicate encoding !\n%s", + BAD_CAST buffer, NULL); } ctxt->charset = XML_CHAR_ENCODING_8859_1; ctxt->input->cur++; @@ -604,6 +614,7 @@ encoding_error: int xmlCurrentChar(xmlParserCtxtPtr ctxt, int *len) { + if ((ctxt == NULL) || (len == NULL) || (ctxt->input == NULL)) return(0); if (ctxt->instate == XML_PARSER_EOF) return(0); @@ -716,13 +727,15 @@ encoding_error: * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ - __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, - "Input is not proper UTF-8, indicate encoding !\n", - NULL, NULL); - if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + { + char buffer[150]; + + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", ctxt->input->cur[0], ctxt->input->cur[1], ctxt->input->cur[2], ctxt->input->cur[3]); + __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, + "Input is not proper UTF-8, indicate encoding !\n%s", + BAD_CAST buffer, NULL); } ctxt->charset = XML_CHAR_ENCODING_8859_1; *len = 1; @@ -744,6 +757,7 @@ encoding_error: int xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len) { + if ((len == NULL) || (cur == NULL)) return(0); if ((ctxt == NULL) || (ctxt->charset == XML_CHAR_ENCODING_UTF8)) { /* * We are supposed to handle UTF8, check it's valid @@ -810,20 +824,31 @@ xmlStringCurrentChar(xmlParserCtxtPtr ctxt, const xmlChar * cur, int *len) encoding_error: /* + * An encoding problem may arise from a truncated input buffer + * splitting a character in the middle. In that case do not raise + * an error but return 0 to endicate an end of stream problem + */ + if ((ctxt == NULL) || (ctxt->input == NULL) || + (ctxt->input->end - ctxt->input->cur < 4)) { + *len = 0; + return(0); + } + /* * If we detect an UTF8 error that probably mean that the * input encoding didn't get properly advertised in the * declaration header. Report the error and switch the encoding * to ISO-Latin-1 (if you don't like this policy, just declare the * encoding !) */ - __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, - "Input is not proper UTF-8, indicate encoding !\n", - NULL, NULL); - if ((ctxt != NULL) && (ctxt->sax != NULL) && (ctxt->sax->error != NULL)) { - ctxt->sax->error(ctxt->userData, - "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", - ctxt->input->cur[0], ctxt->input->cur[1], - ctxt->input->cur[2], ctxt->input->cur[3]); + { + char buffer[150]; + + snprintf(buffer, 149, "Bytes: 0x%02X 0x%02X 0x%02X 0x%02X\n", + ctxt->input->cur[0], ctxt->input->cur[1], + ctxt->input->cur[2], ctxt->input->cur[3]); + __xmlErrEncoding(ctxt, XML_ERR_INVALID_CHAR, + "Input is not proper UTF-8, indicate encoding !\n%s", + BAD_CAST buffer, NULL); } *len = 1; return ((int) *cur); @@ -840,6 +865,7 @@ encoding_error: */ int xmlCopyCharMultiByte(xmlChar *out, int val) { + if (out == NULL) return(0); /* * We are supposed to handle UTF8, check it's valid * From rfc2044: encoding of the Unicode values on UTF-8: @@ -882,6 +908,7 @@ xmlCopyCharMultiByte(xmlChar *out, int val) { int xmlCopyChar(int len ATTRIBUTE_UNUSED, xmlChar *out, int val) { + if (out == NULL) return(0); /* the len parameter is ignored */ if (val >= 0x80) { return(xmlCopyCharMultiByte (out, val)); @@ -911,6 +938,7 @@ xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc) { xmlCharEncodingHandlerPtr handler; + if (ctxt == NULL) return(-1); switch (enc) { case XML_CHAR_ENCODING_ERROR: __xmlErrEncoding(ctxt, XML_ERR_UNKNOWN_ENCODING, @@ -1329,6 +1357,7 @@ xmlNewIOInputStream(xmlParserCtxtPtr ctxt, xmlParserInputBufferPtr input, xmlCharEncoding enc) { xmlParserInputPtr inputStream; + if (input == NULL) return(NULL); if (xmlParserDebugEntities) xmlGenericError(xmlGenericErrorContext, "new input from I/O\n"); inputStream = xmlNewInputStream(ctxt); @@ -1513,6 +1542,8 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) { int xmlInitParserCtxt(xmlParserCtxtPtr ctxt) { + xmlParserInputPtr input; + if(ctxt==NULL) { xmlErrInternal(NULL, "Got NULL parser context\n", NULL); return(-1); @@ -1520,12 +1551,14 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) xmlDefaultSAXHandlerInit(); - ctxt->dict = xmlDictCreate(); + if (ctxt->dict == NULL) + ctxt->dict = xmlDictCreate(); if (ctxt->dict == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); return(-1); } - ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); + if (ctxt->sax == NULL) + ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler)); if (ctxt->sax == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); return(-1); @@ -1536,8 +1569,11 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->maxatts = 0; ctxt->atts = NULL; /* Allocate the Input stack */ - ctxt->inputTab = (xmlParserInputPtr *) - xmlMalloc(5 * sizeof(xmlParserInputPtr)); + if (ctxt->inputTab == NULL) { + ctxt->inputTab = (xmlParserInputPtr *) + xmlMalloc(5 * sizeof(xmlParserInputPtr)); + ctxt->inputMax = 5; + } if (ctxt->inputTab == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); ctxt->inputNr = 0; @@ -1545,8 +1581,10 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->input = NULL; return(-1); } + while ((input = inputPop(ctxt)) != NULL) { /* Non consuming */ + xmlFreeInputStream(input); + } ctxt->inputNr = 0; - ctxt->inputMax = 5; ctxt->input = NULL; ctxt->version = NULL; @@ -1561,7 +1599,10 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) ctxt->directory = NULL; /* Allocate the Node stack */ - ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr)); + if (ctxt->nodeTab == NULL) { + ctxt->nodeTab = (xmlNodePtr *) xmlMalloc(10 * sizeof(xmlNodePtr)); + ctxt->nodeMax = 10; + } if (ctxt->nodeTab == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); ctxt->nodeNr = 0; @@ -1573,11 +1614,13 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) return(-1); } ctxt->nodeNr = 0; - ctxt->nodeMax = 10; ctxt->node = NULL; /* Allocate the Name stack */ - ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *)); + if (ctxt->nameTab == NULL) { + ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *)); + ctxt->nameMax = 10; + } if (ctxt->nameTab == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); ctxt->nodeNr = 0; @@ -1592,11 +1635,13 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) return(-1); } ctxt->nameNr = 0; - ctxt->nameMax = 10; ctxt->name = NULL; /* Allocate the space stack */ - ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int)); + if (ctxt->spaceTab == NULL) { + ctxt->spaceTab = (int *) xmlMalloc(10 * sizeof(int)); + ctxt->spaceMax = 10; + } if (ctxt->spaceTab == NULL) { xmlErrMemory(NULL, "cannot initialize parser context\n"); ctxt->nodeNr = 0; @@ -1630,6 +1675,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt) if (ctxt->keepBlanks == 0) ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace; + ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0; ctxt->vctxt.userData = ctxt; ctxt->vctxt.error = xmlParserValidityError; ctxt->vctxt.warning = xmlParserValidityWarning; @@ -1783,9 +1829,10 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt) if (ctxt==NULL) return; xmlClearNodeInfoSeq(&ctxt->node_seq); - xmlInitParserCtxt(ctxt); + xmlCtxtReset(ctxt); } + /** * xmlParserFindNodeInfo: * @ctx: an XML parser context @@ -1795,17 +1842,20 @@ xmlClearParserCtxt(xmlParserCtxtPtr ctxt) * * Returns an xmlParserNodeInfo block pointer or NULL */ -const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx, - const xmlNodePtr node) +const xmlParserNodeInfo * +xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx, const xmlNodePtr node) { - unsigned long pos; - - /* Find position where node should be at */ - pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node); - if (pos < ctx->node_seq.length && ctx->node_seq.buffer[pos].node == node) - return &ctx->node_seq.buffer[pos]; - else - return NULL; + unsigned long pos; + + if ((ctx == NULL) || (node == NULL)) + return (NULL); + /* Find position where node should be at */ + pos = xmlParserFindNodeInfoIndex(&ctx->node_seq, node); + if (pos < ctx->node_seq.length + && ctx->node_seq.buffer[pos].node == node) + return &ctx->node_seq.buffer[pos]; + else + return NULL; } @@ -1818,9 +1868,11 @@ const xmlParserNodeInfo* xmlParserFindNodeInfo(const xmlParserCtxtPtr ctx, void xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq) { - seq->length = 0; - seq->maximum = 0; - seq->buffer = NULL; + if (seq == NULL) + return; + seq->length = 0; + seq->maximum = 0; + seq->buffer = NULL; } /** @@ -1833,12 +1885,13 @@ xmlInitNodeInfoSeq(xmlParserNodeInfoSeqPtr seq) void xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq) { - if ( seq->buffer != NULL ) - xmlFree(seq->buffer); - xmlInitNodeInfoSeq(seq); + if (seq == NULL) + return; + if (seq->buffer != NULL) + xmlFree(seq->buffer); + xmlInitNodeInfoSeq(seq); } - /** * xmlParserFindNodeInfoIndex: * @seq: a node info sequence pointer @@ -1850,31 +1903,35 @@ xmlClearNodeInfoSeq(xmlParserNodeInfoSeqPtr seq) * * Returns a long indicating the position of the record */ -unsigned long xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, - const xmlNodePtr node) +unsigned long +xmlParserFindNodeInfoIndex(const xmlParserNodeInfoSeqPtr seq, + const xmlNodePtr node) { - unsigned long upper, lower, middle; - int found = 0; - - /* Do a binary search for the key */ - lower = 1; - upper = seq->length; - middle = 0; - while ( lower <= upper && !found) { - middle = lower + (upper - lower) / 2; - if ( node == seq->buffer[middle - 1].node ) - found = 1; - else if ( node < seq->buffer[middle - 1].node ) - upper = middle - 1; + unsigned long upper, lower, middle; + int found = 0; + + if ((seq == NULL) || (node == NULL)) + return (-1); + + /* Do a binary search for the key */ + lower = 1; + upper = seq->length; + middle = 0; + while (lower <= upper && !found) { + middle = lower + (upper - lower) / 2; + if (node == seq->buffer[middle - 1].node) + found = 1; + else if (node < seq->buffer[middle - 1].node) + upper = middle - 1; + else + lower = middle + 1; + } + + /* Return position */ + if (middle == 0 || seq->buffer[middle - 1].node < node) + return middle; else - lower = middle + 1; - } - - /* Return position */ - if ( middle == 0 || seq->buffer[middle - 1].node < node ) - return middle; - else - return middle - 1; + return middle - 1; } @@ -1891,6 +1948,8 @@ xmlParserAddNodeInfo(xmlParserCtxtPtr ctxt, { unsigned long pos; + if ((ctxt == NULL) || (info == NULL)) return; + /* Find pos and check to see if node is already in the sequence */ pos = xmlParserFindNodeInfoIndex(&ctxt->node_seq, (xmlNodePtr) info->node); diff --git a/python/generator.py b/python/generator.py index 04b3832..6032065 100755 --- a/python/generator.py +++ b/python/generator.py @@ -270,6 +270,7 @@ py_types = { 'xmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"), 'htmlParserCtxtPtr': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"), 'htmlParserCtxt *': ('O', "parserCtxt", "xmlParserCtxtPtr", "xmlParserCtxtPtr"), + 'xmlValidCtxtPtr': ('O', "ValidCtxt", "xmlValidCtxtPtr", "xmlValidCtxtPtr"), 'xmlCatalogPtr': ('O', "catalog", "xmlCatalogPtr", "xmlCatalogPtr"), 'FILE *': ('O', "File", "FILEPtr", "FILE *"), 'xmlURIPtr': ('O', "URI", "xmlURIPtr", "xmlURIPtr"), @@ -345,6 +346,14 @@ def skip_function(name): return 1 if name == "xmlErrMemory": return 1 + + if name == "xmlValidBuildContentModel": + return 1 + if name == "xmlValidateElementDecl": + return 1 + if name == "xmlValidateAttributeDecl": + return 1 + return 0 def print_function_wrapper(name, output, export, include): @@ -668,6 +677,7 @@ classes_type = { "xmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"), "htmlParserCtxtPtr": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"), "htmlParserCtxt *": ("._o", "parserCtxt(_obj=%s)", "parserCtxt"), + "xmlValidCtxtPtr": ("._o", "ValidCtxt(_obj=%s)", "ValidCtxt"), "xmlCatalogPtr": ("._o", "catalog(_obj=%s)", "catalog"), "xmlURIPtr": ("._o", "URI(_obj=%s)", "URI"), "xmlErrorPtr": ("._o", "Error(_obj=%s)", "Error"), @@ -718,6 +728,7 @@ classes_destructors = { "Schema": "xmlSchemaFree", "SchemaParserCtxt": "xmlSchemaFreeParserCtxt", "SchemaValidCtxt": "xmlSchemaFreeValidCtxt", + "ValidCtxt": "xmlFreeValidCtxt", } functions_noexcept = { diff --git a/python/libxml.c b/python/libxml.c index bb2649a..ae1a0f4 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -1554,7 +1554,7 @@ libxml_xmlParserCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str) xmlParserCtxtPyCtxtPtr pyCtxt; #ifdef DEBUG_ERROR - printf("libxml_xmlParserCtxtGenericErrorFuncHandler(%p, %s, ...) called\n", ctx, msg); + printf("libxml_xmlParserCtxtGenericErrorFuncHandler(%p, %s, ...) called\n", ctx, str); #endif ctxt = (xmlParserCtxtPtr)ctx; @@ -1723,6 +1723,141 @@ libxml_xmlFreeParserCtxt(ATTRIBUTE_UNUSED PyObject *self, PyObject *args) { return(Py_None); } +/*** + * xmlValidCtxt stuff + */ + +typedef struct +{ + PyObject *warn; + PyObject *error; + PyObject *arg; +} xmlValidCtxtPyCtxt; +typedef xmlValidCtxtPyCtxt *xmlValidCtxtPyCtxtPtr; + +static void +libxml_xmlValidCtxtGenericErrorFuncHandler(void *ctx, int severity, char *str) +{ + PyObject *list; + PyObject *result; + xmlValidCtxtPyCtxtPtr pyCtxt; + +#ifdef DEBUG_ERROR + printf("libxml_xmlValidCtxtGenericErrorFuncHandler(%p, %d, %s, ...) called\n", ctx, severity, str); +#endif + + pyCtxt = (xmlValidCtxtPyCtxtPtr)ctx; + + list = PyTuple_New(2); + PyTuple_SetItem(list, 0, libxml_charPtrWrap(str)); + PyTuple_SetItem(list, 1, pyCtxt->arg); + Py_XINCREF(pyCtxt->arg); + result = PyEval_CallObject(pyCtxt->error, list); + if (result == NULL) + { + /* TODO: manage for the exception to be propagated... */ + PyErr_Print(); + } + Py_XDECREF(list); + Py_XDECREF(result); +} + +static void +libxml_xmlValidCtxtGenericWarningFuncHandler(void *ctx, int severity, char *str) +{ + PyObject *list; + PyObject *result; + xmlValidCtxtPyCtxtPtr pyCtxt; + +#ifdef DEBUG_ERROR + printf("libxml_xmlValidCtxtGenericWarningFuncHandler(%p, %d, %s, ...) called\n", ctx, severity, str); +#endif + + pyCtxt = (xmlValidCtxtPyCtxtPtr)ctx; + + list = PyTuple_New(2); + PyTuple_SetItem(list, 0, libxml_charPtrWrap(str)); + PyTuple_SetItem(list, 1, pyCtxt->arg); + Py_XINCREF(pyCtxt->arg); + result = PyEval_CallObject(pyCtxt->warn, list); + if (result == NULL) + { + /* TODO: manage for the exception to be propagated... */ + PyErr_Print(); + } + Py_XDECREF(list); + Py_XDECREF(result); +} + +static void +libxml_xmlValidCtxtErrorFuncHandler(void *ctx, const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + libxml_xmlValidCtxtGenericErrorFuncHandler(ctx,XML_PARSER_SEVERITY_VALIDITY_ERROR,libxml_buildMessage(msg,ap)); + va_end(ap); +} + +static void +libxml_xmlValidCtxtWarningFuncHandler(void *ctx, const char *msg, ...) +{ + va_list ap; + + va_start(ap, msg); + libxml_xmlValidCtxtGenericWarningFuncHandler(ctx,XML_PARSER_SEVERITY_VALIDITY_WARNING,libxml_buildMessage(msg,ap)); + va_end(ap); +} + +static PyObject * +libxml_xmlSetValidErrors(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) +{ + PyObject *py_retval; + PyObject *pyobj_error; + PyObject *pyobj_warn; + PyObject *pyobj_ctx; + PyObject *pyobj_arg = Py_None; + xmlValidCtxtPtr ctxt; + xmlValidCtxtPyCtxtPtr pyCtxt; + + if (!PyArg_ParseTuple + (args, (char *) "OOO|O:xmlSetValidErrors", &pyobj_ctx, &pyobj_error, &pyobj_warn, &pyobj_arg)) + return (NULL); + +#ifdef DEBUG_ERROR + printf("libxml_xmlSetValidErrors(%p, %p, %p) called\n", pyobj_ctx, pyobj_error, pyobj_warn); +#endif + + ctxt = PyValidCtxt_Get(pyobj_ctx); + pyCtxt = xmlMalloc(sizeof(xmlValidCtxtPyCtxt)); + if (pyCtxt == NULL) { + py_retval = libxml_intWrap(-1); + return(py_retval); + } + memset(pyCtxt, 0, sizeof(xmlValidCtxtPyCtxt)); + + + /* TODO: check warn and error is a function ! */ + Py_XDECREF(pyCtxt->error); + Py_XINCREF(pyobj_error); + pyCtxt->error = pyobj_error; + + Py_XDECREF(pyCtxt->warn); + Py_XINCREF(pyobj_warn); + pyCtxt->warn = pyobj_warn; + + Py_XDECREF(pyCtxt->arg); + Py_XINCREF(pyobj_arg); + pyCtxt->arg = pyobj_arg; + + ctxt->error = libxml_xmlValidCtxtErrorFuncHandler; + ctxt->warning = libxml_xmlValidCtxtWarningFuncHandler; + ctxt->userData = pyCtxt; + + py_retval = libxml_intWrap(1); + return (py_retval); +} + /************************************************************************ * * * Per xmlTextReader error handler * @@ -3482,6 +3617,7 @@ static PyMethodDef libxmlMethods[] = { {(char *) "type", libxml_type, METH_VARARGS, NULL}, {(char *) "doc", libxml_doc, METH_VARARGS, NULL}, {(char *) "xmlNewNode", libxml_xmlNewNode, METH_VARARGS, NULL}, + {(char *)"xmlSetValidErrors", libxml_xmlSetValidErrors, METH_VARARGS, NULL}, #ifdef LIBXML_OUTPUT_ENABLED {(char *) "serializeNode", libxml_serializeNode, METH_VARARGS, NULL}, {(char *) "saveNodeTo", libxml_saveNodeTo, METH_VARARGS, NULL}, @@ -3505,6 +3641,7 @@ static PyMethodDef libxmlMethods[] = { #ifdef LIBXML_SCHEMAS_ENABLED {(char *)"xmlRelaxNGSetValidErrors", libxml_xmlRelaxNGSetValidErrors, METH_VARARGS, NULL}, {(char *)"xmlRelaxNGFreeValidCtxt", libxml_xmlRelaxNGFreeValidCtxt, METH_VARARGS, NULL}, + {(char *)"xmlSchemaSetValidErrors", libxml_xmlSchemaSetValidErrors, METH_VARARGS, NULL}, #endif #ifdef LIBXML_C14N_ENABLED #ifdef LIBXML_OUTPUT_ENABLED diff --git a/python/libxml2-py.c b/python/libxml2-py.c index e67f193..2dc4649 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -368,6 +368,28 @@ libxml_xmlNanoFTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBU } PyObject * +libxml_xmlValidateOneElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + + if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateOneElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + + c_retval = xmlValidateOneElement(ctxt, doc, elem); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlRecoverMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlDocPtr c_retval; @@ -502,6 +524,30 @@ libxml_xmlSchemaSetValidOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) #endif /* LIBXML_SCHEMAS_ENABLED */ PyObject * +libxml_xmlValidCtxtNormalizeAttributeValue(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlChar * c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + xmlChar * name; + xmlChar * value; + + if (!PyArg_ParseTuple(args, (char *)"OOOzz:xmlValidCtxtNormalizeAttributeValue", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &name, &value)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + + c_retval = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value); + py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlFreeNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xmlNsPtr cur; PyObject *pyobj_cur; @@ -936,6 +982,29 @@ libxml_xmlParseNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlValidatePopElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + xmlChar * qname; + + if (!PyArg_ParseTuple(args, (char *)"OOOz:xmlValidatePopElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &qname)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + + c_retval = xmlValidatePopElement(ctxt, doc, elem, qname); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlStrncasecmp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -1328,20 +1397,18 @@ libxml_xmlCatalogSetDebug(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +#ifdef LIBXML_SCHEMAS_ENABLED PyObject * -libxml_xmlUCSIsMiscellaneousMathematicalSymbolsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { +libxml_xmlRelaxNGInitTypes(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { PyObject *py_retval; int c_retval; - int code; - - if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsB", &code)) - return(NULL); - c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsB(code); + c_retval = xmlRelaxNGInitTypes(); py_retval = libxml_intWrap((int) c_retval); return(py_retval); } +#endif /* LIBXML_SCHEMAS_ENABLED */ PyObject * libxml_xmlParserGetDirectory(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -1654,6 +1721,32 @@ libxml_xmlTextReaderConstEncoding(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg } PyObject * +libxml_xmlValidateOneAttribute(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + xmlAttrPtr attr; + PyObject *pyobj_attr; + xmlChar * value; + + if (!PyArg_ParseTuple(args, (char *)"OOOOz:xmlValidateOneAttribute", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &pyobj_attr, &value)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + attr = (xmlAttrPtr) PyxmlNode_Get(pyobj_attr); + + c_retval = xmlValidateOneAttribute(ctxt, doc, elem, attr, value); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlHasNsProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlAttrPtr c_retval; @@ -1858,6 +1951,25 @@ libxml_xmlCleanupInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args } PyObject * +libxml_xmlValidateRoot(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + + if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateRoot", &pyobj_ctxt, &pyobj_doc)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlValidateRoot(ctxt, doc); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlNormalizeURIPath(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -3158,6 +3270,28 @@ libxml_xmlSetListDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +PyObject * +libxml_xmlValidateDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlDtdPtr dtd; + PyObject *pyobj_dtd; + + if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateDtd", &pyobj_ctxt, &pyobj_doc, &pyobj_dtd)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + dtd = (xmlDtdPtr) PyxmlNode_Get(pyobj_dtd); + + c_retval = xmlValidateDtd(ctxt, doc, dtd); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + #ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlReadFile(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -3313,6 +3447,28 @@ libxml_xmlUCSIsCombiningMarksforSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObjec } PyObject * +libxml_xmlValidateElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + + if (!PyArg_ParseTuple(args, (char *)"OOO:xmlValidateElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + + c_retval = xmlValidateElement(ctxt, doc, elem); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlPopInputCallbacks(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { PyObject *py_retval; int c_retval; @@ -5475,6 +5631,25 @@ libxml_xmlRelaxNGValidateFullElement(PyObject *self ATTRIBUTE_UNUSED, PyObject * #endif /* LIBXML_SCHEMAS_ENABLED */ PyObject * +libxml_xmlValidateDocument(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + + if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDocument", &pyobj_ctxt, &pyobj_doc)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlValidateDocument(ctxt, doc); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlUCSIsLimbu(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -5788,6 +5963,25 @@ libxml_xmlXPathNotEqualValues(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { #endif /* LIBXML_XPATH_ENABLED */ PyObject * +libxml_xmlValidateDtdFinal(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + + if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDtdFinal", &pyobj_ctxt, &pyobj_doc)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlValidateDtdFinal(ctxt, doc); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlParseEncName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlChar * c_retval; @@ -6068,6 +6262,23 @@ libxml_htmlNodeDumpOutput(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } #endif /* LIBXML_HTML_ENABLED */ +PyObject * +libxml_xmlEncodeSpecialChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlChar * c_retval; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlChar * input; + + if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input)) + return(NULL); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlEncodeSpecialChars(doc, input); + py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); + return(py_retval); +} + #ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlParseElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -6648,6 +6859,26 @@ libxml_xmlLoadCatalogs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +PyObject * +libxml_xmlValidateNotationUse(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlChar * notationName; + + if (!PyArg_ParseTuple(args, (char *)"OOz:xmlValidateNotationUse", &pyobj_ctxt, &pyobj_doc, ¬ationName)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlValidateNotationUse(ctxt, doc, notationName); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + #ifdef LIBXML_HTML_ENABLED PyObject * libxml_htmlCtxtReadDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { @@ -7104,23 +7335,6 @@ libxml_xmlBuildQName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * -libxml_xmlEncodeSpecialChars(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlChar * c_retval; - xmlDocPtr doc; - PyObject *pyobj_doc; - xmlChar * input; - - if (!PyArg_ParseTuple(args, (char *)"Oz:xmlEncodeSpecialChars", &pyobj_doc, &input)) - return(NULL); - doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); - - c_retval = xmlEncodeSpecialChars(doc, input); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); - return(py_retval); -} - -PyObject * libxml_xmlFreePropList(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xmlAttrPtr cur; PyObject *pyobj_cur; @@ -7382,6 +7596,16 @@ libxml_xmlRegexpPrint(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { #endif /* LIBXML_REGEXP_ENABLED */ PyObject * +libxml_xmlNewValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { + PyObject *py_retval; + xmlValidCtxtPtr c_retval; + + c_retval = xmlNewValidCtxt(); + py_retval = libxml_xmlValidCtxtPtrWrap((xmlValidCtxtPtr) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlUCSIsCatSm(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -9427,6 +9651,20 @@ libxml_xmlUCSIsArabic(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlUCSIsMiscellaneousMathematicalSymbolsB(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + int code; + + if (!PyArg_ParseTuple(args, (char *)"i:xmlUCSIsMiscellaneousMathematicalSymbolsB", &code)) + return(NULL); + + c_retval = xmlUCSIsMiscellaneousMathematicalSymbolsB(code); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlNanoHTTPCleanup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBUTE_UNUSED) { xmlNanoHTTPCleanup(); @@ -9621,6 +9859,29 @@ libxml_xmlCatalogConvert(PyObject *self ATTRIBUTE_UNUSED, PyObject *args ATTRIBU } PyObject * +libxml_xmlValidatePushElement(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + xmlChar * qname; + + if (!PyArg_ParseTuple(args, (char *)"OOOz:xmlValidatePushElement", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &qname)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + + c_retval = xmlValidatePushElement(ctxt, doc, elem, qname); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlUCSIsTaiXuanJingSymbols(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -10369,6 +10630,24 @@ libxml_xmlXPathStartsWithFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg #endif /* LIBXML_XPATH_ENABLED */ PyObject * +libxml_xmlValidatePushCData(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlChar * data; + int len; + + if (!PyArg_ParseTuple(args, (char *)"Ozi:xmlValidatePushCData", &pyobj_ctxt, &data, &len)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + + c_retval = xmlValidatePushCData(ctxt, data, len); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlSearchNsByHref(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlNsPtr c_retval; @@ -10501,21 +10780,23 @@ libxml_xmlCheckFilename(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(py_retval); } +#ifdef LIBXML_XPATH_ENABLED PyObject * -libxml_xmlParseDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - PyObject *py_retval; - xmlDtdPtr c_retval; - xmlChar * ExternalID; - xmlChar * SystemID; +libxml_xmlXPathFloorFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + xmlXPathParserContextPtr ctxt; + PyObject *pyobj_ctxt; + int nargs; - if (!PyArg_ParseTuple(args, (char *)"zz:xmlParseDTD", &ExternalID, &SystemID)) + if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFloorFunction", &pyobj_ctxt, &nargs)) return(NULL); + ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - c_retval = xmlParseDTD(ExternalID, SystemID); - py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); - return(py_retval); + xmlXPathFloorFunction(ctxt, nargs); + Py_INCREF(Py_None); + return(Py_None); } +#endif /* LIBXML_XPATH_ENABLED */ PyObject * libxml_xmlUCSIsTibetan(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -10565,23 +10846,21 @@ libxml_xmlSchemaValidCtxtGetOptions(PyObject *self ATTRIBUTE_UNUSED, PyObject *a } #endif /* LIBXML_SCHEMAS_ENABLED */ -#ifdef LIBXML_XPATH_ENABLED PyObject * -libxml_xmlXPathFloorFunction(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { - xmlXPathParserContextPtr ctxt; - PyObject *pyobj_ctxt; - int nargs; +libxml_xmlParseDTD(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + xmlDtdPtr c_retval; + xmlChar * ExternalID; + xmlChar * SystemID; - if (!PyArg_ParseTuple(args, (char *)"Oi:xmlXPathFloorFunction", &pyobj_ctxt, &nargs)) + if (!PyArg_ParseTuple(args, (char *)"zz:xmlParseDTD", &ExternalID, &SystemID)) return(NULL); - ctxt = (xmlXPathParserContextPtr) PyxmlXPathParserContext_Get(pyobj_ctxt); - xmlXPathFloorFunction(ctxt, nargs); - Py_INCREF(Py_None); - return(Py_None); + c_retval = xmlParseDTD(ExternalID, SystemID); + py_retval = libxml_xmlNodePtrWrap((xmlNodePtr) c_retval); + return(py_retval); } -#endif /* LIBXML_XPATH_ENABLED */ PyObject * libxml_xmlNewGlobalNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; @@ -10601,6 +10880,25 @@ libxml_xmlNewGlobalNs(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlValidateDocumentFinal(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + + if (!PyArg_ParseTuple(args, (char *)"OO:xmlValidateDocumentFinal", &pyobj_ctxt, &pyobj_doc)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + + c_retval = xmlValidateDocumentFinal(ctxt, doc); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlIsLetter(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; @@ -10748,6 +11046,33 @@ libxml_xmlParseURI(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlValidateOneNamespace(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlValidCtxtPtr ctxt; + PyObject *pyobj_ctxt; + xmlDocPtr doc; + PyObject *pyobj_doc; + xmlNodePtr elem; + PyObject *pyobj_elem; + xmlChar * prefix; + xmlNsPtr ns; + PyObject *pyobj_ns; + xmlChar * value; + + if (!PyArg_ParseTuple(args, (char *)"OOOzOz:xmlValidateOneNamespace", &pyobj_ctxt, &pyobj_doc, &pyobj_elem, &prefix, &pyobj_ns, &value)) + return(NULL); + ctxt = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_ctxt); + doc = (xmlDocPtr) PyxmlNode_Get(pyobj_doc); + elem = (xmlNodePtr) PyxmlNode_Get(pyobj_elem); + ns = (xmlNsPtr) PyxmlNode_Get(pyobj_ns); + + c_retval = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +PyObject * libxml_xmlCopyProp(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; xmlAttrPtr c_retval; @@ -11197,7 +11522,7 @@ libxml_xmlStrncatNew(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject * libxml_xmlUTF8Strpos(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; - xmlChar * c_retval; + const xmlChar * c_retval; xmlChar * utf; int pos; @@ -11205,7 +11530,7 @@ libxml_xmlUTF8Strpos(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(NULL); c_retval = xmlUTF8Strpos(utf, pos); - py_retval = libxml_xmlCharPtrWrap((xmlChar *) c_retval); + py_retval = libxml_xmlCharPtrConstWrap((const xmlChar *) c_retval); return(py_retval); } @@ -11893,6 +12218,20 @@ libxml_xmlNodeSetName(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { } PyObject * +libxml_xmlFreeValidCtxt(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + xmlValidCtxtPtr cur; + PyObject *pyobj_cur; + + if (!PyArg_ParseTuple(args, (char *)"O:xmlFreeValidCtxt", &pyobj_cur)) + return(NULL); + cur = (xmlValidCtxtPtr) PyValidCtxt_Get(pyobj_cur); + + xmlFreeValidCtxt(cur); + Py_INCREF(Py_None); + return(Py_None); +} + +PyObject * libxml_xmlUCSIsYiRadicals(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { PyObject *py_retval; int c_retval; diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h index e821075..2758e99 100644 --- a/python/libxml_wrap.h +++ b/python/libxml_wrap.h @@ -73,6 +73,14 @@ typedef struct { xmlParserCtxtPtr obj; } PyparserCtxt_Object; +#define PyValidCtxt_Get(v) (((v) == Py_None) ? NULL : \ + (((PyValidCtxt_Object *)(v))->obj)) + +typedef struct { + PyObject_HEAD + xmlValidCtxtPtr obj; +} PyValidCtxt_Object; + #define Pycatalog_Get(v) (((v) == Py_None) ? NULL : \ (((Pycatalog_Object *)(v))->obj)) @@ -213,6 +221,7 @@ PyObject * libxml_xmlXPathContextPtrWrap(xmlXPathContextPtr ctxt); PyObject * libxml_xmlParserCtxtPtrWrap(xmlParserCtxtPtr ctxt); PyObject * libxml_xmlXPathParserContextPtrWrap(xmlXPathParserContextPtr ctxt); PyObject * libxml_xmlXPathObjectPtrWrap(xmlXPathObjectPtr obj); +PyObject * libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid); PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr obj); PyObject * libxml_xmlURIPtrWrap(xmlURIPtr uri); PyObject * libxml_xmlOutputBufferPtrWrap(xmlOutputBufferPtr buffer); diff --git a/python/setup.py b/python/setup.py index e8bd1ae..75bf340 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.15", + version = "2.6.16", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 722e0ec..1ae9b6c 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -36,12 +36,14 @@ PYTESTS= \ thread2.py \ sync.py \ tstLastError.py \ - indexes.py + indexes.py \ + dtdvalid.py XMLS= \ tst.xml \ valid.xml \ - invalid.xml + invalid.xml \ + test.dtd EXTRA_DIST = $(PYTESTS) $(XMLS) diff --git a/python/tests/Makefile.in b/python/tests/Makefile.in index 3b55268..9113a20 100644 --- a/python/tests/Makefile.in +++ b/python/tests/Makefile.in @@ -285,12 +285,14 @@ PYTESTS = \ thread2.py \ sync.py \ tstLastError.py \ - indexes.py + indexes.py \ + dtdvalid.py XMLS = \ tst.xml \ valid.xml \ - invalid.xml + invalid.xml \ + test.dtd EXTRA_DIST = $(PYTESTS) $(XMLS) all: all-am diff --git a/python/tests/dtdvalid.py b/python/tests/dtdvalid.py new file mode 100755 index 0000000..2011f2c --- /dev/null +++ b/python/tests/dtdvalid.py @@ -0,0 +1,32 @@ +#!/usr/bin/python -u +import libxml2 +import sys + +# Memory debug specific +libxml2.debugMemory(1) + +dtd="""<!ELEMENT foo EMPTY>""" +instance="""<?xml version="1.0"?> +<foo></foo>""" + +dtd = libxml2.parseDTD(None, 'test.dtd') +ctxt = libxml2.newValidCtxt() +doc = libxml2.parseDoc(instance) +ret = doc.validateDtd(ctxt, dtd) +if ret != 1: + print "error doing DTD validation" + sys.exit(1) + +doc.freeDoc() +dtd.freeDtd() +del dtd +del ctxt + +# Memory debug specific +libxml2.cleanupParser() +if libxml2.debugMemory(1) == 0: + print "OK" +else: + print "Memory leak %d bytes" % (libxml2.debugMemory(1)) + libxml2.dumpMemory() + diff --git a/python/tests/test.dtd b/python/tests/test.dtd new file mode 100644 index 0000000..b61b438 --- /dev/null +++ b/python/tests/test.dtd @@ -0,0 +1 @@ +<!ELEMENT foo EMPTY> diff --git a/python/types.c b/python/types.c index fa91a65..329d270 100644 --- a/python/types.c +++ b/python/types.c @@ -478,6 +478,26 @@ libxml_xmlXPathObjectPtrConvert(PyObject * obj) } PyObject * +libxml_xmlValidCtxtPtrWrap(xmlValidCtxtPtr valid) +{ + PyObject *ret; + +#ifdef DEBUG + printf("libxml_xmlValidCtxtPtrWrap: valid = %p\n", valid); +#endif + if (valid == NULL) { + Py_INCREF(Py_None); + return (Py_None); + } + + ret = + PyCObject_FromVoidPtrAndDesc((void *) valid, + (char *) "xmlValidCtxtPtr", NULL); + + return (ret); +} + +PyObject * libxml_xmlCatalogPtrWrap(xmlCatalogPtr catal) { PyObject *ret; @@ -248,6 +248,7 @@ struct _xmlRelaxNGParserCtxt { xmlAutomataStatePtr state; /* used to build the automata */ int crng; /* compact syntax and other flags */ + int freedoc; /* need to free the document */ }; #define FLAGS_IGNORABLE 1 @@ -2781,7 +2782,7 @@ xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data, * * Returns 0 in case of success and -1 in case of error. */ -static int +int xmlRelaxNGInitTypes(void) { if (xmlRelaxNGTypeInitialized != 0) @@ -6657,6 +6658,7 @@ xmlRelaxNGNewDocParserCtxt(xmlDocPtr doc) } memset(ret, 0, sizeof(xmlRelaxNGParserCtxt)); ret->document = copy; + ret->freedoc = 1; ret->userData = xmlGenericErrorContext; return (ret); } @@ -6693,6 +6695,8 @@ xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxtPtr ctxt) xmlRelaxNGFreeDefine(ctxt->defTab[i]); xmlFree(ctxt->defTab); } + if ((ctxt->document != NULL) && (ctxt->freedoc)) + xmlFreeDoc(ctxt->document); xmlFree(ctxt); } @@ -7671,6 +7675,8 @@ xmlRelaxNGDumpGrammar(FILE * output, xmlRelaxNGGrammarPtr grammar, int top) void xmlRelaxNGDump(FILE * output, xmlRelaxNGPtr schema) { + if (output == NULL) + return; if (schema == NULL) { fprintf(output, "RelaxNG empty or failed to compile\n"); return; @@ -7700,6 +7706,8 @@ xmlRelaxNGDump(FILE * output, xmlRelaxNGPtr schema) void xmlRelaxNGDumpTree(FILE * output, xmlRelaxNGPtr schema) { + if (output == NULL) + return; if (schema == NULL) { fprintf(output, "RelaxNG empty or failed to compile\n"); return; diff --git a/testThreads.c b/testThreads.c index d740a14..7147182 100644 --- a/testThreads.c +++ b/testThreads.c @@ -2,7 +2,7 @@ #include <stdio.h> #include "libxml.h" -#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) +#if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_SAX1_ENABLED) #include <libxml/globals.h> #include <libxml/threads.h> #include <libxml/parser.h> diff --git a/testapi.c b/testapi.c new file mode 100644 index 0000000..22c845d --- /dev/null +++ b/testapi.c @@ -0,0 +1,48623 @@ +/* + * testapi.c: libxml2 API tester program. + * + * Automatically generated by gentest.py from libxml2-api.xml + * + * See Copyright for the status of this software. + * + * daniel@veillard.com + */ + +#include <stdio.h> +#include <string.h> +#include <libxml/xmlerror.h> +#include <libxml/relaxng.h> + +static int testlibxml2(void); +static int test_module(const char *module); + +static int generic_errors = 0; +static int call_tests = 0; +static int function_tests = 0; + +static xmlChar chartab[1024]; +static int inttab[1024]; +static unsigned long longtab[1024]; + +static xmlDocPtr api_doc = NULL; +static xmlDtdPtr api_dtd = NULL; +static xmlNodePtr api_root = NULL; +static xmlAttrPtr api_attr = NULL; +static xmlNsPtr api_ns = NULL; + +static void +structured_errors(void *userData ATTRIBUTE_UNUSED, + xmlErrorPtr error ATTRIBUTE_UNUSED) { + generic_errors++; +} + +static void +free_api_doc(void) { + xmlFreeDoc(api_doc); + api_doc = NULL; + api_dtd = NULL; + api_root = NULL; + api_attr = NULL; + api_ns = NULL; +} + +static xmlDocPtr +get_api_doc(void) { + if (api_doc == NULL) { + api_doc = xmlReadMemory("<!DOCTYPE root [<!ELEMENT root EMPTY>]><root xmlns:h='http://example.com/' h:foo='bar'/>", 88, "root_test", NULL, 0); + api_root = NULL; + api_attr = NULL; + } + return(api_doc); +} + +static xmlDtdPtr +get_api_dtd(void) { + if ((api_dtd == NULL) || (api_dtd->type != XML_DTD_NODE)) { + get_api_doc(); + if ((api_doc != NULL) && (api_doc->children != NULL) && + (api_doc->children->type == XML_DTD_NODE)) + api_dtd = (xmlDtdPtr) api_doc->children; + } + return(api_dtd); +} + +static xmlNodePtr +get_api_root(void) { + if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { + get_api_doc(); + if ((api_doc != NULL) && (api_doc->children != NULL) && + (api_doc->children->next != NULL) && + (api_doc->children->next->type == XML_ELEMENT_NODE)) + api_root = api_doc->children->next; + } + return(api_root); +} + +static xmlNsPtr +get_api_ns(void) { + get_api_root(); + if (api_root != NULL) + api_ns = api_root->nsDef; + return(api_ns); +} + +static xmlAttrPtr +get_api_attr(void) { +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) + static int nr = 0; + xmlChar name[20]; +#endif + + if ((api_root == NULL) || (api_root->type != XML_ELEMENT_NODE)) { + get_api_root(); + } + if (api_root == NULL) + return(NULL); + if (api_root->properties != NULL) { + api_attr = api_root->properties; + return(api_root->properties); + } + api_attr = NULL; +#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) + snprintf((char *) name, 20, "foo%d", nr++); + api_attr = xmlSetProp(api_root, name, (const xmlChar *) "bar"); +#endif + return(api_attr); +} + +static int quiet = 0; + +int main(int argc, char **argv) { + int ret; + int blocks, mem; + + memset(chartab, 0, sizeof(chartab)); + strncpy((char *) chartab, " chartab\n", 20); + memset(inttab, 0, sizeof(inttab)); + memset(longtab, 0, sizeof(longtab)); + + xmlInitParser(); +#ifdef LIBXML_SCHEMAS_ENABLED + xmlRelaxNGInitTypes(); +#endif + + LIBXML_TEST_VERSION + + xmlSetStructuredErrorFunc(NULL, structured_errors); + + if (argc >= 2) { + if (!strcmp(argv[1], "-q")) { + quiet = 1; + if (argc >= 3) + ret = test_module(argv[2]); + else + ret = testlibxml2(); + } else { + ret = test_module(argv[1]); + } + } else + ret = testlibxml2(); + + xmlCleanupParser(); + blocks = xmlMemBlocks(); + mem = xmlMemUsed(); + if ((blocks != 0) || (mem != 0)) { + printf("testapi leaked %d bytes in %d blocks\n", mem, blocks); + } + xmlMemoryDump(); + + return (ret != 0); +} + +#include <libxml/HTMLparser.h> +#include <libxml/HTMLtree.h> +#include <libxml/catalog.h> +#include <libxml/chvalid.h> +#include <libxml/dict.h> +#include <libxml/encoding.h> +#include <libxml/entities.h> +#include <libxml/hash.h> +#include <libxml/list.h> +#include <libxml/nanoftp.h> +#include <libxml/nanohttp.h> +#include <libxml/parser.h> +#include <libxml/parserInternals.h> +#include <libxml/pattern.h> +#include <libxml/relaxng.h> +#include <libxml/schemasInternals.h> +#include <libxml/tree.h> +#include <libxml/uri.h> +#include <libxml/valid.h> +#include <libxml/xinclude.h> +#include <libxml/xmlIO.h> +#include <libxml/xmlerror.h> +#include <libxml/xmlreader.h> +#include <libxml/xmlsave.h> +#include <libxml/xmlschemas.h> +#include <libxml/xmlschemastypes.h> +#include <libxml/xmlstring.h> +#include <libxml/xmlwriter.h> +#include <libxml/xpath.h> +#include <libxml/xpointer.h> +#include <libxml/debugXML.h> + +#define gen_nb_void_ptr 2 + +static void *gen_void_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_void_ptr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#if 0 +#define gen_nb_const_void_ptr 2 + +static const void *gen_const_void_ptr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return((const void *) "immutable string"); + return(NULL); +} +static void des_const_void_ptr(int no ATTRIBUTE_UNUSED, const void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#define gen_nb_userdata 3 + +static void *gen_userdata(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return((void *) &call_tests); + if (no == 1) return((void *) -1); + return(NULL); +} +static void des_userdata(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + + +#define gen_nb_int 4 + +static int gen_int(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(0); + if (no == 1) return(1); + if (no == 2) return(-1); + if (no == 3) return(122); + return(-1); +} + +static void des_int(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_parseroptions 5 + +static int gen_parseroptions(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(XML_PARSE_NOBLANKS | XML_PARSE_RECOVER); + if (no == 1) return(XML_PARSE_NOENT | XML_PARSE_DTDLOAD | XML_PARSE_DTDATTR | XML_PARSE_DTDVALID | XML_PARSE_NOCDATA); + if (no == 2) return(XML_PARSE_XINCLUDE | XML_PARSE_NOXINCNODE | XML_PARSE_NSCLEAN); + if (no == 3) return(XML_PARSE_XINCLUDE | XML_PARSE_NODICT); + return(XML_PARSE_SAX1); +} + +static void des_parseroptions(int no ATTRIBUTE_UNUSED, int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#if 0 +#define gen_nb_long 5 + +static long gen_long(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(0); + if (no == 1) return(1); + if (no == 2) return(-1); + if (no == 3) return(122); + return(-1); +} + +static void des_long(int no ATTRIBUTE_UNUSED, long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#define gen_nb_xmlChar 4 + +static xmlChar gen_xmlChar(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return('a'); + if (no == 1) return(' '); + if (no == 2) return('ø'); + return(0); +} + +static void des_xmlChar(int no ATTRIBUTE_UNUSED, xmlChar val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_unsigned_int 3 + +static unsigned int gen_unsigned_int(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(0); + if (no == 1) return(1); + if (no == 2) return(122); + return(-1); +} + +static void des_unsigned_int(int no ATTRIBUTE_UNUSED, unsigned int val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_unsigned_long 4 + +static unsigned long gen_unsigned_long(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(0); + if (no == 1) return(1); + if (no == 2) return(122); + return(-1); +} + +static void des_unsigned_long(int no ATTRIBUTE_UNUSED, unsigned long val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_double 4 + +static double gen_double(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(0); + if (no == 1) return(-1.1); +#if defined(LIBXML_XPATH_ENABLED) + if (no == 2) return(xmlXPathNAN); +#endif + return(-1); +} + +static void des_double(int no ATTRIBUTE_UNUSED, double val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_unsigned_long_ptr 2 + +static unsigned long *gen_unsigned_long_ptr(int no, int nr) { + if (no == 0) return(&longtab[nr]); + return(NULL); +} + +static void des_unsigned_long_ptr(int no ATTRIBUTE_UNUSED, unsigned long *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_int_ptr 2 + +static int *gen_int_ptr(int no, int nr) { + if (no == 0) return(&inttab[nr]); + return(NULL); +} + +static void des_int_ptr(int no ATTRIBUTE_UNUSED, int *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_const_char_ptr 4 + +static char *gen_const_char_ptr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return((char *) "foo"); + if (no == 1) return((char *) "<foo/>"); + if (no == 2) return((char *) "test/ent2"); + return(NULL); +} +static void des_const_char_ptr(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlChar_ptr 2 + +static xmlChar *gen_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(&chartab[0]); + return(NULL); +} +static void des_xmlChar_ptr(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_FILE_ptr 2 + +static FILE *gen_FILE_ptr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(fopen("test.out", "a+")); + return(NULL); +} +static void des_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) fclose(val); +} + +#define gen_nb_debug_FILE_ptr 2 +static FILE *gen_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(fopen("test.out", "a+")); +} +static void des_debug_FILE_ptr(int no ATTRIBUTE_UNUSED, FILE *val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) fclose(val); +} + +#define gen_nb_const_xmlChar_ptr 5 + +static xmlChar *gen_const_xmlChar_ptr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return((xmlChar *) "foo"); + if (no == 1) return((xmlChar *) "<foo/>"); + if (no == 2) return((xmlChar *) "nøne"); + if (no == 3) return((xmlChar *) " 2ab "); + return(NULL); +} +static void des_const_xmlChar_ptr(int no ATTRIBUTE_UNUSED, const xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_filepath 8 + +static const char *gen_filepath(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return("missing.xml"); + if (no == 1) return("<foo/>"); + if (no == 2) return("test/ent2"); + if (no == 3) return("test/valid/REC-xml-19980210.xml"); + if (no == 4) return("test/valid/dtds/xhtml1-strict.dtd"); + if (no == 5) return("http://missing.example.org/"); + if (no == 6) return("http://missing. example.org/"); + return(NULL); +} +static void des_filepath(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_eaten_name 2 + +static xmlChar *gen_eaten_name(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlStrdup(BAD_CAST "eaten")); + return(NULL); +} +static void des_eaten_name(int no ATTRIBUTE_UNUSED, xmlChar *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_fileoutput 6 + +static const char *gen_fileoutput(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return("/missing.xml"); + if (no == 1) return("<foo/>"); + if (no == 2) return("ftp://missing.example.org/foo"); + if (no == 3) return("http://missing.example.org/"); + if (no == 4) return("http://missing. example.org/"); + return(NULL); +} +static void des_fileoutput(int no ATTRIBUTE_UNUSED, const char *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlParserCtxtPtr 3 +static xmlParserCtxtPtr gen_xmlParserCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewParserCtxt()); + if (no == 1) return(xmlCreateMemoryParserCtxt("<doc/>", 6)); + return(NULL); +} +static void des_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlParserCtxtPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) + xmlFreeParserCtxt(val); +} + +#define gen_nb_xmlSAXHandlerPtr 2 +static xmlSAXHandlerPtr gen_xmlSAXHandlerPtr(int no, int nr ATTRIBUTE_UNUSED) { +#ifdef LIBXML_SAX1_ENABLED + if (no == 0) return((xmlSAXHandlerPtr) &xmlDefaultSAXHandler); +#endif + return(NULL); +} +static void des_xmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, xmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlValidCtxtPtr 2 +static xmlValidCtxtPtr gen_xmlValidCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { +#ifdef LIBXML_VALID_ENABLED + if (no == 0) return(xmlNewValidCtxt()); +#endif + return(NULL); +} +static void des_xmlValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlValidCtxtPtr val, int nr ATTRIBUTE_UNUSED) { +#ifdef LIBXML_VALID_ENABLED + if (val != NULL) + xmlFreeValidCtxt(val); +#endif +} + +#define gen_nb_xmlParserInputBufferPtr 8 + +static xmlParserInputBufferPtr gen_xmlParserInputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlParserInputBufferCreateFilename("missing.xml", XML_CHAR_ENCODING_NONE)); + if (no == 1) return(xmlParserInputBufferCreateFilename("<foo/>", XML_CHAR_ENCODING_NONE)); + if (no == 2) return(xmlParserInputBufferCreateFilename("test/ent2", XML_CHAR_ENCODING_NONE)); + if (no == 3) return(xmlParserInputBufferCreateFilename("test/valid/REC-xml-19980210.xml", XML_CHAR_ENCODING_NONE)); + if (no == 4) return(xmlParserInputBufferCreateFilename("test/valid/dtds/xhtml1-strict.dtd", XML_CHAR_ENCODING_NONE)); + if (no == 5) return(xmlParserInputBufferCreateFilename("http://missing.example.org/", XML_CHAR_ENCODING_NONE)); + if (no == 6) return(xmlParserInputBufferCreateFilename("http://missing. example.org/", XML_CHAR_ENCODING_NONE)); + return(NULL); +} +static void des_xmlParserInputBufferPtr(int no ATTRIBUTE_UNUSED, xmlParserInputBufferPtr val, int nr ATTRIBUTE_UNUSED) { + xmlFreeParserInputBuffer(val); +} + +#define gen_nb_xmlDocPtr 3 +static xmlDocPtr gen_xmlDocPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewDoc(BAD_CAST "1.0")); + if (no == 1) return(xmlReadMemory("<foo/>", 6, "test", NULL, 0)); + return(NULL); +} +static void des_xmlDocPtr(int no ATTRIBUTE_UNUSED, xmlDocPtr val, int nr ATTRIBUTE_UNUSED) { + if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) + xmlFreeDoc(val); +} + +#define gen_nb_xmlAttrPtr 2 +static xmlAttrPtr gen_xmlAttrPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(get_api_attr()); + return(NULL); +} +static void des_xmlAttrPtr(int no, xmlAttrPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if (no == 0) free_api_doc(); +} + +#define gen_nb_xmlDictPtr 2 +static xmlDictPtr gen_xmlDictPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlDictCreate()); + return(NULL); +} +static void des_xmlDictPtr(int no ATTRIBUTE_UNUSED, xmlDictPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) + xmlDictFree(val); +} + +#define gen_nb_xmlNodePtr 3 +static xmlNodePtr gen_xmlNodePtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); + if (no == 1) return(get_api_root()); + return(NULL); +/* if (no == 2) return((xmlNodePtr) get_api_doc()); */ +} +static void des_xmlNodePtr(int no, xmlNodePtr val, int nr ATTRIBUTE_UNUSED) { + if (no == 1) free_api_doc(); + else if (val != NULL) { + xmlUnlinkNode(val); + xmlFreeNode(val); + } +} + +#define gen_nb_xmlDtdPtr 3 +static xmlDtdPtr gen_xmlDtdPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) + return(xmlNewDtd(NULL, BAD_CAST "dtd", BAD_CAST"foo", BAD_CAST"bar")); + if (no == 1) return(get_api_dtd()); + return(NULL); +} +static void des_xmlDtdPtr(int no, xmlDtdPtr val, int nr ATTRIBUTE_UNUSED) { + if (no == 1) free_api_doc(); + else if (val != NULL) { + xmlUnlinkNode((xmlNodePtr) val); + xmlFreeNode((xmlNodePtr) val); + } +} + +#define gen_nb_xmlNsPtr 2 +static xmlNsPtr gen_xmlNsPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(get_api_ns()); + return(NULL); +} +static void des_xmlNsPtr(int no, xmlNsPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if (no == 0) free_api_doc(); +} + +#define gen_nb_xmlNodePtr_in 3 +static xmlNodePtr gen_xmlNodePtr_in(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewPI(BAD_CAST "test", NULL)); + if (no == 0) return(xmlNewText(BAD_CAST "text")); + return(NULL); +} +static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#ifdef LIBXML_WRITER_ENABLED +#define gen_nb_xmlTextWriterPtr 2 +static xmlTextWriterPtr gen_xmlTextWriterPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewTextWriterFilename("test.out", 0)); + return(NULL); +} +static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) xmlFreeTextWriter(val); +} +#endif + +#ifdef LIBXML_READER_ENABLED +#define gen_nb_xmlTextReaderPtr 4 +static xmlTextReaderPtr gen_xmlTextReaderPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewTextReaderFilename("test/ent2")); + if (no == 1) return(xmlNewTextReaderFilename("test/valid/REC-xml-19980210.xml")); + if (no == 2) return(xmlNewTextReaderFilename("test/valid/dtds/xhtml1-strict.dtd")); + return(NULL); +} +static void des_xmlTextReaderPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) xmlFreeTextReader(val); +} +#endif + +#define gen_nb_xmlBufferPtr 3 +static xmlBufferPtr gen_xmlBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlBufferCreate()); + if (no == 1) return(xmlBufferCreateStatic((void *)"a static buffer", 13)); + return(NULL); +} +static void des_xmlBufferPtr(int no ATTRIBUTE_UNUSED, xmlBufferPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlBufferFree(val); + } +} + +#define gen_nb_xmlListPtr 2 +static xmlListPtr gen_xmlListPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlListCreate(NULL, NULL)); + return(NULL); +} +static void des_xmlListPtr(int no ATTRIBUTE_UNUSED, xmlListPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlListDelete(val); + } +} + +#define gen_nb_xmlHashTablePtr 2 +static xmlHashTablePtr gen_xmlHashTablePtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlHashCreate(10)); + return(NULL); +} +static void des_xmlHashTablePtr(int no ATTRIBUTE_UNUSED, xmlHashTablePtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlHashFree(val, NULL); + } +} + +#include <libxml/xpathInternals.h> + +#ifdef LIBXML_XPATH_ENABLED +#define gen_nb_xmlXPathObjectPtr 5 +static xmlXPathObjectPtr gen_xmlXPathObjectPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlXPathNewString(BAD_CAST "string object")); + if (no == 1) return(xmlXPathNewFloat(1.1)); + if (no == 2) return(xmlXPathNewBoolean(1)); + if (no == 3) return(xmlXPathNewNodeSet(NULL)); + return(NULL); +} +static void des_xmlXPathObjectPtr(int no ATTRIBUTE_UNUSED, xmlXPathObjectPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlXPathFreeObject(val); + } +} +#endif + +#ifdef LIBXML_OUTPUT_ENABLED +#define gen_nb_xmlOutputBufferPtr 2 +static xmlOutputBufferPtr gen_xmlOutputBufferPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlOutputBufferCreateFilename("test.out", NULL, 0)); + return(NULL); +} +static void des_xmlOutputBufferPtr(int no ATTRIBUTE_UNUSED, xmlOutputBufferPtr val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlOutputBufferClose(val); + } +} +#endif + +#ifdef LIBXML_FTP_ENABLED +#define gen_nb_xmlNanoFTPCtxtPtr 4 +static void *gen_xmlNanoFTPCtxtPtr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNanoFTPNewCtxt("ftp://example.com/")); + if (no == 1) return(xmlNanoFTPNewCtxt("http://example.com/")); + if (no == 2) return(xmlNanoFTPNewCtxt("foo")); + return(NULL); +} +static void des_xmlNanoFTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) { + xmlNanoFTPFreeCtxt(val); + } +} +#endif + +#ifdef LIBXML_HTTP_ENABLED +#define gen_nb_xmlNanoHTTPCtxtPtr 1 +static void *gen_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlNanoHTTPCtxtPtr(int no ATTRIBUTE_UNUSED, void *val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#define gen_nb_xmlCharEncoding 4 +static xmlCharEncoding gen_xmlCharEncoding(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(XML_CHAR_ENCODING_UTF8); + if (no == 1) return(XML_CHAR_ENCODING_NONE); + if (no == 0) return(XML_CHAR_ENCODING_8859_1); + return(XML_CHAR_ENCODING_ERROR); +} +static void des_xmlCharEncoding(int no ATTRIBUTE_UNUSED, xmlCharEncoding val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlHashDeallocator 2 +static void +test_xmlHashDeallocator(void *payload ATTRIBUTE_UNUSED, xmlChar *name ATTRIBUTE_UNUSED) { +} + +static xmlHashDeallocator gen_xmlHashDeallocator(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(test_xmlHashDeallocator); + return(NULL); +} +static void des_xmlHashDeallocator(int no ATTRIBUTE_UNUSED, xmlHashDeallocator val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + + +static void desret_int(int val ATTRIBUTE_UNUSED) { +} +static void desret_xmlChar(xmlChar val ATTRIBUTE_UNUSED) { +} +static void desret_long(long val ATTRIBUTE_UNUSED) { +} +static void desret_double(double val ATTRIBUTE_UNUSED) { +} +static void desret_xmlCharEncoding(xmlCharEncoding val ATTRIBUTE_UNUSED) { +} +#if 0 +static void desret_const_void_ptr(void *val ATTRIBUTE_UNUSED) { +} +#endif +static void desret_void_ptr(void *val ATTRIBUTE_UNUSED) { +} +static void desret_const_char_ptr(const char *val ATTRIBUTE_UNUSED) { +} +static void desret_const_xmlChar_ptr(const xmlChar *val ATTRIBUTE_UNUSED) { +} +static void desret_xmlChar_ptr(xmlChar *val) { + if (val != NULL) + xmlFree(val); +} +static void desret_xmlDocPtr(xmlDocPtr val) { + if (val != api_doc) + xmlFreeDoc(val); +} +static void desret_xmlDictPtr(xmlDictPtr val) { + xmlDictFree(val); +} +#ifdef LIBXML_OUTPUT_ENABLED +static void desret_xmlOutputBufferPtr(xmlOutputBufferPtr val) { + xmlOutputBufferClose(val); +} +#endif +#ifdef LIBXML_READER_ENABLED +static void desret_xmlTextReaderPtr(xmlTextReaderPtr val) { + xmlFreeTextReader(val); +} +#endif +static void desret_xmlNodePtr(xmlNodePtr val) { + if ((val != NULL) && (val != api_root) && (val != (xmlNodePtr) api_doc)) { + xmlUnlinkNode(val); + xmlFreeNode(val); + } +} +static void desret_xmlAttrPtr(xmlAttrPtr val) { + if (val != NULL) { + xmlUnlinkNode((xmlNodePtr) val); + xmlFreeNode((xmlNodePtr) val); + } +} +static void desret_xmlEntityPtr(xmlEntityPtr val) { + if (val != NULL) { + xmlUnlinkNode((xmlNodePtr) val); + xmlFreeNode((xmlNodePtr) val); + } +} +static void desret_xmlElementPtr(xmlElementPtr val) { + if (val != NULL) { + xmlUnlinkNode((xmlNodePtr) val); + } +} +static void desret_xmlAttributePtr(xmlAttributePtr val) { + if (val != NULL) { + xmlUnlinkNode((xmlNodePtr) val); + } +} +static void desret_xmlNsPtr(xmlNsPtr val ATTRIBUTE_UNUSED) { +} +static void desret_xmlDtdPtr(xmlDtdPtr val) { + desret_xmlNodePtr((xmlNodePtr)val); +} +#ifdef LIBXML_XPATH_ENABLED +static void desret_xmlXPathObjectPtr(xmlXPathObjectPtr val) { + xmlXPathFreeObject(val); +} +static void desret_xmlNodeSetPtr(xmlNodeSetPtr val) { + xmlXPathFreeNodeSet(val); +} +#endif +static void desret_xmlParserCtxtPtr(xmlParserCtxtPtr val) { + xmlFreeParserCtxt(val); +} + +static void desret_xmlParserInputBufferPtr(xmlParserInputBufferPtr val) { + xmlFreeParserInputBuffer(val); +} +static void desret_xmlParserInputPtr(xmlParserInputPtr val) { + xmlFreeInputStream(val); +} +#ifdef LIBXML_WRITER_ENABLED +static void desret_xmlTextWriterPtr(xmlTextWriterPtr val) { + xmlFreeTextWriter(val); +} +#endif +static void desret_xmlBufferPtr(xmlBufferPtr val) { + xmlBufferFree(val); +} +#ifdef LIBXML_SCHEMAS_ENABLED +static void desret_xmlSchemaParserCtxtPtr(xmlSchemaParserCtxtPtr val) { + xmlSchemaFreeParserCtxt(val); +} +static void desret_xmlSchemaTypePtr(xmlSchemaTypePtr val ATTRIBUTE_UNUSED) { +} +static void desret_xmlRelaxNGParserCtxtPtr(xmlRelaxNGParserCtxtPtr val) { + xmlRelaxNGFreeParserCtxt(val); +} +#endif +#ifdef LIBXML_HTML_ENABLED +static void desret_const_htmlEntityDesc_ptr(const htmlEntityDescPtr val ATTRIBUTE_UNUSED) { +} +#endif + +/* cut and pasted from autogenerated to avoid troubles */ +#define gen_nb_const_xmlChar_ptr_ptr 1 +static xmlChar ** gen_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, const xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_unsigned_char_ptr 1 +static unsigned char * gen_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_const_unsigned_char_ptr 1 +static unsigned char * gen_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_unsigned_char_ptr(int no ATTRIBUTE_UNUSED, const unsigned char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#ifdef LIBXML_HTML_ENABLED +#define gen_nb_const_htmlNodePtr 1 +static htmlNodePtr gen_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_htmlNodePtr(int no ATTRIBUTE_UNUSED, const htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_HTML_ENABLED +#define gen_nb_htmlDocPtr 3 +static htmlDocPtr gen_htmlDocPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(htmlNewDoc(NULL, NULL)); + if (no == 1) return(htmlReadMemory("<html/>", 7, "test", NULL, 0)); + return(NULL); +} +static void des_htmlDocPtr(int no ATTRIBUTE_UNUSED, htmlDocPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) + xmlFreeDoc(val); +} +static void desret_htmlDocPtr(htmlDocPtr val) { + if ((val != NULL) && (val != api_doc) && (val->doc != api_doc)) + xmlFreeDoc(val); +} +#define gen_nb_htmlParserCtxtPtr 3 +static htmlParserCtxtPtr gen_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if (no == 0) return(xmlNewParserCtxt()); + if (no == 1) return(htmlCreateMemoryParserCtxt("<html/>", 7)); + return(NULL); +} +static void des_htmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, htmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + if (val != NULL) + htmlFreeParserCtxt(val); +} +static void desret_htmlParserCtxtPtr(htmlParserCtxtPtr val) { + if (val != NULL) + htmlFreeParserCtxt(val); +} +#endif + +#ifdef LIBXML_XPATH_ENABLED +#define gen_nb_xmlNodeSetPtr 1 +static xmlNodeSetPtr gen_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlNodeSetPtr(int no ATTRIBUTE_UNUSED, xmlNodeSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED +#define gen_nb_xmlShellCtxtPtr 1 +static xmlShellCtxtPtr gen_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlShellCtxtPtr(int no ATTRIBUTE_UNUSED, xmlShellCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif +#endif + +#ifdef LIBXML_PATTERN_ENABLED +#define gen_nb_xmlPatternPtr 1 +static xmlPatternPtr gen_xmlPatternPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlPatternPtr(int no ATTRIBUTE_UNUSED, xmlPatternPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +/************************************************************************ + * * + * WARNING: end of the manually maintained part of the test code * + * do not remove or alter the CUT HERE line * + * * + ************************************************************************/ + +/* CUT HERE: everything below that line is generated */ +#ifdef LIBXML_HTML_ENABLED +#define gen_nb_htmlParserOption 4 +static htmlParserOption gen_htmlParserOption(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(HTML_PARSE_NOBLANKS); + if (no == 2) return(HTML_PARSE_NOERROR); + if (no == 3) return(HTML_PARSE_NONET); + if (no == 4) return(HTML_PARSE_NOWARNING); + return(0); +} +static void des_htmlParserOption(int no ATTRIBUTE_UNUSED, htmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_htmlParserOption(htmlParserOption val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_HTML_ENABLED +#define gen_nb_htmlStatus 4 +static htmlStatus gen_htmlStatus(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(HTML_DEPRECATED); + if (no == 2) return(HTML_INVALID); + if (no == 3) return(HTML_NA); + if (no == 4) return(HTML_REQUIRED); + return(0); +} +static void des_htmlStatus(int no ATTRIBUTE_UNUSED, htmlStatus val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_htmlStatus(htmlStatus val ATTRIBUTE_UNUSED) { +} + +#endif + +#define gen_nb_xlinkActuate 3 +static xlinkActuate gen_xlinkActuate(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XLINK_ACTUATE_AUTO); + if (no == 2) return(XLINK_ACTUATE_NONE); + if (no == 3) return(XLINK_ACTUATE_ONREQUEST); + return(0); +} +static void des_xlinkActuate(int no ATTRIBUTE_UNUSED, xlinkActuate val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xlinkActuate(xlinkActuate val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xlinkShow 4 +static xlinkShow gen_xlinkShow(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XLINK_SHOW_EMBED); + if (no == 2) return(XLINK_SHOW_NEW); + if (no == 3) return(XLINK_SHOW_NONE); + if (no == 4) return(XLINK_SHOW_REPLACE); + return(0); +} +static void des_xlinkShow(int no ATTRIBUTE_UNUSED, xlinkShow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xlinkShow(xlinkShow val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xlinkType 4 +static xlinkType gen_xlinkType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XLINK_TYPE_EXTENDED); + if (no == 2) return(XLINK_TYPE_EXTENDED_SET); + if (no == 3) return(XLINK_TYPE_NONE); + if (no == 4) return(XLINK_TYPE_SIMPLE); + return(0); +} +static void des_xlinkType(int no ATTRIBUTE_UNUSED, xlinkType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xlinkType(xlinkType val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlAttributeDefault 4 +static xmlAttributeDefault gen_xmlAttributeDefault(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ATTRIBUTE_FIXED); + if (no == 2) return(XML_ATTRIBUTE_IMPLIED); + if (no == 3) return(XML_ATTRIBUTE_NONE); + if (no == 4) return(XML_ATTRIBUTE_REQUIRED); + return(0); +} +static void des_xmlAttributeDefault(int no ATTRIBUTE_UNUSED, xmlAttributeDefault val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlAttributeDefault(xmlAttributeDefault val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlAttributeType 4 +static xmlAttributeType gen_xmlAttributeType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ATTRIBUTE_CDATA); + if (no == 2) return(XML_ATTRIBUTE_ENTITIES); + if (no == 3) return(XML_ATTRIBUTE_ENTITY); + if (no == 4) return(XML_ATTRIBUTE_ENUMERATION); + return(0); +} +static void des_xmlAttributeType(int no ATTRIBUTE_UNUSED, xmlAttributeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlAttributeType(xmlAttributeType val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlBufferAllocationScheme 3 +static xmlBufferAllocationScheme gen_xmlBufferAllocationScheme(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_BUFFER_ALLOC_DOUBLEIT); + if (no == 2) return(XML_BUFFER_ALLOC_EXACT); + if (no == 3) return(XML_BUFFER_ALLOC_IMMUTABLE); + return(0); +} +static void des_xmlBufferAllocationScheme(int no ATTRIBUTE_UNUSED, xmlBufferAllocationScheme val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlBufferAllocationScheme(xmlBufferAllocationScheme val ATTRIBUTE_UNUSED) { +} + +#ifdef LIBXML_CATALOG_ENABLED +#define gen_nb_xmlCatalogAllow 4 +static xmlCatalogAllow gen_xmlCatalogAllow(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_CATA_ALLOW_ALL); + if (no == 2) return(XML_CATA_ALLOW_DOCUMENT); + if (no == 3) return(XML_CATA_ALLOW_GLOBAL); + if (no == 4) return(XML_CATA_ALLOW_NONE); + return(0); +} +static void des_xmlCatalogAllow(int no ATTRIBUTE_UNUSED, xmlCatalogAllow val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlCatalogAllow(xmlCatalogAllow val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_CATALOG_ENABLED +#define gen_nb_xmlCatalogPrefer 3 +static xmlCatalogPrefer gen_xmlCatalogPrefer(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_CATA_PREFER_NONE); + if (no == 2) return(XML_CATA_PREFER_PUBLIC); + if (no == 3) return(XML_CATA_PREFER_SYSTEM); + return(0); +} +static void des_xmlCatalogPrefer(int no ATTRIBUTE_UNUSED, xmlCatalogPrefer val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlCatalogPrefer(xmlCatalogPrefer val ATTRIBUTE_UNUSED) { +} + +#endif + +#define gen_nb_xmlElementContentOccur 4 +static xmlElementContentOccur gen_xmlElementContentOccur(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ELEMENT_CONTENT_MULT); + if (no == 2) return(XML_ELEMENT_CONTENT_ONCE); + if (no == 3) return(XML_ELEMENT_CONTENT_OPT); + if (no == 4) return(XML_ELEMENT_CONTENT_PLUS); + return(0); +} +static void des_xmlElementContentOccur(int no ATTRIBUTE_UNUSED, xmlElementContentOccur val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlElementContentOccur(xmlElementContentOccur val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlElementContentType 4 +static xmlElementContentType gen_xmlElementContentType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ELEMENT_CONTENT_ELEMENT); + if (no == 2) return(XML_ELEMENT_CONTENT_OR); + if (no == 3) return(XML_ELEMENT_CONTENT_PCDATA); + if (no == 4) return(XML_ELEMENT_CONTENT_SEQ); + return(0); +} +static void des_xmlElementContentType(int no ATTRIBUTE_UNUSED, xmlElementContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlElementContentType(xmlElementContentType val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlElementType 4 +static xmlElementType gen_xmlElementType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ATTRIBUTE_DECL); + if (no == 2) return(XML_ATTRIBUTE_NODE); + if (no == 3) return(XML_CDATA_SECTION_NODE); + if (no == 4) return(XML_COMMENT_NODE); + return(0); +} +static void des_xmlElementType(int no ATTRIBUTE_UNUSED, xmlElementType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlElementType(xmlElementType val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlElementTypeVal 4 +static xmlElementTypeVal gen_xmlElementTypeVal(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ELEMENT_TYPE_ANY); + if (no == 2) return(XML_ELEMENT_TYPE_ELEMENT); + if (no == 3) return(XML_ELEMENT_TYPE_EMPTY); + if (no == 4) return(XML_ELEMENT_TYPE_MIXED); + return(0); +} +static void des_xmlElementTypeVal(int no ATTRIBUTE_UNUSED, xmlElementTypeVal val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlElementTypeVal(xmlElementTypeVal val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlEntityType 4 +static xmlEntityType gen_xmlEntityType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_EXTERNAL_GENERAL_PARSED_ENTITY); + if (no == 2) return(XML_EXTERNAL_GENERAL_UNPARSED_ENTITY); + if (no == 3) return(XML_EXTERNAL_PARAMETER_ENTITY); + if (no == 4) return(XML_INTERNAL_GENERAL_ENTITY); + return(0); +} +static void des_xmlEntityType(int no ATTRIBUTE_UNUSED, xmlEntityType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlEntityType(xmlEntityType val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlErrorDomain 4 +static xmlErrorDomain gen_xmlErrorDomain(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_FROM_C14N); + if (no == 2) return(XML_FROM_CATALOG); + if (no == 3) return(XML_FROM_CHECK); + if (no == 4) return(XML_FROM_DATATYPE); + return(0); +} +static void des_xmlErrorDomain(int no ATTRIBUTE_UNUSED, xmlErrorDomain val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlErrorDomain(xmlErrorDomain val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlErrorLevel 4 +static xmlErrorLevel gen_xmlErrorLevel(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_ERR_ERROR); + if (no == 2) return(XML_ERR_FATAL); + if (no == 3) return(XML_ERR_NONE); + if (no == 4) return(XML_ERR_WARNING); + return(0); +} +static void des_xmlErrorLevel(int no ATTRIBUTE_UNUSED, xmlErrorLevel val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlErrorLevel(xmlErrorLevel val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlParserErrors 4 +static xmlParserErrors gen_xmlParserErrors(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_C14N_CREATE_CTXT); + if (no == 2) return(XML_C14N_CREATE_STACK); + if (no == 3) return(XML_C14N_INVALID_NODE); + if (no == 4) return(XML_C14N_REQUIRES_UTF8); + return(0); +} +static void des_xmlParserErrors(int no ATTRIBUTE_UNUSED, xmlParserErrors val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserErrors(xmlParserErrors val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlParserInputState 4 +static xmlParserInputState gen_xmlParserInputState(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_PARSER_ATTRIBUTE_VALUE); + if (no == 2) return(XML_PARSER_CDATA_SECTION); + if (no == 3) return(XML_PARSER_COMMENT); + if (no == 4) return(XML_PARSER_CONTENT); + return(0); +} +static void des_xmlParserInputState(int no ATTRIBUTE_UNUSED, xmlParserInputState val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserInputState(xmlParserInputState val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlParserMode 4 +static xmlParserMode gen_xmlParserMode(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_PARSE_DOM); + if (no == 2) return(XML_PARSE_PUSH_DOM); + if (no == 3) return(XML_PARSE_PUSH_SAX); + if (no == 4) return(XML_PARSE_READER); + return(0); +} +static void des_xmlParserMode(int no ATTRIBUTE_UNUSED, xmlParserMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserMode(xmlParserMode val ATTRIBUTE_UNUSED) { +} + +#define gen_nb_xmlParserOption 4 +static xmlParserOption gen_xmlParserOption(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_PARSE_DTDATTR); + if (no == 2) return(XML_PARSE_DTDLOAD); + if (no == 3) return(XML_PARSE_DTDVALID); + if (no == 4) return(XML_PARSE_NOBLANKS); + return(0); +} +static void des_xmlParserOption(int no ATTRIBUTE_UNUSED, xmlParserOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserOption(xmlParserOption val ATTRIBUTE_UNUSED) { +} + +#ifdef LIBXML_READER_ENABLED +#define gen_nb_xmlParserProperties 4 +static xmlParserProperties gen_xmlParserProperties(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_PARSER_DEFAULTATTRS); + if (no == 2) return(XML_PARSER_LOADDTD); + if (no == 3) return(XML_PARSER_SUBST_ENTITIES); + if (no == 4) return(XML_PARSER_VALIDATE); + return(0); +} +static void des_xmlParserProperties(int no ATTRIBUTE_UNUSED, xmlParserProperties val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserProperties(xmlParserProperties val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_READER_ENABLED +#define gen_nb_xmlParserSeverities 4 +static xmlParserSeverities gen_xmlParserSeverities(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_PARSER_SEVERITY_ERROR); + if (no == 2) return(XML_PARSER_SEVERITY_VALIDITY_ERROR); + if (no == 3) return(XML_PARSER_SEVERITY_VALIDITY_WARNING); + if (no == 4) return(XML_PARSER_SEVERITY_WARNING); + return(0); +} +static void des_xmlParserSeverities(int no ATTRIBUTE_UNUSED, xmlParserSeverities val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlParserSeverities(xmlParserSeverities val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_READER_ENABLED +#define gen_nb_xmlReaderTypes 4 +static xmlReaderTypes gen_xmlReaderTypes(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_READER_TYPE_ATTRIBUTE); + if (no == 2) return(XML_READER_TYPE_CDATA); + if (no == 3) return(XML_READER_TYPE_COMMENT); + if (no == 4) return(XML_READER_TYPE_DOCUMENT); + return(0); +} +static void des_xmlReaderTypes(int no ATTRIBUTE_UNUSED, xmlReaderTypes val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlReaderTypes(xmlReaderTypes val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlRelaxNGParserFlag 3 +static xmlRelaxNGParserFlag gen_xmlRelaxNGParserFlag(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_RELAXNGP_CRNG); + if (no == 2) return(XML_RELAXNGP_FREE_DOC); + if (no == 3) return(XML_RELAXNGP_NONE); + return(0); +} +static void des_xmlRelaxNGParserFlag(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlRelaxNGParserFlag(xmlRelaxNGParserFlag val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlRelaxNGValidErr 4 +static xmlRelaxNGValidErr gen_xmlRelaxNGValidErr(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_RELAXNG_ERR_ATTREXTRANS); + if (no == 2) return(XML_RELAXNG_ERR_ATTRNAME); + if (no == 3) return(XML_RELAXNG_ERR_ATTRNONS); + if (no == 4) return(XML_RELAXNG_ERR_ATTRVALID); + return(0); +} +static void des_xmlRelaxNGValidErr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidErr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlRelaxNGValidErr(xmlRelaxNGValidErr val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlSchemaContentType 4 +static xmlSchemaContentType gen_xmlSchemaContentType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_SCHEMA_CONTENT_ANY); + if (no == 2) return(XML_SCHEMA_CONTENT_BASIC); + if (no == 3) return(XML_SCHEMA_CONTENT_ELEMENTS); + if (no == 4) return(XML_SCHEMA_CONTENT_EMPTY); + return(0); +} +static void des_xmlSchemaContentType(int no ATTRIBUTE_UNUSED, xmlSchemaContentType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlSchemaContentType(xmlSchemaContentType val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlSchemaTypeType 4 +static xmlSchemaTypeType gen_xmlSchemaTypeType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_SCHEMA_FACET_ENUMERATION); + if (no == 2) return(XML_SCHEMA_FACET_FRACTIONDIGITS); + if (no == 3) return(XML_SCHEMA_FACET_LENGTH); + if (no == 4) return(XML_SCHEMA_FACET_MAXEXCLUSIVE); + return(0); +} +static void des_xmlSchemaTypeType(int no ATTRIBUTE_UNUSED, xmlSchemaTypeType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlSchemaTypeType(xmlSchemaTypeType val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlSchemaValType 4 +static xmlSchemaValType gen_xmlSchemaValType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_SCHEMAS_ANYSIMPLETYPE); + if (no == 2) return(XML_SCHEMAS_ANYTYPE); + if (no == 3) return(XML_SCHEMAS_ANYURI); + if (no == 4) return(XML_SCHEMAS_BASE64BINARY); + return(0); +} +static void des_xmlSchemaValType(int no ATTRIBUTE_UNUSED, xmlSchemaValType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlSchemaValType(xmlSchemaValType val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlSchemaValidError 4 +static xmlSchemaValidError gen_xmlSchemaValidError(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_SCHEMAS_ERR_); + if (no == 2) return(XML_SCHEMAS_ERR_ATTRINVALID); + if (no == 3) return(XML_SCHEMAS_ERR_ATTRUNKNOWN); + if (no == 4) return(XML_SCHEMAS_ERR_CONSTRUCT); + return(0); +} +static void des_xmlSchemaValidError(int no ATTRIBUTE_UNUSED, xmlSchemaValidError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlSchemaValidError(xmlSchemaValidError val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED +#define gen_nb_xmlSchemaValidOption 1 +static xmlSchemaValidOption gen_xmlSchemaValidOption(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_SCHEMA_VAL_VC_I_CREATE); + return(0); +} +static void des_xmlSchemaValidOption(int no ATTRIBUTE_UNUSED, xmlSchemaValidOption val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlSchemaValidOption(xmlSchemaValidOption val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_READER_ENABLED +#define gen_nb_xmlTextReaderMode 4 +static xmlTextReaderMode gen_xmlTextReaderMode(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XML_TEXTREADER_MODE_CLOSED); + if (no == 2) return(XML_TEXTREADER_MODE_EOF); + if (no == 3) return(XML_TEXTREADER_MODE_ERROR); + if (no == 4) return(XML_TEXTREADER_MODE_INITIAL); + return(0); +} +static void des_xmlTextReaderMode(int no ATTRIBUTE_UNUSED, xmlTextReaderMode val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlTextReaderMode(xmlTextReaderMode val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_XPATH_ENABLED +#define gen_nb_xmlXPathError 4 +static xmlXPathError gen_xmlXPathError(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XPATH_ENCODING_ERROR); + if (no == 2) return(XPATH_EXPRESSION_OK); + if (no == 3) return(XPATH_EXPR_ERROR); + if (no == 4) return(XPATH_INVALID_ARITY); + return(0); +} +static void des_xmlXPathError(int no ATTRIBUTE_UNUSED, xmlXPathError val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlXPathError(xmlXPathError val ATTRIBUTE_UNUSED) { +} + +#endif + +#ifdef LIBXML_XPATH_ENABLED +#define gen_nb_xmlXPathObjectType 4 +static xmlXPathObjectType gen_xmlXPathObjectType(int no, int nr ATTRIBUTE_UNUSED) { + if (no == 1) return(XPATH_BOOLEAN); + if (no == 2) return(XPATH_LOCATIONSET); + if (no == 3) return(XPATH_NODESET); + if (no == 4) return(XPATH_NUMBER); + return(0); +} +static void des_xmlXPathObjectType(int no ATTRIBUTE_UNUSED, xmlXPathObjectType val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +static void desret_xmlXPathObjectType(xmlXPathObjectType val ATTRIBUTE_UNUSED) { +} + +#endif + +#include <libxml/HTMLparser.h> +#include <libxml/HTMLtree.h> +#include <libxml/SAX2.h> +#include <libxml/c14n.h> +#include <libxml/catalog.h> +#include <libxml/chvalid.h> +#include <libxml/debugXML.h> +#include <libxml/dict.h> +#include <libxml/encoding.h> +#include <libxml/entities.h> +#include <libxml/hash.h> +#include <libxml/list.h> +#include <libxml/nanoftp.h> +#include <libxml/nanohttp.h> +#include <libxml/parser.h> +#include <libxml/parserInternals.h> +#include <libxml/pattern.h> +#include <libxml/relaxng.h> +#include <libxml/schemasInternals.h> +#include <libxml/tree.h> +#include <libxml/uri.h> +#include <libxml/valid.h> +#include <libxml/xinclude.h> +#include <libxml/xmlIO.h> +#include <libxml/xmlautomata.h> +#include <libxml/xmlerror.h> +#include <libxml/xmlreader.h> +#include <libxml/xmlregexp.h> +#include <libxml/xmlsave.h> +#include <libxml/xmlschemas.h> +#include <libxml/xmlschemastypes.h> +#include <libxml/xmlstring.h> +#include <libxml/xmlunicode.h> +#include <libxml/xmlwriter.h> +#include <libxml/xpath.h> +#include <libxml/xpathInternals.h> +#include <libxml/xpointer.h> +static int test_HTMLparser(void); +static int test_HTMLtree(void); +static int test_SAX2(void); +static int test_c14n(void); +static int test_catalog(void); +static int test_chvalid(void); +static int test_debugXML(void); +static int test_dict(void); +static int test_encoding(void); +static int test_entities(void); +static int test_hash(void); +static int test_list(void); +static int test_nanoftp(void); +static int test_nanohttp(void); +static int test_parser(void); +static int test_parserInternals(void); +static int test_pattern(void); +static int test_relaxng(void); +static int test_schemasInternals(void); +static int test_tree(void); +static int test_uri(void); +static int test_valid(void); +static int test_xinclude(void); +static int test_xmlIO(void); +static int test_xmlautomata(void); +static int test_xmlerror(void); +static int test_xmlreader(void); +static int test_xmlregexp(void); +static int test_xmlsave(void); +static int test_xmlschemas(void); +static int test_xmlschemastypes(void); +static int test_xmlstring(void); +static int test_xmlunicode(void); +static int test_xmlwriter(void); +static int test_xpath(void); +static int test_xpathInternals(void); +static int test_xpointer(void); + +/** + * testlibxml2: + * + * Main entry point of the tester for the full libxml2 module, + * it calls all the tester entry point for each module. + * + * Returns the number of error found + */ +static int +testlibxml2(void) +{ + int test_ret = 0; + + test_ret += test_HTMLparser(); + test_ret += test_HTMLtree(); + test_ret += test_SAX2(); + test_ret += test_c14n(); + test_ret += test_catalog(); + test_ret += test_chvalid(); + test_ret += test_debugXML(); + test_ret += test_dict(); + test_ret += test_encoding(); + test_ret += test_entities(); + test_ret += test_hash(); + test_ret += test_list(); + test_ret += test_nanoftp(); + test_ret += test_nanohttp(); + test_ret += test_parser(); + test_ret += test_parserInternals(); + test_ret += test_pattern(); + test_ret += test_relaxng(); + test_ret += test_schemasInternals(); + test_ret += test_tree(); + test_ret += test_uri(); + test_ret += test_valid(); + test_ret += test_xinclude(); + test_ret += test_xmlIO(); + test_ret += test_xmlautomata(); + test_ret += test_xmlerror(); + test_ret += test_xmlreader(); + test_ret += test_xmlregexp(); + test_ret += test_xmlsave(); + test_ret += test_xmlschemas(); + test_ret += test_xmlschemastypes(); + test_ret += test_xmlstring(); + test_ret += test_xmlunicode(); + test_ret += test_xmlwriter(); + test_ret += test_xpath(); + test_ret += test_xpathInternals(); + test_ret += test_xpointer(); + + printf("Total: %d functions, %d tests, %d errors\n", + function_tests, call_tests, test_ret); + return(test_ret); +} + + +static int +test_UTF8ToHtml(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + unsigned char * out; /* a pointer to an array of bytes to store the result */ + int n_out; + int * outlen; /* the length of @out */ + int n_outlen; + unsigned char * in; /* a pointer to an array of UTF-8 chars */ + int n_in; + int * inlen; /* the length of @in */ + int n_inlen; + + for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { + for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { + for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { + for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { + mem_base = xmlMemBlocks(); + out = gen_unsigned_char_ptr(n_out, 0); + outlen = gen_int_ptr(n_outlen, 1); + in = gen_const_unsigned_char_ptr(n_in, 2); + inlen = gen_int_ptr(n_inlen, 3); + + ret_val = UTF8ToHtml(out, outlen, in, inlen); + desret_int(ret_val); + call_tests++; + des_unsigned_char_ptr(n_out, out, 0); + des_int_ptr(n_outlen, outlen, 1); + des_const_unsigned_char_ptr(n_in, in, 2); + des_int_ptr(n_inlen, inlen, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in UTF8ToHtml", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_outlen); + printf(" %d", n_in); + printf(" %d", n_inlen); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_HTML_ENABLED + +#define gen_nb_const_htmlElemDesc_ptr 1 +static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_htmlAttrAllowed(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlStatus ret_val; + htmlElemDesc * elt; /* HTML element */ + int n_elt; + xmlChar * attr; /* HTML attribute */ + int n_attr; + int legacy; /* whether to allow deprecated attributes */ + int n_legacy; + + for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { + for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) { + for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { + mem_base = xmlMemBlocks(); + elt = gen_const_htmlElemDesc_ptr(n_elt, 0); + attr = gen_const_xmlChar_ptr(n_attr, 1); + legacy = gen_int(n_legacy, 2); + + ret_val = htmlAttrAllowed(elt, attr, legacy); + desret_htmlStatus(ret_val); + call_tests++; + des_const_htmlElemDesc_ptr(n_elt, elt, 0); + des_const_xmlChar_ptr(n_attr, attr, 1); + des_int(n_legacy, legacy, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlAttrAllowed", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_elt); + printf(" %d", n_attr); + printf(" %d", n_legacy); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_HTML_ENABLED + +#define gen_nb_htmlNodePtr 1 +static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_htmlAutoCloseTag(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the HTML document */ + int n_doc; + xmlChar * name; /* The tag name */ + int n_name; + htmlNodePtr elem; /* the HTML element */ + int n_elem; + + for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + doc = gen_htmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + elem = gen_htmlNodePtr(n_elem, 2); + + ret_val = htmlAutoCloseTag(doc, name, elem); + desret_int(ret_val); + call_tests++; + des_htmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_htmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlAutoCloseTag", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlCreateMemoryParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ret_val; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = htmlCreateMemoryParserCtxt(buffer, size); + desret_htmlParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_HTML_ENABLED + +#define gen_nb_htmlSAXHandlerPtr 1 +static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_htmlCreatePushParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + htmlParserCtxtPtr ret_val; + htmlSAXHandlerPtr sax; /* a SAX handler */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks */ + int n_user_data; + char * chunk; /* a pointer to an array of chars */ + int n_chunk; + int size; /* number of chars in the array */ + int n_size; + const char * filename; /* an optional file name or URI */ + int n_filename; + xmlCharEncoding enc; /* an optional encoding */ + int n_enc; + + for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + sax = gen_htmlSAXHandlerPtr(n_sax, 0); + user_data = gen_userdata(n_user_data, 1); + chunk = gen_const_char_ptr(n_chunk, 2); + size = gen_int(n_size, 3); + filename = gen_fileoutput(n_filename, 4); + enc = gen_xmlCharEncoding(n_enc, 5); + + ret_val = htmlCreatePushParserCtxt(sax, user_data, chunk, size, filename, enc); + desret_htmlParserCtxtPtr(ret_val); + call_tests++; + des_htmlSAXHandlerPtr(n_sax, sax, 0); + des_userdata(n_user_data, user_data, 1); + des_const_char_ptr(n_chunk, chunk, 2); + des_int(n_size, size, 3); + des_fileoutput(n_filename, filename, 4); + des_xmlCharEncoding(n_enc, enc, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCreatePushParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_filename); + printf(" %d", n_enc); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlCtxtReadDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + cur = gen_const_xmlChar_ptr(n_cur, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_int(n_options, 4); + + ret_val = htmlCtxtReadDoc(ctxt, cur, URL, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_cur, cur, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_int(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlCtxtReadFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + filename = gen_filepath(n_filename, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_int(n_options, 3); + + ret_val = htmlCtxtReadFile(ctxt, filename, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_filepath(n_filename, filename, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlCtxtReadMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + buffer = gen_const_char_ptr(n_buffer, 1); + size = gen_int(n_size, 2); + URL = gen_filepath(n_URL, 3); + encoding = gen_const_char_ptr(n_encoding, 4); + options = gen_int(n_options, 5); + + ret_val = htmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_buffer, buffer, 1); + des_int(n_size, size, 2); + des_filepath(n_URL, URL, 3); + des_const_char_ptr(n_encoding, encoding, 4); + des_int(n_options, options, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReadMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlCtxtReset(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + + htmlCtxtReset(ctxt); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtReset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlCtxtUseOptions(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + options = gen_int(n_options, 1); + + ret_val = htmlCtxtUseOptions(ctxt, options); + desret_int(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_int(n_options, options, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCtxtUseOptions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlElementAllowedHere(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlElemDesc * parent; /* HTML parent element */ + int n_parent; + xmlChar * elt; /* HTML element */ + int n_elt; + + for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { + for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) { + mem_base = xmlMemBlocks(); + parent = gen_const_htmlElemDesc_ptr(n_parent, 0); + elt = gen_const_xmlChar_ptr(n_elt, 1); + + ret_val = htmlElementAllowedHere(parent, elt); + desret_int(ret_val); + call_tests++; + des_const_htmlElemDesc_ptr(n_parent, parent, 0); + des_const_xmlChar_ptr(n_elt, elt, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlElementAllowedHere", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_elt); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlElementStatusHere(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlStatus ret_val; + htmlElemDesc * parent; /* HTML parent element */ + int n_parent; + htmlElemDesc * elt; /* HTML element */ + int n_elt; + + for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) { + for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) { + mem_base = xmlMemBlocks(); + parent = gen_const_htmlElemDesc_ptr(n_parent, 0); + elt = gen_const_htmlElemDesc_ptr(n_elt, 1); + + ret_val = htmlElementStatusHere(parent, elt); + desret_htmlStatus(ret_val); + call_tests++; + des_const_htmlElemDesc_ptr(n_parent, parent, 0); + des_const_htmlElemDesc_ptr(n_elt, elt, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlElementStatusHere", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_elt); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlEncodeEntities(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + unsigned char * out; /* a pointer to an array of bytes to store the result */ + int n_out; + int * outlen; /* the length of @out */ + int n_outlen; + unsigned char * in; /* a pointer to an array of UTF-8 chars */ + int n_in; + int * inlen; /* the length of @in */ + int n_inlen; + int quoteChar; /* the quote character to escape (' or ") or zero. */ + int n_quoteChar; + + for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { + for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { + for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { + for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { + for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) { + mem_base = xmlMemBlocks(); + out = gen_unsigned_char_ptr(n_out, 0); + outlen = gen_int_ptr(n_outlen, 1); + in = gen_const_unsigned_char_ptr(n_in, 2); + inlen = gen_int_ptr(n_inlen, 3); + quoteChar = gen_int(n_quoteChar, 4); + + ret_val = htmlEncodeEntities(out, outlen, in, inlen, quoteChar); + desret_int(ret_val); + call_tests++; + des_unsigned_char_ptr(n_out, out, 0); + des_int_ptr(n_outlen, outlen, 1); + des_const_unsigned_char_ptr(n_in, in, 2); + des_int_ptr(n_inlen, inlen, 3); + des_int(n_quoteChar, quoteChar, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlEncodeEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_outlen); + printf(" %d", n_in); + printf(" %d", n_inlen); + printf(" %d", n_quoteChar); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlEntityLookup(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + const htmlEntityDesc * ret_val; + xmlChar * name; /* the entity name */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + + ret_val = htmlEntityLookup(name); + desret_const_htmlEntityDesc_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlEntityLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlEntityValueLookup(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + const htmlEntityDesc * ret_val; + unsigned int value; /* the entity's unicode value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_unsigned_int(n_value, 0); + + ret_val = htmlEntityValueLookup(value); + desret_const_htmlEntityDesc_ptr(ret_val); + call_tests++; + des_unsigned_int(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlEntityValueLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlHandleOmittedElem(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + int val; /* int 0 or 1 */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = htmlHandleOmittedElem(val); + desret_int(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlHandleOmittedElem", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlIsAutoClosed(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the HTML document */ + int n_doc; + htmlNodePtr elem; /* the HTML element */ + int n_elem; + + for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + doc = gen_htmlDocPtr(n_doc, 0); + elem = gen_htmlNodePtr(n_elem, 1); + + ret_val = htmlIsAutoClosed(doc, elem); + desret_int(ret_val); + call_tests++; + des_htmlDocPtr(n_doc, doc, 0); + des_htmlNodePtr(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlIsAutoClosed", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlIsScriptAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + xmlChar * name; /* an attribute name */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + + ret_val = htmlIsScriptAttribute(name); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlIsScriptAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlNodeStatus(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlStatus ret_val; + htmlNodePtr node; /* an htmlNodePtr in a tree */ + int n_node; + int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */ + int n_legacy; + + for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) { + for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) { + mem_base = xmlMemBlocks(); + node = gen_const_htmlNodePtr(n_node, 0); + legacy = gen_int(n_legacy, 1); + + ret_val = htmlNodeStatus(node, legacy); + desret_htmlStatus(ret_val); + call_tests++; + des_const_htmlNodePtr(n_node, node, 0); + des_int(n_legacy, legacy, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeStatus", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_legacy); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseCharRef(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + + ret_val = htmlParseCharRef(ctxt); + desret_int(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseCharRef", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseChunk(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + char * chunk; /* an char array */ + int n_chunk; + int size; /* the size in byte of the chunk */ + int n_size; + int terminate; /* last chunk indicator */ + int n_terminate; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + chunk = gen_const_char_ptr(n_chunk, 1); + size = gen_int(n_size, 2); + terminate = gen_int(n_terminate, 3); + + ret_val = htmlParseChunk(ctxt, chunk, size, terminate); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} + desret_int(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_chunk, chunk, 1); + des_int(n_size, size, 2); + des_int(n_terminate, terminate, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseChunk", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_terminate); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlParseDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + + for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlChar_ptr(n_cur, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + + ret_val = htmlParseDoc(cur, encoding); + desret_htmlDocPtr(ret_val); + call_tests++; + des_xmlChar_ptr(n_cur, cur, 0); + des_const_char_ptr(n_encoding, encoding, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + + ret_val = htmlParseDocument(ctxt); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} + desret_int(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseElement(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + + htmlParseElement(ctxt); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseEntityRef(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + const htmlEntityDesc * ret_val; + htmlParserCtxtPtr ctxt; /* an HTML parser context */ + int n_ctxt; + xmlChar ** str; /* location to store the entity name */ + int n_str; + + for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) { + mem_base = xmlMemBlocks(); + ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0); + str = gen_const_xmlChar_ptr_ptr(n_str, 1); + + ret_val = htmlParseEntityRef(ctxt, str); + desret_const_htmlEntityDesc_ptr(ret_val); + call_tests++; + des_htmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlParseEntityRef", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlParseFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + htmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + filename = gen_filepath(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + + ret_val = htmlParseFile(filename, encoding); + desret_htmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + xmlResetLastError(); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlReadDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + URL = gen_filepath(n_URL, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_int(n_options, 3); + + ret_val = htmlReadDoc(cur, URL, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + des_filepath(n_URL, URL, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlReadFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + options = gen_int(n_options, 2); + + ret_val = htmlReadFile(filename, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + des_int(n_options, options, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlReadMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of htmlParserOption(s) */ + int n_options; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_int(n_options, 4); + + ret_val = htmlReadMemory(buffer, size, URL, encoding, options); + desret_htmlDocPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_int(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlReadMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlSAXParseDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + htmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + void * userData; /* if using SAX, this pointer will be provided on callbacks. */ + int n_userData; + + for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { + for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlChar_ptr(n_cur, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + sax = gen_htmlSAXHandlerPtr(n_sax, 2); + userData = gen_userdata(n_userData, 3); + + ret_val = htmlSAXParseDoc(cur, encoding, sax, userData); + desret_htmlDocPtr(ret_val); + call_tests++; + des_xmlChar_ptr(n_cur, cur, 0); + des_const_char_ptr(n_encoding, encoding, 1); + des_htmlSAXHandlerPtr(n_sax, sax, 2); + des_userdata(n_userData, userData, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSAXParseDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_sax); + printf(" %d", n_userData); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlSAXParseFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + htmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + void * userData; /* if using SAX, this pointer will be provided on callbacks. */ + int n_userData; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) { + for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + sax = gen_htmlSAXHandlerPtr(n_sax, 2); + userData = gen_userdata(n_userData, 3); + + ret_val = htmlSAXParseFile(filename, encoding, sax, userData); + desret_htmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + des_htmlSAXHandlerPtr(n_sax, sax, 2); + des_userdata(n_userData, userData, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSAXParseFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_sax); + printf(" %d", n_userData); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlTagLookup(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_HTMLparser(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n"); + test_ret += test_UTF8ToHtml(); + test_ret += test_htmlAttrAllowed(); + test_ret += test_htmlAutoCloseTag(); + test_ret += test_htmlCreateMemoryParserCtxt(); + test_ret += test_htmlCreatePushParserCtxt(); + test_ret += test_htmlCtxtReadDoc(); + test_ret += test_htmlCtxtReadFile(); + test_ret += test_htmlCtxtReadMemory(); + test_ret += test_htmlCtxtReset(); + test_ret += test_htmlCtxtUseOptions(); + test_ret += test_htmlElementAllowedHere(); + test_ret += test_htmlElementStatusHere(); + test_ret += test_htmlEncodeEntities(); + test_ret += test_htmlEntityLookup(); + test_ret += test_htmlEntityValueLookup(); + test_ret += test_htmlHandleOmittedElem(); + test_ret += test_htmlIsAutoClosed(); + test_ret += test_htmlIsScriptAttribute(); + test_ret += test_htmlNodeStatus(); + test_ret += test_htmlParseCharRef(); + test_ret += test_htmlParseChunk(); + test_ret += test_htmlParseDoc(); + test_ret += test_htmlParseDocument(); + test_ret += test_htmlParseElement(); + test_ret += test_htmlParseEntityRef(); + test_ret += test_htmlParseFile(); + test_ret += test_htmlReadDoc(); + test_ret += test_htmlReadFile(); + test_ret += test_htmlReadMemory(); + test_ret += test_htmlSAXParseDoc(); + test_ret += test_htmlSAXParseFile(); + test_ret += test_htmlTagLookup(); + + if (test_ret != 0) + printf("Module HTMLparser: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_htmlDocContentDumpFormatOutput(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr buf; /* the HTML buffer output */ + int n_buf; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the encoding string */ + int n_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + format = gen_int(n_format, 3); + + htmlDocContentDumpFormatOutput(buf, cur, encoding, format); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlDocContentDumpOutput(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr buf; /* the HTML buffer output */ + int n_buf; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the encoding string */ + int n_encoding; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + + htmlDocContentDumpOutput(buf, cur, encoding); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDocContentDumpOutput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlDocDump(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + FILE * f; /* the FILE* */ + int n_f; + xmlDocPtr cur; /* the document */ + int n_cur; + + for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + mem_base = xmlMemBlocks(); + f = gen_FILE_ptr(n_f, 0); + cur = gen_xmlDocPtr(n_cur, 1); + + ret_val = htmlDocDump(f, cur); + desret_int(ret_val); + call_tests++; + des_FILE_ptr(n_f, f, 0); + des_xmlDocPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDocDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_f); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +#define gen_nb_xmlChar_ptr_ptr 1 +static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_htmlDocDumpMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlDocPtr cur; /* the document */ + int n_cur; + xmlChar ** mem; /* OUT: the memory pointer */ + int n_mem; + int * size; /* OUT: the memory length */ + int n_size; + + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlDocPtr(n_cur, 0); + mem = gen_xmlChar_ptr_ptr(n_mem, 1); + size = gen_int_ptr(n_size, 2); + + htmlDocDumpMemory(cur, mem, size); + call_tests++; + des_xmlDocPtr(n_cur, cur, 0); + des_xmlChar_ptr_ptr(n_mem, mem, 1); + des_int_ptr(n_size, size, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDocDumpMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_mem); + printf(" %d", n_size); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlGetMetaEncoding(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + const xmlChar * ret_val; + htmlDocPtr doc; /* the document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_htmlDocPtr(n_doc, 0); + + ret_val = htmlGetMetaEncoding(doc); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_htmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlGetMetaEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlIsBooleanAttr(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + xmlChar * name; /* the name of the attribute to check */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + + ret_val = htmlIsBooleanAttr(name); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlIsBooleanAttr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlNewDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + xmlChar * URI; /* URI for the dtd, or NULL */ + int n_URI; + xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ + int n_ExternalID; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI, 0); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); + + ret_val = htmlNewDoc(URI, ExternalID); + desret_htmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI, 0); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNewDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_ExternalID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlNewDocNoDtD(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlDocPtr ret_val; + xmlChar * URI; /* URI for the dtd, or NULL */ + int n_URI; + xmlChar * ExternalID; /* the external ID of the DTD, or NULL */ + int n_ExternalID; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI, 0); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); + + ret_val = htmlNewDocNoDtD(URI, ExternalID); + desret_htmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI, 0); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNewDocNoDtD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_ExternalID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlNodeDump(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the HTML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + + ret_val = htmlNodeDump(buf, doc, cur); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlNodeDumpFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * out; /* the FILE pointer */ + int n_out; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + + for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + out = gen_FILE_ptr(n_out, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + + htmlNodeDumpFile(out, doc, cur); + call_tests++; + des_FILE_ptr(n_out, out, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeDumpFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlNodeDumpFileFormat(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + FILE * out; /* the FILE pointer */ + int n_out; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + char * encoding; /* the document encoding */ + int n_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + out = gen_FILE_ptr(n_out, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + format = gen_int(n_format, 4); + + ret_val = htmlNodeDumpFileFormat(out, doc, cur, encoding, format); + desret_int(ret_val); + call_tests++; + des_FILE_ptr(n_out, out, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_int(n_format, format, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeDumpFileFormat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlNodeDumpFormatOutput(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr buf; /* the HTML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + char * encoding; /* the encoding string */ + int n_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + format = gen_int(n_format, 4); + + htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_int(n_format, format, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeDumpFormatOutput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlNodeDumpOutput(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr buf; /* the HTML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + char * encoding; /* the encoding string */ + int n_encoding; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + + htmlNodeDumpOutput(buf, doc, cur, encoding); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + des_const_char_ptr(n_encoding, encoding, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlNodeDumpOutput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlSaveFile(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename (or URL) */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + + ret_val = htmlSaveFile(filename, cur); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSaveFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlSaveFileEnc(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the document encoding */ + int n_encoding; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + + ret_val = htmlSaveFileEnc(filename, cur, encoding); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSaveFileEnc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlSaveFileFormat(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the document encoding */ + int n_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + format = gen_int(n_format, 3); + + ret_val = htmlSaveFileFormat(filename, cur, encoding, format); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSaveFileFormat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_htmlSetMetaEncoding(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + int ret_val; + htmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * encoding; /* the encoding string */ + int n_encoding; + + for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) { + for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + doc = gen_htmlDocPtr(n_doc, 0); + encoding = gen_const_xmlChar_ptr(n_encoding, 1); + + ret_val = htmlSetMetaEncoding(doc, encoding); + desret_int(ret_val); + call_tests++; + des_htmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_encoding, encoding, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlSetMetaEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_HTMLtree(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n"); + test_ret += test_htmlDocContentDumpFormatOutput(); + test_ret += test_htmlDocContentDumpOutput(); + test_ret += test_htmlDocDump(); + test_ret += test_htmlDocDumpMemory(); + test_ret += test_htmlGetMetaEncoding(); + test_ret += test_htmlIsBooleanAttr(); + test_ret += test_htmlNewDoc(); + test_ret += test_htmlNewDocNoDtD(); + test_ret += test_htmlNodeDump(); + test_ret += test_htmlNodeDumpFile(); + test_ret += test_htmlNodeDumpFileFormat(); + test_ret += test_htmlNodeDumpFormatOutput(); + test_ret += test_htmlNodeDumpOutput(); + test_ret += test_htmlSaveFile(); + test_ret += test_htmlSaveFileEnc(); + test_ret += test_htmlSaveFileFormat(); + test_ret += test_htmlSetMetaEncoding(); + + if (test_ret != 0) + printf("Module HTMLtree: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_docbDefaultSAXHandlerInit(void) { + int test_ret = 0; + +#ifdef LIBXML_DOCB_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + docbDefaultSAXHandlerInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in docbDefaultSAXHandlerInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlDefaultSAXHandlerInit(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + htmlDefaultSAXHandlerInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDefaultSAXHandlerInit(void) { + int test_ret = 0; + + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlDefaultSAXHandlerInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlEnumerationPtr 1 +static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlSAX2AttributeDecl(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * elem; /* the name of the element */ + int n_elem; + xmlChar * fullname; /* the attribute name */ + int n_fullname; + int type; /* the attribute type */ + int n_type; + int def; /* the type of default value */ + int n_def; + xmlChar * defaultValue; /* the attribute default value */ + int n_defaultValue; + xmlEnumerationPtr tree; /* the tree of enumerated value set */ + int n_tree; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { + for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_def = 0;n_def < gen_nb_int;n_def++) { + for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { + for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + elem = gen_const_xmlChar_ptr(n_elem, 1); + fullname = gen_const_xmlChar_ptr(n_fullname, 2); + type = gen_int(n_type, 3); + def = gen_int(n_def, 4); + defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5); + tree = gen_xmlEnumerationPtr(n_tree, 6); + + xmlSAX2AttributeDecl(ctx, elem, fullname, type, def, defaultValue, tree); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_elem, elem, 1); + des_const_xmlChar_ptr(n_fullname, fullname, 2); + des_int(n_type, type, 3); + des_int(n_def, def, 4); + des_const_xmlChar_ptr(n_defaultValue, defaultValue, 5); + des_xmlEnumerationPtr(n_tree, tree, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2AttributeDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_elem); + printf(" %d", n_fullname); + printf(" %d", n_type); + printf(" %d", n_def); + printf(" %d", n_defaultValue); + printf(" %d", n_tree); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2CDataBlock(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * value; /* The pcdata content */ + int n_value; + int len; /* the block length */ + int n_len; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + len = gen_int(n_len, 2); + + xmlSAX2CDataBlock(ctx, value, len); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2CDataBlock", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_value); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2Characters(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * ch; /* a xmlChar string */ + int n_ch; + int len; /* the number of xmlChar */ + int n_len; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + ch = gen_const_xmlChar_ptr(n_ch, 1); + len = gen_int(n_len, 2); + + xmlSAX2Characters(ctx, ch, len); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_ch, ch, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2Characters", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_ch); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2Comment(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * value; /* the xmlSAX2Comment content */ + int n_value; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + + xmlSAX2Comment(ctx, value); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2Comment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlElementContentPtr 1 +static xmlElementContentPtr gen_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlElementContentPtr(int no ATTRIBUTE_UNUSED, xmlElementContentPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlSAX2ElementDecl(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* the element name */ + int n_name; + int type; /* the element type */ + int n_type; + xmlElementContentPtr content; /* the element value tree */ + int n_content; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_int(n_type, 2); + content = gen_xmlElementContentPtr(n_content, 3); + + xmlSAX2ElementDecl(ctx, name, type, content); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_int(n_type, type, 2); + des_xmlElementContentPtr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2ElementDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2EndDocument(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + xmlSAX2EndDocument(ctx); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2EndDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2EndElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The element name */ + int n_name; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + xmlSAX2EndElement(ctx, name); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2EndElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAX2EndElementNs(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * localname; /* the local name of the element */ + int n_localname; + xmlChar * prefix; /* the element namespace prefix if available */ + int n_prefix; + xmlChar * URI; /* the element namespace name if available */ + int n_URI; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + localname = gen_const_xmlChar_ptr(n_localname, 1); + prefix = gen_const_xmlChar_ptr(n_prefix, 2); + URI = gen_const_xmlChar_ptr(n_URI, 3); + + xmlSAX2EndElementNs(ctx, localname, prefix, URI); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_localname, localname, 1); + des_const_xmlChar_ptr(n_prefix, prefix, 2); + des_const_xmlChar_ptr(n_URI, URI, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2EndElementNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_localname); + printf(" %d", n_prefix); + printf(" %d", n_URI); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2EntityDecl(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* the entity name */ + int n_name; + int type; /* the entity type */ + int n_type; + xmlChar * publicId; /* The public ID of the entity */ + int n_publicId; + xmlChar * systemId; /* The system ID of the entity */ + int n_systemId; + xmlChar * content; /* the entity value (without processing). */ + int n_content; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { + for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { + for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_int(n_type, 2); + publicId = gen_const_xmlChar_ptr(n_publicId, 3); + systemId = gen_const_xmlChar_ptr(n_systemId, 4); + content = gen_xmlChar_ptr(n_content, 5); + + xmlSAX2EntityDecl(ctx, name, type, publicId, systemId, content); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_int(n_type, type, 2); + des_const_xmlChar_ptr(n_publicId, publicId, 3); + des_const_xmlChar_ptr(n_systemId, systemId, 4); + des_xmlChar_ptr(n_content, content, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2EntityDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_publicId); + printf(" %d", n_systemId); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2ExternalSubset(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* the root element name */ + int n_name; + xmlChar * ExternalID; /* the external ID */ + int n_ExternalID; + xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ + int n_SystemID; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); + + xmlSAX2ExternalSubset(ctx, name, ExternalID, SystemID); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); + des_const_xmlChar_ptr(n_SystemID, SystemID, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2ExternalSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetColumnNumber(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2GetColumnNumber(ctx); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetColumnNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The entity name */ + int n_name; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlSAX2GetEntity(ctx, name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetLineNumber(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2GetLineNumber(ctx); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetLineNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetParameterEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The entity name */ + int n_name; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlSAX2GetParameterEntity(ctx, name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetParameterEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetPublicId(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2GetPublicId(ctx); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetPublicId", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2GetSystemId(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2GetSystemId(ctx); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2GetSystemId", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2HasExternalSubset(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2HasExternalSubset(ctx); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2HasExternalSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2HasInternalSubset(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2HasInternalSubset(ctx); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2HasInternalSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2IgnorableWhitespace(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * ch; /* a xmlChar string */ + int n_ch; + int len; /* the number of xmlChar */ + int n_len; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + ch = gen_const_xmlChar_ptr(n_ch, 1); + len = gen_int(n_len, 2); + + xmlSAX2IgnorableWhitespace(ctx, ch, len); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_ch, ch, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_ch); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlSAXHandler_ptr 1 +static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlSAX2InitDefaultSAXHandler(void) { + int test_ret = 0; + + int mem_base; + xmlSAXHandler * hdlr; /* the SAX handler */ + int n_hdlr; + int warning; /* flag if non-zero sets the handler warning procedure */ + int n_warning; + + for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { + for (n_warning = 0;n_warning < gen_nb_int;n_warning++) { + mem_base = xmlMemBlocks(); + hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); + warning = gen_int(n_warning, 1); + + xmlSAX2InitDefaultSAXHandler(hdlr, warning); + call_tests++; + des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); + des_int(n_warning, warning, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_hdlr); + printf(" %d", n_warning); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2InitDocbDefaultSAXHandler(void) { + int test_ret = 0; + +#ifdef LIBXML_DOCB_ENABLED + int mem_base; + xmlSAXHandler * hdlr; /* the SAX handler */ + int n_hdlr; + + for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { + mem_base = xmlMemBlocks(); + hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); + + xmlSAX2InitDocbDefaultSAXHandler(hdlr); + call_tests++; + des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_hdlr); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAX2InitHtmlDefaultSAXHandler(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + xmlSAXHandler * hdlr; /* the SAX handler */ + int n_hdlr; + + for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { + mem_base = xmlMemBlocks(); + hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); + + xmlSAX2InitHtmlDefaultSAXHandler(hdlr); + call_tests++; + des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_hdlr); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAX2InternalSubset(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* the root element name */ + int n_name; + xmlChar * ExternalID; /* the external ID */ + int n_ExternalID; + xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */ + int n_SystemID; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); + + xmlSAX2InternalSubset(ctx, name, ExternalID, SystemID); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); + des_const_xmlChar_ptr(n_SystemID, SystemID, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2InternalSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2IsStandalone(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + ret_val = xmlSAX2IsStandalone(ctx); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2IsStandalone", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2NotationDecl(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The name of the notation */ + int n_name; + xmlChar * publicId; /* The public ID of the entity */ + int n_publicId; + xmlChar * systemId; /* The system ID of the entity */ + int n_systemId; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { + for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + publicId = gen_const_xmlChar_ptr(n_publicId, 2); + systemId = gen_const_xmlChar_ptr(n_systemId, 3); + + xmlSAX2NotationDecl(ctx, name, publicId, systemId); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_publicId, publicId, 2); + des_const_xmlChar_ptr(n_systemId, systemId, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2NotationDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_publicId); + printf(" %d", n_systemId); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2ProcessingInstruction(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * target; /* the target name */ + int n_target; + xmlChar * data; /* the PI data's */ + int n_data; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { + for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + target = gen_const_xmlChar_ptr(n_target, 1); + data = gen_const_xmlChar_ptr(n_data, 2); + + xmlSAX2ProcessingInstruction(ctx, target, data); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_target, target, 1); + des_const_xmlChar_ptr(n_data, data, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_target); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2Reference(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The entity name */ + int n_name; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + xmlSAX2Reference(ctx, name); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2Reference", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2ResolveEntity(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * publicId; /* The public ID of the entity */ + int n_publicId; + xmlChar * systemId; /* The system ID of the entity */ + int n_systemId; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { + for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + publicId = gen_const_xmlChar_ptr(n_publicId, 1); + systemId = gen_const_xmlChar_ptr(n_systemId, 2); + + ret_val = xmlSAX2ResolveEntity(ctx, publicId, systemId); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_publicId, publicId, 1); + des_const_xmlChar_ptr(n_systemId, systemId, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2ResolveEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_publicId); + printf(" %d", n_systemId); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlSAXLocatorPtr 1 +static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlSAX2SetDocumentLocator(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlSAXLocatorPtr loc; /* A SAX Locator */ + int n_loc; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + loc = gen_xmlSAXLocatorPtr(n_loc, 1); + + xmlSAX2SetDocumentLocator(ctx, loc); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_xmlSAXLocatorPtr(n_loc, loc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_loc); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2StartDocument(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + xmlSAX2StartDocument(ctx); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2StartDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2StartElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * fullname; /* The element name, including namespace prefix */ + int n_fullname; + xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */ + int n_atts; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) { + for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + fullname = gen_const_xmlChar_ptr(n_fullname, 1); + atts = gen_const_xmlChar_ptr_ptr(n_atts, 2); + + xmlSAX2StartElement(ctx, fullname, atts); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_fullname, fullname, 1); + des_const_xmlChar_ptr_ptr(n_atts, atts, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2StartElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_fullname); + printf(" %d", n_atts); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAX2StartElementNs(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * localname; /* the local name of the element */ + int n_localname; + xmlChar * prefix; /* the element namespace prefix if available */ + int n_prefix; + xmlChar * URI; /* the element namespace name if available */ + int n_URI; + int nb_namespaces; /* number of namespace definitions on that node */ + int n_nb_namespaces; + xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */ + int n_namespaces; + int nb_attributes; /* the number of attributes on that node */ + int n_nb_attributes; + int nb_defaulted; /* the number of defaulted attributes. */ + int n_nb_defaulted; + xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */ + int n_attributes; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) { + for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { + for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) { + for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) { + for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + localname = gen_const_xmlChar_ptr(n_localname, 1); + prefix = gen_const_xmlChar_ptr(n_prefix, 2); + URI = gen_const_xmlChar_ptr(n_URI, 3); + nb_namespaces = gen_int(n_nb_namespaces, 4); + namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5); + nb_attributes = gen_int(n_nb_attributes, 6); + nb_defaulted = gen_int(n_nb_defaulted, 7); + attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8); + + xmlSAX2StartElementNs(ctx, localname, prefix, URI, nb_namespaces, namespaces, nb_attributes, nb_defaulted, attributes); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_localname, localname, 1); + des_const_xmlChar_ptr(n_prefix, prefix, 2); + des_const_xmlChar_ptr(n_URI, URI, 3); + des_int(n_nb_namespaces, nb_namespaces, 4); + des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 5); + des_int(n_nb_attributes, nb_attributes, 6); + des_int(n_nb_defaulted, nb_defaulted, 7); + des_const_xmlChar_ptr_ptr(n_attributes, attributes, 8); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2StartElementNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_localname); + printf(" %d", n_prefix); + printf(" %d", n_URI); + printf(" %d", n_nb_namespaces); + printf(" %d", n_namespaces); + printf(" %d", n_nb_attributes); + printf(" %d", n_nb_defaulted); + printf(" %d", n_attributes); + printf("\n"); + } + } + } + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAX2UnparsedEntityDecl(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* the user data (XML parser context) */ + int n_ctx; + xmlChar * name; /* The name of the entity */ + int n_name; + xmlChar * publicId; /* The public ID of the entity */ + int n_publicId; + xmlChar * systemId; /* The system ID of the entity */ + int n_systemId; + xmlChar * notationName; /* the name of the notation */ + int n_notationName; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) { + for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) { + for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + publicId = gen_const_xmlChar_ptr(n_publicId, 2); + systemId = gen_const_xmlChar_ptr(n_systemId, 3); + notationName = gen_const_xmlChar_ptr(n_notationName, 4); + + xmlSAX2UnparsedEntityDecl(ctx, name, publicId, systemId, notationName); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_publicId, publicId, 2); + des_const_xmlChar_ptr(n_systemId, systemId, 3); + des_const_xmlChar_ptr(n_notationName, notationName, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_name); + printf(" %d", n_publicId); + printf(" %d", n_systemId); + printf(" %d", n_notationName); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSAXDefaultVersion(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + int version; /* the version, 1 or 2 */ + int n_version; + + for (n_version = 0;n_version < gen_nb_int;n_version++) { + mem_base = xmlMemBlocks(); + version = gen_int(n_version, 0); + + ret_val = xmlSAXDefaultVersion(version); + desret_int(ret_val); + call_tests++; + des_int(n_version, version, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXDefaultVersion", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_version); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXVersion(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlSAXHandler * hdlr; /* the SAX handler */ + int n_hdlr; + int version; /* the version, 1 or 2 */ + int n_version; + + for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) { + for (n_version = 0;n_version < gen_nb_int;n_version++) { + mem_base = xmlMemBlocks(); + hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0); + version = gen_int(n_version, 1); + + ret_val = xmlSAXVersion(hdlr, version); + desret_int(ret_val); + call_tests++; + des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0); + des_int(n_version, version, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXVersion", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_hdlr); + printf(" %d", n_version); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + +static int +test_SAX2(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n"); + test_ret += test_docbDefaultSAXHandlerInit(); + test_ret += test_htmlDefaultSAXHandlerInit(); + test_ret += test_xmlDefaultSAXHandlerInit(); + test_ret += test_xmlSAX2AttributeDecl(); + test_ret += test_xmlSAX2CDataBlock(); + test_ret += test_xmlSAX2Characters(); + test_ret += test_xmlSAX2Comment(); + test_ret += test_xmlSAX2ElementDecl(); + test_ret += test_xmlSAX2EndDocument(); + test_ret += test_xmlSAX2EndElement(); + test_ret += test_xmlSAX2EndElementNs(); + test_ret += test_xmlSAX2EntityDecl(); + test_ret += test_xmlSAX2ExternalSubset(); + test_ret += test_xmlSAX2GetColumnNumber(); + test_ret += test_xmlSAX2GetEntity(); + test_ret += test_xmlSAX2GetLineNumber(); + test_ret += test_xmlSAX2GetParameterEntity(); + test_ret += test_xmlSAX2GetPublicId(); + test_ret += test_xmlSAX2GetSystemId(); + test_ret += test_xmlSAX2HasExternalSubset(); + test_ret += test_xmlSAX2HasInternalSubset(); + test_ret += test_xmlSAX2IgnorableWhitespace(); + test_ret += test_xmlSAX2InitDefaultSAXHandler(); + test_ret += test_xmlSAX2InitDocbDefaultSAXHandler(); + test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler(); + test_ret += test_xmlSAX2InternalSubset(); + test_ret += test_xmlSAX2IsStandalone(); + test_ret += test_xmlSAX2NotationDecl(); + test_ret += test_xmlSAX2ProcessingInstruction(); + test_ret += test_xmlSAX2Reference(); + test_ret += test_xmlSAX2ResolveEntity(); + test_ret += test_xmlSAX2SetDocumentLocator(); + test_ret += test_xmlSAX2StartDocument(); + test_ret += test_xmlSAX2StartElement(); + test_ret += test_xmlSAX2StartElementNs(); + test_ret += test_xmlSAX2UnparsedEntityDecl(); + test_ret += test_xmlSAXDefaultVersion(); + test_ret += test_xmlSAXVersion(); + + if (test_ret != 0) + printf("Module SAX2: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlC14NDocDumpMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_C14N_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the XML document for canonization */ + int n_doc; + xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ + int n_nodes; + int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */ + int n_exclusive; + xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ + int n_inclusive_ns_prefixes; + int with_comments; /* include comments in the result (!=0) or not (==0) */ + int n_with_comments; + xmlChar ** doc_txt_ptr; /* the memory pointer for allocated canonical XML text; the caller of this functions is responsible for calling xmlFree() to free allocated memory */ + int n_doc_txt_ptr; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) { + for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { + for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { + for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + nodes = gen_xmlNodeSetPtr(n_nodes, 1); + exclusive = gen_int(n_exclusive, 2); + inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); + with_comments = gen_int(n_with_comments, 4); + doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5); + + ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodeSetPtr(n_nodes, nodes, 1); + des_int(n_exclusive, exclusive, 2); + des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); + des_int(n_with_comments, with_comments, 4); + des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlC14NDocDumpMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_nodes); + printf(" %d", n_exclusive); + printf(" %d", n_inclusive_ns_prefixes); + printf(" %d", n_with_comments); + printf(" %d", n_doc_txt_ptr); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlC14NDocSave(void) { + int test_ret = 0; + +#ifdef LIBXML_C14N_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the XML document for canonization */ + int n_doc; + xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ + int n_nodes; + int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */ + int n_exclusive; + xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ + int n_inclusive_ns_prefixes; + int with_comments; /* include comments in the result (!=0) or not (==0) */ + int n_with_comments; + const char * filename; /* the filename to store canonical XML image */ + int n_filename; + int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */ + int n_compression; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) { + for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { + for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + nodes = gen_xmlNodeSetPtr(n_nodes, 1); + exclusive = gen_int(n_exclusive, 2); + inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); + with_comments = gen_int(n_with_comments, 4); + filename = gen_fileoutput(n_filename, 5); + compression = gen_int(n_compression, 6); + + ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodeSetPtr(n_nodes, nodes, 1); + des_int(n_exclusive, exclusive, 2); + des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); + des_int(n_with_comments, with_comments, 4); + des_fileoutput(n_filename, filename, 5); + des_int(n_compression, compression, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlC14NDocSave", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_nodes); + printf(" %d", n_exclusive); + printf(" %d", n_inclusive_ns_prefixes); + printf(" %d", n_with_comments); + printf(" %d", n_filename); + printf(" %d", n_compression); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlC14NDocSaveTo(void) { + int test_ret = 0; + +#ifdef LIBXML_C14N_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the XML document for canonization */ + int n_doc; + xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */ + int n_nodes; + int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */ + int n_exclusive; + xmlChar ** inclusive_ns_prefixes; /* the list of inclusive namespace prefixes ended with a NULL or NULL if there is no inclusive namespaces (only for exclusive canonicalization, ignored otherwise) */ + int n_inclusive_ns_prefixes; + int with_comments; /* include comments in the result (!=0) or not (==0) */ + int n_with_comments; + xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */ + int n_buf; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) { + for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) { + for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) { + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + nodes = gen_xmlNodeSetPtr(n_nodes, 1); + exclusive = gen_int(n_exclusive, 2); + inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3); + with_comments = gen_int(n_with_comments, 4); + buf = gen_xmlOutputBufferPtr(n_buf, 5); + + ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodeSetPtr(n_nodes, nodes, 1); + des_int(n_exclusive, exclusive, 2); + des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3); + des_int(n_with_comments, with_comments, 4); + des_xmlOutputBufferPtr(n_buf, buf, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlC14NDocSaveTo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_nodes); + printf(" %d", n_exclusive); + printf(" %d", n_inclusive_ns_prefixes); + printf(" %d", n_with_comments); + printf(" %d", n_buf); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlC14NExecute(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_c14n(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n"); + test_ret += test_xmlC14NDocDumpMemory(); + test_ret += test_xmlC14NDocSave(); + test_ret += test_xmlC14NDocSaveTo(); + test_ret += test_xmlC14NExecute(); + + if (test_ret != 0) + printf("Module c14n: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_CATALOG_ENABLED + +#define gen_nb_xmlCatalogPtr 1 +static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlACatalogAdd(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + int ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * type; /* the type of record to add to the catalog */ + int n_type; + xmlChar * orig; /* the system, public or prefix to match */ + int n_orig; + xmlChar * replace; /* the replacement value for the match */ + int n_replace; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { + for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { + for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + type = gen_const_xmlChar_ptr(n_type, 1); + orig = gen_const_xmlChar_ptr(n_orig, 2); + replace = gen_const_xmlChar_ptr(n_replace, 3); + + ret_val = xmlACatalogAdd(catal, type, orig, replace); + desret_int(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_type, type, 1); + des_const_xmlChar_ptr(n_orig, orig, 2); + des_const_xmlChar_ptr(n_replace, replace, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogAdd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_type); + printf(" %d", n_orig); + printf(" %d", n_replace); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogDump(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + FILE * out; /* the file. */ + int n_out; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + out = gen_FILE_ptr(n_out, 1); + + xmlACatalogDump(catal, out); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_FILE_ptr(n_out, out, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_out); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogRemove(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + int ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * value; /* the value to remove */ + int n_value; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + + ret_val = xmlACatalogRemove(catal, value); + desret_int(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogRemove", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogResolve(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * pubID; /* the public ID string */ + int n_pubID; + xmlChar * sysID; /* the system ID string */ + int n_sysID; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { + for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + pubID = gen_const_xmlChar_ptr(n_pubID, 1); + sysID = gen_const_xmlChar_ptr(n_sysID, 2); + + ret_val = xmlACatalogResolve(catal, pubID, sysID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_pubID, pubID, 1); + des_const_xmlChar_ptr(n_sysID, sysID, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogResolve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_pubID); + printf(" %d", n_sysID); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogResolvePublic(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * pubID; /* the public ID string */ + int n_pubID; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + pubID = gen_const_xmlChar_ptr(n_pubID, 1); + + ret_val = xmlACatalogResolvePublic(catal, pubID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_pubID, pubID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogResolvePublic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_pubID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogResolveSystem(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * sysID; /* the system ID string */ + int n_sysID; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + sysID = gen_const_xmlChar_ptr(n_sysID, 1); + + ret_val = xmlACatalogResolveSystem(catal, sysID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_sysID, sysID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogResolveSystem", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_sysID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlACatalogResolveURI(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlCatalogPtr catal; /* a Catalog */ + int n_catal; + xmlChar * URI; /* the URI */ + int n_URI; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + URI = gen_const_xmlChar_ptr(n_URI, 1); + + ret_val = xmlACatalogResolveURI(catal, URI); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + des_const_xmlChar_ptr(n_URI, URI, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlACatalogResolveURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf(" %d", n_URI); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogAdd(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + int ret_val; + xmlChar * type; /* the type of record to add to the catalog */ + int n_type; + xmlChar * orig; /* the system, public or prefix to match */ + int n_orig; + xmlChar * replace; /* the replacement value for the match */ + int n_replace; + + for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) { + for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) { + for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) { + mem_base = xmlMemBlocks(); + type = gen_const_xmlChar_ptr(n_type, 0); + orig = gen_const_xmlChar_ptr(n_orig, 1); + replace = gen_const_xmlChar_ptr(n_replace, 2); + + ret_val = xmlCatalogAdd(type, orig, replace); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_type, type, 0); + des_const_xmlChar_ptr(n_orig, orig, 1); + des_const_xmlChar_ptr(n_replace, replace, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogAdd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_orig); + printf(" %d", n_replace); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + + + xmlCatalogCleanup(); + call_tests++; + xmlResetLastError(); + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogConvert(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int ret_val; + + + ret_val = xmlCatalogConvert(); + desret_int(ret_val); + call_tests++; + xmlResetLastError(); + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogDump(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * out; /* the file. */ + int n_out; + + for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) { + mem_base = xmlMemBlocks(); + out = gen_FILE_ptr(n_out, 0); + + xmlCatalogDump(out); + call_tests++; + des_FILE_ptr(n_out, out, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf("\n"); + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogGetDefaults(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlCatalogAllow ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlCatalogGetDefaults(); + desret_xmlCatalogAllow(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogGetDefaults", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogIsEmpty(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + int ret_val; + xmlCatalogPtr catal; /* should this create an SGML catalog */ + int n_catal; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + + ret_val = xmlCatalogIsEmpty(catal); + desret_int(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogIsEmpty", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogLocalResolve(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + void * catalogs; /* a document's list of catalogs */ + int n_catalogs; + xmlChar * pubID; /* the public ID string */ + int n_pubID; + xmlChar * sysID; /* the system ID string */ + int n_sysID; + + for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { + for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { + for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { + mem_base = xmlMemBlocks(); + catalogs = gen_void_ptr(n_catalogs, 0); + pubID = gen_const_xmlChar_ptr(n_pubID, 1); + sysID = gen_const_xmlChar_ptr(n_sysID, 2); + + ret_val = xmlCatalogLocalResolve(catalogs, pubID, sysID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_void_ptr(n_catalogs, catalogs, 0); + des_const_xmlChar_ptr(n_pubID, pubID, 1); + des_const_xmlChar_ptr(n_sysID, sysID, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogLocalResolve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catalogs); + printf(" %d", n_pubID); + printf(" %d", n_sysID); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogLocalResolveURI(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + void * catalogs; /* a document's list of catalogs */ + int n_catalogs; + xmlChar * URI; /* the URI */ + int n_URI; + + for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) { + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + mem_base = xmlMemBlocks(); + catalogs = gen_void_ptr(n_catalogs, 0); + URI = gen_const_xmlChar_ptr(n_URI, 1); + + ret_val = xmlCatalogLocalResolveURI(catalogs, URI); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_void_ptr(n_catalogs, catalogs, 0); + des_const_xmlChar_ptr(n_URI, URI, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogLocalResolveURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catalogs); + printf(" %d", n_URI); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogRemove(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int ret_val; + xmlChar * value; /* the value to remove */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlCatalogRemove(value); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogResolve(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlChar * pubID; /* the public ID string */ + int n_pubID; + xmlChar * sysID; /* the system ID string */ + int n_sysID; + + for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { + for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { + mem_base = xmlMemBlocks(); + pubID = gen_const_xmlChar_ptr(n_pubID, 0); + sysID = gen_const_xmlChar_ptr(n_sysID, 1); + + ret_val = xmlCatalogResolve(pubID, sysID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_pubID, pubID, 0); + des_const_xmlChar_ptr(n_sysID, sysID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogResolve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_pubID); + printf(" %d", n_sysID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogResolvePublic(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlChar * pubID; /* the public ID string */ + int n_pubID; + + for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) { + mem_base = xmlMemBlocks(); + pubID = gen_const_xmlChar_ptr(n_pubID, 0); + + ret_val = xmlCatalogResolvePublic(pubID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_pubID, pubID, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogResolvePublic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_pubID); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogResolveSystem(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlChar * sysID; /* the system ID string */ + int n_sysID; + + for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) { + mem_base = xmlMemBlocks(); + sysID = gen_const_xmlChar_ptr(n_sysID, 0); + + ret_val = xmlCatalogResolveSystem(sysID); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_sysID, sysID, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogResolveSystem", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sysID); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogResolveURI(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlChar * ret_val; + xmlChar * URI; /* the URI */ + int n_URI; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI, 0); + + ret_val = xmlCatalogResolveURI(URI); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogResolveURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogSetDefaultPrefer(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlCatalogPrefer ret_val; + xmlCatalogPrefer prefer; /* the default preference for delegation */ + int n_prefer; + + for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) { + mem_base = xmlMemBlocks(); + prefer = gen_xmlCatalogPrefer(n_prefer, 0); + + ret_val = xmlCatalogSetDefaultPrefer(prefer); + desret_xmlCatalogPrefer(ret_val); + call_tests++; + des_xmlCatalogPrefer(n_prefer, prefer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_prefer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCatalogSetDefaults(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlCatalogAllow allow; /* what catalogs should be accepted */ + int n_allow; + + for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) { + mem_base = xmlMemBlocks(); + allow = gen_xmlCatalogAllow(n_allow, 0); + + xmlCatalogSetDefaults(allow); + call_tests++; + des_xmlCatalogAllow(n_allow, allow, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCatalogSetDefaults", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_allow); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlConvertSGMLCatalog(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + int ret_val; + xmlCatalogPtr catal; /* the catalog */ + int n_catal; + + for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) { + mem_base = xmlMemBlocks(); + catal = gen_xmlCatalogPtr(n_catal, 0); + + ret_val = xmlConvertSGMLCatalog(catal); + desret_int(ret_val); + call_tests++; + des_xmlCatalogPtr(n_catal, catal, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlConvertSGMLCatalog", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_catal); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlInitializeCatalog(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlInitializeCatalog(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlInitializeCatalog", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlLoadACatalog(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlLoadCatalog(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int ret_val; + const char * filename; /* a file path */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + filename = gen_filepath(n_filename, 0); + + ret_val = xmlLoadCatalog(filename); + desret_int(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlLoadCatalogs(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + char * pathss; /* a list of directories separated by a colon or a space. */ + int n_pathss; + + for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) { + pathss = gen_const_char_ptr(n_pathss, 0); + + xmlLoadCatalogs(pathss); + call_tests++; + des_const_char_ptr(n_pathss, pathss, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlLoadSGMLSuperCatalog(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNewCatalog(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParseCatalogFile(void) { + int test_ret = 0; + +#ifdef LIBXML_CATALOG_ENABLED + int mem_base; + xmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlParseCatalogFile(filename); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseCatalogFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_catalog(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n"); + test_ret += test_xmlACatalogAdd(); + test_ret += test_xmlACatalogDump(); + test_ret += test_xmlACatalogRemove(); + test_ret += test_xmlACatalogResolve(); + test_ret += test_xmlACatalogResolvePublic(); + test_ret += test_xmlACatalogResolveSystem(); + test_ret += test_xmlACatalogResolveURI(); + test_ret += test_xmlCatalogAdd(); + test_ret += test_xmlCatalogCleanup(); + test_ret += test_xmlCatalogConvert(); + test_ret += test_xmlCatalogDump(); + test_ret += test_xmlCatalogGetDefaults(); + test_ret += test_xmlCatalogIsEmpty(); + test_ret += test_xmlCatalogLocalResolve(); + test_ret += test_xmlCatalogLocalResolveURI(); + test_ret += test_xmlCatalogRemove(); + test_ret += test_xmlCatalogResolve(); + test_ret += test_xmlCatalogResolvePublic(); + test_ret += test_xmlCatalogResolveSystem(); + test_ret += test_xmlCatalogResolveURI(); + test_ret += test_xmlCatalogSetDefaultPrefer(); + test_ret += test_xmlCatalogSetDefaults(); + test_ret += test_xmlConvertSGMLCatalog(); + test_ret += test_xmlInitializeCatalog(); + test_ret += test_xmlLoadACatalog(); + test_ret += test_xmlLoadCatalog(); + test_ret += test_xmlLoadCatalogs(); + test_ret += test_xmlLoadSGMLSuperCatalog(); + test_ret += test_xmlNewCatalog(); + test_ret += test_xmlParseCatalogFile(); + + if (test_ret != 0) + printf("Module catalog: %d errors\n", test_ret); + return(test_ret); +} + +#define gen_nb_const_xmlChRangeGroupPtr 1 +static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCharInRange(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int val; /* character to be validated */ + int n_val; + xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */ + int n_rptr; + + for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) { + for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) { + mem_base = xmlMemBlocks(); + val = gen_unsigned_int(n_val, 0); + rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1); + + ret_val = xmlCharInRange(val, rptr); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_val, val, 0); + des_const_xmlChRangeGroupPtr(n_rptr, rptr, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharInRange", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf(" %d", n_rptr); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsBaseChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsBaseChar(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsBaseChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsBlank(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsBlank(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsBlank", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsChar(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsCombining(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsCombining(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsCombining", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsDigit(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsDigit(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsDigit", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsExtender(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsExtender(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsExtender", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsIdeographic(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsIdeographic(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsIdeographic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsPubidChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned int ch; /* character to validate */ + int n_ch; + + for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) { + mem_base = xmlMemBlocks(); + ch = gen_unsigned_int(n_ch, 0); + + ret_val = xmlIsPubidChar(ch); + desret_int(ret_val); + call_tests++; + des_unsigned_int(n_ch, ch, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsPubidChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ch); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + +static int +test_chvalid(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n"); + test_ret += test_xmlCharInRange(); + test_ret += test_xmlIsBaseChar(); + test_ret += test_xmlIsBlank(); + test_ret += test_xmlIsChar(); + test_ret += test_xmlIsCombining(); + test_ret += test_xmlIsDigit(); + test_ret += test_xmlIsExtender(); + test_ret += test_xmlIsIdeographic(); + test_ret += test_xmlIsPubidChar(); + + if (test_ret != 0) + printf("Module chvalid: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlBoolToText(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + const char * ret_val; + int boolval; /* a bool to turn into text */ + int n_boolval; + + for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) { + mem_base = xmlMemBlocks(); + boolval = gen_int(n_boolval, 0); + + ret_val = xmlBoolToText(boolval); + desret_const_char_ptr(ret_val); + call_tests++; + des_int(n_boolval, boolval, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBoolToText", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_boolval); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugCheckDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + int ret_val; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlDebugCheckDocument(output, doc); + desret_int(ret_val); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugCheckDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpAttr(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlAttrPtr attr; /* the attribute */ + int n_attr; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + attr = gen_xmlAttrPtr(n_attr, 1); + depth = gen_int(n_depth, 2); + + xmlDebugDumpAttr(output, attr, depth); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlAttrPtr(n_attr, attr, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpAttr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_attr); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpAttrList(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlAttrPtr attr; /* the attribute list */ + int n_attr; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + attr = gen_xmlAttrPtr(n_attr, 1); + depth = gen_int(n_depth, 2); + + xmlDebugDumpAttrList(output, attr, depth); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlAttrPtr(n_attr, attr, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpAttrList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_attr); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlDtdPtr dtd; /* the DTD */ + int n_dtd; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + dtd = gen_xmlDtdPtr(n_dtd, 1); + + xmlDebugDumpDTD(output, dtd); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlDtdPtr(n_dtd, dtd, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_dtd); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + xmlDebugDumpDocument(output, doc); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpDocumentHead(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + xmlDebugDumpDocumentHead(output, doc); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpDocumentHead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpEntities(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + xmlDebugDumpEntities(output, doc); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpNode(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlNodePtr node; /* the node */ + int n_node; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + node = gen_xmlNodePtr(n_node, 1); + depth = gen_int(n_depth, 2); + + xmlDebugDumpNode(output, node, depth); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlNodePtr(n_node, node, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_node); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpNodeList(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlNodePtr node; /* the node list */ + int n_node; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + node = gen_xmlNodePtr(n_node, 1); + depth = gen_int(n_depth, 2); + + xmlDebugDumpNodeList(output, node, depth); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlNodePtr(n_node, node, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_node); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpOneNode(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlNodePtr node; /* the node */ + int n_node; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + node = gen_xmlNodePtr(n_node, 1); + depth = gen_int(n_depth, 2); + + xmlDebugDumpOneNode(output, node, depth); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlNodePtr(n_node, node, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpOneNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_node); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDebugDumpString(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlChar * str; /* the string */ + int n_str; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + + xmlDebugDumpString(output, str); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_const_xmlChar_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDebugDumpString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlLsCountNode(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + int ret_val; + xmlNodePtr node; /* the node to count */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlLsCountNode(node); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLsCountNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlLsOneNode(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlNodePtr node; /* the node to dump */ + int n_node; + + for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + output = gen_debug_FILE_ptr(n_output, 0); + node = gen_xmlNodePtr(n_node, 1); + + xmlLsOneNode(output, node); + call_tests++; + des_debug_FILE_ptr(n_output, output, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLsOneNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_char_ptr 1 +static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlShell(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlShellBase(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * arg; /* unused */ + int n_arg; + xmlNodePtr node; /* a node */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + arg = gen_char_ptr(n_arg, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellBase(ctxt, arg, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_arg, arg, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellBase", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_arg); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellCat(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * arg; /* unused */ + int n_arg; + xmlNodePtr node; /* a node */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + arg = gen_char_ptr(n_arg, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellCat(ctxt, arg, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_arg, arg, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellCat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_arg); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellDir(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * arg; /* unused */ + int n_arg; + xmlNodePtr node; /* a node */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + arg = gen_char_ptr(n_arg, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellDir(ctxt, arg, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_arg, arg, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellDir", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_arg); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellDu(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * arg; /* unused */ + int n_arg; + xmlNodePtr tree; /* a node defining a subtree */ + int n_tree; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { + for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + arg = gen_char_ptr(n_arg, 1); + tree = gen_xmlNodePtr(n_tree, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellDu(ctxt, arg, tree, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_arg, arg, 1); + des_xmlNodePtr(n_tree, tree, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellDu", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_arg); + printf(" %d", n_tree); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellList(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * arg; /* unused */ + int n_arg; + xmlNodePtr node; /* a node */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + arg = gen_char_ptr(n_arg, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellList(ctxt, arg, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_arg, arg, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_arg); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellLoad(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * filename; /* the file name */ + int n_filename; + xmlNodePtr node; /* unused */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + filename = gen_char_ptr(n_filename, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellLoad(ctxt, filename, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_filename, filename, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellLoad", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellPrintXPathResult(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */ + int n_list; + + for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) { + mem_base = xmlMemBlocks(); + list = gen_xmlXPathObjectPtr(n_list, 0); + + xmlShellPrintXPathResult(list); + call_tests++; + des_xmlXPathObjectPtr(n_list, list, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellPrintXPathResult", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_list); + printf("\n"); + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellPwd(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * buffer; /* the output buffer */ + int n_buffer; + xmlNodePtr node; /* a node */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + buffer = gen_char_ptr(n_buffer, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellPwd(ctxt, buffer, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_buffer, buffer, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellPwd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellSave(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * filename; /* the file name (optional) */ + int n_filename; + xmlNodePtr node; /* unused */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + filename = gen_char_ptr(n_filename, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellSave(ctxt, filename, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_filename, filename, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellSave", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellValidate(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * dtd; /* the DTD URI (optional) */ + int n_dtd; + xmlNodePtr node; /* unused */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + dtd = gen_char_ptr(n_dtd, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellValidate(ctxt, dtd, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_dtd, dtd, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellValidate", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_dtd); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlShellWrite(void) { + int test_ret = 0; + +#ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlShellCtxtPtr ctxt; /* the shell context */ + int n_ctxt; + char * filename; /* the file name */ + int n_filename; + xmlNodePtr node; /* a node in the tree */ + int n_node; + xmlNodePtr node2; /* unused */ + int n_node2; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0); + filename = gen_char_ptr(n_filename, 1); + node = gen_xmlNodePtr(n_node, 2); + node2 = gen_xmlNodePtr(n_node2, 3); + + ret_val = xmlShellWrite(ctxt, filename, node, node2); + desret_int(ret_val); + call_tests++; + des_xmlShellCtxtPtr(n_ctxt, ctxt, 0); + des_char_ptr(n_filename, filename, 1); + des_xmlNodePtr(n_node, node, 2); + des_xmlNodePtr(n_node2, node2, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlShellWrite", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_node); + printf(" %d", n_node2); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif +#endif +#endif + + return(test_ret); +} + +static int +test_debugXML(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n"); + test_ret += test_xmlBoolToText(); + test_ret += test_xmlDebugCheckDocument(); + test_ret += test_xmlDebugDumpAttr(); + test_ret += test_xmlDebugDumpAttrList(); + test_ret += test_xmlDebugDumpDTD(); + test_ret += test_xmlDebugDumpDocument(); + test_ret += test_xmlDebugDumpDocumentHead(); + test_ret += test_xmlDebugDumpEntities(); + test_ret += test_xmlDebugDumpNode(); + test_ret += test_xmlDebugDumpNodeList(); + test_ret += test_xmlDebugDumpOneNode(); + test_ret += test_xmlDebugDumpString(); + test_ret += test_xmlLsCountNode(); + test_ret += test_xmlLsOneNode(); + test_ret += test_xmlShell(); + test_ret += test_xmlShellBase(); + test_ret += test_xmlShellCat(); + test_ret += test_xmlShellDir(); + test_ret += test_xmlShellDu(); + test_ret += test_xmlShellList(); + test_ret += test_xmlShellLoad(); + test_ret += test_xmlShellPrintXPathResult(); + test_ret += test_xmlShellPwd(); + test_ret += test_xmlShellSave(); + test_ret += test_xmlShellValidate(); + test_ret += test_xmlShellWrite(); + + if (test_ret != 0) + printf("Module debugXML: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlDictCreate(void) { + int test_ret = 0; + + int mem_base; + xmlDictPtr ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlDictCreate(); + desret_xmlDictPtr(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictCreate", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictCreateSub(void) { + int test_ret = 0; + + int mem_base; + xmlDictPtr ret_val; + xmlDictPtr sub; /* an existing dictionnary */ + int n_sub; + + for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) { + mem_base = xmlMemBlocks(); + sub = gen_xmlDictPtr(n_sub, 0); + + ret_val = xmlDictCreateSub(sub); + desret_xmlDictPtr(ret_val); + call_tests++; + des_xmlDictPtr(n_sub, sub, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictCreateSub", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sub); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictLookup(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlDictPtr dict; /* the dictionnary */ + int n_dict; + xmlChar * name; /* the name of the userdata */ + int n_name; + int len; /* the length of the name, if -1 it is recomputed */ + int n_len; + + for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + dict = gen_xmlDictPtr(n_dict, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + len = gen_int(n_len, 2); + + ret_val = xmlDictLookup(dict, name, len); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDictPtr(n_dict, dict, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dict); + printf(" %d", n_name); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictOwns(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDictPtr dict; /* the dictionnary */ + int n_dict; + xmlChar * str; /* the string */ + int n_str; + + for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + dict = gen_xmlDictPtr(n_dict, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + + ret_val = xmlDictOwns(dict, str); + desret_int(ret_val); + call_tests++; + des_xmlDictPtr(n_dict, dict, 0); + des_const_xmlChar_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictOwns", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dict); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictQLookup(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlDictPtr dict; /* the dictionnary */ + int n_dict; + xmlChar * prefix; /* the prefix */ + int n_prefix; + xmlChar * name; /* the name */ + int n_name; + + for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + dict = gen_xmlDictPtr(n_dict, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + + ret_val = xmlDictQLookup(dict, prefix, name); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDictPtr(n_dict, dict, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictQLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dict); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictReference(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDictPtr dict; /* the dictionnary */ + int n_dict; + + for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { + mem_base = xmlMemBlocks(); + dict = gen_xmlDictPtr(n_dict, 0); + + ret_val = xmlDictReference(dict); + xmlDictFree(dict); + desret_int(ret_val); + call_tests++; + des_xmlDictPtr(n_dict, dict, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictReference", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dict); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDictSize(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDictPtr dict; /* the dictionnary */ + int n_dict; + + for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) { + mem_base = xmlMemBlocks(); + dict = gen_xmlDictPtr(n_dict, 0); + + ret_val = xmlDictSize(dict); + desret_int(ret_val); + call_tests++; + des_xmlDictPtr(n_dict, dict, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDictSize", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dict); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + +static int +test_dict(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing dict : 7 of 8 functions ...\n"); + test_ret += test_xmlDictCreate(); + test_ret += test_xmlDictCreateSub(); + test_ret += test_xmlDictLookup(); + test_ret += test_xmlDictOwns(); + test_ret += test_xmlDictQLookup(); + test_ret += test_xmlDictReference(); + test_ret += test_xmlDictSize(); + + if (test_ret != 0) + printf("Module dict: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_UTF8Toisolat1(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + unsigned char * out; /* a pointer to an array of bytes to store the result */ + int n_out; + int * outlen; /* the length of @out */ + int n_outlen; + unsigned char * in; /* a pointer to an array of UTF-8 chars */ + int n_in; + int * inlen; /* the length of @in */ + int n_inlen; + + for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { + for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { + for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { + for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { + mem_base = xmlMemBlocks(); + out = gen_unsigned_char_ptr(n_out, 0); + outlen = gen_int_ptr(n_outlen, 1); + in = gen_const_unsigned_char_ptr(n_in, 2); + inlen = gen_int_ptr(n_inlen, 3); + + ret_val = UTF8Toisolat1(out, outlen, in, inlen); + desret_int(ret_val); + call_tests++; + des_unsigned_char_ptr(n_out, out, 0); + des_int_ptr(n_outlen, outlen, 1); + des_const_unsigned_char_ptr(n_in, in, 2); + des_int_ptr(n_inlen, inlen, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in UTF8Toisolat1", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_outlen); + printf(" %d", n_in); + printf(" %d", n_inlen); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_isolat1ToUTF8(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned char * out; /* a pointer to an array of bytes to store the result */ + int n_out; + int * outlen; /* the length of @out */ + int n_outlen; + unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */ + int n_in; + int * inlen; /* the length of @in */ + int n_inlen; + + for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) { + for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) { + for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { + for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) { + mem_base = xmlMemBlocks(); + out = gen_unsigned_char_ptr(n_out, 0); + outlen = gen_int_ptr(n_outlen, 1); + in = gen_const_unsigned_char_ptr(n_in, 2); + inlen = gen_int_ptr(n_inlen, 3); + + ret_val = isolat1ToUTF8(out, outlen, in, inlen); + desret_int(ret_val); + call_tests++; + des_unsigned_char_ptr(n_out, out, 0); + des_int_ptr(n_outlen, outlen, 1); + des_const_unsigned_char_ptr(n_in, in, 2); + des_int_ptr(n_inlen, inlen, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in isolat1ToUTF8", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_outlen); + printf(" %d", n_in); + printf(" %d", n_inlen); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddEncodingAlias(void) { + int test_ret = 0; + + int ret_val; + char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ + int n_name; + char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ + int n_alias; + + for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { + for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { + name = gen_const_char_ptr(n_name, 0); + alias = gen_const_char_ptr(n_alias, 1); + + ret_val = xmlAddEncodingAlias(name, alias); + desret_int(ret_val); + call_tests++; + des_const_char_ptr(n_name, name, 0); + des_const_char_ptr(n_alias, alias, 1); + xmlResetLastError(); + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlCharEncodingHandler_ptr 1 +static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCharEncCloseFunc(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ + int n_handler; + + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); + + ret_val = xmlCharEncCloseFunc(handler); + desret_int(ret_val); + call_tests++; + des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharEncCloseFunc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCharEncFirstLine(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ + int n_handler; + xmlBufferPtr out; /* an xmlBuffer for the output. */ + int n_out; + xmlBufferPtr in; /* an xmlBuffer for the input */ + int n_in; + + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { + for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { + for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); + out = gen_xmlBufferPtr(n_out, 1); + in = gen_xmlBufferPtr(n_in, 2); + + ret_val = xmlCharEncFirstLine(handler, out, in); + desret_int(ret_val); + call_tests++; + des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); + des_xmlBufferPtr(n_out, out, 1); + des_xmlBufferPtr(n_in, in, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharEncFirstLine", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf(" %d", n_out); + printf(" %d", n_in); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCharEncInFunc(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlCharEncodingHandler * handler; /* char encoding transformation data structure */ + int n_handler; + xmlBufferPtr out; /* an xmlBuffer for the output. */ + int n_out; + xmlBufferPtr in; /* an xmlBuffer for the input */ + int n_in; + + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { + for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { + for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); + out = gen_xmlBufferPtr(n_out, 1); + in = gen_xmlBufferPtr(n_in, 2); + + ret_val = xmlCharEncInFunc(handler, out, in); + desret_int(ret_val); + call_tests++; + des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); + des_xmlBufferPtr(n_out, out, 1); + des_xmlBufferPtr(n_in, in, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharEncInFunc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf(" %d", n_out); + printf(" %d", n_in); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCharEncOutFunc(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlCharEncodingHandler * handler; /* char enconding transformation data structure */ + int n_handler; + xmlBufferPtr out; /* an xmlBuffer for the output. */ + int n_out; + xmlBufferPtr in; /* an xmlBuffer for the input */ + int n_in; + + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) { + for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) { + for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0); + out = gen_xmlBufferPtr(n_out, 1); + in = gen_xmlBufferPtr(n_in, 2); + + ret_val = xmlCharEncOutFunc(handler, out, in); + desret_int(ret_val); + call_tests++; + des_xmlCharEncodingHandler_ptr(n_handler, handler, 0); + des_xmlBufferPtr(n_out, out, 1); + des_xmlBufferPtr(n_in, in, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharEncOutFunc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf(" %d", n_out); + printf(" %d", n_in); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCleanupCharEncodingHandlers(void) { + int test_ret = 0; + + + + xmlCleanupCharEncodingHandlers(); + call_tests++; + xmlResetLastError(); + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCleanupEncodingAliases(void) { + int test_ret = 0; + + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlCleanupEncodingAliases(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCleanupEncodingAliases", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDelEncodingAlias(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ + int n_alias; + + for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { + mem_base = xmlMemBlocks(); + alias = gen_const_char_ptr(n_alias, 0); + + ret_val = xmlDelEncodingAlias(alias); + desret_int(ret_val); + call_tests++; + des_const_char_ptr(n_alias, alias, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDelEncodingAlias", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_alias); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDetectCharEncoding(void) { + int test_ret = 0; + + int mem_base; + xmlCharEncoding ret_val; + unsigned char * in; /* a pointer to the first bytes of the XML entity, must be at least 2 bytes long (at least 4 if encoding is UTF4 variant). */ + int n_in; + int len; /* pointer to the length of the buffer */ + int n_len; + + for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + in = gen_const_unsigned_char_ptr(n_in, 0); + len = gen_int(n_len, 1); + + ret_val = xmlDetectCharEncoding(in, len); + desret_xmlCharEncoding(ret_val); + call_tests++; + des_const_unsigned_char_ptr(n_in, in, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDetectCharEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlFindCharEncodingHandler(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlGetCharEncodingHandler(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlGetCharEncodingName(void) { + int test_ret = 0; + + int mem_base; + const char * ret_val; + xmlCharEncoding enc; /* the encoding */ + int n_enc; + + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + enc = gen_xmlCharEncoding(n_enc, 0); + + ret_val = xmlGetCharEncodingName(enc); + desret_const_char_ptr(ret_val); + call_tests++; + des_xmlCharEncoding(n_enc, enc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetCharEncodingName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_enc); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetEncodingAlias(void) { + int test_ret = 0; + + int mem_base; + const char * ret_val; + char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */ + int n_alias; + + for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) { + mem_base = xmlMemBlocks(); + alias = gen_const_char_ptr(n_alias, 0); + + ret_val = xmlGetEncodingAlias(alias); + desret_const_char_ptr(ret_val); + call_tests++; + des_const_char_ptr(n_alias, alias, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetEncodingAlias", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_alias); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlInitCharEncodingHandlers(void) { + int test_ret = 0; + + + + xmlInitCharEncodingHandlers(); + call_tests++; + xmlResetLastError(); + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewCharEncodingHandler(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParseCharEncoding(void) { + int test_ret = 0; + + int mem_base; + xmlCharEncoding ret_val; + char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_char_ptr(n_name, 0); + + ret_val = xmlParseCharEncoding(name); + desret_xmlCharEncoding(ret_val); + call_tests++; + des_const_char_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseCharEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlCharEncodingHandlerPtr 1 +static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlRegisterCharEncodingHandler(void) { + int test_ret = 0; + + int mem_base; + xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */ + int n_handler; + + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0); + + xmlRegisterCharEncodingHandler(handler); + call_tests++; + des_xmlCharEncodingHandlerPtr(n_handler, handler, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + +static int +test_encoding(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n"); + test_ret += test_UTF8Toisolat1(); + test_ret += test_isolat1ToUTF8(); + test_ret += test_xmlAddEncodingAlias(); + test_ret += test_xmlCharEncCloseFunc(); + test_ret += test_xmlCharEncFirstLine(); + test_ret += test_xmlCharEncInFunc(); + test_ret += test_xmlCharEncOutFunc(); + test_ret += test_xmlCleanupCharEncodingHandlers(); + test_ret += test_xmlCleanupEncodingAliases(); + test_ret += test_xmlDelEncodingAlias(); + test_ret += test_xmlDetectCharEncoding(); + test_ret += test_xmlFindCharEncodingHandler(); + test_ret += test_xmlGetCharEncodingHandler(); + test_ret += test_xmlGetCharEncodingName(); + test_ret += test_xmlGetEncodingAlias(); + test_ret += test_xmlInitCharEncodingHandlers(); + test_ret += test_xmlNewCharEncodingHandler(); + test_ret += test_xmlParseCharEncoding(); + test_ret += test_xmlRegisterCharEncodingHandler(); + + if (test_ret != 0) + printf("Module encoding: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlAddDocEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + int type; /* the entity type XML_xxx_yyy_ENTITY */ + int n_type; + xmlChar * ExternalID; /* the entity external ID if available */ + int n_ExternalID; + xmlChar * SystemID; /* the entity system ID if available */ + int n_SystemID; + xmlChar * content; /* the entity content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_int(n_type, 2); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); + content = gen_const_xmlChar_ptr(n_content, 5); + + ret_val = xmlAddDocEntity(doc, name, type, ExternalID, SystemID, content); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_int(n_type, type, 2); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3); + des_const_xmlChar_ptr(n_SystemID, SystemID, 4); + des_const_xmlChar_ptr(n_content, content, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddDocEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddDtdEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + int type; /* the entity type XML_xxx_yyy_ENTITY */ + int n_type; + xmlChar * ExternalID; /* the entity external ID if available */ + int n_ExternalID; + xmlChar * SystemID; /* the entity system ID if available */ + int n_SystemID; + xmlChar * content; /* the entity content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + type = gen_int(n_type, 2); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 4); + content = gen_const_xmlChar_ptr(n_content, 5); + + ret_val = xmlAddDtdEntity(doc, name, type, ExternalID, SystemID, content); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_int(n_type, type, 2); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 3); + des_const_xmlChar_ptr(n_SystemID, SystemID, 4); + des_const_xmlChar_ptr(n_content, content, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddDtdEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCleanupPredefinedEntities(void) { + int test_ret = 0; + +#ifdef LIBXML_LEGACY_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlCleanupPredefinedEntities(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCleanupPredefinedEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_xmlEntitiesTablePtr 1 +static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCopyEntitiesTable(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlCreateEntitiesTable(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlDumpEntitiesTable(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* An XML buffer. */ + int n_buf; + xmlEntitiesTablePtr table; /* An entity table */ + int n_table; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + table = gen_xmlEntitiesTablePtr(n_table, 1); + + xmlDumpEntitiesTable(buf, table); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlEntitiesTablePtr(n_table, table, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpEntitiesTable", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_table); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_xmlEntityPtr 1 +static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlDumpEntityDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* An XML buffer. */ + int n_buf; + xmlEntityPtr ent; /* An entity table */ + int n_ent; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + ent = gen_xmlEntityPtr(n_ent, 1); + + xmlDumpEntityDecl(buf, ent); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlEntityPtr(n_ent, ent, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpEntityDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_ent); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlEncodeEntitiesReentrant(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document containing the string */ + int n_doc; + xmlChar * input; /* A string to convert to XML. */ + int n_input; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + input = gen_const_xmlChar_ptr(n_input, 1); + + ret_val = xmlEncodeEntitiesReentrant(doc, input); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_input, input, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_input); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlEncodeSpecialChars(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document containing the string */ + int n_doc; + xmlChar * input; /* A string to convert to XML. */ + int n_input; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + input = gen_const_xmlChar_ptr(n_input, 1); + + ret_val = xmlEncodeSpecialChars(doc, input); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_input, input, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlEncodeSpecialChars", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_input); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDocEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document referencing the entity */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetDocEntity(doc, name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDocEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDtdEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document referencing the entity */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetDtdEntity(doc, name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDtdEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetParameterEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlDocPtr doc; /* the document referencing the entity */ + int n_doc; + xmlChar * name; /* the entity name */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetParameterEntity(doc, name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetParameterEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetPredefinedEntity(void) { + int test_ret = 0; + + int mem_base; + xmlEntityPtr ret_val; + xmlChar * name; /* the entity name */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + + ret_val = xmlGetPredefinedEntity(name); + desret_xmlEntityPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetPredefinedEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlInitializePredefinedEntities(void) { + int test_ret = 0; + +#ifdef LIBXML_LEGACY_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlInitializePredefinedEntities(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlInitializePredefinedEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_entities(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n"); + test_ret += test_xmlAddDocEntity(); + test_ret += test_xmlAddDtdEntity(); + test_ret += test_xmlCleanupPredefinedEntities(); + test_ret += test_xmlCopyEntitiesTable(); + test_ret += test_xmlCreateEntitiesTable(); + test_ret += test_xmlDumpEntitiesTable(); + test_ret += test_xmlDumpEntityDecl(); + test_ret += test_xmlEncodeEntitiesReentrant(); + test_ret += test_xmlEncodeSpecialChars(); + test_ret += test_xmlGetDocEntity(); + test_ret += test_xmlGetDtdEntity(); + test_ret += test_xmlGetParameterEntity(); + test_ret += test_xmlGetPredefinedEntity(); + test_ret += test_xmlInitializePredefinedEntities(); + + if (test_ret != 0) + printf("Module entities: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlHashAddEntry(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + userdata = gen_userdata(n_userdata, 2); + + ret_val = xmlHashAddEntry(table, name, userdata); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_userdata(n_userdata, userdata, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashAddEntry", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_userdata); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashAddEntry2(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + userdata = gen_userdata(n_userdata, 3); + + ret_val = xmlHashAddEntry2(table, name, name2, userdata); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_userdata(n_userdata, userdata, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashAddEntry2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_userdata); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashAddEntry3(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlChar * name3; /* a third name of the userdata */ + int n_name3; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + name3 = gen_const_xmlChar_ptr(n_name3, 3); + userdata = gen_userdata(n_userdata, 4); + + ret_val = xmlHashAddEntry3(table, name, name2, name3, userdata); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_const_xmlChar_ptr(n_name3, name3, 3); + des_userdata(n_userdata, userdata, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashAddEntry3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_name3); + printf(" %d", n_userdata); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashCopy(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashCreate(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashLookup(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlHashLookup(table, name); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashLookup2(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + + ret_val = xmlHashLookup2(table, name, name2); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashLookup2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashLookup3(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlChar * name3; /* a third name of the userdata */ + int n_name3; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + name3 = gen_const_xmlChar_ptr(n_name3, 3); + + ret_val = xmlHashLookup3(table, name, name2, name3); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_const_xmlChar_ptr(n_name3, name3, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashLookup3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_name3); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashQLookup(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * prefix; /* the prefix of the userdata */ + int n_prefix; + xmlChar * name; /* the name of the userdata */ + int n_name; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + + ret_val = xmlHashQLookup(table, prefix, name); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashQLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashQLookup2(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * prefix; /* the prefix of the userdata */ + int n_prefix; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * prefix2; /* the second prefix of the userdata */ + int n_prefix2; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); + name2 = gen_const_xmlChar_ptr(n_name2, 4); + + ret_val = xmlHashQLookup2(table, prefix, name, prefix2, name2); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_prefix2, prefix2, 3); + des_const_xmlChar_ptr(n_name2, name2, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashQLookup2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_prefix2); + printf(" %d", n_name2); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashQLookup3(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * prefix; /* the prefix of the userdata */ + int n_prefix; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * prefix2; /* the second prefix of the userdata */ + int n_prefix2; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlChar * prefix3; /* the third prefix of the userdata */ + int n_prefix3; + xmlChar * name3; /* a third name of the userdata */ + int n_name3; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) { + for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3); + name2 = gen_const_xmlChar_ptr(n_name2, 4); + prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5); + name3 = gen_const_xmlChar_ptr(n_name3, 6); + + ret_val = xmlHashQLookup3(table, prefix, name, prefix2, name2, prefix3, name3); + desret_void_ptr(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_prefix2, prefix2, 3); + des_const_xmlChar_ptr(n_name2, name2, 4); + des_const_xmlChar_ptr(n_prefix3, prefix3, 5); + des_const_xmlChar_ptr(n_name3, name3, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashQLookup3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_prefix2); + printf(" %d", n_name2); + printf(" %d", n_prefix3); + printf(" %d", n_name3); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashRemoveEntry(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + f = gen_xmlHashDeallocator(n_f, 2); + + ret_val = xmlHashRemoveEntry(table, name, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_xmlHashDeallocator(n_f, f, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashRemoveEntry", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashRemoveEntry2(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + f = gen_xmlHashDeallocator(n_f, 3); + + ret_val = xmlHashRemoveEntry2(table, name, name2, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_xmlHashDeallocator(n_f, f, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashRemoveEntry2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashRemoveEntry3(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlChar * name3; /* a third name of the userdata */ + int n_name3; + xmlHashDeallocator f; /* the deallocator function for removed item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + name3 = gen_const_xmlChar_ptr(n_name3, 3); + f = gen_xmlHashDeallocator(n_f, 4); + + ret_val = xmlHashRemoveEntry3(table, name, name2, name3, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_const_xmlChar_ptr(n_name3, name3, 3); + des_xmlHashDeallocator(n_f, f, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashRemoveEntry3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_name3); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashScan(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashScan3(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashScanFull(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashScanFull3(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlHashSize(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + + ret_val = xmlHashSize(table); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashSize", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashUpdateEntry(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + userdata = gen_userdata(n_userdata, 2); + f = gen_xmlHashDeallocator(n_f, 3); + + ret_val = xmlHashUpdateEntry(table, name, userdata, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_userdata(n_userdata, userdata, 2); + des_xmlHashDeallocator(n_f, f, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashUpdateEntry", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_userdata); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashUpdateEntry2(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + userdata = gen_userdata(n_userdata, 3); + f = gen_xmlHashDeallocator(n_f, 4); + + ret_val = xmlHashUpdateEntry2(table, name, name2, userdata, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_userdata(n_userdata, userdata, 3); + des_xmlHashDeallocator(n_f, f, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashUpdateEntry2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_userdata); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHashUpdateEntry3(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlHashTablePtr table; /* the hash table */ + int n_table; + xmlChar * name; /* the name of the userdata */ + int n_name; + xmlChar * name2; /* a second name of the userdata */ + int n_name2; + xmlChar * name3; /* a third name of the userdata */ + int n_name3; + void * userdata; /* a pointer to the userdata */ + int n_userdata; + xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */ + int n_f; + + for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) { + for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) { + for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) { + for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) { + mem_base = xmlMemBlocks(); + table = gen_xmlHashTablePtr(n_table, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + name2 = gen_const_xmlChar_ptr(n_name2, 2); + name3 = gen_const_xmlChar_ptr(n_name3, 3); + userdata = gen_userdata(n_userdata, 4); + f = gen_xmlHashDeallocator(n_f, 5); + + ret_val = xmlHashUpdateEntry3(table, name, name2, name3, userdata, f); + desret_int(ret_val); + call_tests++; + des_xmlHashTablePtr(n_table, table, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_name2, name2, 2); + des_const_xmlChar_ptr(n_name3, name3, 3); + des_userdata(n_userdata, userdata, 4); + des_xmlHashDeallocator(n_f, f, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHashUpdateEntry3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_table); + printf(" %d", n_name); + printf(" %d", n_name2); + printf(" %d", n_name3); + printf(" %d", n_userdata); + printf(" %d", n_f); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + +static int +test_hash(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n"); + test_ret += test_xmlHashAddEntry(); + test_ret += test_xmlHashAddEntry2(); + test_ret += test_xmlHashAddEntry3(); + test_ret += test_xmlHashCopy(); + test_ret += test_xmlHashCreate(); + test_ret += test_xmlHashLookup(); + test_ret += test_xmlHashLookup2(); + test_ret += test_xmlHashLookup3(); + test_ret += test_xmlHashQLookup(); + test_ret += test_xmlHashQLookup2(); + test_ret += test_xmlHashQLookup3(); + test_ret += test_xmlHashRemoveEntry(); + test_ret += test_xmlHashRemoveEntry2(); + test_ret += test_xmlHashRemoveEntry3(); + test_ret += test_xmlHashScan(); + test_ret += test_xmlHashScan3(); + test_ret += test_xmlHashScanFull(); + test_ret += test_xmlHashScanFull3(); + test_ret += test_xmlHashSize(); + test_ret += test_xmlHashUpdateEntry(); + test_ret += test_xmlHashUpdateEntry2(); + test_ret += test_xmlHashUpdateEntry3(); + + if (test_ret != 0) + printf("Module hash: %d errors\n", test_ret); + return(test_ret); +} + +#define gen_nb_xmlLinkPtr 1 +static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlLinkGetData(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlLinkPtr lk; /* a link */ + int n_lk; + + for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) { + mem_base = xmlMemBlocks(); + lk = gen_xmlLinkPtr(n_lk, 0); + + ret_val = xmlLinkGetData(lk); + desret_void_ptr(ret_val); + call_tests++; + des_xmlLinkPtr(n_lk, lk, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLinkGetData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_lk); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListAppend(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* the data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListAppend(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListAppend", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListClear(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + xmlListClear(l); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListClear", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_const_xmlListPtr 1 +static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlListCopy(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr cur; /* the new list */ + int n_cur; + xmlListPtr old; /* the old list */ + int n_old; + + for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) { + for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlListPtr(n_cur, 0); + old = gen_const_xmlListPtr(n_old, 1); + + ret_val = xmlListCopy(cur, old); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_cur, cur, 0); + des_const_xmlListPtr(n_old, old, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListCopy", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_old); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListCreate(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlListDup(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlListEmpty(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + ret_val = xmlListEmpty(l); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListEmpty", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListEnd(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlListFront(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlListInsert(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* the data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListInsert(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListInsert", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListMerge(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l1; /* the original list */ + int n_l1; + xmlListPtr l2; /* the new list */ + int n_l2; + + for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) { + for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) { + mem_base = xmlMemBlocks(); + l1 = gen_xmlListPtr(n_l1, 0); + l2 = gen_xmlListPtr(n_l2, 1); + + xmlListMerge(l1, l2); + call_tests++; + des_xmlListPtr(n_l1, l1, 0); + des_xmlListPtr(n_l2, l2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListMerge", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l1); + printf(" %d", n_l2); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListPopBack(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + xmlListPopBack(l); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListPopBack", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListPopFront(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + xmlListPopFront(l); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListPopFront", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListPushBack(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* new data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListPushBack(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListPushBack", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListPushFront(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* new data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListPushFront(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListPushFront", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListRemoveAll(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* list data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListRemoveAll(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListRemoveAll", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListRemoveFirst(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* list data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListRemoveFirst(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListRemoveFirst", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListRemoveLast(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* list data */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListRemoveLast(l, data); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListRemoveLast", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListReverse(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + xmlListReverse(l); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListReverse", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListReverseSearch(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* a search value */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListReverseSearch(l, data); + desret_void_ptr(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListReverseSearch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListReverseWalk(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlListSearch(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + xmlListPtr l; /* a list */ + int n_l; + void * data; /* a search value */ + int n_data; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + data = gen_userdata(n_data, 1); + + ret_val = xmlListSearch(l, data); + desret_void_ptr(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + des_userdata(n_data, data, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListSearch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf(" %d", n_data); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListSize(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + ret_val = xmlListSize(l); + desret_int(ret_val); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListSize", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListSort(void) { + int test_ret = 0; + + int mem_base; + xmlListPtr l; /* a list */ + int n_l; + + for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) { + mem_base = xmlMemBlocks(); + l = gen_xmlListPtr(n_l, 0); + + xmlListSort(l); + call_tests++; + des_xmlListPtr(n_l, l, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlListSort", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_l); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlListWalk(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_list(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n"); + test_ret += test_xmlLinkGetData(); + test_ret += test_xmlListAppend(); + test_ret += test_xmlListClear(); + test_ret += test_xmlListCopy(); + test_ret += test_xmlListCreate(); + test_ret += test_xmlListDup(); + test_ret += test_xmlListEmpty(); + test_ret += test_xmlListEnd(); + test_ret += test_xmlListFront(); + test_ret += test_xmlListInsert(); + test_ret += test_xmlListMerge(); + test_ret += test_xmlListPopBack(); + test_ret += test_xmlListPopFront(); + test_ret += test_xmlListPushBack(); + test_ret += test_xmlListPushFront(); + test_ret += test_xmlListRemoveAll(); + test_ret += test_xmlListRemoveFirst(); + test_ret += test_xmlListRemoveLast(); + test_ret += test_xmlListReverse(); + test_ret += test_xmlListReverseSearch(); + test_ret += test_xmlListReverseWalk(); + test_ret += test_xmlListSearch(); + test_ret += test_xmlListSize(); + test_ret += test_xmlListSort(); + test_ret += test_xmlListWalk(); + + if (test_ret != 0) + printf("Module list: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlNanoFTPCheckResponse(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoFTPCheckResponse(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPCheckResponse", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlNanoFTPCleanup(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPCleanup", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPCloseConnection(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoFTPCloseConnection(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPCloseConnection", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPCwd(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + char * directory; /* a directory on the server */ + int n_directory; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + directory = gen_const_char_ptr(n_directory, 1); + + ret_val = xmlNanoFTPCwd(ctx, directory); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + des_const_char_ptr(n_directory, directory, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPCwd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_directory); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPDele(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + const char * file; /* a file or directory on the server */ + int n_file; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + for (n_file = 0;n_file < gen_nb_filepath;n_file++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + file = gen_filepath(n_file, 1); + + ret_val = xmlNanoFTPDele(ctx, file); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + des_filepath(n_file, file, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPDele", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_file); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPGet(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNanoFTPGetConnection(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoFTPGetConnection(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPGetConnection", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPGetResponse(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoFTPGetResponse(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPGetResponse", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPGetSocket(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + const char * filename; /* the file to retrieve (or NULL if path is in context). */ + int n_filename; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + filename = gen_filepath(n_filename, 1); + + ret_val = xmlNanoFTPGetSocket(ctx, filename); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + des_filepath(n_filename, filename, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPGetSocket", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_filename); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPInit(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlNanoFTPInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPList(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNanoFTPNewCtxt(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNanoFTPOpen(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + void * ret_val; + const char * URL; /* the URL to the resource */ + int n_URL; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + + ret_val = xmlNanoFTPOpen(URL); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPOpen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPProxy(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + char * host; /* the proxy host name */ + int n_host; + int port; /* the proxy port */ + int n_port; + char * user; /* the proxy user name */ + int n_user; + char * passwd; /* the proxy password */ + int n_passwd; + int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */ + int n_type; + + for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) { + for (n_port = 0;n_port < gen_nb_int;n_port++) { + for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) { + for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) { + for (n_type = 0;n_type < gen_nb_int;n_type++) { + host = gen_const_char_ptr(n_host, 0); + port = gen_int(n_port, 1); + user = gen_const_char_ptr(n_user, 2); + passwd = gen_const_char_ptr(n_passwd, 3); + type = gen_int(n_type, 4); + + xmlNanoFTPProxy(host, port, user, passwd, type); + call_tests++; + des_const_char_ptr(n_host, host, 0); + des_int(n_port, port, 1); + des_const_char_ptr(n_user, user, 2); + des_const_char_ptr(n_passwd, passwd, 3); + des_int(n_type, type, 4); + xmlResetLastError(); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPQuit(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoFTPQuit(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPQuit", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPRead(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* the FTP context */ + int n_ctx; + void * dest; /* a buffer */ + int n_dest; + int len; /* the buffer length */ + int n_len; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + dest = gen_void_ptr(n_dest, 1); + len = gen_int(n_len, 2); + + ret_val = xmlNanoFTPRead(ctx, dest, len); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + des_void_ptr(n_dest, dest, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_dest); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPScanProxy(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + const char * URL; /* The proxy URL used to initialize the proxy context */ + int n_URL; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + URL = gen_filepath(n_URL, 0); + + xmlNanoFTPScanProxy(URL); + call_tests++; + des_filepath(n_URL, URL, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoFTPUpdateURL(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* an FTP context */ + int n_ctx; + const char * URL; /* The URL used to update the context */ + int n_URL; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0); + URL = gen_filepath(n_URL, 1); + + ret_val = xmlNanoFTPUpdateURL(ctx, URL); + desret_int(ret_val); + call_tests++; + des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0); + des_filepath(n_URL, URL, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoFTPUpdateURL", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_URL); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_nanoftp(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n"); + test_ret += test_xmlNanoFTPCheckResponse(); + test_ret += test_xmlNanoFTPCleanup(); + test_ret += test_xmlNanoFTPCloseConnection(); + test_ret += test_xmlNanoFTPCwd(); + test_ret += test_xmlNanoFTPDele(); + test_ret += test_xmlNanoFTPGet(); + test_ret += test_xmlNanoFTPGetConnection(); + test_ret += test_xmlNanoFTPGetResponse(); + test_ret += test_xmlNanoFTPGetSocket(); + test_ret += test_xmlNanoFTPInit(); + test_ret += test_xmlNanoFTPList(); + test_ret += test_xmlNanoFTPNewCtxt(); + test_ret += test_xmlNanoFTPOpen(); + test_ret += test_xmlNanoFTPProxy(); + test_ret += test_xmlNanoFTPQuit(); + test_ret += test_xmlNanoFTPRead(); + test_ret += test_xmlNanoFTPScanProxy(); + test_ret += test_xmlNanoFTPUpdateURL(); + + if (test_ret != 0) + printf("Module nanoftp: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlNanoHTTPAuthHeader(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + const char * ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoHTTPAuthHeader(ctx); + desret_const_char_ptr(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlNanoHTTPCleanup(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPCleanup", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPClose(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + xmlNanoHTTPClose(ctx); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPContentLength(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoHTTPContentLength(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPContentLength", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPEncoding(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + const char * ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoHTTPEncoding(ctx); + desret_const_char_ptr(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_char_ptr_ptr 1 +static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlNanoHTTPFetch(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + const char * URL; /* The URL to load */ + int n_URL; + const char * filename; /* the filename where the content should be saved */ + int n_filename; + char ** contentType; /* if available the Content-Type information will be returned at that location */ + int n_contentType; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + filename = gen_filepath(n_filename, 1); + contentType = gen_char_ptr_ptr(n_contentType, 2); + + ret_val = xmlNanoHTTPFetch(URL, filename, contentType); + desret_int(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_filepath(n_filename, filename, 1); + des_char_ptr_ptr(n_contentType, contentType, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPFetch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_filename); + printf(" %d", n_contentType); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPInit(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlNanoHTTPInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPMethod(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ret_val; + const char * URL; /* The URL to load */ + int n_URL; + char * method; /* the HTTP method to use */ + int n_method; + char * input; /* the input string if any */ + int n_input; + char ** contentType; /* the Content-Type information IN and OUT */ + int n_contentType; + char * headers; /* the extra headers */ + int n_headers; + int ilen; /* input length */ + int n_ilen; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) { + for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) { + for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { + for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) { + for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + method = gen_const_char_ptr(n_method, 1); + input = gen_const_char_ptr(n_input, 2); + contentType = gen_char_ptr_ptr(n_contentType, 3); + headers = gen_const_char_ptr(n_headers, 4); + ilen = gen_int(n_ilen, 5); + + ret_val = xmlNanoHTTPMethod(URL, method, input, contentType, headers, ilen); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_const_char_ptr(n_method, method, 1); + des_const_char_ptr(n_input, input, 2); + des_char_ptr_ptr(n_contentType, contentType, 3); + des_const_char_ptr(n_headers, headers, 4); + des_int(n_ilen, ilen, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPMethod", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_method); + printf(" %d", n_input); + printf(" %d", n_contentType); + printf(" %d", n_headers); + printf(" %d", n_ilen); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPMethodRedir(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ret_val; + const char * URL; /* The URL to load */ + int n_URL; + char * method; /* the HTTP method to use */ + int n_method; + char * input; /* the input string if any */ + int n_input; + char ** contentType; /* the Content-Type information IN and OUT */ + int n_contentType; + char ** redir; /* the redirected URL OUT */ + int n_redir; + char * headers; /* the extra headers */ + int n_headers; + int ilen; /* input length */ + int n_ilen; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) { + for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) { + for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { + for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) { + for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) { + for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + method = gen_const_char_ptr(n_method, 1); + input = gen_const_char_ptr(n_input, 2); + contentType = gen_char_ptr_ptr(n_contentType, 3); + redir = gen_char_ptr_ptr(n_redir, 4); + headers = gen_const_char_ptr(n_headers, 5); + ilen = gen_int(n_ilen, 6); + + ret_val = xmlNanoHTTPMethodRedir(URL, method, input, contentType, redir, headers, ilen); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_const_char_ptr(n_method, method, 1); + des_const_char_ptr(n_input, input, 2); + des_char_ptr_ptr(n_contentType, contentType, 3); + des_char_ptr_ptr(n_redir, redir, 4); + des_const_char_ptr(n_headers, headers, 5); + des_int(n_ilen, ilen, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_method); + printf(" %d", n_input); + printf(" %d", n_contentType); + printf(" %d", n_redir); + printf(" %d", n_headers); + printf(" %d", n_ilen); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPMimeType(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + const char * ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoHTTPMimeType(ctx); + desret_const_char_ptr(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPMimeType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPOpen(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ret_val; + const char * URL; /* The URL to load */ + int n_URL; + char ** contentType; /* if available the Content-Type information will be returned at that location */ + int n_contentType; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + contentType = gen_char_ptr_ptr(n_contentType, 1); + + ret_val = xmlNanoHTTPOpen(URL, contentType); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_char_ptr_ptr(n_contentType, contentType, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPOpen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_contentType); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPOpenRedir(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ret_val; + const char * URL; /* The URL to load */ + int n_URL; + char ** contentType; /* if available the Content-Type information will be returned at that location */ + int n_contentType; + char ** redir; /* if available the redirected URL will be returned */ + int n_redir; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) { + for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + contentType = gen_char_ptr_ptr(n_contentType, 1); + redir = gen_char_ptr_ptr(n_redir, 2); + + ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_char_ptr_ptr(n_contentType, contentType, 1); + des_char_ptr_ptr(n_redir, redir, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_contentType); + printf(" %d", n_redir); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPRead(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + void * dest; /* a buffer */ + int n_dest; + int len; /* the buffer length */ + int n_len; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + dest = gen_void_ptr(n_dest, 1); + len = gen_int(n_len, 2); + + ret_val = xmlNanoHTTPRead(ctx, dest, len); + desret_int(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + des_void_ptr(n_dest, dest, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_dest); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPRedir(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNanoHTTPReturnCode(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + void * ctx; /* the HTTP context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0); + + ret_val = xmlNanoHTTPReturnCode(ctx); + desret_int(ret_val); + call_tests++; + des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPReturnCode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPSave(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + void * ctxt; /* the HTTP context */ + int n_ctxt; + const char * filename; /* the filename where the content should be saved */ + int n_filename; + + for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + mem_base = xmlMemBlocks(); + ctxt = gen_void_ptr(n_ctxt, 0); + filename = gen_fileoutput(n_filename, 1); + + ret_val = xmlNanoHTTPSave(ctxt, filename); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_ctxt, ctxt, 0); + des_fileoutput(n_filename, filename, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNanoHTTPSave", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlNanoHTTPScanProxy(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + const char * URL; /* The proxy URL used to initialize the proxy context */ + int n_URL; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + URL = gen_filepath(n_URL, 0); + + xmlNanoHTTPScanProxy(URL); + call_tests++; + des_filepath(n_URL, URL, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_nanohttp(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n"); + test_ret += test_xmlNanoHTTPAuthHeader(); + test_ret += test_xmlNanoHTTPCleanup(); + test_ret += test_xmlNanoHTTPClose(); + test_ret += test_xmlNanoHTTPContentLength(); + test_ret += test_xmlNanoHTTPEncoding(); + test_ret += test_xmlNanoHTTPFetch(); + test_ret += test_xmlNanoHTTPInit(); + test_ret += test_xmlNanoHTTPMethod(); + test_ret += test_xmlNanoHTTPMethodRedir(); + test_ret += test_xmlNanoHTTPMimeType(); + test_ret += test_xmlNanoHTTPOpen(); + test_ret += test_xmlNanoHTTPOpenRedir(); + test_ret += test_xmlNanoHTTPRead(); + test_ret += test_xmlNanoHTTPRedir(); + test_ret += test_xmlNanoHTTPReturnCode(); + test_ret += test_xmlNanoHTTPSave(); + test_ret += test_xmlNanoHTTPScanProxy(); + + if (test_ret != 0) + printf("Module nanohttp: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlByteConsumed(void) { + int test_ret = 0; + + int mem_base; + long ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlByteConsumed(ctxt); + desret_long(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlByteConsumed", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlParserNodeInfoSeqPtr 1 +static xmlParserNodeInfoSeqPtr gen_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlClearNodeInfoSeq(void) { + int test_ret = 0; + + int mem_base; + xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ + int n_seq; + + for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { + mem_base = xmlMemBlocks(); + seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); + + xmlClearNodeInfoSeq(seq); + call_tests++; + des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlClearNodeInfoSeq", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_seq); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlClearParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + xmlClearParserCtxt(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlClearParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateDocParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + + ret_val = xmlCreateDocParserCtxt(cur); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateDocParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreatePushParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + xmlParserCtxtPtr ret_val; + xmlSAXHandlerPtr sax; /* a SAX handler */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks */ + int n_user_data; + char * chunk; /* a pointer to an array of chars */ + int n_chunk; + int size; /* number of chars in the array */ + int n_size; + const char * filename; /* an optional file name or URI */ + int n_filename; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + user_data = gen_userdata(n_user_data, 1); + chunk = gen_const_char_ptr(n_chunk, 2); + size = gen_int(n_size, 3); + filename = gen_fileoutput(n_filename, 4); + + ret_val = xmlCreatePushParserCtxt(sax, user_data, chunk, size, filename); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_userdata(n_user_data, user_data, 1); + des_const_char_ptr(n_chunk, chunk, 2); + des_int(n_size, size, 3); + des_fileoutput(n_filename, filename, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreatePushParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_filename); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCtxtReadDoc(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + cur = gen_const_xmlChar_ptr(n_cur, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_parseroptions(n_options, 4); + + ret_val = xmlCtxtReadDoc(ctxt, cur, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_cur, cur, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_parseroptions(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtReadDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtReadFile(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + filename = gen_filepath(n_filename, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_parseroptions(n_options, 3); + + ret_val = xmlCtxtReadFile(ctxt, filename, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_filepath(n_filename, filename, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_parseroptions(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtReadFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtReadMemory(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + buffer = gen_const_char_ptr(n_buffer, 1); + size = gen_int(n_size, 2); + URL = gen_filepath(n_URL, 3); + encoding = gen_const_char_ptr(n_encoding, 4); + options = gen_parseroptions(n_options, 5); + + ret_val = xmlCtxtReadMemory(ctxt, buffer, size, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_buffer, buffer, 1); + des_int(n_size, size, 2); + des_filepath(n_URL, URL, 3); + des_const_char_ptr(n_encoding, encoding, 4); + des_parseroptions(n_options, options, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtReadMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtReset(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + xmlCtxtReset(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtReset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtResetPush(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + char * chunk; /* a pointer to an array of chars */ + int n_chunk; + int size; /* number of chars in the array */ + int n_size; + const char * filename; /* an optional file name or URI */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + chunk = gen_const_char_ptr(n_chunk, 1); + size = gen_int(n_size, 2); + filename = gen_filepath(n_filename, 3); + encoding = gen_const_char_ptr(n_encoding, 4); + + ret_val = xmlCtxtResetPush(ctxt, chunk, size, filename, encoding); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_chunk, chunk, 1); + des_int(n_size, size, 2); + des_filepath(n_filename, filename, 3); + des_const_char_ptr(n_encoding, encoding, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtResetPush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtUseOptions(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + options = gen_parseroptions(n_options, 1); + + ret_val = xmlCtxtUseOptions(ctxt, options); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_parseroptions(n_options, options, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtUseOptions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetExternalEntityLoader(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlGetFeature(void) { + int test_ret = 0; + +#ifdef LIBXML_LEGACY_ENABLED + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ + int n_ctxt; + char * name; /* the feature name */ + int n_name; + void * result; /* location to store the result */ + int n_result; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { + for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + name = gen_const_char_ptr(n_name, 1); + result = gen_void_ptr(n_result, 2); + + ret_val = xmlGetFeature(ctxt, name, result); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_name, name, 1); + des_void_ptr(n_result, result, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetFeature", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_result); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_const_char_ptr_ptr 1 +static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlGetFeaturesList(void) { + int test_ret = 0; + +#ifdef LIBXML_LEGACY_ENABLED + int mem_base; + int ret_val; + int * len; /* the length of the features name array (input/output) */ + int n_len; + char ** result; /* an array of string to be filled with the features name. */ + int n_result; + + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) { + mem_base = xmlMemBlocks(); + len = gen_int_ptr(n_len, 0); + result = gen_const_char_ptr_ptr(n_result, 1); + + ret_val = xmlGetFeaturesList(len, result); + desret_int(ret_val); + call_tests++; + des_int_ptr(n_len, len, 0); + des_const_char_ptr_ptr(n_result, result, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetFeaturesList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_len); + printf(" %d", n_result); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOParseDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + xmlDtdPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */ + int n_sax; + xmlParserInputBufferPtr input; /* an Input Buffer */ + int n_input; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + input = gen_xmlParserInputBufferPtr(n_input, 1); + enc = gen_xmlCharEncoding(n_enc, 2); + + ret_val = xmlIOParseDTD(sax, input, enc); + input = NULL; + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_xmlParserInputBufferPtr(n_input, input, 1); + des_xmlCharEncoding(n_enc, enc, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOParseDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_input); + printf(" %d", n_enc); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlInitNodeInfoSeq(void) { + int test_ret = 0; + + int mem_base; + xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */ + int n_seq; + + for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) { + mem_base = xmlMemBlocks(); + seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0); + + xmlInitNodeInfoSeq(seq); + call_tests++; + des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlInitNodeInfoSeq", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_seq); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlInitParser(void) { + int test_ret = 0; + + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlInitParser(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlInitParser", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlInitParserCtxt(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlInitParserCtxt(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlInitParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlKeepBlanksDefault(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int val; /* int 0 or 1 */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlKeepBlanksDefault(val); + desret_int(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlKeepBlanksDefault", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlLineNumbersDefault(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int val; /* int 0 or 1 */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlLineNumbersDefault(val); + desret_int(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLineNumbersDefault", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlLoadExternalEntity(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + const char * URL; /* the URL for the entity to load */ + int n_URL; + char * ID; /* the Public ID for the entity to load */ + int n_ID; + xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ + int n_ctxt; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + ID = gen_const_char_ptr(n_ID, 1); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); + + ret_val = xmlLoadExternalEntity(URL, ID, ctxt); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_const_char_ptr(n_ID, ID, 1); + des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlLoadExternalEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_ID); + printf(" %d", n_ctxt); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewIOInputStream(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlParserInputBufferPtr input; /* an I/O Input */ + int n_input; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + input = gen_xmlParserInputBufferPtr(n_input, 1); + enc = gen_xmlCharEncoding(n_enc, 2); + + ret_val = xmlNewIOInputStream(ctxt, input, enc); + if (ret_val != NULL) input = NULL; + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputBufferPtr(n_input, input, 1); + des_xmlCharEncoding(n_enc, enc, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewIOInputStream", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_input); + printf(" %d", n_enc); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlNewParserCtxt(); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlNodePtr_ptr 1 +static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParseBalancedChunkMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document the chunk pertains to */ + int n_doc; + xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ + int n_user_data; + int depth; /* Used for loop detection, use 0 */ + int n_depth; + xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ + int n_string; + xmlNodePtr * lst; /* the return value for the set of parsed nodes */ + int n_lst; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { + for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + sax = gen_xmlSAXHandlerPtr(n_sax, 1); + user_data = gen_userdata(n_user_data, 2); + depth = gen_int(n_depth, 3); + string = gen_const_xmlChar_ptr(n_string, 4); + lst = gen_xmlNodePtr_ptr(n_lst, 5); + +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif + + + ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, string, lst); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlSAXHandlerPtr(n_sax, sax, 1); + des_userdata(n_user_data, user_data, 2); + des_int(n_depth, depth, 3); + des_const_xmlChar_ptr(n_string, string, 4); + des_xmlNodePtr_ptr(n_lst, lst, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseBalancedChunkMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_depth); + printf(" %d", n_string); + printf(" %d", n_lst); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseBalancedChunkMemoryRecover(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document the chunk pertains to */ + int n_doc; + xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ + int n_user_data; + int depth; /* Used for loop detection, use 0 */ + int n_depth; + xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */ + int n_string; + xmlNodePtr * lst; /* the return value for the set of parsed nodes */ + int n_lst; + int recover; /* return nodes even if the data is broken (use 0) */ + int n_recover; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { + for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { + for (n_recover = 0;n_recover < gen_nb_int;n_recover++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + sax = gen_xmlSAXHandlerPtr(n_sax, 1); + user_data = gen_userdata(n_user_data, 2); + depth = gen_int(n_depth, 3); + string = gen_const_xmlChar_ptr(n_string, 4); + lst = gen_xmlNodePtr_ptr(n_lst, 5); + recover = gen_int(n_recover, 6); + +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif + + + ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, string, lst, recover); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlSAXHandlerPtr(n_sax, sax, 1); + des_userdata(n_user_data, user_data, 2); + des_int(n_depth, depth, 3); + des_const_xmlChar_ptr(n_string, string, 4); + des_xmlNodePtr_ptr(n_lst, lst, 5); + des_int(n_recover, recover, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_depth); + printf(" %d", n_string); + printf(" %d", n_lst); + printf(" %d", n_recover); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseChunk(void) { + int test_ret = 0; + +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + char * chunk; /* an char array */ + int n_chunk; + int size; /* the size in byte of the chunk */ + int n_size; + int terminate; /* last chunk indicator */ + int n_terminate; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + chunk = gen_const_char_ptr(n_chunk, 1); + size = gen_int(n_size, 2); + terminate = gen_int(n_terminate, 3); + + ret_val = xmlParseChunk(ctxt, chunk, size, terminate); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_chunk, chunk, 1); + des_int(n_size, size, 2); + des_int(n_terminate, terminate, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseChunk", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_chunk); + printf(" %d", n_size); + printf(" %d", n_terminate); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseCtxtExternalEntity(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctx; /* the existing parsing context */ + int n_ctx; + xmlChar * URL; /* the URL for the entity to load */ + int n_URL; + xmlChar * ID; /* the System ID for the entity to load */ + int n_ID; + xmlNodePtr * lst; /* the return value for the set of parsed nodes */ + int n_lst; + + for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) { + for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { + for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { + for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { + mem_base = xmlMemBlocks(); + ctx = gen_xmlParserCtxtPtr(n_ctx, 0); + URL = gen_const_xmlChar_ptr(n_URL, 1); + ID = gen_const_xmlChar_ptr(n_ID, 2); + lst = gen_xmlNodePtr_ptr(n_lst, 3); + + ret_val = xmlParseCtxtExternalEntity(ctx, URL, ID, lst); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctx, ctx, 0); + des_const_xmlChar_ptr(n_URL, URL, 1); + des_const_xmlChar_ptr(n_ID, ID, 2); + des_xmlNodePtr_ptr(n_lst, lst, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseCtxtExternalEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf(" %d", n_URL); + printf(" %d", n_ID); + printf(" %d", n_lst); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParseDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + xmlDtdPtr ret_val; + xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ + int n_ExternalID; + xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ + int n_SystemID; + + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 1); + + ret_val = xmlParseDTD(ExternalID, SystemID); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 0); + des_const_xmlChar_ptr(n_SystemID, SystemID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlChar_ptr(n_cur, 0); + + ret_val = xmlParseDoc(cur); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlChar_ptr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseDocument(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlParseDocument(ctxt); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParseEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlParseEntity(filename); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseExtParsedEnt(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlParseExtParsedEnt(ctxt); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseExtParsedEnt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParseExternalEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document the chunk pertains to */ + int n_doc; + xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */ + int n_user_data; + int depth; /* Used for loop detection, use 0 */ + int n_depth; + xmlChar * URL; /* the URL for the entity to load */ + int n_URL; + xmlChar * ID; /* the System ID for the entity to load */ + int n_ID; + xmlNodePtr * lst; /* the return value for the set of parsed nodes */ + int n_lst; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { + for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { + for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + sax = gen_xmlSAXHandlerPtr(n_sax, 1); + user_data = gen_userdata(n_user_data, 2); + depth = gen_int(n_depth, 3); + URL = gen_const_xmlChar_ptr(n_URL, 4); + ID = gen_const_xmlChar_ptr(n_ID, 5); + lst = gen_xmlNodePtr_ptr(n_lst, 6); + + ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, URL, ID, lst); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlSAXHandlerPtr(n_sax, sax, 1); + des_userdata(n_user_data, user_data, 2); + des_int(n_depth, depth, 3); + des_const_xmlChar_ptr(n_URL, URL, 4); + des_const_xmlChar_ptr(n_ID, ID, 5); + des_xmlNodePtr_ptr(n_lst, lst, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseExternalEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_depth); + printf(" %d", n_URL); + printf(" %d", n_ID); + printf(" %d", n_lst); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseFile(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlParseFile(filename); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParseInNodeContext(void) { + int test_ret = 0; + + int mem_base; + xmlParserErrors ret_val; + xmlNodePtr node; /* the context node */ + int n_node; + char * data; /* the input string */ + int n_data; + int datalen; /* the input string length in bytes */ + int n_datalen; + int options; /* a combination of xmlParserOption */ + int n_options; + xmlNodePtr * lst; /* the return value for the set of parsed nodes */ + int n_lst; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { + for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + data = gen_const_char_ptr(n_data, 1); + datalen = gen_int(n_datalen, 2); + options = gen_parseroptions(n_options, 3); + lst = gen_xmlNodePtr_ptr(n_lst, 4); + + ret_val = xmlParseInNodeContext(node, data, datalen, options, lst); + desret_xmlParserErrors(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_char_ptr(n_data, data, 1); + des_int(n_datalen, datalen, 2); + des_parseroptions(n_options, options, 3); + des_xmlNodePtr_ptr(n_lst, lst, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseInNodeContext", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_data); + printf(" %d", n_datalen); + printf(" %d", n_options); + printf(" %d", n_lst); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParseMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + char * buffer; /* an pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = xmlParseMemory(buffer, size); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_const_xmlParserNodeInfoPtr 1 +static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParserAddNodeInfo(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlParserNodeInfoPtr info; /* a node info sequence pointer */ + int n_info; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + info = gen_const_xmlParserNodeInfoPtr(n_info, 1); + + xmlParserAddNodeInfo(ctxt, info); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlParserNodeInfoPtr(n_info, info, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserAddNodeInfo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_info); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_const_xmlParserCtxtPtr 1 +static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +#define gen_nb_const_xmlNodePtr 1 +static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParserFindNodeInfo(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_const_xmlParserNodeInfoSeqPtr 1 +static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParserFindNodeInfoIndex(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlParserInputPtr 1 +static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParserInputGrow(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserInputPtr in; /* an XML parser input */ + int n_in; + int len; /* an indicative size for the lookahead */ + int n_len; + + for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputPtr(n_in, 0); + len = gen_int(n_len, 1); + + ret_val = xmlParserInputGrow(in, len); + desret_int(ret_val); + call_tests++; + des_xmlParserInputPtr(n_in, in, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputGrow", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputRead(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserInputPtr in; /* an XML parser input */ + int n_in; + int len; /* an indicative size for the lookahead */ + int n_len; + + for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputPtr(n_in, 0); + len = gen_int(n_len, 1); + + ret_val = xmlParserInputRead(in, len); + desret_int(ret_val); + call_tests++; + des_xmlParserInputPtr(n_in, in, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlPedanticParserDefault(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int val; /* int 0 or 1 */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlPedanticParserDefault(val); + desret_int(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPedanticParserDefault", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlReadDoc(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + URL = gen_filepath(n_URL, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_parseroptions(n_options, 3); + + ret_val = xmlReadDoc(cur, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + des_filepath(n_URL, URL, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_parseroptions(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReadDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlReadFile(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + options = gen_parseroptions(n_options, 2); + + ret_val = xmlReadFile(filename, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + des_parseroptions(n_options, options, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReadFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlReadMemory(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_parseroptions(n_options, 4); + + ret_val = xmlReadMemory(buffer, size, URL, encoding, options); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_parseroptions(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReadMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlRecoverDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlChar_ptr(n_cur, 0); + + ret_val = xmlRecoverDoc(cur); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlChar_ptr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRecoverDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRecoverFile(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlRecoverFile(filename); + desret_xmlDocPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRecoverFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRecoverMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + char * buffer; /* an pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = xmlRecoverMemory(buffer, size); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRecoverMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDtdPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */ + int n_ExternalID; + xmlChar * SystemID; /* a NAME* containing the URL to the DTD */ + int n_SystemID; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 2); + + ret_val = xmlSAXParseDTD(sax, ExternalID, SystemID); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 1); + des_const_xmlChar_ptr(n_SystemID, SystemID, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + xmlChar * cur; /* a pointer to an array of xmlChar */ + int n_cur; + int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ + int n_recovery; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) { + for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + cur = gen_xmlChar_ptr(n_cur, 1); + recovery = gen_int(n_recovery, 2); + + ret_val = xmlSAXParseDoc(sax, cur, recovery); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_xmlChar_ptr(n_cur, cur, 1); + des_int(n_recovery, recovery, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_cur); + printf(" %d", n_recovery); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + const char * filename; /* the filename */ + int n_filename; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + filename = gen_filepath(n_filename, 1); + + ret_val = xmlSAXParseEntity(sax, filename); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_filepath(n_filename, filename, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_filename); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseFile(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + const char * filename; /* the filename */ + int n_filename; + int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ + int n_recovery; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + filename = gen_filepath(n_filename, 1); + recovery = gen_int(n_recovery, 2); + + ret_val = xmlSAXParseFile(sax, filename, recovery); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_filepath(n_filename, filename, 1); + des_int(n_recovery, recovery, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_filename); + printf(" %d", n_recovery); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseFileWithData(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + const char * filename; /* the filename */ + int n_filename; + int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ + int n_recovery; + void * data; /* the userdata */ + int n_data; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + filename = gen_filepath(n_filename, 1); + recovery = gen_int(n_recovery, 2); + data = gen_userdata(n_data, 3); + + ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_filepath(n_filename, filename, 1); + des_int(n_recovery, recovery, 2); + des_userdata(n_data, data, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseFileWithData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_filename); + printf(" %d", n_recovery); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + char * buffer; /* an pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */ + int n_recovery; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + buffer = gen_const_char_ptr(n_buffer, 1); + size = gen_int(n_size, 2); + recovery = gen_int(n_recovery, 3); + + ret_val = xmlSAXParseMemory(sax, buffer, size, recovery); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_const_char_ptr(n_buffer, buffer, 1); + des_int(n_size, size, 2); + des_int(n_recovery, recovery, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_recovery); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXParseMemoryWithData(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlSAXHandlerPtr sax; /* the SAX handler block */ + int n_sax; + char * buffer; /* an pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */ + int n_recovery; + void * data; /* the userdata */ + int n_data; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + buffer = gen_const_char_ptr(n_buffer, 1); + size = gen_int(n_size, 2); + recovery = gen_int(n_recovery, 3); + data = gen_userdata(n_data, 4); + + ret_val = xmlSAXParseMemoryWithData(sax, buffer, size, recovery, data); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_const_char_ptr(n_buffer, buffer, 1); + des_int(n_size, size, 2); + des_int(n_recovery, recovery, 3); + des_userdata(n_data, data, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXParseMemoryWithData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_recovery); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXUserParseFile(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + xmlSAXHandlerPtr sax; /* a SAX handler */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks */ + int n_user_data; + const char * filename; /* a file name */ + int n_filename; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + user_data = gen_userdata(n_user_data, 1); + filename = gen_filepath(n_filename, 2); + +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif + + + ret_val = xmlSAXUserParseFile(sax, user_data, filename); + desret_int(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_userdata(n_user_data, user_data, 1); + des_filepath(n_filename, filename, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXUserParseFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_filename); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSAXUserParseMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + int ret_val; + xmlSAXHandlerPtr sax; /* a SAX handler */ + int n_sax; + void * user_data; /* The user data returned on SAX callbacks */ + int n_user_data; + char * buffer; /* an in-memory XML document input */ + int n_buffer; + int size; /* the length of the XML document in bytes */ + int n_size; + + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + sax = gen_xmlSAXHandlerPtr(n_sax, 0); + user_data = gen_userdata(n_user_data, 1); + buffer = gen_const_char_ptr(n_buffer, 2); + size = gen_int(n_size, 3); + +#ifdef LIBXML_SAX1_ENABLED + if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL; +#endif + + + ret_val = xmlSAXUserParseMemory(sax, user_data, buffer, size); + desret_int(ret_val); + call_tests++; + des_xmlSAXHandlerPtr(n_sax, sax, 0); + des_userdata(n_user_data, user_data, 1); + des_const_char_ptr(n_buffer, buffer, 2); + des_int(n_size, size, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSAXUserParseMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSetExternalEntityLoader(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSetFeature(void) { + int test_ret = 0; + +#ifdef LIBXML_LEGACY_ENABLED + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */ + int n_ctxt; + char * name; /* the feature name */ + int n_name; + void * value; /* pointer to the location of the new value */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + name = gen_const_char_ptr(n_name, 1); + value = gen_void_ptr(n_value, 2); + + ret_val = xmlSetFeature(ctxt, name, value); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_name, name, 1); + des_void_ptr(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetFeature", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSetupParserForBuffer(void) { + int test_ret = 0; + +#ifdef LIBXML_SAX1_ENABLED + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlChar * buffer; /* a xmlChar * buffer */ + int n_buffer; + const char * filename; /* a file name */ + int n_filename; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + buffer = gen_const_xmlChar_ptr(n_buffer, 1); + filename = gen_filepath(n_filename, 2); + + xmlSetupParserForBuffer(ctxt, buffer, filename); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_buffer, buffer, 1); + des_filepath(n_filename, filename, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetupParserForBuffer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf(" %d", n_filename); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlStopParser(void) { + int test_ret = 0; + +#ifdef LIBXML_PUSH_ENABLED + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + xmlStopParser(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStopParser", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSubstituteEntitiesDefault(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int val; /* int 0 or 1 */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlSubstituteEntitiesDefault(val); + desret_int(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + +static int +test_parser(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing parser : 58 of 69 functions ...\n"); + test_ret += test_xmlByteConsumed(); + test_ret += test_xmlClearNodeInfoSeq(); + test_ret += test_xmlClearParserCtxt(); + test_ret += test_xmlCreateDocParserCtxt(); + test_ret += test_xmlCreatePushParserCtxt(); + test_ret += test_xmlCtxtReadDoc(); + test_ret += test_xmlCtxtReadFile(); + test_ret += test_xmlCtxtReadMemory(); + test_ret += test_xmlCtxtReset(); + test_ret += test_xmlCtxtResetPush(); + test_ret += test_xmlCtxtUseOptions(); + test_ret += test_xmlGetExternalEntityLoader(); + test_ret += test_xmlGetFeature(); + test_ret += test_xmlGetFeaturesList(); + test_ret += test_xmlIOParseDTD(); + test_ret += test_xmlInitNodeInfoSeq(); + test_ret += test_xmlInitParser(); + test_ret += test_xmlInitParserCtxt(); + test_ret += test_xmlKeepBlanksDefault(); + test_ret += test_xmlLineNumbersDefault(); + test_ret += test_xmlLoadExternalEntity(); + test_ret += test_xmlNewIOInputStream(); + test_ret += test_xmlNewParserCtxt(); + test_ret += test_xmlParseBalancedChunkMemory(); + test_ret += test_xmlParseBalancedChunkMemoryRecover(); + test_ret += test_xmlParseChunk(); + test_ret += test_xmlParseCtxtExternalEntity(); + test_ret += test_xmlParseDTD(); + test_ret += test_xmlParseDoc(); + test_ret += test_xmlParseDocument(); + test_ret += test_xmlParseEntity(); + test_ret += test_xmlParseExtParsedEnt(); + test_ret += test_xmlParseExternalEntity(); + test_ret += test_xmlParseFile(); + test_ret += test_xmlParseInNodeContext(); + test_ret += test_xmlParseMemory(); + test_ret += test_xmlParserAddNodeInfo(); + test_ret += test_xmlParserFindNodeInfo(); + test_ret += test_xmlParserFindNodeInfoIndex(); + test_ret += test_xmlParserInputGrow(); + test_ret += test_xmlParserInputRead(); + test_ret += test_xmlPedanticParserDefault(); + test_ret += test_xmlReadDoc(); + test_ret += test_xmlReadFile(); + test_ret += test_xmlReadMemory(); + test_ret += test_xmlRecoverDoc(); + test_ret += test_xmlRecoverFile(); + test_ret += test_xmlRecoverMemory(); + test_ret += test_xmlSAXParseDTD(); + test_ret += test_xmlSAXParseDoc(); + test_ret += test_xmlSAXParseEntity(); + test_ret += test_xmlSAXParseFile(); + test_ret += test_xmlSAXParseFileWithData(); + test_ret += test_xmlSAXParseMemory(); + test_ret += test_xmlSAXParseMemoryWithData(); + test_ret += test_xmlSAXUserParseFile(); + test_ret += test_xmlSAXUserParseMemory(); + test_ret += test_xmlSetExternalEntityLoader(); + test_ret += test_xmlSetFeature(); + test_ret += test_xmlSetupParserForBuffer(); + test_ret += test_xmlStopParser(); + test_ret += test_xmlSubstituteEntitiesDefault(); + + if (test_ret != 0) + printf("Module parser: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_htmlCreateFileParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + htmlParserCtxtPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + char * encoding; /* a free form C string describing the HTML document encoding, or NULL */ + int n_encoding; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + + ret_val = htmlCreateFileParserCtxt(filename, encoding); + desret_htmlParserCtxtPtr(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlCreateFileParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_htmlInitAutoClose(void) { + int test_ret = 0; + +#ifdef LIBXML_HTML_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + htmlInitAutoClose(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in htmlInitAutoClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_inputPop(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = inputPop(ctxt); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in inputPop", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_inputPush(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlParserInputPtr value; /* the parser input */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + value = gen_xmlParserInputPtr(n_value, 1); + + ret_val = inputPush(ctxt, value); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputPtr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in inputPush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_namePop(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = namePop(ctxt); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in namePop", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_namePush(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlChar * value; /* the element name */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + + ret_val = namePush(ctxt, value); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in namePush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_nodePop(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = nodePop(ctxt); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in nodePop", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_nodePush(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlNodePtr value; /* the element node */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + value = gen_xmlNodePtr(n_value, 1); + + ret_val = nodePush(ctxt, value); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in nodePush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCheckLanguageID(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * lang; /* pointer to the string value */ + int n_lang; + + for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) { + mem_base = xmlMemBlocks(); + lang = gen_const_xmlChar_ptr(n_lang, 0); + + ret_val = xmlCheckLanguageID(lang); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_lang, lang, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCheckLanguageID", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_lang); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int len; /* Ignored, compatibility */ + int n_len; + xmlChar * out; /* pointer to an array of xmlChar */ + int n_out; + int val; /* the char value */ + int n_val; + + for (n_len = 0;n_len < gen_nb_int;n_len++) { + for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + len = gen_int(n_len, 0); + out = gen_xmlChar_ptr(n_out, 1); + val = gen_int(n_val, 2); + + ret_val = xmlCopyChar(len, out, val); + desret_int(ret_val); + call_tests++; + des_int(n_len, len, 0); + des_xmlChar_ptr(n_out, out, 1); + des_int(n_val, val, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_len); + printf(" %d", n_out); + printf(" %d", n_val); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyCharMultiByte(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * out; /* pointer to an array of xmlChar */ + int n_out; + int val; /* the char value */ + int n_val; + + for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) { + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + out = gen_xmlChar_ptr(n_out, 0); + val = gen_int(n_val, 1); + + ret_val = xmlCopyCharMultiByte(out, val); + desret_int(ret_val); + call_tests++; + des_xmlChar_ptr(n_out, out, 0); + des_int(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyCharMultiByte", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateEntityParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + xmlChar * URL; /* the entity URL */ + int n_URL; + xmlChar * ID; /* the entity PUBLIC ID */ + int n_ID; + xmlChar * base; /* a possible base for the target URI */ + int n_base; + + for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) { + for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { + for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { + mem_base = xmlMemBlocks(); + URL = gen_const_xmlChar_ptr(n_URL, 0); + ID = gen_const_xmlChar_ptr(n_ID, 1); + base = gen_const_xmlChar_ptr(n_base, 2); + + ret_val = xmlCreateEntityParserCtxt(URL, ID, base); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URL, URL, 0); + des_const_xmlChar_ptr(n_ID, ID, 1); + des_const_xmlChar_ptr(n_base, base, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateEntityParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_ID); + printf(" %d", n_base); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateFileParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + const char * filename; /* the filename */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + + ret_val = xmlCreateFileParserCtxt(filename); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateFileParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateMemoryParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = xmlCreateMemoryParserCtxt(buffer, size); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateURLParserCtxt(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ret_val; + const char * filename; /* the filename or URL */ + int n_filename; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + options = gen_int(n_options, 1); + + ret_val = xmlCreateURLParserCtxt(filename, options); + desret_xmlParserCtxtPtr(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_int(n_options, options, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateURLParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_options); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCurrentChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* the XML parser context */ + int n_ctxt; + int * len; /* pointer to the length of the char read */ + int n_len; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + len = gen_int_ptr(n_len, 1); + + ret_val = xmlCurrentChar(ctxt, len); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_int_ptr(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCurrentChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlErrMemory(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + char * extra; /* extra informations */ + int n_extra; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + extra = gen_const_char_ptr(n_extra, 1); + + xmlErrMemory(ctxt, extra); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_char_ptr(n_extra, extra, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlErrMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_extra); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsLetter(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + int c; /* an unicode character (int) */ + int n_c; + + for (n_c = 0;n_c < gen_nb_int;n_c++) { + mem_base = xmlMemBlocks(); + c = gen_int(n_c, 0); + + ret_val = xmlIsLetter(c); + desret_int(ret_val); + call_tests++; + des_int(n_c, c, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsLetter", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_c); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewEntityInputStream(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlEntityPtr entity; /* an Entity pointer */ + int n_entity; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + entity = gen_xmlEntityPtr(n_entity, 1); + + ret_val = xmlNewEntityInputStream(ctxt, entity); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlEntityPtr(n_entity, entity, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewEntityInputStream", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_entity); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewInputFromFile(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + const char * filename; /* the filename to use as entity */ + int n_filename; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + filename = gen_filepath(n_filename, 1); + + ret_val = xmlNewInputFromFile(ctxt, filename); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_filepath(n_filename, filename, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewInputFromFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_filename); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewInputStream(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlNewInputStream(ctxt); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewInputStream", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewStringInputStream(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlChar * buffer; /* an memory buffer */ + int n_buffer; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + buffer = gen_const_xmlChar_ptr(n_buffer, 1); + + ret_val = xmlNewStringInputStream(ctxt, buffer); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_buffer, buffer, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewStringInputStream", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_buffer); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNextChar(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* the XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + xmlNextChar(ctxt); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNextChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputShrink(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr in; /* an XML parser input */ + int n_in; + + for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputPtr(n_in, 0); + + xmlParserInputShrink(in); + call_tests++; + des_xmlParserInputPtr(n_in, in, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputShrink", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlPopInput(void) { + int test_ret = 0; + + int mem_base; + xmlChar ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + + ret_val = xmlPopInput(ctxt); + desret_xmlChar(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPopInput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlPushInput(void) { + int test_ret = 0; + + int mem_base; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */ + int n_input; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + input = gen_xmlParserInputPtr(n_input, 1); + + xmlPushInput(ctxt, input); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputPtr(n_input, input, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPushInput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_input); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetEntityReferenceFunc(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSplitQName(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlChar * name; /* an XML parser context */ + int n_name; + xmlChar ** prefix; /* a xmlChar ** */ + int n_prefix; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + prefix = gen_xmlChar_ptr_ptr(n_prefix, 2); + + ret_val = xmlSplitQName(ctxt, name, prefix); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_xmlChar_ptr_ptr(n_prefix, prefix, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSplitQName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStringCurrentChar(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* the XML parser context */ + int n_ctxt; + xmlChar * cur; /* pointer to the beginning of the char */ + int n_cur; + int * len; /* pointer to the length of the char read */ + int n_len; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + cur = gen_const_xmlChar_ptr(n_cur, 1); + len = gen_int_ptr(n_len, 2); + + ret_val = xmlStringCurrentChar(ctxt, cur, len); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_cur, cur, 1); + des_int_ptr(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStringCurrentChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStringDecodeEntities(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlParserCtxtPtr ctxt; /* the parser context */ + int n_ctxt; + xmlChar * str; /* the input string */ + int n_str; + int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */ + int n_what; + xmlChar end; /* an end marker xmlChar, 0 if none */ + int n_end; + xmlChar end2; /* an end marker xmlChar, 0 if none */ + int n_end2; + xmlChar end3; /* an end marker xmlChar, 0 if none */ + int n_end3; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_what = 0;n_what < gen_nb_int;n_what++) { + for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) { + for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) { + for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + what = gen_int(n_what, 2); + end = gen_xmlChar(n_end, 3); + end2 = gen_xmlChar(n_end2, 4); + end3 = gen_xmlChar(n_end3, 5); + + ret_val = xmlStringDecodeEntities(ctxt, str, what, end, end2, end3); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_str, str, 1); + des_int(n_what, what, 2); + des_xmlChar(n_end, end, 3); + des_xmlChar(n_end2, end2, 4); + des_xmlChar(n_end3, end3, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStringDecodeEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_str); + printf(" %d", n_what); + printf(" %d", n_end); + printf(" %d", n_end2); + printf(" %d", n_end3); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStringLenDecodeEntities(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlParserCtxtPtr ctxt; /* the parser context */ + int n_ctxt; + xmlChar * str; /* the input string */ + int n_str; + int len; /* the string length */ + int n_len; + int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */ + int n_what; + xmlChar end; /* an end marker xmlChar, 0 if none */ + int n_end; + xmlChar end2; /* an end marker xmlChar, 0 if none */ + int n_end2; + xmlChar end3; /* an end marker xmlChar, 0 if none */ + int n_end3; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + for (n_what = 0;n_what < gen_nb_int;n_what++) { + for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) { + for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) { + for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + len = gen_int(n_len, 2); + what = gen_int(n_what, 3); + end = gen_xmlChar(n_end, 4); + end2 = gen_xmlChar(n_end2, 5); + end3 = gen_xmlChar(n_end3, 6); + + ret_val = xmlStringLenDecodeEntities(ctxt, str, len, what, end, end2, end3); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_str, str, 1); + des_int(n_len, len, 2); + des_int(n_what, what, 3); + des_xmlChar(n_end, end, 4); + des_xmlChar(n_end2, end2, 5); + des_xmlChar(n_end3, end3, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStringLenDecodeEntities", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_str); + printf(" %d", n_len); + printf(" %d", n_what); + printf(" %d", n_end); + printf(" %d", n_end2); + printf(" %d", n_end3); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSwitchEncoding(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* the parser context */ + int n_ctxt; + xmlCharEncoding enc; /* the encoding value (number) */ + int n_enc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + enc = gen_xmlCharEncoding(n_enc, 1); + + ret_val = xmlSwitchEncoding(ctxt, enc); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlCharEncoding(n_enc, enc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSwitchEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_enc); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSwitchInputEncoding(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* the parser context */ + int n_ctxt; + xmlParserInputPtr input; /* the input stream */ + int n_input; + xmlCharEncodingHandlerPtr handler; /* the encoding handler */ + int n_handler; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + input = gen_xmlParserInputPtr(n_input, 1); + handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2); + + ret_val = xmlSwitchInputEncoding(ctxt, input, handler); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputPtr(n_input, input, 1); + des_xmlCharEncodingHandlerPtr(n_handler, handler, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSwitchInputEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_input); + printf(" %d", n_handler); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSwitchToEncoding(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserCtxtPtr ctxt; /* the parser context */ + int n_ctxt; + xmlCharEncodingHandlerPtr handler; /* the encoding handler */ + int n_handler; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1); + + ret_val = xmlSwitchToEncoding(ctxt, handler); + desret_int(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlCharEncodingHandlerPtr(n_handler, handler, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSwitchToEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_handler); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + +static int +test_parserInternals(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n"); + test_ret += test_htmlCreateFileParserCtxt(); + test_ret += test_htmlInitAutoClose(); + test_ret += test_inputPop(); + test_ret += test_inputPush(); + test_ret += test_namePop(); + test_ret += test_namePush(); + test_ret += test_nodePop(); + test_ret += test_nodePush(); + test_ret += test_xmlCheckLanguageID(); + test_ret += test_xmlCopyChar(); + test_ret += test_xmlCopyCharMultiByte(); + test_ret += test_xmlCreateEntityParserCtxt(); + test_ret += test_xmlCreateFileParserCtxt(); + test_ret += test_xmlCreateMemoryParserCtxt(); + test_ret += test_xmlCreateURLParserCtxt(); + test_ret += test_xmlCurrentChar(); + test_ret += test_xmlErrMemory(); + test_ret += test_xmlIsLetter(); + test_ret += test_xmlNewEntityInputStream(); + test_ret += test_xmlNewInputFromFile(); + test_ret += test_xmlNewInputStream(); + test_ret += test_xmlNewStringInputStream(); + test_ret += test_xmlNextChar(); + test_ret += test_xmlParserInputShrink(); + test_ret += test_xmlPopInput(); + test_ret += test_xmlPushInput(); + test_ret += test_xmlSetEntityReferenceFunc(); + test_ret += test_xmlSplitQName(); + test_ret += test_xmlStringCurrentChar(); + test_ret += test_xmlStringDecodeEntities(); + test_ret += test_xmlStringLenDecodeEntities(); + test_ret += test_xmlSwitchEncoding(); + test_ret += test_xmlSwitchInputEncoding(); + test_ret += test_xmlSwitchToEncoding(); + + if (test_ret != 0) + printf("Module parserInternals: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlPatternMatch(void) { + int test_ret = 0; + +#ifdef LIBXML_PATTERN_ENABLED + int mem_base; + int ret_val; + xmlPatternPtr comp; /* the precompiled pattern */ + int n_comp; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + comp = gen_xmlPatternPtr(n_comp, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlPatternMatch(comp, node); + desret_int(ret_val); + call_tests++; + des_xmlPatternPtr(n_comp, comp, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPatternMatch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_comp); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlPatterncompile(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_pattern(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n"); + test_ret += test_xmlPatternMatch(); + test_ret += test_xmlPatterncompile(); + + if (test_ret != 0) + printf("Module pattern: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlRelaxNGPtr 1 +static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlRelaxNGDump(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * output; /* the file output */ + int n_output; + xmlRelaxNGPtr schema; /* a schema structure */ + int n_schema; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + schema = gen_xmlRelaxNGPtr(n_schema, 1); + + xmlRelaxNGDump(output, schema); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlRelaxNGPtr(n_schema, schema, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_schema); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGDumpTree(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * output; /* the file output */ + int n_output; + xmlRelaxNGPtr schema; /* a schema structure */ + int n_schema; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + schema = gen_xmlRelaxNGPtr(n_schema, 1); + + xmlRelaxNGDumpTree(output, schema); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlRelaxNGPtr(n_schema, schema, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGDumpTree", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_schema); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlRelaxNGParserCtxtPtr 1 +static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1 +static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1 +static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_void_ptr_ptr 1 +static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlRelaxNGGetParserErrors(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */ + int n_ctxt; + xmlRelaxNGValidityErrorFunc * err; /* the error callback result */ + int n_err; + xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */ + int n_warn; + void ** ctx; /* contextual data for the callbacks result */ + int n_ctx; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) { + for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) { + for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) { + for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0); + err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1); + warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2); + ctx = gen_void_ptr_ptr(n_ctx, 3); + + ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1); + des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2); + des_void_ptr_ptr(n_ctx, ctx, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_err); + printf(" %d", n_warn); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlRelaxNGValidCtxtPtr 1 +static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlRelaxNGGetValidErrors(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */ + int n_ctxt; + xmlRelaxNGValidityErrorFunc * err; /* the error function result */ + int n_err; + xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */ + int n_warn; + void ** ctx; /* the functions context result */ + int n_ctx; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) { + for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) { + for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1); + warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2); + ctx = gen_void_ptr_ptr(n_ctx, 3); + + ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1); + des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2); + des_void_ptr_ptr(n_ctx, ctx, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_err); + printf(" %d", n_warn); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGInitTypes(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlRelaxNGInitTypes(); + desret_int(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGInitTypes", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGNewDocParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlRelaxNGParserCtxtPtr ret_val; + xmlDocPtr doc; /* a preparsed document tree */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlRelaxNGNewDocParserCtxt(doc); + desret_xmlRelaxNGParserCtxtPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGNewMemParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlRelaxNGParserCtxtPtr ret_val; + char * buffer; /* a pointer to a char array containing the schemas */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = xmlRelaxNGNewMemParserCtxt(buffer, size); + desret_xmlRelaxNGParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGNewParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlRelaxNGParserCtxtPtr ret_val; + char * URL; /* the location of the schema */ + int n_URL; + + for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { + mem_base = xmlMemBlocks(); + URL = gen_const_char_ptr(n_URL, 0); + + ret_val = xmlRelaxNGNewParserCtxt(URL); + desret_xmlRelaxNGParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_URL, URL, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGNewValidCtxt(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRelaxNGParse(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRelaxNGSetParserErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRelaxNGSetValidErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRelaxNGValidateDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */ + int n_ctxt; + xmlDocPtr doc; /* a parsed document tree */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlRelaxNGValidateDoc(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGValidateDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGValidateFullElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + + ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGValidatePopElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + + ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGValidatePushCData(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */ + int n_ctxt; + xmlChar * data; /* some character data read */ + int n_data; + int len; /* the lenght of the data */ + int n_len; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + data = gen_const_xmlChar_ptr(n_data, 1); + len = gen_int(n_len, 2); + + ret_val = xmlRelaxNGValidatePushCData(ctxt, data, len); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_data, data, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_data); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxNGValidatePushElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + + ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRelaxParserSetFlag(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */ + int n_ctxt; + int flags; /* a set of flags values */ + int n_flags; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0); + flags = gen_int(n_flags, 1); + + ret_val = xmlRelaxParserSetFlag(ctxt, flags); + desret_int(ret_val); + call_tests++; + des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0); + des_int(n_flags, flags, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRelaxParserSetFlag", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_flags); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_relaxng(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n"); + test_ret += test_xmlRelaxNGDump(); + test_ret += test_xmlRelaxNGDumpTree(); + test_ret += test_xmlRelaxNGGetParserErrors(); + test_ret += test_xmlRelaxNGGetValidErrors(); + test_ret += test_xmlRelaxNGInitTypes(); + test_ret += test_xmlRelaxNGNewDocParserCtxt(); + test_ret += test_xmlRelaxNGNewMemParserCtxt(); + test_ret += test_xmlRelaxNGNewParserCtxt(); + test_ret += test_xmlRelaxNGNewValidCtxt(); + test_ret += test_xmlRelaxNGParse(); + test_ret += test_xmlRelaxNGSetParserErrors(); + test_ret += test_xmlRelaxNGSetValidErrors(); + test_ret += test_xmlRelaxNGValidateDoc(); + test_ret += test_xmlRelaxNGValidateFullElement(); + test_ret += test_xmlRelaxNGValidatePopElement(); + test_ret += test_xmlRelaxNGValidatePushCData(); + test_ret += test_xmlRelaxNGValidatePushElement(); + test_ret += test_xmlRelaxParserSetFlag(); + + if (test_ret != 0) + printf("Module relaxng: %d errors\n", test_ret); + return(test_ret); +} +static int +test_schemasInternals(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n"); + + if (test_ret != 0) + printf("Module schemasInternals: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlAddChild(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + xmlNodePtr cur; /* the child node */ + int n_cur; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + cur = gen_xmlNodePtr_in(n_cur, 1); + + ret_val = xmlAddChild(parent, cur); + if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + des_xmlNodePtr_in(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddChildList(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + xmlNodePtr cur; /* the first node in the list */ + int n_cur; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + cur = gen_xmlNodePtr_in(n_cur, 1); + + ret_val = xmlAddChildList(parent, cur); + if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + des_xmlNodePtr_in(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddChildList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddNextSibling(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr cur; /* the child node */ + int n_cur; + xmlNodePtr elem; /* the new node */ + int n_elem; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + elem = gen_xmlNodePtr_in(n_elem, 1); + + ret_val = xmlAddNextSibling(cur, elem); + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_xmlNodePtr_in(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddNextSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddPrevSibling(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr cur; /* the child node */ + int n_cur; + xmlNodePtr elem; /* the new node */ + int n_elem; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + elem = gen_xmlNodePtr_in(n_elem, 1); + + ret_val = xmlAddPrevSibling(cur, elem); + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_xmlNodePtr_in(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddPrevSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlAddSibling(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr cur; /* the child node */ + int n_cur; + xmlNodePtr elem; /* the new node */ + int n_elem; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + elem = gen_xmlNodePtr_in(n_elem, 1); + + ret_val = xmlAddSibling(cur, elem); + if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_xmlNodePtr_in(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAttrSerializeTxtContent(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlAttrPtr attr; /* the attribute node */ + int n_attr; + xmlChar * string; /* the text content */ + int n_string; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + attr = gen_xmlAttrPtr(n_attr, 2); + string = gen_const_xmlChar_ptr(n_string, 3); + + xmlAttrSerializeTxtContent(buf, doc, attr, string); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlAttrPtr(n_attr, attr, 2); + des_const_xmlChar_ptr(n_string, string, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAttrSerializeTxtContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_attr); + printf(" %d", n_string); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlBufferAdd(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer to dump */ + int n_buf; + xmlChar * str; /* the #xmlChar string */ + int n_str; + int len; /* the number of #xmlChar to add */ + int n_len; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + len = gen_int(n_len, 2); + + ret_val = xmlBufferAdd(buf, str, len); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_xmlChar_ptr(n_str, str, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferAdd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_str); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferAddHead(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer */ + int n_buf; + xmlChar * str; /* the #xmlChar string */ + int n_str; + int len; /* the number of #xmlChar to add */ + int n_len; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + len = gen_int(n_len, 2); + + ret_val = xmlBufferAddHead(buf, str, len); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_xmlChar_ptr(n_str, str, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferAddHead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_str); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferCCat(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer to dump */ + int n_buf; + char * str; /* the C char string */ + int n_str; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + str = gen_const_char_ptr(n_str, 1); + + ret_val = xmlBufferCCat(buf, str); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_char_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferCCat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferCat(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer to add to */ + int n_buf; + xmlChar * str; /* the #xmlChar string */ + int n_str; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + + ret_val = xmlBufferCat(buf, str); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_xmlChar_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferCat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_const_xmlBufferPtr 1 +static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlBufferContent(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlBufferPtr buf; /* the buffer */ + int n_buf; + + for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) { + mem_base = xmlMemBlocks(); + buf = gen_const_xmlBufferPtr(n_buf, 0); + + ret_val = xmlBufferContent(buf); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlBufferPtr(n_buf, buf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferCreate(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlBufferCreate(); + desret_xmlBufferPtr(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferCreate", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferCreateSize(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlBufferCreateStatic(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlBufferEmpty(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr buf; /* the buffer */ + int n_buf; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + + xmlBufferEmpty(buf); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferEmpty", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferGrow(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer */ + int n_buf; + unsigned int len; /* the minimum free size to allocate */ + int n_len; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + len = gen_unsigned_int(n_len, 1); + + ret_val = xmlBufferGrow(buf, len); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_unsigned_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferGrow", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferLength(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer */ + int n_buf; + + for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) { + mem_base = xmlMemBlocks(); + buf = gen_const_xmlBufferPtr(n_buf, 0); + + ret_val = xmlBufferLength(buf); + desret_int(ret_val); + call_tests++; + des_const_xmlBufferPtr(n_buf, buf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferLength", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferResize(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer to resize */ + int n_buf; + unsigned int size; /* the desired size */ + int n_size; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + size = gen_unsigned_int(n_size, 1); + + ret_val = xmlBufferResize(buf, size); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_unsigned_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferResize", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferSetAllocationScheme(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr buf; /* the buffer to tune */ + int n_buf; + xmlBufferAllocationScheme scheme; /* allocation scheme to use */ + int n_scheme; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + scheme = gen_xmlBufferAllocationScheme(n_scheme, 1); + + xmlBufferSetAllocationScheme(buf, scheme); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlBufferAllocationScheme(n_scheme, scheme, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferSetAllocationScheme", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_scheme); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferShrink(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the buffer to dump */ + int n_buf; + unsigned int len; /* the number of xmlChar to remove */ + int n_len; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + len = gen_unsigned_int(n_len, 1); + + ret_val = xmlBufferShrink(buf, len); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_unsigned_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferShrink", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferWriteCHAR(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr buf; /* the XML buffer */ + int n_buf; + xmlChar * string; /* the string to add */ + int n_string; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + string = gen_const_xmlChar_ptr(n_string, 1); + + xmlBufferWriteCHAR(buf, string); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_xmlChar_ptr(n_string, string, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferWriteCHAR", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_string); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferWriteChar(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + char * string; /* the string to add */ + int n_string; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + string = gen_const_char_ptr(n_string, 1); + + xmlBufferWriteChar(buf, string); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_char_ptr(n_string, string, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferWriteChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_string); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBufferWriteQuotedString(void) { + int test_ret = 0; + + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlChar * string; /* the string to add */ + int n_string; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + string = gen_const_xmlChar_ptr(n_string, 1); + + xmlBufferWriteQuotedString(buf, string); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_const_xmlChar_ptr(n_string, string, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBufferWriteQuotedString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_string); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBuildQName(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * ncname; /* the Name */ + int n_ncname; + xmlChar * prefix; /* the prefix */ + int n_prefix; + xmlChar * memory; /* preallocated memory */ + int n_memory; + int len; /* preallocated memory length */ + int n_len; + + for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ncname = gen_const_xmlChar_ptr(n_ncname, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + memory = gen_xmlChar_ptr(n_memory, 2); + len = gen_int(n_len, 3); + + ret_val = xmlBuildQName(ncname, prefix, memory, len); + if ((ret_val != NULL) && (ret_val != ncname) && + (ret_val != prefix) && (ret_val != memory)) + xmlFree(ret_val); + ret_val = NULL; + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_ncname, ncname, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_xmlChar_ptr(n_memory, memory, 2); + des_int(n_len, len, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBuildQName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ncname); + printf(" %d", n_prefix); + printf(" %d", n_memory); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + int recursive; /* if not zero do a recursive copy. */ + int n_recursive; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + recursive = gen_int(n_recursive, 1); + + ret_val = xmlCopyDoc(doc, recursive); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_int(n_recursive, recursive, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_recursive); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCopyDtd(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlDtdPtr ret_val; + xmlDtdPtr dtd; /* the dtd */ + int n_dtd; + + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + mem_base = xmlMemBlocks(); + dtd = gen_xmlDtdPtr(n_dtd, 0); + + ret_val = xmlCopyDtd(dtd); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlDtdPtr(n_dtd, dtd, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyDtd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dtd); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlCopyNamespace(void) { + int test_ret = 0; + + int mem_base; + xmlNsPtr ret_val; + xmlNsPtr cur; /* the namespace */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNsPtr(n_cur, 0); + + ret_val = xmlCopyNamespace(cur); + if (ret_val != NULL) xmlFreeNs(ret_val); + desret_xmlNsPtr(ret_val); + call_tests++; + des_xmlNsPtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyNamespace", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyNamespaceList(void) { + int test_ret = 0; + + int mem_base; + xmlNsPtr ret_val; + xmlNsPtr cur; /* the first namespace */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNsPtr(n_cur, 0); + + ret_val = xmlCopyNamespaceList(cur); + if (ret_val != NULL) xmlFreeNsList(ret_val); + desret_xmlNsPtr(ret_val); + call_tests++; + des_xmlNsPtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyNamespaceList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyNode(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */ + int n_extended; + + for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { + for (n_extended = 0;n_extended < gen_nb_int;n_extended++) { + mem_base = xmlMemBlocks(); + node = gen_const_xmlNodePtr(n_node, 0); + extended = gen_int(n_extended, 1); + + ret_val = xmlCopyNode(node, extended); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlNodePtr(n_node, node, 0); + des_int(n_extended, extended, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_extended); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyNodeList(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr node; /* the first node in the list. */ + int n_node; + + for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_const_xmlNodePtr(n_node, 0); + + ret_val = xmlCopyNodeList(node); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyProp(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr target; /* the element where the attribute will be grafted */ + int n_target; + xmlAttrPtr cur; /* the attribute */ + int n_cur; + + for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) { + for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { + mem_base = xmlMemBlocks(); + target = gen_xmlNodePtr(n_target, 0); + cur = gen_xmlAttrPtr(n_cur, 1); + + ret_val = xmlCopyProp(target, cur); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_target, target, 0); + des_xmlAttrPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_target); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCopyPropList(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr target; /* the element where the attributes will be grafted */ + int n_target; + xmlAttrPtr cur; /* the first attribute */ + int n_cur; + + for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) { + for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { + mem_base = xmlMemBlocks(); + target = gen_xmlNodePtr(n_target, 0); + cur = gen_xmlAttrPtr(n_cur, 1); + + ret_val = xmlCopyPropList(target, cur); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_target, target, 0); + des_xmlAttrPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyPropList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_target); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateIntSubset(void) { + int test_ret = 0; + + int mem_base; + xmlDtdPtr ret_val; + xmlDocPtr doc; /* the document pointer */ + int n_doc; + xmlChar * name; /* the DTD name */ + int n_name; + xmlChar * ExternalID; /* the external (PUBLIC) ID */ + int n_ExternalID; + xmlChar * SystemID; /* the system ID */ + int n_SystemID; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); + + ret_val = xmlCreateIntSubset(doc, name, ExternalID, SystemID); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); + des_const_xmlChar_ptr(n_SystemID, SystemID, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCreateIntSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDocCopyNode(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlDocPtr doc; /* the document */ + int n_doc; + int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */ + int n_extended; + + for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_extended = 0;n_extended < gen_nb_int;n_extended++) { + mem_base = xmlMemBlocks(); + node = gen_const_xmlNodePtr(n_node, 0); + doc = gen_xmlDocPtr(n_doc, 1); + extended = gen_int(n_extended, 2); + + ret_val = xmlDocCopyNode(node, doc, extended); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlNodePtr(n_node, node, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_int(n_extended, extended, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocCopyNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_doc); + printf(" %d", n_extended); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDocCopyNodeList(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the target document */ + int n_doc; + xmlNodePtr node; /* the first node in the list. */ + int n_node; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + node = gen_const_xmlNodePtr(n_node, 1); + + ret_val = xmlDocCopyNodeList(doc, node); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocCopyNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDocDump(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + FILE * f; /* the FILE* */ + int n_f; + xmlDocPtr cur; /* the document */ + int n_cur; + + for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + mem_base = xmlMemBlocks(); + f = gen_FILE_ptr(n_f, 0); + cur = gen_xmlDocPtr(n_cur, 1); + + ret_val = xmlDocDump(f, cur); + desret_int(ret_val); + call_tests++; + des_FILE_ptr(n_f, f, 0); + des_xmlDocPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_f); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocDumpFormatMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlDocPtr cur; /* the document */ + int n_cur; + xmlChar ** mem; /* OUT: the memory pointer */ + int n_mem; + int * size; /* OUT: the memory length */ + int n_size; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlDocPtr(n_cur, 0); + mem = gen_xmlChar_ptr_ptr(n_mem, 1); + size = gen_int_ptr(n_size, 2); + format = gen_int(n_format, 3); + + xmlDocDumpFormatMemory(cur, mem, size, format); + call_tests++; + des_xmlDocPtr(n_cur, cur, 0); + des_xmlChar_ptr_ptr(n_mem, mem, 1); + des_int_ptr(n_size, size, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocDumpFormatMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_mem); + printf(" %d", n_size); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocDumpFormatMemoryEnc(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlDocPtr out_doc; /* Document to generate XML text from */ + int n_out_doc; + xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */ + int n_doc_txt_ptr; + int * doc_txt_len; /* Length of the generated XML text */ + int n_doc_txt_len; + char * txt_encoding; /* Character encoding to use when generating XML text */ + int n_txt_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) { + for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { + for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) { + for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + out_doc = gen_xmlDocPtr(n_out_doc, 0); + doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1); + doc_txt_len = gen_int_ptr(n_doc_txt_len, 2); + txt_encoding = gen_const_char_ptr(n_txt_encoding, 3); + format = gen_int(n_format, 4); + + xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding, format); + call_tests++; + des_xmlDocPtr(n_out_doc, out_doc, 0); + des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1); + des_int_ptr(n_doc_txt_len, doc_txt_len, 2); + des_const_char_ptr(n_txt_encoding, txt_encoding, 3); + des_int(n_format, format, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out_doc); + printf(" %d", n_doc_txt_ptr); + printf(" %d", n_doc_txt_len); + printf(" %d", n_txt_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocDumpMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlDocPtr cur; /* the document */ + int n_cur; + xmlChar ** mem; /* OUT: the memory pointer */ + int n_mem; + int * size; /* OUT: the memory length */ + int n_size; + + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlDocPtr(n_cur, 0); + mem = gen_xmlChar_ptr_ptr(n_mem, 1); + size = gen_int_ptr(n_size, 2); + + xmlDocDumpMemory(cur, mem, size); + call_tests++; + des_xmlDocPtr(n_cur, cur, 0); + des_xmlChar_ptr_ptr(n_mem, mem, 1); + des_int_ptr(n_size, size, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocDumpMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_mem); + printf(" %d", n_size); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocDumpMemoryEnc(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlDocPtr out_doc; /* Document to generate XML text from */ + int n_out_doc; + xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */ + int n_doc_txt_ptr; + int * doc_txt_len; /* Length of the generated XML text */ + int n_doc_txt_len; + char * txt_encoding; /* Character encoding to use when generating XML text */ + int n_txt_encoding; + + for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) { + for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) { + for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) { + for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) { + mem_base = xmlMemBlocks(); + out_doc = gen_xmlDocPtr(n_out_doc, 0); + doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1); + doc_txt_len = gen_int_ptr(n_doc_txt_len, 2); + txt_encoding = gen_const_char_ptr(n_txt_encoding, 3); + + xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, txt_encoding); + call_tests++; + des_xmlDocPtr(n_out_doc, out_doc, 0); + des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1); + des_int_ptr(n_doc_txt_len, doc_txt_len, 2); + des_const_char_ptr(n_txt_encoding, txt_encoding, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocDumpMemoryEnc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out_doc); + printf(" %d", n_doc_txt_ptr); + printf(" %d", n_doc_txt_len); + printf(" %d", n_txt_encoding); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocFormatDump(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + FILE * f; /* the FILE* */ + int n_f; + xmlDocPtr cur; /* the document */ + int n_cur; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + f = gen_FILE_ptr(n_f, 0); + cur = gen_xmlDocPtr(n_cur, 1); + format = gen_int(n_format, 2); + + ret_val = xmlDocFormatDump(f, cur, format); + desret_int(ret_val); + call_tests++; + des_FILE_ptr(n_f, f, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_int(n_format, format, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocFormatDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_f); + printf(" %d", n_cur); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDocGetRootElement(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlDocGetRootElement(doc); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocGetRootElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlDocSetRootElement(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr root; /* the new document root element */ + int n_root; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + root = gen_xmlNodePtr_in(n_root, 1); + + ret_val = xmlDocSetRootElement(doc, root); + if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr_in(n_root, root, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDocSetRootElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_root); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlElemDump(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * f; /* the FILE * for the output */ + int n_f; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + + for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + f = gen_FILE_ptr(n_f, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + + xmlElemDump(f, doc, cur); + call_tests++; + des_FILE_ptr(n_f, f, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlElemDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_f); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlGetBufferAllocationScheme(void) { + int test_ret = 0; + + int mem_base; + xmlBufferAllocationScheme ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlGetBufferAllocationScheme(); + desret_xmlBufferAllocationScheme(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetBufferAllocationScheme", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetCompressMode(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlGetCompressMode(); + desret_int(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetCompressMode", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDocCompressMode(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlGetDocCompressMode(doc); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDocCompressMode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetIntSubset(void) { + int test_ret = 0; + + int mem_base; + xmlDtdPtr ret_val; + xmlDocPtr doc; /* the document pointer */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlGetIntSubset(doc); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetIntSubset", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetLastChild(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + + ret_val = xmlGetLastChild(parent); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetLastChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetLineNo(void) { + int test_ret = 0; + + int mem_base; + long ret_val; + xmlNodePtr node; /* valid node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlGetLineNo(node); + desret_long(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetLineNo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetNoNsProp(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetNoNsProp(node, name); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetNoNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetNodePath(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlChar * ret_val; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlGetNodePath(node); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetNodePath", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlGetNsList(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlGetNsProp(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * nameSpace; /* the URI of the namespace */ + int n_nameSpace; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); + + ret_val = xmlGetNsProp(node, name, nameSpace); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf(" %d", n_nameSpace); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetProp(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetProp(node, name); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHasNsProp(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * nameSpace; /* the URI of the namespace */ + int n_nameSpace; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); + + ret_val = xmlHasNsProp(node, name, nameSpace); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHasNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf(" %d", n_nameSpace); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlHasProp(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlHasProp(node, name); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlHasProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsBlankNode(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlNodePtr node; /* the node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlIsBlankNode(node); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsBlankNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsXHTML(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * systemID; /* the system identifier */ + int n_systemID; + xmlChar * publicID; /* the public identifier */ + int n_publicID; + + for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) { + for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) { + mem_base = xmlMemBlocks(); + systemID = gen_const_xmlChar_ptr(n_systemID, 0); + publicID = gen_const_xmlChar_ptr(n_publicID, 1); + + ret_val = xmlIsXHTML(systemID, publicID); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_systemID, systemID, 0); + des_const_xmlChar_ptr(n_publicID, publicID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsXHTML", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_systemID); + printf(" %d", n_publicID); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewCDataBlock(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * content; /* the CDATA block content content */ + int n_content; + int len; /* the length of the block */ + int n_len; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + ret_val = xmlNewCDataBlock(doc, content, len); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewCDataBlock", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewCharRef(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlNewCharRef(doc, name); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewCharRef", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewChild(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + xmlNsPtr ns; /* a namespace if any */ + int n_ns; + xmlChar * name; /* the name of the child */ + int n_name; + xmlChar * content; /* the XML content of the child if any. */ + int n_content; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlNewChild(parent, ns, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewComment(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlChar * content; /* the comment content */ + int n_content; + + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + content = gen_const_xmlChar_ptr(n_content, 0); + + ret_val = xmlNewComment(content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_content, content, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewComment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_content); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDoc(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr ret_val; + xmlChar * version; /* xmlChar string giving the version of XML "1.0" */ + int n_version; + + for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) { + mem_base = xmlMemBlocks(); + version = gen_const_xmlChar_ptr(n_version, 0); + + ret_val = xmlNewDoc(version); + desret_xmlDocPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_version, version, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_version); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocComment(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * content; /* the comment content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlNewDocComment(doc, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocComment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocFragment(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document owning the fragment */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlNewDocFragment(doc); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocFragment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewDocNode(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNsPtr ns; /* namespace if any */ + int n_ns; + xmlChar * name; /* the node name */ + int n_name; + xmlChar * content; /* the XML text content if any */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlNewDocNode(doc, ns, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocNodeEatName(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNsPtr ns; /* namespace if any */ + int n_ns; + xmlChar * name; /* the node name */ + int n_name; + xmlChar * content; /* the XML text content if any */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_eaten_name(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlNewDocNodeEatName(doc, ns, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_eaten_name(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocNodeEatName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocPI(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the target document */ + int n_doc; + xmlChar * name; /* the processing instruction name */ + int n_name; + xmlChar * content; /* the PI content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlNewDocPI(doc, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocPI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocProp(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the name of the attribute */ + int n_name; + xmlChar * value; /* the value of the attribute */ + int n_value; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + value = gen_const_xmlChar_ptr(n_value, 2); + + ret_val = xmlNewDocProp(doc, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocRawNode(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNsPtr ns; /* namespace if any */ + int n_ns; + xmlChar * name; /* the node name */ + int n_name; + xmlChar * content; /* the text content if any */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlNewDocRawNode(doc, ns, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocRawNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewDocText(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * content; /* the text content */ + int n_content; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlNewDocText(doc, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocText", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDocTextLen(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * content; /* the text content */ + int n_content; + int len; /* the text len. */ + int n_len; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + ret_val = xmlNewDocTextLen(doc, content, len); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDocTextLen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewDtd(void) { + int test_ret = 0; + + int mem_base; + xmlDtdPtr ret_val; + xmlDocPtr doc; /* the document pointer */ + int n_doc; + xmlChar * name; /* the DTD name */ + int n_name; + xmlChar * ExternalID; /* the external ID */ + int n_ExternalID; + xmlChar * SystemID; /* the system ID */ + int n_SystemID; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) { + for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2); + SystemID = gen_const_xmlChar_ptr(n_SystemID, 3); + + ret_val = xmlNewDtd(doc, name, ExternalID, SystemID); + desret_xmlDtdPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ExternalID, ExternalID, 2); + des_const_xmlChar_ptr(n_SystemID, SystemID, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewDtd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf(" %d", n_ExternalID); + printf(" %d", n_SystemID); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewNode(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNsPtr ns; /* namespace if any */ + int n_ns; + xmlChar * name; /* the node name */ + int n_name; + + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ns = gen_xmlNsPtr(n_ns, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlNewNode(ns, name); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNsPtr(n_ns, ns, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ns); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewNodeEatName(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNsPtr ns; /* namespace if any */ + int n_ns; + xmlChar * name; /* the node name */ + int n_name; + + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { + mem_base = xmlMemBlocks(); + ns = gen_xmlNsPtr(n_ns, 0); + name = gen_eaten_name(n_name, 1); + + ret_val = xmlNewNodeEatName(ns, name); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNsPtr(n_ns, ns, 0); + des_eaten_name(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewNodeEatName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ns); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewNs(void) { + int test_ret = 0; + + int mem_base; + xmlNsPtr ret_val; + xmlNodePtr node; /* the element carrying the namespace */ + int n_node; + xmlChar * href; /* the URI associated */ + int n_href; + xmlChar * prefix; /* the prefix for the namespace */ + int n_prefix; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + href = gen_const_xmlChar_ptr(n_href, 1); + prefix = gen_const_xmlChar_ptr(n_prefix, 2); + + ret_val = xmlNewNs(node, href, prefix); + if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val); + desret_xmlNsPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_href, href, 1); + des_const_xmlChar_ptr(n_prefix, prefix, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_href); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewNsProp(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the holding node */ + int n_node; + xmlNsPtr ns; /* the namespace */ + int n_ns; + xmlChar * name; /* the name of the attribute */ + int n_name; + xmlChar * value; /* the value of the attribute */ + int n_value; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + value = gen_const_xmlChar_ptr(n_value, 3); + + ret_val = xmlNewNsProp(node, ns, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_value, value, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewNsPropEatName(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the holding node */ + int n_node; + xmlNsPtr ns; /* the namespace */ + int n_ns; + xmlChar * name; /* the name of the attribute */ + int n_name; + xmlChar * value; /* the value of the attribute */ + int n_value; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_eaten_name(n_name, 2); + value = gen_const_xmlChar_ptr(n_value, 3); + + ret_val = xmlNewNsPropEatName(node, ns, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_eaten_name(n_name, name, 2); + des_const_xmlChar_ptr(n_value, value, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewNsPropEatName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewPI(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlChar * name; /* the processing instruction name */ + int n_name; + xmlChar * content; /* the PI content */ + int n_content; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlNewPI(name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewPI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the holding node */ + int n_node; + xmlChar * name; /* the name of the attribute */ + int n_name; + xmlChar * value; /* the value of the attribute */ + int n_value; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + value = gen_const_xmlChar_ptr(n_value, 2); + + ret_val = xmlNewProp(node, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewReference(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the reference name, or the reference string with & and ; */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlNewReference(doc, name); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewReference", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewText(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlChar * content; /* the text content */ + int n_content; + + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + content = gen_const_xmlChar_ptr(n_content, 0); + + ret_val = xmlNewText(content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_content, content, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewText", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_content); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewTextChild(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr parent; /* the parent node */ + int n_parent; + xmlNsPtr ns; /* a namespace if any */ + int n_ns; + xmlChar * name; /* the name of the child */ + int n_name; + xmlChar * content; /* the text content of the child if any. */ + int n_content; + + for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + parent = gen_xmlNodePtr(n_parent, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlNewTextChild(parent, ns, name, content); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_parent, parent, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_parent); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextLen(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlChar * content; /* the text content */ + int n_content; + int len; /* the text len. */ + int n_len; + + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + content = gen_const_xmlChar_ptr(n_content, 0); + len = gen_int(n_len, 1); + + ret_val = xmlNewTextLen(content, len); + desret_xmlNodePtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_content, content, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextLen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeAddContent(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr cur; /* the node being modified */ + int n_cur; + xmlChar * content; /* extra content */ + int n_content; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + xmlNodeAddContent(cur, content); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeAddContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeAddContentLen(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr cur; /* the node being modified */ + int n_cur; + xmlChar * content; /* extra content */ + int n_content; + int len; /* the size of @content */ + int n_len; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + xmlNodeAddContentLen(cur, content, len); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeAddContentLen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeBufGetContent(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlBufferPtr buffer; /* a buffer */ + int n_buffer; + xmlNodePtr cur; /* the node being read */ + int n_cur; + + for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + buffer = gen_xmlBufferPtr(n_buffer, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlNodeBufGetContent(buffer, cur); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buffer, buffer, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeBufGetContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeDump(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + int level; /* the imbrication level for indenting */ + int n_level; + int format; /* is formatting allowed */ + int n_format; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_level = 0;n_level < gen_nb_int;n_level++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + level = gen_int(n_level, 3); + format = gen_int(n_format, 4); + + ret_val = xmlNodeDump(buf, doc, cur, level, format); + desret_int(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + des_int(n_level, level, 3); + des_int(n_format, format, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf(" %d", n_level); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeDumpOutput(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr cur; /* the current node */ + int n_cur; + int level; /* the imbrication level for indenting */ + int n_level; + int format; /* is formatting allowed */ + int n_format; + char * encoding; /* an optional encoding string */ + int n_encoding; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_level = 0;n_level < gen_nb_int;n_level++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + doc = gen_xmlDocPtr(n_doc, 1); + cur = gen_xmlNodePtr(n_cur, 2); + level = gen_int(n_level, 3); + format = gen_int(n_format, 4); + encoding = gen_const_char_ptr(n_encoding, 5); + + xmlNodeDumpOutput(buf, doc, cur, level, format, encoding); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_cur, cur, 2); + des_int(n_level, level, 3); + des_int(n_format, format, 4); + des_const_char_ptr(n_encoding, encoding, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeDumpOutput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_doc); + printf(" %d", n_cur); + printf(" %d", n_level); + printf(" %d", n_format); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeGetBase(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document the node pertains to */ + int n_doc; + xmlNodePtr cur; /* the node being checked */ + int n_cur; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlNodeGetBase(doc, cur); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeGetBase", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeGetContent(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlNodePtr cur; /* the node being read */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + + ret_val = xmlNodeGetContent(cur); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeGetContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeGetLang(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlNodePtr cur; /* the node being checked */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + + ret_val = xmlNodeGetLang(cur); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeGetLang", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeGetSpacePreserve(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlNodePtr cur; /* the node being checked */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + + ret_val = xmlNodeGetSpacePreserve(cur); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeGetSpacePreserve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeIsText(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlNodePtr node; /* the node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlNodeIsText(node); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeIsText", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeListGetRawString(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr list; /* a Node list */ + int n_list; + int inLine; /* should we replace entity contents or show their external form */ + int n_inLine; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) { + for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + list = gen_xmlNodePtr(n_list, 1); + inLine = gen_int(n_inLine, 2); + + ret_val = xmlNodeListGetRawString(doc, list, inLine); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_list, list, 1); + des_int(n_inLine, inLine, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeListGetRawString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_list); + printf(" %d", n_inLine); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeListGetString(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr list; /* a Node list */ + int n_list; + int inLine; /* should we replace entity contents or show their external form */ + int n_inLine; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) { + for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + list = gen_xmlNodePtr(n_list, 1); + inLine = gen_int(n_inLine, 2); + + ret_val = xmlNodeListGetString(doc, list, inLine); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_list, list, 1); + des_int(n_inLine, inLine, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeListGetString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_list); + printf(" %d", n_inLine); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeSetBase(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr cur; /* the node being changed */ + int n_cur; + xmlChar * uri; /* the new base URI */ + int n_uri; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + uri = gen_const_xmlChar_ptr(n_uri, 1); + + xmlNodeSetBase(cur, uri); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_uri, uri, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetBase", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_uri); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeSetContent(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr cur; /* the node being modified */ + int n_cur; + xmlChar * content; /* the new value of the content */ + int n_content; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + xmlNodeSetContent(cur, content); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNodeSetContentLen(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr cur; /* the node being modified */ + int n_cur; + xmlChar * content; /* the new value of the content */ + int n_content; + int len; /* the size of @content */ + int n_len; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + xmlNodeSetContentLen(cur, content, len); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetContentLen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeSetLang(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr cur; /* the node being changed */ + int n_cur; + xmlChar * lang; /* the language description */ + int n_lang; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + lang = gen_const_xmlChar_ptr(n_lang, 1); + + xmlNodeSetLang(cur, lang); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_lang, lang, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetLang", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_lang); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeSetName(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr cur; /* the node being changed */ + int n_cur; + xmlChar * name; /* the new tag name */ + int n_name; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + xmlNodeSetName(cur, name); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNodeSetSpacePreserve(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr cur; /* the node being changed */ + int n_cur; + int val; /* the xml:space value ("0": default, 1: "preserve") */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodePtr(n_cur, 0); + val = gen_int(n_val, 1); + + xmlNodeSetSpacePreserve(cur, val); + call_tests++; + des_xmlNodePtr(n_cur, cur, 0); + des_int(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNodeSetSpacePreserve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReconciliateNs(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr tree; /* a node defining the subtree to reconciliate */ + int n_tree; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + tree = gen_xmlNodePtr(n_tree, 1); + + ret_val = xmlReconciliateNs(doc, tree); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_tree, tree, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReconciliateNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_tree); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRemoveProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlAttrPtr cur; /* an attribute */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlAttrPtr(n_cur, 0); + + ret_val = xmlRemoveProp(cur); + cur = NULL; + desret_int(ret_val); + call_tests++; + des_xmlAttrPtr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRemoveProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReplaceNode(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr old; /* the old node */ + int n_old; + xmlNodePtr cur; /* the node */ + int n_cur; + + for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) { + mem_base = xmlMemBlocks(); + old = gen_xmlNodePtr(n_old, 0); + cur = gen_xmlNodePtr_in(n_cur, 1); + + ret_val = xmlReplaceNode(old, cur); + if (cur != NULL) { + xmlUnlinkNode(cur); + xmlFreeNode(cur) ; cur = NULL ; } + if (old != NULL) { + xmlUnlinkNode(old); + xmlFreeNode(old) ; old = NULL ; } + ret_val = NULL; + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr(n_old, old, 0); + des_xmlNodePtr_in(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReplaceNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_old); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFile(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename (or URL) */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + + ret_val = xmlSaveFile(filename, cur); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFileEnc(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename (or URL) */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the name of an encoding (or NULL) */ + int n_encoding; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + + ret_val = xmlSaveFileEnc(filename, cur, encoding); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFileEnc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFileTo(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlOutputBufferPtr buf; /* an output I/O buffer */ + int n_buf; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */ + int n_encoding; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + + ret_val = xmlSaveFileTo(buf, cur, encoding); + buf = NULL; + desret_int(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFileTo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFormatFile(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename (or URL) */ + int n_filename; + xmlDocPtr cur; /* the document */ + int n_cur; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + format = gen_int(n_format, 2); + + ret_val = xmlSaveFormatFile(filename, cur, format); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_int(n_format, format, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFormatFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFormatFileEnc(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the filename or URL to output */ + int n_filename; + xmlDocPtr cur; /* the document being saved */ + int n_cur; + char * encoding; /* the name of the encoding to use or NULL. */ + int n_encoding; + int format; /* should formatting spaces be added. */ + int n_format; + + for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + filename = gen_fileoutput(n_filename, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + format = gen_int(n_format, 3); + + ret_val = xmlSaveFormatFileEnc(filename, cur, encoding, format); + desret_int(ret_val); + call_tests++; + des_fileoutput(n_filename, filename, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFormatFileEnc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFormatFileTo(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlOutputBufferPtr buf; /* an output I/O buffer */ + int n_buf; + xmlDocPtr cur; /* the document */ + int n_cur; + char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */ + int n_encoding; + int format; /* should formatting spaces been added */ + int n_format; + + for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) { + for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_format = 0;n_format < gen_nb_int;n_format++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlOutputBufferPtr(n_buf, 0); + cur = gen_xmlDocPtr(n_cur, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + format = gen_int(n_format, 3); + + ret_val = xmlSaveFormatFileTo(buf, cur, encoding, format); + buf = NULL; + desret_int(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_buf, buf, 0); + des_xmlDocPtr(n_cur, cur, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_int(n_format, format, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFormatFileTo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_cur); + printf(" %d", n_encoding); + printf(" %d", n_format); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSearchNs(void) { + int test_ret = 0; + + int mem_base; + xmlNsPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr node; /* the current node */ + int n_node; + xmlChar * nameSpace; /* the namespace prefix */ + int n_nameSpace; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + node = gen_xmlNodePtr(n_node, 1); + nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2); + + ret_val = xmlSearchNs(doc, node, nameSpace); + desret_xmlNsPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_node, node, 1); + des_const_xmlChar_ptr(n_nameSpace, nameSpace, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSearchNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_node); + printf(" %d", n_nameSpace); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSearchNsByHref(void) { + int test_ret = 0; + + int mem_base; + xmlNsPtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr node; /* the current node */ + int n_node; + xmlChar * href; /* the namespace value */ + int n_href; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + node = gen_xmlNodePtr(n_node, 1); + href = gen_const_xmlChar_ptr(n_href, 2); + + ret_val = xmlSearchNsByHref(doc, node, href); + desret_xmlNsPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_node, node, 1); + des_const_xmlChar_ptr(n_href, href, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSearchNsByHref", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_node); + printf(" %d", n_href); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetBufferAllocationScheme(void) { + int test_ret = 0; + + int mem_base; + xmlBufferAllocationScheme scheme; /* allocation method to use */ + int n_scheme; + + for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) { + mem_base = xmlMemBlocks(); + scheme = gen_xmlBufferAllocationScheme(n_scheme, 0); + + xmlSetBufferAllocationScheme(scheme); + call_tests++; + des_xmlBufferAllocationScheme(n_scheme, scheme, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetBufferAllocationScheme", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_scheme); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetCompressMode(void) { + int test_ret = 0; + + int mem_base; + int mode; /* the compression ratio */ + int n_mode; + + for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { + mem_base = xmlMemBlocks(); + mode = gen_int(n_mode, 0); + + xmlSetCompressMode(mode); + call_tests++; + des_int(n_mode, mode, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetCompressMode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_mode); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetDocCompressMode(void) { + int test_ret = 0; + + int mem_base; + xmlDocPtr doc; /* the document */ + int n_doc; + int mode; /* the compression ratio */ + int n_mode; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_mode = 0;n_mode < gen_nb_int;n_mode++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + mode = gen_int(n_mode, 1); + + xmlSetDocCompressMode(doc, mode); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_int(n_mode, mode, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetDocCompressMode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_mode); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetNs(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr node; /* a node in the document */ + int n_node; + xmlNsPtr ns; /* a namespace pointer */ + int n_ns; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + ns = gen_xmlNsPtr(n_ns, 1); + + xmlSetNs(node, ns); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_xmlNsPtr(n_ns, ns, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_ns); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetNsProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlNsPtr ns; /* the namespace definition */ + int n_ns; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * value; /* the attribute value */ + int n_value; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + value = gen_const_xmlChar_ptr(n_value, 3); + + ret_val = xmlSetNsProp(node, ns, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_value, value, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_ns); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSetProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + xmlAttrPtr ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * value; /* the attribute value */ + int n_value; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + value = gen_const_xmlChar_ptr(n_value, 2); + + ret_val = xmlSetProp(node, name, value); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSetProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSplitQName2(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * name; /* the full QName */ + int n_name; + xmlChar ** prefix; /* a xmlChar ** */ + int n_prefix; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + prefix = gen_xmlChar_ptr_ptr(n_prefix, 1); + + ret_val = xmlSplitQName2(name, prefix); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + des_xmlChar_ptr_ptr(n_prefix, prefix, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSplitQName2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSplitQName3(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlChar * name; /* the full QName */ + int n_name; + int * len; /* an int * */ + int n_len; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + len = gen_int_ptr(n_len, 1); + + ret_val = xmlSplitQName3(name, len); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + des_int_ptr(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSplitQName3", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStringGetNodeList(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * value; /* the value of the attribute */ + int n_value; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + + ret_val = xmlStringGetNodeList(doc, value); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStringGetNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStringLenGetNodeList(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * value; /* the value of the text */ + int n_value; + int len; /* the length of the string value */ + int n_len; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + len = gen_int(n_len, 2); + + ret_val = xmlStringLenGetNodeList(doc, value, len); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStringLenGetNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_value); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlTextConcat(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * content; /* the content */ + int n_content; + int len; /* @content length */ + int n_len; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + ret_val = xmlTextConcat(node, content, len); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextConcat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlTextMerge(void) { + int test_ret = 0; + + int mem_base; + xmlNodePtr ret_val; + xmlNodePtr first; /* the first text node */ + int n_first; + xmlNodePtr second; /* the second text node being merged */ + int n_second; + + for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) { + for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) { + mem_base = xmlMemBlocks(); + first = gen_xmlNodePtr_in(n_first, 0); + second = gen_xmlNodePtr_in(n_second, 1); + + ret_val = xmlTextMerge(first, second); + if ((first != NULL) && (first->type != XML_TEXT_NODE)) { + xmlUnlinkNode(second); + xmlFreeNode(second) ; second = NULL ; } + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlNodePtr_in(n_first, first, 0); + des_xmlNodePtr_in(n_second, second, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextMerge", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_first); + printf(" %d", n_second); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUnsetNsProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlNsPtr ns; /* the namespace definition */ + int n_ns; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + ns = gen_xmlNsPtr(n_ns, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + + ret_val = xmlUnsetNsProp(node, ns, name); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_xmlNsPtr(n_ns, ns, 1); + des_const_xmlChar_ptr(n_name, name, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUnsetNsProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_ns); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUnsetProp(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlNodePtr node; /* the node */ + int n_node; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlUnsetProp(node, name); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUnsetProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNCName(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* the value to check */ + int n_value; + int space; /* allow spaces in front and end of the string */ + int n_space; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_space = 0;n_space < gen_nb_int;n_space++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + space = gen_int(n_space, 1); + + ret_val = xmlValidateNCName(value, space); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + des_int(n_space, space, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNCName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNMToken(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* the value to check */ + int n_value; + int space; /* allow spaces in front and end of the string */ + int n_space; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_space = 0;n_space < gen_nb_int;n_space++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + space = gen_int(n_space, 1); + + ret_val = xmlValidateNMToken(value, space); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + des_int(n_space, space, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNMToken", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateName(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* the value to check */ + int n_value; + int space; /* allow spaces in front and end of the string */ + int n_space; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_space = 0;n_space < gen_nb_int;n_space++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + space = gen_int(n_space, 1); + + ret_val = xmlValidateName(value, space); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + des_int(n_space, space, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateQName(void) { + int test_ret = 0; + +#ifdef LIBXML_TREE_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* the value to check */ + int n_value; + int space; /* allow spaces in front and end of the string */ + int n_space; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_space = 0;n_space < gen_nb_int;n_space++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + space = gen_int(n_space, 1); + + ret_val = xmlValidateQName(value, space); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + des_int(n_space, space, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateQName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf(" %d", n_space); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_tree(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n"); + test_ret += test_xmlAddChild(); + test_ret += test_xmlAddChildList(); + test_ret += test_xmlAddNextSibling(); + test_ret += test_xmlAddPrevSibling(); + test_ret += test_xmlAddSibling(); + test_ret += test_xmlAttrSerializeTxtContent(); + test_ret += test_xmlBufferAdd(); + test_ret += test_xmlBufferAddHead(); + test_ret += test_xmlBufferCCat(); + test_ret += test_xmlBufferCat(); + test_ret += test_xmlBufferContent(); + test_ret += test_xmlBufferCreate(); + test_ret += test_xmlBufferCreateSize(); + test_ret += test_xmlBufferCreateStatic(); + test_ret += test_xmlBufferEmpty(); + test_ret += test_xmlBufferGrow(); + test_ret += test_xmlBufferLength(); + test_ret += test_xmlBufferResize(); + test_ret += test_xmlBufferSetAllocationScheme(); + test_ret += test_xmlBufferShrink(); + test_ret += test_xmlBufferWriteCHAR(); + test_ret += test_xmlBufferWriteChar(); + test_ret += test_xmlBufferWriteQuotedString(); + test_ret += test_xmlBuildQName(); + test_ret += test_xmlCopyDoc(); + test_ret += test_xmlCopyDtd(); + test_ret += test_xmlCopyNamespace(); + test_ret += test_xmlCopyNamespaceList(); + test_ret += test_xmlCopyNode(); + test_ret += test_xmlCopyNodeList(); + test_ret += test_xmlCopyProp(); + test_ret += test_xmlCopyPropList(); + test_ret += test_xmlCreateIntSubset(); + test_ret += test_xmlDocCopyNode(); + test_ret += test_xmlDocCopyNodeList(); + test_ret += test_xmlDocDump(); + test_ret += test_xmlDocDumpFormatMemory(); + test_ret += test_xmlDocDumpFormatMemoryEnc(); + test_ret += test_xmlDocDumpMemory(); + test_ret += test_xmlDocDumpMemoryEnc(); + test_ret += test_xmlDocFormatDump(); + test_ret += test_xmlDocGetRootElement(); + test_ret += test_xmlDocSetRootElement(); + test_ret += test_xmlElemDump(); + test_ret += test_xmlGetBufferAllocationScheme(); + test_ret += test_xmlGetCompressMode(); + test_ret += test_xmlGetDocCompressMode(); + test_ret += test_xmlGetIntSubset(); + test_ret += test_xmlGetLastChild(); + test_ret += test_xmlGetLineNo(); + test_ret += test_xmlGetNoNsProp(); + test_ret += test_xmlGetNodePath(); + test_ret += test_xmlGetNsList(); + test_ret += test_xmlGetNsProp(); + test_ret += test_xmlGetProp(); + test_ret += test_xmlHasNsProp(); + test_ret += test_xmlHasProp(); + test_ret += test_xmlIsBlankNode(); + test_ret += test_xmlIsXHTML(); + test_ret += test_xmlNewCDataBlock(); + test_ret += test_xmlNewCharRef(); + test_ret += test_xmlNewChild(); + test_ret += test_xmlNewComment(); + test_ret += test_xmlNewDoc(); + test_ret += test_xmlNewDocComment(); + test_ret += test_xmlNewDocFragment(); + test_ret += test_xmlNewDocNode(); + test_ret += test_xmlNewDocNodeEatName(); + test_ret += test_xmlNewDocPI(); + test_ret += test_xmlNewDocProp(); + test_ret += test_xmlNewDocRawNode(); + test_ret += test_xmlNewDocText(); + test_ret += test_xmlNewDocTextLen(); + test_ret += test_xmlNewDtd(); + test_ret += test_xmlNewNode(); + test_ret += test_xmlNewNodeEatName(); + test_ret += test_xmlNewNs(); + test_ret += test_xmlNewNsProp(); + test_ret += test_xmlNewNsPropEatName(); + test_ret += test_xmlNewPI(); + test_ret += test_xmlNewProp(); + test_ret += test_xmlNewReference(); + test_ret += test_xmlNewText(); + test_ret += test_xmlNewTextChild(); + test_ret += test_xmlNewTextLen(); + test_ret += test_xmlNodeAddContent(); + test_ret += test_xmlNodeAddContentLen(); + test_ret += test_xmlNodeBufGetContent(); + test_ret += test_xmlNodeDump(); + test_ret += test_xmlNodeDumpOutput(); + test_ret += test_xmlNodeGetBase(); + test_ret += test_xmlNodeGetContent(); + test_ret += test_xmlNodeGetLang(); + test_ret += test_xmlNodeGetSpacePreserve(); + test_ret += test_xmlNodeIsText(); + test_ret += test_xmlNodeListGetRawString(); + test_ret += test_xmlNodeListGetString(); + test_ret += test_xmlNodeSetBase(); + test_ret += test_xmlNodeSetContent(); + test_ret += test_xmlNodeSetContentLen(); + test_ret += test_xmlNodeSetLang(); + test_ret += test_xmlNodeSetName(); + test_ret += test_xmlNodeSetSpacePreserve(); + test_ret += test_xmlReconciliateNs(); + test_ret += test_xmlRemoveProp(); + test_ret += test_xmlReplaceNode(); + test_ret += test_xmlSaveFile(); + test_ret += test_xmlSaveFileEnc(); + test_ret += test_xmlSaveFileTo(); + test_ret += test_xmlSaveFormatFile(); + test_ret += test_xmlSaveFormatFileEnc(); + test_ret += test_xmlSaveFormatFileTo(); + test_ret += test_xmlSearchNs(); + test_ret += test_xmlSearchNsByHref(); + test_ret += test_xmlSetBufferAllocationScheme(); + test_ret += test_xmlSetCompressMode(); + test_ret += test_xmlSetDocCompressMode(); + test_ret += test_xmlSetNs(); + test_ret += test_xmlSetNsProp(); + test_ret += test_xmlSetProp(); + test_ret += test_xmlSplitQName2(); + test_ret += test_xmlSplitQName3(); + test_ret += test_xmlStringGetNodeList(); + test_ret += test_xmlStringLenGetNodeList(); + test_ret += test_xmlTextConcat(); + test_ret += test_xmlTextMerge(); + test_ret += test_xmlUnsetNsProp(); + test_ret += test_xmlUnsetProp(); + test_ret += test_xmlValidateNCName(); + test_ret += test_xmlValidateNMToken(); + test_ret += test_xmlValidateName(); + test_ret += test_xmlValidateQName(); + + if (test_ret != 0) + printf("Module tree: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlBuildRelativeURI(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * URI; /* the URI reference under consideration */ + int n_URI; + xmlChar * base; /* the base value */ + int n_base; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI, 0); + base = gen_const_xmlChar_ptr(n_base, 1); + + ret_val = xmlBuildRelativeURI(URI, base); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI, 0); + des_const_xmlChar_ptr(n_base, base, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBuildRelativeURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_base); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlBuildURI(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * URI; /* the URI instance found in the document */ + int n_URI; + xmlChar * base; /* the base value */ + int n_base; + + for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) { + for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) { + mem_base = xmlMemBlocks(); + URI = gen_const_xmlChar_ptr(n_URI, 0); + base = gen_const_xmlChar_ptr(n_base, 1); + + ret_val = xmlBuildURI(URI, base); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_URI, URI, 0); + des_const_xmlChar_ptr(n_base, base, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlBuildURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_base); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCanonicPath(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * path; /* the resource locator in a filesystem notation */ + int n_path; + + for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { + mem_base = xmlMemBlocks(); + path = gen_const_xmlChar_ptr(n_path, 0); + + ret_val = xmlCanonicPath(path); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_path, path, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCanonicPath", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_path); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCreateURI(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNormalizeURIPath(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + char * path; /* pointer to the path string */ + int n_path; + + for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) { + mem_base = xmlMemBlocks(); + path = gen_char_ptr(n_path, 0); + + ret_val = xmlNormalizeURIPath(path); + desret_int(ret_val); + call_tests++; + des_char_ptr(n_path, path, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNormalizeURIPath", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_path); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParseURI(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlURIPtr 1 +static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlParseURIReference(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlURIPtr uri; /* pointer to an URI structure */ + int n_uri; + char * str; /* the string to analyze */ + int n_str; + + for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { + for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { + mem_base = xmlMemBlocks(); + uri = gen_xmlURIPtr(n_uri, 0); + str = gen_const_char_ptr(n_str, 1); + + ret_val = xmlParseURIReference(uri, str); + desret_int(ret_val); + call_tests++; + des_xmlURIPtr(n_uri, uri, 0); + des_const_char_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParseURIReference", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_uri); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlPrintURI(void) { + int test_ret = 0; + + int mem_base; + FILE * stream; /* a FILE* for the output */ + int n_stream; + xmlURIPtr uri; /* pointer to an xmlURI */ + int n_uri; + + for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) { + for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { + mem_base = xmlMemBlocks(); + stream = gen_FILE_ptr(n_stream, 0); + uri = gen_xmlURIPtr(n_uri, 1); + + xmlPrintURI(stream, uri); + call_tests++; + des_FILE_ptr(n_stream, stream, 0); + des_xmlURIPtr(n_uri, uri, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPrintURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_stream); + printf(" %d", n_uri); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSaveUri(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlURIPtr uri; /* pointer to an xmlURI */ + int n_uri; + + for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) { + mem_base = xmlMemBlocks(); + uri = gen_xmlURIPtr(n_uri, 0); + + ret_val = xmlSaveUri(uri); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlURIPtr(n_uri, uri, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveUri", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_uri); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlURIEscape(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * str; /* the string of the URI to escape */ + int n_str; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + + ret_val = xmlURIEscape(str); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlURIEscape", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlURIEscapeStr(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * str; /* string to escape */ + int n_str; + xmlChar * list; /* exception list string of chars not to escape */ + int n_list; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + list = gen_const_xmlChar_ptr(n_list, 1); + + ret_val = xmlURIEscapeStr(str, list); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_const_xmlChar_ptr(n_list, list, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlURIEscapeStr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_list); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlURIUnescapeString(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_uri(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n"); + test_ret += test_xmlBuildRelativeURI(); + test_ret += test_xmlBuildURI(); + test_ret += test_xmlCanonicPath(); + test_ret += test_xmlCreateURI(); + test_ret += test_xmlNormalizeURIPath(); + test_ret += test_xmlParseURI(); + test_ret += test_xmlParseURIReference(); + test_ret += test_xmlPrintURI(); + test_ret += test_xmlSaveUri(); + test_ret += test_xmlURIEscape(); + test_ret += test_xmlURIEscapeStr(); + test_ret += test_xmlURIUnescapeString(); + + if (test_ret != 0) + printf("Module uri: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlAddAttributeDecl(void) { + int test_ret = 0; + + int mem_base; + xmlAttributePtr ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDtdPtr dtd; /* pointer to the DTD */ + int n_dtd; + xmlChar * elem; /* the element name */ + int n_elem; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * ns; /* the attribute namespace prefix */ + int n_ns; + xmlAttributeType type; /* the attribute type */ + int n_type; + xmlAttributeDefault def; /* the attribute default type */ + int n_def; + xmlChar * defaultValue; /* the attribute default value */ + int n_defaultValue; + xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */ + int n_tree; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { + for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) { + for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) { + for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) { + for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + dtd = gen_xmlDtdPtr(n_dtd, 1); + elem = gen_const_xmlChar_ptr(n_elem, 2); + name = gen_const_xmlChar_ptr(n_name, 3); + ns = gen_const_xmlChar_ptr(n_ns, 4); + type = gen_xmlAttributeType(n_type, 5); + def = gen_xmlAttributeDefault(n_def, 6); + defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7); + tree = gen_xmlEnumerationPtr(n_tree, 8); + + ret_val = xmlAddAttributeDecl(ctxt, dtd, elem, name, ns, type, def, defaultValue, tree); + desret_xmlAttributePtr(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDtdPtr(n_dtd, dtd, 1); + des_const_xmlChar_ptr(n_elem, elem, 2); + des_const_xmlChar_ptr(n_name, name, 3); + des_const_xmlChar_ptr(n_ns, ns, 4); + des_xmlAttributeType(n_type, type, 5); + des_xmlAttributeDefault(n_def, def, 6); + des_const_xmlChar_ptr(n_defaultValue, defaultValue, 7); + des_xmlEnumerationPtr(n_tree, tree, 8); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddAttributeDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_dtd); + printf(" %d", n_elem); + printf(" %d", n_name); + printf(" %d", n_ns); + printf(" %d", n_type); + printf(" %d", n_def); + printf(" %d", n_defaultValue); + printf(" %d", n_tree); + printf("\n"); + } + } + } + } + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddElementDecl(void) { + int test_ret = 0; + + int mem_base; + xmlElementPtr ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDtdPtr dtd; /* pointer to the DTD */ + int n_dtd; + xmlChar * name; /* the entity name */ + int n_name; + xmlElementTypeVal type; /* the element type */ + int n_type; + xmlElementContentPtr content; /* the element content tree or NULL */ + int n_content; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) { + for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + dtd = gen_xmlDtdPtr(n_dtd, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + type = gen_xmlElementTypeVal(n_type, 3); + content = gen_xmlElementContentPtr(n_content, 4); + + ret_val = xmlAddElementDecl(ctxt, dtd, name, type, content); + desret_xmlElementPtr(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDtdPtr(n_dtd, dtd, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_xmlElementTypeVal(n_type, type, 3); + des_xmlElementContentPtr(n_content, content, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAddElementDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_dtd); + printf(" %d", n_name); + printf(" %d", n_type); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlAddID(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAddNotationDecl(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAddRef(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlAttributeTablePtr 1 +static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCopyAttributeTable(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlCopyElementContent(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlElementTablePtr 1 +static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCopyElementTable(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlCopyEnumeration(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlNotationTablePtr 1 +static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCopyNotationTable(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlCreateEnumeration(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +#define gen_nb_xmlAttributePtr 1 +static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlDumpAttributeDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlAttributePtr attr; /* An attribute declaration */ + int n_attr; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + attr = gen_xmlAttributePtr(n_attr, 1); + + xmlDumpAttributeDecl(buf, attr); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlAttributePtr(n_attr, attr, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpAttributeDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_attr); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDumpAttributeTable(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlAttributeTablePtr table; /* An attribute table */ + int n_table; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + table = gen_xmlAttributeTablePtr(n_table, 1); + + xmlDumpAttributeTable(buf, table); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlAttributeTablePtr(n_table, table, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpAttributeTable", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_table); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_xmlElementPtr 1 +static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlDumpElementDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlElementPtr elem; /* An element table */ + int n_elem; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + elem = gen_xmlElementPtr(n_elem, 1); + + xmlDumpElementDecl(buf, elem); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlElementPtr(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpElementDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDumpElementTable(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlElementTablePtr table; /* An element table */ + int n_table; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + table = gen_xmlElementTablePtr(n_table, 1); + + xmlDumpElementTable(buf, table); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlElementTablePtr(n_table, table, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpElementTable", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_table); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_xmlNotationPtr 1 +static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlDumpNotationDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlNotationPtr nota; /* A notation declaration */ + int n_nota; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + nota = gen_xmlNotationPtr(n_nota, 1); + + xmlDumpNotationDecl(buf, nota); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlNotationPtr(n_nota, nota, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpNotationDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_nota); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlDumpNotationTable(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlBufferPtr buf; /* the XML buffer output */ + int n_buf; + xmlNotationTablePtr table; /* A notation table */ + int n_table; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + table = gen_xmlNotationTablePtr(n_table, 1); + + xmlDumpNotationTable(buf, table); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_xmlNotationTablePtr(n_table, table, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlDumpNotationTable", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_table); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlGetDtdAttrDesc(void) { + int test_ret = 0; + + int mem_base; + xmlAttributePtr ret_val; + xmlDtdPtr dtd; /* a pointer to the DtD to search */ + int n_dtd; + xmlChar * elem; /* the element name */ + int n_elem; + xmlChar * name; /* the attribute name */ + int n_name; + + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + dtd = gen_xmlDtdPtr(n_dtd, 0); + elem = gen_const_xmlChar_ptr(n_elem, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + + ret_val = xmlGetDtdAttrDesc(dtd, elem, name); + desret_xmlAttributePtr(ret_val); + call_tests++; + des_xmlDtdPtr(n_dtd, dtd, 0); + des_const_xmlChar_ptr(n_elem, elem, 1); + des_const_xmlChar_ptr(n_name, name, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDtdAttrDesc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dtd); + printf(" %d", n_elem); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDtdElementDesc(void) { + int test_ret = 0; + + int mem_base; + xmlElementPtr ret_val; + xmlDtdPtr dtd; /* a pointer to the DtD to search */ + int n_dtd; + xmlChar * name; /* the element name */ + int n_name; + + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + dtd = gen_xmlDtdPtr(n_dtd, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlGetDtdElementDesc(dtd, name); + desret_xmlElementPtr(ret_val); + call_tests++; + des_xmlDtdPtr(n_dtd, dtd, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDtdElementDesc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dtd); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDtdNotationDesc(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlGetDtdQAttrDesc(void) { + int test_ret = 0; + + int mem_base; + xmlAttributePtr ret_val; + xmlDtdPtr dtd; /* a pointer to the DtD to search */ + int n_dtd; + xmlChar * elem; /* the element name */ + int n_elem; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * prefix; /* the attribute namespace prefix */ + int n_prefix; + + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + dtd = gen_xmlDtdPtr(n_dtd, 0); + elem = gen_const_xmlChar_ptr(n_elem, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + prefix = gen_const_xmlChar_ptr(n_prefix, 3); + + ret_val = xmlGetDtdQAttrDesc(dtd, elem, name, prefix); + desret_xmlAttributePtr(ret_val); + call_tests++; + des_xmlDtdPtr(n_dtd, dtd, 0); + des_const_xmlChar_ptr(n_elem, elem, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_prefix, prefix, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDtdQAttrDesc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dtd); + printf(" %d", n_elem); + printf(" %d", n_name); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetDtdQElementDesc(void) { + int test_ret = 0; + + int mem_base; + xmlElementPtr ret_val; + xmlDtdPtr dtd; /* a pointer to the DtD to search */ + int n_dtd; + xmlChar * name; /* the element name */ + int n_name; + xmlChar * prefix; /* the element namespace prefix */ + int n_prefix; + + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + dtd = gen_xmlDtdPtr(n_dtd, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + prefix = gen_const_xmlChar_ptr(n_prefix, 2); + + ret_val = xmlGetDtdQElementDesc(dtd, name, prefix); + desret_xmlElementPtr(ret_val); + call_tests++; + des_xmlDtdPtr(n_dtd, dtd, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_prefix, prefix, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetDtdQElementDesc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_dtd); + printf(" %d", n_name); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetID(void) { + int test_ret = 0; + + int mem_base; + xmlAttrPtr ret_val; + xmlDocPtr doc; /* pointer to the document */ + int n_doc; + xmlChar * ID; /* the ID value */ + int n_ID; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + ID = gen_const_xmlChar_ptr(n_ID, 1); + + ret_val = xmlGetID(doc, ID); + desret_xmlAttrPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_ID, ID, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetID", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_ID); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetRefs(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlIsID(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr elem; /* the element carrying the attribute */ + int n_elem; + xmlAttrPtr attr; /* the attribute */ + int n_attr; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + elem = gen_xmlNodePtr(n_elem, 1); + attr = gen_xmlAttrPtr(n_attr, 2); + + ret_val = xmlIsID(doc, elem, attr); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_elem, elem, 1); + des_xmlAttrPtr(n_attr, attr, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsID", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_attr); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsMixedElement(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * name; /* the element name */ + int n_name; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlIsMixedElement(doc, name); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsMixedElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIsRef(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr elem; /* the element carrying the attribute */ + int n_elem; + xmlAttrPtr attr; /* the attribute */ + int n_attr; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + elem = gen_xmlNodePtr(n_elem, 1); + attr = gen_xmlAttrPtr(n_attr, 2); + + ret_val = xmlIsRef(doc, elem, attr); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_elem, elem, 1); + des_xmlAttrPtr(n_attr, attr, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIsRef", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_attr); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNewElementContent(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlNewValidCtxt(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRemoveID(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlAttrPtr attr; /* the attribute */ + int n_attr; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + attr = gen_xmlAttrPtr(n_attr, 1); + + ret_val = xmlRemoveID(doc, attr); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlAttrPtr(n_attr, attr, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRemoveID", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_attr); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlRemoveRef(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlAttrPtr attr; /* the attribute */ + int n_attr; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + attr = gen_xmlAttrPtr(n_attr, 1); + + ret_val = xmlRemoveRef(doc, attr); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlAttrPtr(n_attr, attr, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRemoveRef", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_attr); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSnprintfElementContent(void) { + int test_ret = 0; + + int mem_base; + char * buf; /* an output buffer */ + int n_buf; + int size; /* the buffer size */ + int n_size; + xmlElementContentPtr content; /* An element table */ + int n_content; + int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */ + int n_glob; + + for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { + for (n_glob = 0;n_glob < gen_nb_int;n_glob++) { + mem_base = xmlMemBlocks(); + buf = gen_char_ptr(n_buf, 0); + size = gen_int(n_size, 1); + content = gen_xmlElementContentPtr(n_content, 2); + glob = gen_int(n_glob, 3); + + xmlSnprintfElementContent(buf, size, content, glob); + call_tests++; + des_char_ptr(n_buf, buf, 0); + des_int(n_size, size, 1); + des_xmlElementContentPtr(n_content, content, 2); + des_int(n_glob, glob, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSnprintfElementContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_size); + printf(" %d", n_content); + printf(" %d", n_glob); + printf("\n"); + } + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSprintfElementContent(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + char * buf; /* an output buffer */ + int n_buf; + xmlElementContentPtr content; /* An element table */ + int n_content; + int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */ + int n_glob; + + for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) { + for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) { + for (n_glob = 0;n_glob < gen_nb_int;n_glob++) { + mem_base = xmlMemBlocks(); + buf = gen_char_ptr(n_buf, 0); + content = gen_xmlElementContentPtr(n_content, 1); + glob = gen_int(n_glob, 2); + + xmlSprintfElementContent(buf, content, glob); + call_tests++; + des_char_ptr(n_buf, buf, 0); + des_xmlElementContentPtr(n_content, content, 1); + des_int(n_glob, glob, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSprintfElementContent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_content); + printf(" %d", n_glob); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidBuildContentModel(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* a validation context */ + int n_ctxt; + xmlElementPtr elem; /* an element declaration node */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + elem = gen_xmlElementPtr(n_elem, 1); + + ret_val = xmlValidBuildContentModel(ctxt, elem); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlElementPtr(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidBuildContentModel", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidCtxtNormalizeAttributeValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + xmlChar * ret_val; + xmlValidCtxtPtr ctxt; /* the validation context or NULL */ + int n_ctxt; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr elem; /* the parent */ + int n_elem; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * value; /* the attribute value */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + name = gen_const_xmlChar_ptr(n_name, 3); + value = gen_const_xmlChar_ptr(n_value, 4); + + ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, name, value); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + des_const_xmlChar_ptr(n_name, name, 3); + des_const_xmlChar_ptr(n_value, value, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +#define gen_nb_xmlElementContent_ptr 1 +static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlValidGetPotentialChildren(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlElementContent * ctree; /* an element content tree */ + int n_ctree; + xmlChar ** list; /* an array to store the list of child names */ + int n_list; + int * len; /* a pointer to the number of element in the list */ + int n_len; + int max; /* the size of the array */ + int n_max; + + for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) { + for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) { + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + for (n_max = 0;n_max < gen_nb_int;n_max++) { + mem_base = xmlMemBlocks(); + ctree = gen_xmlElementContent_ptr(n_ctree, 0); + list = gen_const_xmlChar_ptr_ptr(n_list, 1); + len = gen_int_ptr(n_len, 2); + max = gen_int(n_max, 3); + + ret_val = xmlValidGetPotentialChildren(ctree, list, len, max); + desret_int(ret_val); + call_tests++; + des_xmlElementContent_ptr(n_ctree, ctree, 0); + des_const_xmlChar_ptr_ptr(n_list, list, 1); + des_int_ptr(n_len, len, 2); + des_int(n_max, max, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidGetPotentialChildren", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctree); + printf(" %d", n_list); + printf(" %d", n_len); + printf(" %d", n_max); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidGetValidElements(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlNode * prev; /* an element to insert after */ + int n_prev; + xmlNode * next; /* an element to insert next */ + int n_next; + xmlChar ** names; /* an array to store the list of child names */ + int n_names; + int max; /* the size of the array */ + int n_max; + + for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) { + for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) { + for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) { + for (n_max = 0;n_max < gen_nb_int;n_max++) { + mem_base = xmlMemBlocks(); + prev = gen_xmlNodePtr(n_prev, 0); + next = gen_xmlNodePtr(n_next, 1); + names = gen_const_xmlChar_ptr_ptr(n_names, 2); + max = gen_int(n_max, 3); + + ret_val = xmlValidGetValidElements(prev, next, names, max); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_prev, prev, 0); + des_xmlNodePtr(n_next, next, 1); + des_const_xmlChar_ptr_ptr(n_names, names, 2); + des_int(n_max, max, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidGetValidElements", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_prev); + printf(" %d", n_next); + printf(" %d", n_names); + printf(" %d", n_max); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidNormalizeAttributeValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + xmlChar * ret_val; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlNodePtr elem; /* the parent */ + int n_elem; + xmlChar * name; /* the attribute name */ + int n_name; + xmlChar * value; /* the attribute value */ + int n_value; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + elem = gen_xmlNodePtr(n_elem, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + value = gen_const_xmlChar_ptr(n_value, 3); + + ret_val = xmlValidNormalizeAttributeValue(doc, elem, name, value); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_elem, elem, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_value, value, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateAttributeDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlAttributePtr attr; /* an attribute definition */ + int n_attr; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + attr = gen_xmlAttributePtr(n_attr, 2); + + ret_val = xmlValidateAttributeDecl(ctxt, doc, attr); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlAttributePtr(n_attr, attr, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateAttributeDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_attr); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateAttributeValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlAttributeType type; /* an attribute type */ + int n_type; + xmlChar * value; /* an attribute value */ + int n_value; + + for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + type = gen_xmlAttributeType(n_type, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + + ret_val = xmlValidateAttributeValue(type, value); + desret_int(ret_val); + call_tests++; + des_xmlAttributeType(n_type, type, 0); + des_const_xmlChar_ptr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateAttributeValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlValidateDocument(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateDocumentFinal(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlValidateDocumentFinal(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateDocumentFinal", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateDtd(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlDtdPtr dtd; /* a dtd instance */ + int n_dtd; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + dtd = gen_xmlDtdPtr(n_dtd, 2); + + ret_val = xmlValidateDtd(ctxt, doc, dtd); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlDtdPtr(n_dtd, dtd, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateDtd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_dtd); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateDtdFinal(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlValidateDtdFinal(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateDtdFinal", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateElement(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + + ret_val = xmlValidateElement(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateElementDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlElementPtr elem; /* an element definition */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlElementPtr(n_elem, 2); + + ret_val = xmlValidateElementDecl(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlElementPtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateElementDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNameValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* an Name value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlValidateNameValue(value); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNameValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNamesValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* an Names value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlValidateNamesValue(value); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNamesValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNmtokenValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* an Nmtoken value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlValidateNmtokenValue(value); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNmtokenValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNmtokensValue(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlChar * value; /* an Nmtokens value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlValidateNmtokensValue(value); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNmtokensValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNotationDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNotationPtr nota; /* a notation definition */ + int n_nota; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + nota = gen_xmlNotationPtr(n_nota, 2); + + ret_val = xmlValidateNotationDecl(ctxt, doc, nota); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNotationPtr(n_nota, nota, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNotationDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_nota); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateNotationUse(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* the document */ + int n_doc; + xmlChar * notationName; /* the notation name to check */ + int n_notationName; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + notationName = gen_const_xmlChar_ptr(n_notationName, 2); + + ret_val = xmlValidateNotationUse(ctxt, doc, notationName); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_const_xmlChar_ptr(n_notationName, notationName, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateNotationUse", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_notationName); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateOneAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + xmlAttrPtr attr; /* an attribute instance */ + int n_attr; + xmlChar * value; /* the attribute value (without entities processing) */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + attr = gen_xmlAttrPtr(n_attr, 3); + value = gen_const_xmlChar_ptr(n_value, 4); + + ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, value); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + des_xmlAttrPtr(n_attr, attr, 3); + des_const_xmlChar_ptr(n_value, value, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateOneAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_attr); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateOneElement(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + + ret_val = xmlValidateOneElement(ctxt, doc, elem); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateOneElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateOneNamespace(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + xmlChar * prefix; /* the namespace prefix */ + int n_prefix; + xmlNsPtr ns; /* an namespace declaration instance */ + int n_ns; + xmlChar * value; /* the attribute value (without entities processing) */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + prefix = gen_const_xmlChar_ptr(n_prefix, 3); + ns = gen_xmlNsPtr(n_ns, 4); + value = gen_const_xmlChar_ptr(n_value, 5); + + ret_val = xmlValidateOneNamespace(ctxt, doc, elem, prefix, ns, value); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + des_const_xmlChar_ptr(n_prefix, prefix, 3); + des_xmlNsPtr(n_ns, ns, 4); + des_const_xmlChar_ptr(n_value, value, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateOneNamespace", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_prefix); + printf(" %d", n_ns); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidatePopElement(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + xmlChar * qname; /* the qualified name as appearing in the serialization */ + int n_qname; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + qname = gen_const_xmlChar_ptr(n_qname, 3); + + ret_val = xmlValidatePopElement(ctxt, doc, elem, qname); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + des_const_xmlChar_ptr(n_qname, qname, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidatePopElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_qname); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidatePushCData(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlChar * data; /* some character data read */ + int n_data; + int len; /* the lenght of the data */ + int n_len; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + data = gen_const_xmlChar_ptr(n_data, 1); + len = gen_int(n_len, 2); + + ret_val = xmlValidatePushCData(ctxt, data, len); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_data, data, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidatePushCData", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_data); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidatePushElement(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + xmlNodePtr elem; /* an element instance */ + int n_elem; + xmlChar * qname; /* the qualified name as appearing in the serialization */ + int n_qname; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + elem = gen_xmlNodePtr(n_elem, 2); + qname = gen_const_xmlChar_ptr(n_qname, 3); + + ret_val = xmlValidatePushElement(ctxt, doc, elem, qname); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + des_xmlNodePtr(n_elem, elem, 2); + des_const_xmlChar_ptr(n_qname, qname, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidatePushElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf(" %d", n_elem); + printf(" %d", n_qname); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlValidateRoot(void) { + int test_ret = 0; + +#ifdef LIBXML_VALID_ENABLED + int mem_base; + int ret_val; + xmlValidCtxtPtr ctxt; /* the validation context */ + int n_ctxt; + xmlDocPtr doc; /* a document instance */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlValidateRoot(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlValidateRoot", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_valid(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing valid : 46 of 67 functions ...\n"); + test_ret += test_xmlAddAttributeDecl(); + test_ret += test_xmlAddElementDecl(); + test_ret += test_xmlAddID(); + test_ret += test_xmlAddNotationDecl(); + test_ret += test_xmlAddRef(); + test_ret += test_xmlCopyAttributeTable(); + test_ret += test_xmlCopyElementContent(); + test_ret += test_xmlCopyElementTable(); + test_ret += test_xmlCopyEnumeration(); + test_ret += test_xmlCopyNotationTable(); + test_ret += test_xmlCreateEnumeration(); + test_ret += test_xmlDumpAttributeDecl(); + test_ret += test_xmlDumpAttributeTable(); + test_ret += test_xmlDumpElementDecl(); + test_ret += test_xmlDumpElementTable(); + test_ret += test_xmlDumpNotationDecl(); + test_ret += test_xmlDumpNotationTable(); + test_ret += test_xmlGetDtdAttrDesc(); + test_ret += test_xmlGetDtdElementDesc(); + test_ret += test_xmlGetDtdNotationDesc(); + test_ret += test_xmlGetDtdQAttrDesc(); + test_ret += test_xmlGetDtdQElementDesc(); + test_ret += test_xmlGetID(); + test_ret += test_xmlGetRefs(); + test_ret += test_xmlIsID(); + test_ret += test_xmlIsMixedElement(); + test_ret += test_xmlIsRef(); + test_ret += test_xmlNewElementContent(); + test_ret += test_xmlNewValidCtxt(); + test_ret += test_xmlRemoveID(); + test_ret += test_xmlRemoveRef(); + test_ret += test_xmlSnprintfElementContent(); + test_ret += test_xmlSprintfElementContent(); + test_ret += test_xmlValidBuildContentModel(); + test_ret += test_xmlValidCtxtNormalizeAttributeValue(); + test_ret += test_xmlValidGetPotentialChildren(); + test_ret += test_xmlValidGetValidElements(); + test_ret += test_xmlValidNormalizeAttributeValue(); + test_ret += test_xmlValidateAttributeDecl(); + test_ret += test_xmlValidateAttributeValue(); + test_ret += test_xmlValidateDocument(); + test_ret += test_xmlValidateDocumentFinal(); + test_ret += test_xmlValidateDtd(); + test_ret += test_xmlValidateDtdFinal(); + test_ret += test_xmlValidateElement(); + test_ret += test_xmlValidateElementDecl(); + test_ret += test_xmlValidateNameValue(); + test_ret += test_xmlValidateNamesValue(); + test_ret += test_xmlValidateNmtokenValue(); + test_ret += test_xmlValidateNmtokensValue(); + test_ret += test_xmlValidateNotationDecl(); + test_ret += test_xmlValidateNotationUse(); + test_ret += test_xmlValidateOneAttribute(); + test_ret += test_xmlValidateOneElement(); + test_ret += test_xmlValidateOneNamespace(); + test_ret += test_xmlValidatePopElement(); + test_ret += test_xmlValidatePushCData(); + test_ret += test_xmlValidatePushElement(); + test_ret += test_xmlValidateRoot(); + + if (test_ret != 0) + printf("Module valid: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlXIncludeNewContext(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXIncludeProcess(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* an XML document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlXIncludeProcess(doc); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcess", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXIncludeProcessFlags(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlDocPtr doc; /* an XML document */ + int n_doc; + int flags; /* a set of xmlParserOption used for parsing XML includes */ + int n_flags; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + flags = gen_int(n_flags, 1); + + ret_val = xmlXIncludeProcessFlags(doc, flags); + desret_int(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_int(n_flags, flags, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessFlags", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_flags); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_XINCLUDE_ENABLED + +#define gen_nb_xmlXIncludeCtxtPtr 1 +static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlXIncludeProcessNode(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */ + int n_ctxt; + xmlNodePtr node; /* a node in an XML document */ + int n_node; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlXIncludeProcessNode(ctxt, node); + desret_int(ret_val); + call_tests++; + des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXIncludeProcessTree(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlNodePtr tree; /* a node in an XML document */ + int n_tree; + + for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { + mem_base = xmlMemBlocks(); + tree = gen_xmlNodePtr(n_tree, 0); + + ret_val = xmlXIncludeProcessTree(tree); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_tree, tree, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessTree", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_tree); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXIncludeProcessTreeFlags(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlNodePtr tree; /* a node in an XML document */ + int n_tree; + int flags; /* a set of xmlParserOption used for parsing XML includes */ + int n_flags; + + for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + mem_base = xmlMemBlocks(); + tree = gen_xmlNodePtr(n_tree, 0); + flags = gen_int(n_flags, 1); + + ret_val = xmlXIncludeProcessTreeFlags(tree, flags); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_tree, tree, 0); + des_int(n_flags, flags, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_tree); + printf(" %d", n_flags); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXIncludeSetFlags(void) { + int test_ret = 0; + +#ifdef LIBXML_XINCLUDE_ENABLED + int mem_base; + int ret_val; + xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */ + int n_ctxt; + int flags; /* a set of xmlParserOption used for parsing XML includes */ + int n_flags; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) { + for (n_flags = 0;n_flags < gen_nb_int;n_flags++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0); + flags = gen_int(n_flags, 1); + + ret_val = xmlXIncludeSetFlags(ctxt, flags); + desret_int(ret_val); + call_tests++; + des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0); + des_int(n_flags, flags, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXIncludeSetFlags", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_flags); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xinclude(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n"); + test_ret += test_xmlXIncludeNewContext(); + test_ret += test_xmlXIncludeProcess(); + test_ret += test_xmlXIncludeProcessFlags(); + test_ret += test_xmlXIncludeProcessNode(); + test_ret += test_xmlXIncludeProcessTree(); + test_ret += test_xmlXIncludeProcessTreeFlags(); + test_ret += test_xmlXIncludeSetFlags(); + + if (test_ret != 0) + printf("Module xinclude: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlAllocOutputBuffer(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr ret_val; + xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ + int n_encoder; + + for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { + mem_base = xmlMemBlocks(); + encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0); + + ret_val = xmlAllocOutputBuffer(encoder); + desret_xmlOutputBufferPtr(ret_val); + call_tests++; + des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAllocOutputBuffer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_encoder); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlAllocParserInputBuffer(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + enc = gen_xmlCharEncoding(n_enc, 0); + + ret_val = xmlAllocParserInputBuffer(enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_xmlCharEncoding(n_enc, enc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAllocParserInputBuffer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_enc); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCheckFilename(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + char * path; /* the path to check */ + int n_path; + + for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) { + mem_base = xmlMemBlocks(); + path = gen_const_char_ptr(n_path, 0); + + ret_val = xmlCheckFilename(path); + desret_int(ret_val); + call_tests++; + des_const_char_ptr(n_path, path, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCheckFilename", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_path); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCheckHTTPInput(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + xmlParserCtxtPtr ctxt; /* an XML parser context */ + int n_ctxt; + xmlParserInputPtr ret; /* an XML parser input */ + int n_ret; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + ret = gen_xmlParserInputPtr(n_ret, 1); + + ret_val = xmlCheckHTTPInput(ctxt, ret); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputPtr(n_ret, ret, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCheckHTTPInput", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_ret); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCleanupInputCallbacks(void) { + int test_ret = 0; + + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlCleanupInputCallbacks(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCleanupInputCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCleanupOutputCallbacks(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlCleanupOutputCallbacks(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCleanupOutputCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlFileClose(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + + ret_val = xmlFileClose(context); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlFileClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlFileMatch(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlFileMatch(filename); + desret_int(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlFileMatch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlFileOpen(void) { + int test_ret = 0; + + int mem_base; + void * ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlFileOpen(filename); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlFileOpen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlFileRead(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + char * buffer; /* where to drop data */ + int n_buffer; + int len; /* number of bytes to write */ + int n_len; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + buffer = gen_char_ptr(n_buffer, 1); + len = gen_int(n_len, 2); + + ret_val = xmlFileRead(context, buffer, len); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + des_char_ptr(n_buffer, buffer, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlFileRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf(" %d", n_buffer); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlIOFTPClose(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + + ret_val = xmlIOFTPClose(context); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOFTPClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOFTPMatch(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlIOFTPMatch(filename); + desret_int(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOFTPMatch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOFTPOpen(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + void * ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlIOFTPOpen(filename); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOFTPOpen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOFTPRead(void) { + int test_ret = 0; + +#ifdef LIBXML_FTP_ENABLED + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + char * buffer; /* where to drop data */ + int n_buffer; + int len; /* number of bytes to write */ + int n_len; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + buffer = gen_char_ptr(n_buffer, 1); + len = gen_int(n_len, 2); + + ret_val = xmlIOFTPRead(context, buffer, len); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + des_char_ptr(n_buffer, buffer, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOFTPRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf(" %d", n_buffer); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOHTTPClose(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + + ret_val = xmlIOHTTPClose(context); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOHTTPClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOHTTPMatch(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlIOHTTPMatch(filename); + desret_int(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOHTTPMatch", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOHTTPOpen(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + void * ret_val; + const char * filename; /* the URI for matching */ + int n_filename; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + + ret_val = xmlIOHTTPOpen(filename); + desret_void_ptr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOHTTPOpen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlIOHTTPOpenW(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlIOHTTPRead(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + int ret_val; + void * context; /* the I/O context */ + int n_context; + char * buffer; /* where to drop data */ + int n_buffer; + int len; /* number of bytes to write */ + int n_len; + + for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) { + for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + context = gen_void_ptr(n_context, 0); + buffer = gen_char_ptr(n_buffer, 1); + len = gen_int(n_len, 2); + + ret_val = xmlIOHTTPRead(context, buffer, len); + desret_int(ret_val); + call_tests++; + des_void_ptr(n_context, context, 0); + des_char_ptr(n_buffer, buffer, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlIOHTTPRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_context); + printf(" %d", n_buffer); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNoNetExternalEntityLoader(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr ret_val; + const char * URL; /* the URL for the entity to load */ + int n_URL; + char * ID; /* the System ID for the entity to load */ + int n_ID; + xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */ + int n_ctxt; + + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + URL = gen_filepath(n_URL, 0); + ID = gen_const_char_ptr(n_ID, 1); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2); + + ret_val = xmlNoNetExternalEntityLoader(URL, ID, ctxt); + desret_xmlParserInputPtr(ret_val); + call_tests++; + des_filepath(n_URL, URL, 0); + des_const_char_ptr(n_ID, ID, 1); + des_xmlParserCtxtPtr(n_ctxt, ctxt, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf(" %d", n_ID); + printf(" %d", n_ctxt); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlNormalizeWindowsPath(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * path; /* the input file path */ + int n_path; + + for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) { + mem_base = xmlMemBlocks(); + path = gen_const_xmlChar_ptr(n_path, 0); + + ret_val = xmlNormalizeWindowsPath(path); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_path, path, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNormalizeWindowsPath", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_path); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlOutputBufferCreateFd(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr ret_val; + int fd; /* a file descriptor number */ + int n_fd; + xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ + int n_encoder; + + for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { + for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { + mem_base = xmlMemBlocks(); + fd = gen_int(n_fd, 0); + encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); + + ret_val = xmlOutputBufferCreateFd(fd, encoder); + desret_xmlOutputBufferPtr(ret_val); + call_tests++; + des_int(n_fd, fd, 0); + des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferCreateFd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_fd); + printf(" %d", n_encoder); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlOutputBufferCreateFile(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr ret_val; + FILE * file; /* a FILE* */ + int n_file; + xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ + int n_encoder; + + for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) { + for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { + mem_base = xmlMemBlocks(); + file = gen_FILE_ptr(n_file, 0); + encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); + + ret_val = xmlOutputBufferCreateFile(file, encoder); + desret_xmlOutputBufferPtr(ret_val); + call_tests++; + des_FILE_ptr(n_file, file, 0); + des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferCreateFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_file); + printf(" %d", n_encoder); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlOutputBufferCreateFilename(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + xmlOutputBufferPtr ret_val; + const char * URI; /* a C string containing the URI or filename */ + int n_URI; + xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */ + int n_encoder; + int compression; /* the compression ration (0 none, 9 max). */ + int n_compression; + + for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) { + for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + URI = gen_fileoutput(n_URI, 0); + encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1); + compression = gen_int(n_compression, 2); + + ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression); + desret_xmlOutputBufferPtr(ret_val); + call_tests++; + des_fileoutput(n_URI, URI, 0); + des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1); + des_int(n_compression, compression, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferCreateFilename", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_encoder); + printf(" %d", n_compression); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlOutputBufferFlush(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlOutputBufferPtr out; /* a buffered output */ + int n_out; + + for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { + mem_base = xmlMemBlocks(); + out = gen_xmlOutputBufferPtr(n_out, 0); + + ret_val = xmlOutputBufferFlush(out); + desret_int(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_out, out, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferFlush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlOutputBufferWrite(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlOutputBufferPtr out; /* a buffered parser output */ + int n_out; + int len; /* the size in bytes of the array. */ + int n_len; + char * buf; /* an char array */ + int n_buf; + + for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) { + mem_base = xmlMemBlocks(); + out = gen_xmlOutputBufferPtr(n_out, 0); + len = gen_int(n_len, 1); + buf = gen_const_char_ptr(n_buf, 2); + + ret_val = xmlOutputBufferWrite(out, len, buf); + desret_int(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_out, out, 0); + des_int(n_len, len, 1); + des_const_char_ptr(n_buf, buf, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferWrite", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_len); + printf(" %d", n_buf); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlOutputBufferWriteEscape(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlOutputBufferWriteString(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlOutputBufferPtr out; /* a buffered parser output */ + int n_out; + char * str; /* a zero terminated C string */ + int n_str; + + for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { + for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) { + mem_base = xmlMemBlocks(); + out = gen_xmlOutputBufferPtr(n_out, 0); + str = gen_const_char_ptr(n_str, 1); + + ret_val = xmlOutputBufferWriteString(out, str); + desret_int(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_out, out, 0); + des_const_char_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlOutputBufferWriteString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlParserGetDirectory(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParserInputBufferCreateFd(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + int fd; /* a file descriptor number */ + int n_fd; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_fd = 0;n_fd < gen_nb_int;n_fd++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + fd = gen_int(n_fd, 0); + enc = gen_xmlCharEncoding(n_enc, 1); + if (fd >= 0) fd = -1; + + ret_val = xmlParserInputBufferCreateFd(fd, enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_int(n_fd, fd, 0); + des_xmlCharEncoding(n_enc, enc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferCreateFd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_fd); + printf(" %d", n_enc); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferCreateFile(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + FILE * file; /* a FILE* */ + int n_file; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + file = gen_FILE_ptr(n_file, 0); + enc = gen_xmlCharEncoding(n_enc, 1); + + ret_val = xmlParserInputBufferCreateFile(file, enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_FILE_ptr(n_file, file, 0); + des_xmlCharEncoding(n_enc, enc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferCreateFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_file); + printf(" %d", n_enc); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferCreateFilename(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + const char * URI; /* a C string containing the URI or filename */ + int n_URI; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + URI = gen_fileoutput(n_URI, 0); + enc = gen_xmlCharEncoding(n_enc, 1); + + ret_val = xmlParserInputBufferCreateFilename(URI, enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_fileoutput(n_URI, URI, 0); + des_xmlCharEncoding(n_enc, enc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf(" %d", n_enc); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferCreateMem(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + char * mem; /* the memory input */ + int n_mem; + int size; /* the length of the memory block */ + int n_size; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + mem = gen_const_char_ptr(n_mem, 0); + size = gen_int(n_size, 1); + enc = gen_xmlCharEncoding(n_enc, 2); + + ret_val = xmlParserInputBufferCreateMem(mem, size, enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_const_char_ptr(n_mem, mem, 0); + des_int(n_size, size, 1); + des_xmlCharEncoding(n_enc, enc, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferCreateMem", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_mem); + printf(" %d", n_size); + printf(" %d", n_enc); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferCreateStatic(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputBufferPtr ret_val; + char * mem; /* the memory input */ + int n_mem; + int size; /* the length of the memory block */ + int n_size; + xmlCharEncoding enc; /* the charset encoding if known */ + int n_enc; + + for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + mem_base = xmlMemBlocks(); + mem = gen_const_char_ptr(n_mem, 0); + size = gen_int(n_size, 1); + enc = gen_xmlCharEncoding(n_enc, 2); + + ret_val = xmlParserInputBufferCreateStatic(mem, size, enc); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_const_char_ptr(n_mem, mem, 0); + des_int(n_size, size, 1); + des_xmlCharEncoding(n_enc, enc, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_mem); + printf(" %d", n_size); + printf(" %d", n_enc); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferGrow(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserInputBufferPtr in; /* a buffered parser input */ + int n_in; + int len; /* indicative value of the amount of chars to read */ + int n_len; + + for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputBufferPtr(n_in, 0); + len = gen_int(n_len, 1); + + ret_val = xmlParserInputBufferGrow(in, len); + desret_int(ret_val); + call_tests++; + des_xmlParserInputBufferPtr(n_in, in, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferGrow", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferPush(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserInputBufferPtr in; /* a buffered parser input */ + int n_in; + int len; /* the size in bytes of the array. */ + int n_len; + char * buf; /* an char array */ + int n_buf; + + for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputBufferPtr(n_in, 0); + len = gen_int(n_len, 1); + buf = gen_const_char_ptr(n_buf, 2); + + ret_val = xmlParserInputBufferPush(in, len, buf); + desret_int(ret_val); + call_tests++; + des_xmlParserInputBufferPtr(n_in, in, 0); + des_int(n_len, len, 1); + des_const_char_ptr(n_buf, buf, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferPush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf(" %d", n_buf); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserInputBufferRead(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlParserInputBufferPtr in; /* a buffered parser input */ + int n_in; + int len; /* indicative value of the amount of chars to read */ + int n_len; + + for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + in = gen_xmlParserInputBufferPtr(n_in, 0); + len = gen_int(n_len, 1); + + ret_val = xmlParserInputBufferRead(in, len); + desret_int(ret_val); + call_tests++; + des_xmlParserInputBufferPtr(n_in, in, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserInputBufferRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_in); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlPopInputCallbacks(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + + mem_base = xmlMemBlocks(); + + ret_val = xmlPopInputCallbacks(); + desret_int(ret_val); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlPopInputCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlRegisterDefaultInputCallbacks(void) { + int test_ret = 0; + + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlRegisterDefaultInputCallbacks(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlRegisterDefaultOutputCallbacks(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlRegisterDefaultOutputCallbacks(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRegisterHTTPPostCallbacks(void) { + int test_ret = 0; + +#ifdef LIBXML_HTTP_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlRegisterHTTPPostCallbacks(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlIO(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n"); + test_ret += test_xmlAllocOutputBuffer(); + test_ret += test_xmlAllocParserInputBuffer(); + test_ret += test_xmlCheckFilename(); + test_ret += test_xmlCheckHTTPInput(); + test_ret += test_xmlCleanupInputCallbacks(); + test_ret += test_xmlCleanupOutputCallbacks(); + test_ret += test_xmlFileClose(); + test_ret += test_xmlFileMatch(); + test_ret += test_xmlFileOpen(); + test_ret += test_xmlFileRead(); + test_ret += test_xmlIOFTPClose(); + test_ret += test_xmlIOFTPMatch(); + test_ret += test_xmlIOFTPOpen(); + test_ret += test_xmlIOFTPRead(); + test_ret += test_xmlIOHTTPClose(); + test_ret += test_xmlIOHTTPMatch(); + test_ret += test_xmlIOHTTPOpen(); + test_ret += test_xmlIOHTTPOpenW(); + test_ret += test_xmlIOHTTPRead(); + test_ret += test_xmlNoNetExternalEntityLoader(); + test_ret += test_xmlNormalizeWindowsPath(); + test_ret += test_xmlOutputBufferCreateFd(); + test_ret += test_xmlOutputBufferCreateFile(); + test_ret += test_xmlOutputBufferCreateFilename(); + test_ret += test_xmlOutputBufferFlush(); + test_ret += test_xmlOutputBufferWrite(); + test_ret += test_xmlOutputBufferWriteEscape(); + test_ret += test_xmlOutputBufferWriteString(); + test_ret += test_xmlParserGetDirectory(); + test_ret += test_xmlParserInputBufferCreateFd(); + test_ret += test_xmlParserInputBufferCreateFile(); + test_ret += test_xmlParserInputBufferCreateFilename(); + test_ret += test_xmlParserInputBufferCreateMem(); + test_ret += test_xmlParserInputBufferCreateStatic(); + test_ret += test_xmlParserInputBufferGrow(); + test_ret += test_xmlParserInputBufferPush(); + test_ret += test_xmlParserInputBufferRead(); + test_ret += test_xmlPopInputCallbacks(); + test_ret += test_xmlRegisterDefaultInputCallbacks(); + test_ret += test_xmlRegisterDefaultOutputCallbacks(); + test_ret += test_xmlRegisterHTTPPostCallbacks(); + + if (test_ret != 0) + printf("Module xmlIO: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_AUTOMATA_ENABLED + +#define gen_nb_xmlAutomataPtr 1 +static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlAutomataCompile(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataGetInitState(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataIsDeterminist(void) { + int test_ret = 0; + +#ifdef LIBXML_AUTOMATA_ENABLED + int mem_base; + int ret_val; + xmlAutomataPtr am; /* an automata */ + int n_am; + + for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { + mem_base = xmlMemBlocks(); + am = gen_xmlAutomataPtr(n_am, 0); + + ret_val = xmlAutomataIsDeterminist(am); + desret_int(ret_val); + call_tests++; + des_xmlAutomataPtr(n_am, am, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAutomataIsDeterminist", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_am); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_AUTOMATA_ENABLED + +#define gen_nb_xmlAutomataStatePtr 1 +static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlAutomataNewAllTrans(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewCountTrans(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewCountTrans2(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewCountedTrans(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewCounter(void) { + int test_ret = 0; + +#ifdef LIBXML_AUTOMATA_ENABLED + int mem_base; + int ret_val; + xmlAutomataPtr am; /* an automata */ + int n_am; + int min; /* the minimal value on the counter */ + int n_min; + int max; /* the maximal value on the counter */ + int n_max; + + for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { + for (n_min = 0;n_min < gen_nb_int;n_min++) { + for (n_max = 0;n_max < gen_nb_int;n_max++) { + mem_base = xmlMemBlocks(); + am = gen_xmlAutomataPtr(n_am, 0); + min = gen_int(n_min, 1); + max = gen_int(n_max, 2); + + ret_val = xmlAutomataNewCounter(am, min, max); + desret_int(ret_val); + call_tests++; + des_xmlAutomataPtr(n_am, am, 0); + des_int(n_min, min, 1); + des_int(n_max, max, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAutomataNewCounter", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_am); + printf(" %d", n_min); + printf(" %d", n_max); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlAutomataNewCounterTrans(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewEpsilon(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewOnceTrans(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewOnceTrans2(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewState(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewTransition(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataNewTransition2(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlAutomataSetFinalState(void) { + int test_ret = 0; + +#ifdef LIBXML_AUTOMATA_ENABLED + int mem_base; + int ret_val; + xmlAutomataPtr am; /* an automata */ + int n_am; + xmlAutomataStatePtr state; /* a state in this automata */ + int n_state; + + for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) { + for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) { + mem_base = xmlMemBlocks(); + am = gen_xmlAutomataPtr(n_am, 0); + state = gen_xmlAutomataStatePtr(n_state, 1); + + ret_val = xmlAutomataSetFinalState(am, state); + desret_int(ret_val); + call_tests++; + des_xmlAutomataPtr(n_am, am, 0); + des_xmlAutomataStatePtr(n_state, state, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlAutomataSetFinalState", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_am); + printf(" %d", n_state); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewAutomata(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_xmlautomata(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n"); + test_ret += test_xmlAutomataCompile(); + test_ret += test_xmlAutomataGetInitState(); + test_ret += test_xmlAutomataIsDeterminist(); + test_ret += test_xmlAutomataNewAllTrans(); + test_ret += test_xmlAutomataNewCountTrans(); + test_ret += test_xmlAutomataNewCountTrans2(); + test_ret += test_xmlAutomataNewCountedTrans(); + test_ret += test_xmlAutomataNewCounter(); + test_ret += test_xmlAutomataNewCounterTrans(); + test_ret += test_xmlAutomataNewEpsilon(); + test_ret += test_xmlAutomataNewOnceTrans(); + test_ret += test_xmlAutomataNewOnceTrans2(); + test_ret += test_xmlAutomataNewState(); + test_ret += test_xmlAutomataNewTransition(); + test_ret += test_xmlAutomataNewTransition2(); + test_ret += test_xmlAutomataSetFinalState(); + test_ret += test_xmlNewAutomata(); + + if (test_ret != 0) + printf("Module xmlautomata: %d errors\n", test_ret); + return(test_ret); +} + +#define gen_nb_xmlGenericErrorFunc_ptr 1 +static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_initGenericErrorDefaultFunc(void) { + int test_ret = 0; + + int mem_base; + xmlGenericErrorFunc * handler; /* the handler */ + int n_handler; + + for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) { + mem_base = xmlMemBlocks(); + handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0); + + initGenericErrorDefaultFunc(handler); + call_tests++; + des_xmlGenericErrorFunc_ptr(n_handler, handler, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in initGenericErrorDefaultFunc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_handler); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +#define gen_nb_xmlErrorPtr 1 +static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} + +static int +test_xmlCopyError(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlErrorPtr from; /* a source error */ + int n_from; + xmlErrorPtr to; /* a target error */ + int n_to; + + for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) { + for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) { + mem_base = xmlMemBlocks(); + from = gen_xmlErrorPtr(n_from, 0); + to = gen_xmlErrorPtr(n_to, 1); + + ret_val = xmlCopyError(from, to); + desret_int(ret_val); + call_tests++; + des_xmlErrorPtr(n_from, from, 0); + des_xmlErrorPtr(n_to, to, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCopyError", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_from); + printf(" %d", n_to); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCtxtGetLastError(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlCtxtResetLastError(void) { + int test_ret = 0; + + int mem_base; + void * ctx; /* an XML parser context */ + int n_ctx; + + for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctx = gen_void_ptr(n_ctx, 0); + + xmlCtxtResetLastError(ctx); + call_tests++; + des_void_ptr(n_ctx, ctx, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCtxtResetLastError", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctx); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetLastError(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParserError(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParserPrintFileContext(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr input; /* an xmlParserInputPtr input */ + int n_input; + + for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { + mem_base = xmlMemBlocks(); + input = gen_xmlParserInputPtr(n_input, 0); + + xmlParserPrintFileContext(input); + call_tests++; + des_xmlParserInputPtr(n_input, input, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserPrintFileContext", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_input); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserPrintFileInfo(void) { + int test_ret = 0; + + int mem_base; + xmlParserInputPtr input; /* an xmlParserInputPtr input */ + int n_input; + + for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) { + mem_base = xmlMemBlocks(); + input = gen_xmlParserInputPtr(n_input, 0); + + xmlParserPrintFileInfo(input); + call_tests++; + des_xmlParserInputPtr(n_input, input, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlParserPrintFileInfo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_input); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlParserValidityError(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParserValidityWarning(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlParserWarning(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlResetError(void) { + int test_ret = 0; + + int mem_base; + xmlErrorPtr err; /* pointer to the error. */ + int n_err; + + for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) { + mem_base = xmlMemBlocks(); + err = gen_xmlErrorPtr(n_err, 0); + + xmlResetError(err); + call_tests++; + des_xmlErrorPtr(n_err, err, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlResetError", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_err); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlResetLastError(void) { + int test_ret = 0; + + + + xmlResetLastError(); + call_tests++; + xmlResetLastError(); + function_tests++; + + return(test_ret); +} + + +static int +test_xmlSetGenericErrorFunc(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSetStructuredErrorFunc(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_xmlerror(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n"); + test_ret += test_initGenericErrorDefaultFunc(); + test_ret += test_xmlCopyError(); + test_ret += test_xmlCtxtGetLastError(); + test_ret += test_xmlCtxtResetLastError(); + test_ret += test_xmlGetLastError(); + test_ret += test_xmlParserError(); + test_ret += test_xmlParserPrintFileContext(); + test_ret += test_xmlParserPrintFileInfo(); + test_ret += test_xmlParserValidityError(); + test_ret += test_xmlParserValidityWarning(); + test_ret += test_xmlParserWarning(); + test_ret += test_xmlResetError(); + test_ret += test_xmlResetLastError(); + test_ret += test_xmlSetGenericErrorFunc(); + test_ret += test_xmlSetStructuredErrorFunc(); + + if (test_ret != 0) + printf("Module xmlerror: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlNewTextReader(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */ + int n_input; + const char * URI; /* the URI information for the source if available */ + int n_URI; + + for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { + for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) { + mem_base = xmlMemBlocks(); + input = gen_xmlParserInputBufferPtr(n_input, 0); + URI = gen_filepath(n_URI, 1); + + ret_val = xmlNewTextReader(input, URI); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_xmlParserInputBufferPtr(n_input, input, 0); + des_filepath(n_URI, URI, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextReader", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_input); + printf(" %d", n_URI); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextReaderFilename(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + const char * URI; /* the URI of the resource to process */ + int n_URI; + + for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) { + mem_base = xmlMemBlocks(); + URI = gen_filepath(n_URI, 0); + + ret_val = xmlNewTextReaderFilename(URI); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_filepath(n_URI, URI, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextReaderFilename", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URI); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderForDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + URL = gen_filepath(n_URL, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_parseroptions(n_options, 3); + + ret_val = xmlReaderForDoc(cur, URL, encoding, options); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + des_filepath(n_URL, URL, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_parseroptions(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderForDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderForFile(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + filename = gen_filepath(n_filename, 0); + encoding = gen_const_char_ptr(n_encoding, 1); + options = gen_parseroptions(n_options, 2); + + ret_val = xmlReaderForFile(filename, encoding, options); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_filepath(n_filename, filename, 0); + des_const_char_ptr(n_encoding, encoding, 1); + des_parseroptions(n_options, options, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderForFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderForMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_parseroptions(n_options, 4); + + ret_val = xmlReaderForMemory(buffer, size, URL, encoding, options); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_parseroptions(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderForMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderNewDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* an XML reader */ + int n_reader; + xmlChar * cur; /* a pointer to a zero terminated string */ + int n_cur; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + cur = gen_const_xmlChar_ptr(n_cur, 1); + URL = gen_filepath(n_URL, 2); + encoding = gen_const_char_ptr(n_encoding, 3); + options = gen_parseroptions(n_options, 4); + + ret_val = xmlReaderNewDoc(reader, cur, URL, encoding, options); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_cur, cur, 1); + des_filepath(n_URL, URL, 2); + des_const_char_ptr(n_encoding, encoding, 3); + des_parseroptions(n_options, options, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderNewDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_cur); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderNewFile(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* an XML reader */ + int n_reader; + const char * filename; /* a file or URL */ + int n_filename; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + filename = gen_filepath(n_filename, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + options = gen_parseroptions(n_options, 3); + + ret_val = xmlReaderNewFile(reader, filename, encoding, options); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_filepath(n_filename, filename, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_parseroptions(n_options, options, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderNewFile", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_filename); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderNewMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* an XML reader */ + int n_reader; + char * buffer; /* a pointer to a char array */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + const char * URL; /* the base URL to use for the document */ + int n_URL; + char * encoding; /* the document encoding, or NULL */ + int n_encoding; + int options; /* a combination of xmlParserOption */ + int n_options; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + buffer = gen_const_char_ptr(n_buffer, 1); + size = gen_int(n_size, 2); + URL = gen_filepath(n_URL, 3); + encoding = gen_const_char_ptr(n_encoding, 4); + options = gen_parseroptions(n_options, 5); + + ret_val = xmlReaderNewMemory(reader, buffer, size, URL, encoding, options); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_char_ptr(n_buffer, buffer, 1); + des_int(n_size, size, 2); + des_filepath(n_URL, URL, 3); + des_const_char_ptr(n_encoding, encoding, 4); + des_parseroptions(n_options, options, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderNewMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_buffer); + printf(" %d", n_size); + printf(" %d", n_URL); + printf(" %d", n_encoding); + printf(" %d", n_options); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderNewWalker(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* an XML reader */ + int n_reader; + xmlDocPtr doc; /* a preparsed document */ + int n_doc; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlReaderNewWalker(reader, doc); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderNewWalker", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlReaderWalker(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr ret_val; + xmlDocPtr doc; /* a preparsed document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlReaderWalker(doc); + desret_xmlTextReaderPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlReaderWalker", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderAttributeCount(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderAttributeCount(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderAttributeCount", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderBaseUri(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderBaseUri(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderBaseUri", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderClose(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderClose(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstBaseUri(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstBaseUri(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstBaseUri", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstEncoding(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstEncoding(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstEncoding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstLocalName(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstLocalName(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstLocalName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstName(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstName(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstNamespaceUri(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstNamespaceUri(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstPrefix(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstPrefix(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstPrefix", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstString(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * str; /* the string to intern. */ + int n_str; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + + ret_val = xmlTextReaderConstString(reader, str); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstValue(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstValue(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstXmlLang(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstXmlLang(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstXmlLang", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderConstXmlVersion(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderConstXmlVersion(reader); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderCurrentDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlDocPtr ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderCurrentDoc(reader); + desret_xmlDocPtr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderCurrentDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderCurrentNode(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderCurrentNode(reader); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderCurrentNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderDepth(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderDepth(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderDepth", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderExpand(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderExpand(reader); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderExpand", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderGetAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * name; /* the qualified name of the attribute. */ + int n_name; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextReaderGetAttribute(reader, name); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderGetAttributeNo(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + int no; /* the zero-based index of the attribute relative to the containing element */ + int n_no; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_no = 0;n_no < gen_nb_int;n_no++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + no = gen_int(n_no, 1); + + ret_val = xmlTextReaderGetAttributeNo(reader, no); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_int(n_no, no, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_no); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderGetAttributeNs(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * localName; /* the local name of the attribute. */ + int n_localName; + xmlChar * namespaceURI; /* the namespace URI of the attribute. */ + int n_namespaceURI; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + localName = gen_const_xmlChar_ptr(n_localName, 1); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2); + + ret_val = xmlTextReaderGetAttributeNs(reader, localName, namespaceURI); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_localName, localName, 1); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_localName); + printf(" %d", n_namespaceURI); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_READER_ENABLED + +#define gen_nb_xmlTextReaderErrorFunc_ptr 1 +static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlTextReaderGetErrorHandler(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */ + int n_f; + void ** arg; /* a user argument */ + int n_arg; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) { + for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1); + arg = gen_void_ptr_ptr(n_arg, 2); + + xmlTextReaderGetErrorHandler(reader, f, arg); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_xmlTextReaderErrorFunc_ptr(n_f, f, 1); + des_void_ptr_ptr(n_arg, arg, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_f); + printf(" %d", n_arg); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderGetParserProp(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + int prop; /* the xmlParserProperties to get */ + int n_prop; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_prop = 0;n_prop < gen_nb_int;n_prop++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + prop = gen_int(n_prop, 1); + + ret_val = xmlTextReaderGetParserProp(reader, prop); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_int(n_prop, prop, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetParserProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_prop); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderGetRemainder(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlParserInputBufferPtr ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderGetRemainder(reader); + desret_xmlParserInputBufferPtr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderGetRemainder", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderHasAttributes(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderHasAttributes(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderHasAttributes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderHasValue(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderHasValue(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderHasValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderIsDefault(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderIsDefault(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderIsDefault", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderIsEmptyElement(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderIsEmptyElement(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderIsNamespaceDecl(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderIsNamespaceDecl(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderIsValid(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderIsValid(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderIsValid", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderLocalName(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderLocalName(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderLocalName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_READER_ENABLED + +#define gen_nb_xmlTextReaderLocatorPtr 1 +static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlTextReaderLocatorBaseURI(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */ + int n_locator; + + for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) { + mem_base = xmlMemBlocks(); + locator = gen_xmlTextReaderLocatorPtr(n_locator, 0); + + ret_val = xmlTextReaderLocatorBaseURI(locator); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderLocatorPtr(n_locator, locator, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_locator); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderLocatorLineNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */ + int n_locator; + + for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) { + mem_base = xmlMemBlocks(); + locator = gen_xmlTextReaderLocatorPtr(n_locator, 0); + + ret_val = xmlTextReaderLocatorLineNumber(locator); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderLocatorPtr(n_locator, locator, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_locator); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderLookupNamespace(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * prefix; /* the prefix whose namespace URI is to be resolved. To return the default namespace, specify NULL */ + int n_prefix; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + + ret_val = xmlTextReaderLookupNamespace(reader, prefix); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderLookupNamespace", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * name; /* the qualified name of the attribute. */ + int n_name; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextReaderMoveToAttribute(reader, name); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToAttributeNo(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + int no; /* the zero-based index of the attribute relative to the containing element. */ + int n_no; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_no = 0;n_no < gen_nb_int;n_no++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + no = gen_int(n_no, 1); + + ret_val = xmlTextReaderMoveToAttributeNo(reader, no); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_int(n_no, no, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_no); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToAttributeNs(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * localName; /* the local name of the attribute. */ + int n_localName; + xmlChar * namespaceURI; /* the namespace URI of the attribute. */ + int n_namespaceURI; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + localName = gen_const_xmlChar_ptr(n_localName, 1); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2); + + ret_val = xmlTextReaderMoveToAttributeNs(reader, localName, namespaceURI); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_localName, localName, 1); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_localName); + printf(" %d", n_namespaceURI); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToElement(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderMoveToElement(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToFirstAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderMoveToFirstAttribute(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderMoveToNextAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderMoveToNextAttribute(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderName(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderName(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderNamespaceUri(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderNamespaceUri(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderNamespaceUri", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderNext(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderNext(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderNext", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderNextSibling(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderNextSibling(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderNextSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderNodeType(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderNodeType(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderNodeType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderNormalization(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderNormalization(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderNormalization", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderPrefix(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderPrefix(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderPrefix", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderPreserve(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderPreserve(reader); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderPreserve", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderPreservePattern(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED +#ifdef LIBXML_PATTERN_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlChar * pattern; /* an XPath subset pattern */ + int n_pattern; + xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */ + int n_namespaces; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) { + for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + pattern = gen_const_xmlChar_ptr(n_pattern, 1); + namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2); + + ret_val = xmlTextReaderPreservePattern(reader, pattern, namespaces); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_xmlChar_ptr(n_pattern, pattern, 1); + des_const_xmlChar_ptr_ptr(n_namespaces, namespaces, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderPreservePattern", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_pattern); + printf(" %d", n_namespaces); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderQuoteChar(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderQuoteChar(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderQuoteChar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderRead(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderRead(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderRead", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderReadAttributeValue(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderReadAttributeValue(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderReadState(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderReadState(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderReadState", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderRelaxNGSetSchema(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */ + int n_schema; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + schema = gen_xmlRelaxNGPtr(n_schema, 1); + + ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_xmlRelaxNGPtr(n_schema, schema, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_schema); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderRelaxNGValidate(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + char * rng; /* the path to a RelaxNG schema or NULL */ + int n_rng; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + rng = gen_const_char_ptr(n_rng, 1); + + ret_val = xmlTextReaderRelaxNGValidate(reader, rng); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_const_char_ptr(n_rng, rng, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_rng); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderSetErrorHandler(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextReaderSetParserProp(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + int prop; /* the xmlParserProperties to set */ + int n_prop; + int value; /* usually 0 or 1 to (de)activate it */ + int n_value; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + for (n_prop = 0;n_prop < gen_nb_int;n_prop++) { + for (n_value = 0;n_value < gen_nb_int;n_value++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + prop = gen_int(n_prop, 1); + value = gen_int(n_value, 2); + + ret_val = xmlTextReaderSetParserProp(reader, prop, value); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + des_int(n_prop, prop, 1); + des_int(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderSetParserProp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf(" %d", n_prop); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderSetStructuredErrorHandler(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextReaderStandalone(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + int ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderStandalone(reader); + desret_int(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderStandalone", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderValue(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderValue(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderValue", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextReaderXmlLang(void) { + int test_ret = 0; + +#ifdef LIBXML_READER_ENABLED + int mem_base; + xmlChar * ret_val; + xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */ + int n_reader; + + for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) { + mem_base = xmlMemBlocks(); + reader = gen_xmlTextReaderPtr(n_reader, 0); + + ret_val = xmlTextReaderXmlLang(reader); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlTextReaderPtr(n_reader, reader, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextReaderXmlLang", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_reader); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlreader(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n"); + test_ret += test_xmlNewTextReader(); + test_ret += test_xmlNewTextReaderFilename(); + test_ret += test_xmlReaderForDoc(); + test_ret += test_xmlReaderForFile(); + test_ret += test_xmlReaderForMemory(); + test_ret += test_xmlReaderNewDoc(); + test_ret += test_xmlReaderNewFile(); + test_ret += test_xmlReaderNewMemory(); + test_ret += test_xmlReaderNewWalker(); + test_ret += test_xmlReaderWalker(); + test_ret += test_xmlTextReaderAttributeCount(); + test_ret += test_xmlTextReaderBaseUri(); + test_ret += test_xmlTextReaderClose(); + test_ret += test_xmlTextReaderConstBaseUri(); + test_ret += test_xmlTextReaderConstEncoding(); + test_ret += test_xmlTextReaderConstLocalName(); + test_ret += test_xmlTextReaderConstName(); + test_ret += test_xmlTextReaderConstNamespaceUri(); + test_ret += test_xmlTextReaderConstPrefix(); + test_ret += test_xmlTextReaderConstString(); + test_ret += test_xmlTextReaderConstValue(); + test_ret += test_xmlTextReaderConstXmlLang(); + test_ret += test_xmlTextReaderConstXmlVersion(); + test_ret += test_xmlTextReaderCurrentDoc(); + test_ret += test_xmlTextReaderCurrentNode(); + test_ret += test_xmlTextReaderDepth(); + test_ret += test_xmlTextReaderExpand(); + test_ret += test_xmlTextReaderGetAttribute(); + test_ret += test_xmlTextReaderGetAttributeNo(); + test_ret += test_xmlTextReaderGetAttributeNs(); + test_ret += test_xmlTextReaderGetErrorHandler(); + test_ret += test_xmlTextReaderGetParserProp(); + test_ret += test_xmlTextReaderGetRemainder(); + test_ret += test_xmlTextReaderHasAttributes(); + test_ret += test_xmlTextReaderHasValue(); + test_ret += test_xmlTextReaderIsDefault(); + test_ret += test_xmlTextReaderIsEmptyElement(); + test_ret += test_xmlTextReaderIsNamespaceDecl(); + test_ret += test_xmlTextReaderIsValid(); + test_ret += test_xmlTextReaderLocalName(); + test_ret += test_xmlTextReaderLocatorBaseURI(); + test_ret += test_xmlTextReaderLocatorLineNumber(); + test_ret += test_xmlTextReaderLookupNamespace(); + test_ret += test_xmlTextReaderMoveToAttribute(); + test_ret += test_xmlTextReaderMoveToAttributeNo(); + test_ret += test_xmlTextReaderMoveToAttributeNs(); + test_ret += test_xmlTextReaderMoveToElement(); + test_ret += test_xmlTextReaderMoveToFirstAttribute(); + test_ret += test_xmlTextReaderMoveToNextAttribute(); + test_ret += test_xmlTextReaderName(); + test_ret += test_xmlTextReaderNamespaceUri(); + test_ret += test_xmlTextReaderNext(); + test_ret += test_xmlTextReaderNextSibling(); + test_ret += test_xmlTextReaderNodeType(); + test_ret += test_xmlTextReaderNormalization(); + test_ret += test_xmlTextReaderPrefix(); + test_ret += test_xmlTextReaderPreserve(); + test_ret += test_xmlTextReaderPreservePattern(); + test_ret += test_xmlTextReaderQuoteChar(); + test_ret += test_xmlTextReaderRead(); + test_ret += test_xmlTextReaderReadAttributeValue(); + test_ret += test_xmlTextReaderReadState(); + test_ret += test_xmlTextReaderRelaxNGSetSchema(); + test_ret += test_xmlTextReaderRelaxNGValidate(); + test_ret += test_xmlTextReaderSetErrorHandler(); + test_ret += test_xmlTextReaderSetParserProp(); + test_ret += test_xmlTextReaderSetStructuredErrorHandler(); + test_ret += test_xmlTextReaderStandalone(); + test_ret += test_xmlTextReaderValue(); + test_ret += test_xmlTextReaderXmlLang(); + + if (test_ret != 0) + printf("Module xmlreader: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_REGEXP_ENABLED + +#define gen_nb_xmlRegExecCtxtPtr 1 +static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlRegExecPushString(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */ + int n_exec; + xmlChar * value; /* a string token input */ + int n_value; + void * data; /* data associated to the token to reuse in callbacks */ + int n_data; + + for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + exec = gen_xmlRegExecCtxtPtr(n_exec, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + data = gen_userdata(n_data, 2); + + ret_val = xmlRegExecPushString(exec, value, data); + desret_int(ret_val); + call_tests++; + des_xmlRegExecCtxtPtr(n_exec, exec, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_userdata(n_data, data, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegExecPushString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_exec); + printf(" %d", n_value); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRegExecPushString2(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */ + int n_exec; + xmlChar * value; /* the first string token input */ + int n_value; + xmlChar * value2; /* the second string token input */ + int n_value2; + void * data; /* data associated to the token to reuse in callbacks */ + int n_data; + + for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) { + for (n_data = 0;n_data < gen_nb_userdata;n_data++) { + mem_base = xmlMemBlocks(); + exec = gen_xmlRegExecCtxtPtr(n_exec, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + value2 = gen_const_xmlChar_ptr(n_value2, 2); + data = gen_userdata(n_data, 3); + + ret_val = xmlRegExecPushString2(exec, value, value2, data); + desret_int(ret_val); + call_tests++; + des_xmlRegExecCtxtPtr(n_exec, exec, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_const_xmlChar_ptr(n_value2, value2, 2); + des_userdata(n_data, data, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegExecPushString2", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_exec); + printf(" %d", n_value); + printf(" %d", n_value2); + printf(" %d", n_data); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_REGEXP_ENABLED + +#define gen_nb_xmlRegexpPtr 1 +static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlRegNewExecCtxt(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRegexpCompile(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlRegexpExec(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlRegexpPtr comp; /* the compiled regular expression */ + int n_comp; + xmlChar * content; /* the value to check against the regular expression */ + int n_content; + + for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + comp = gen_xmlRegexpPtr(n_comp, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlRegexpExec(comp, content); + desret_int(ret_val); + call_tests++; + des_xmlRegexpPtr(n_comp, comp, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegexpExec", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_comp); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRegexpIsDeterminist(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + int ret_val; + xmlRegexpPtr comp; /* the compiled regular expression */ + int n_comp; + + for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) { + mem_base = xmlMemBlocks(); + comp = gen_xmlRegexpPtr(n_comp, 0); + + ret_val = xmlRegexpIsDeterminist(comp); + desret_int(ret_val); + call_tests++; + des_xmlRegexpPtr(n_comp, comp, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegexpIsDeterminist", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_comp); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlRegexpPrint(void) { + int test_ret = 0; + +#ifdef LIBXML_REGEXP_ENABLED + int mem_base; + FILE * output; /* the file for the output debug */ + int n_output; + xmlRegexpPtr regexp; /* the compiled regexp */ + int n_regexp; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + regexp = gen_xmlRegexpPtr(n_regexp, 1); + + xmlRegexpPrint(output, regexp); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlRegexpPtr(n_regexp, regexp, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlRegexpPrint", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_regexp); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlregexp(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n"); + test_ret += test_xmlRegExecPushString(); + test_ret += test_xmlRegExecPushString2(); + test_ret += test_xmlRegNewExecCtxt(); + test_ret += test_xmlRegexpCompile(); + test_ret += test_xmlRegexpExec(); + test_ret += test_xmlRegexpIsDeterminist(); + test_ret += test_xmlRegexpPrint(); + + if (test_ret != 0) + printf("Module xmlregexp: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_OUTPUT_ENABLED + +#define gen_nb_xmlSaveCtxtPtr 1 +static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSaveClose(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlSaveCtxtPtr ctxt; /* a document saving context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); + + ret_val = xmlSaveClose(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveClose", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + long ret_val; + xmlSaveCtxtPtr ctxt; /* a document saving context */ + int n_ctxt; + xmlDocPtr doc; /* a document */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlSaveDoc(ctxt, doc); + desret_long(ret_val); + call_tests++; + des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveFlush(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + int ret_val; + xmlSaveCtxtPtr ctxt; /* a document saving context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); + + ret_val = xmlSaveFlush(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveFlush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSaveSetAttrEscape(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSaveSetEscape(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSaveToFd(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSaveToFilename(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSaveTree(void) { + int test_ret = 0; + +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + long ret_val; + xmlSaveCtxtPtr ctxt; /* a document saving context */ + int n_ctxt; + xmlNodePtr node; /* a document */ + int n_node; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlSaveTree(ctxt, node); + desret_long(ret_val); + call_tests++; + des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSaveTree", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlsave(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n"); + test_ret += test_xmlSaveClose(); + test_ret += test_xmlSaveDoc(); + test_ret += test_xmlSaveFlush(); + test_ret += test_xmlSaveSetAttrEscape(); + test_ret += test_xmlSaveSetEscape(); + test_ret += test_xmlSaveToFd(); + test_ret += test_xmlSaveToFilename(); + test_ret += test_xmlSaveTree(); + + if (test_ret != 0) + printf("Module xmlsave: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaPtr 1 +static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaDump(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED +#ifdef LIBXML_OUTPUT_ENABLED + int mem_base; + FILE * output; /* the file output */ + int n_output; + xmlSchemaPtr schema; /* a schema structure */ + int n_schema; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + schema = gen_xmlSchemaPtr(n_schema, 1); + + xmlSchemaDump(output, schema); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlSchemaPtr(n_schema, schema, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaDump", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_schema); + printf("\n"); + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaParserCtxtPtr 1 +static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1 +static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1 +static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaGetParserErrors(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */ + int n_ctxt; + xmlSchemaValidityErrorFunc * err; /* the error callback result */ + int n_err; + xmlSchemaValidityWarningFunc * warn; /* the warning callback result */ + int n_warn; + void ** ctx; /* contextual data for the callbacks result */ + int n_ctx; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) { + for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) { + for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) { + for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0); + err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1); + warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2); + ctx = gen_void_ptr_ptr(n_ctx, 3); + + ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx); + desret_int(ret_val); + call_tests++; + des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0); + des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1); + des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2); + des_void_ptr_ptr(n_ctx, ctx, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaGetParserErrors", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_err); + printf(" %d", n_warn); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaValidCtxtPtr 1 +static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaGetValidErrors(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */ + int n_ctxt; + xmlSchemaValidityErrorFunc * err; /* the error function result */ + int n_err; + xmlSchemaValidityWarningFunc * warn; /* the warning function result */ + int n_warn; + void ** ctx; /* the functions context result */ + int n_ctx; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) { + for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) { + for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1); + warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2); + ctx = gen_void_ptr_ptr(n_ctx, 3); + + ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1); + des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2); + des_void_ptr_ptr(n_ctx, ctx, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaGetValidErrors", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_err); + printf(" %d", n_warn); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaNewDocParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlSchemaParserCtxtPtr ret_val; + xmlDocPtr doc; /* a preparsed document tree */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlSchemaNewDocParserCtxt(doc); + desret_xmlSchemaParserCtxtPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaNewMemParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlSchemaParserCtxtPtr ret_val; + char * buffer; /* a pointer to a char array containing the schemas */ + int n_buffer; + int size; /* the size of the array */ + int n_size; + + for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) { + for (n_size = 0;n_size < gen_nb_int;n_size++) { + mem_base = xmlMemBlocks(); + buffer = gen_const_char_ptr(n_buffer, 0); + size = gen_int(n_size, 1); + + ret_val = xmlSchemaNewMemParserCtxt(buffer, size); + desret_xmlSchemaParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_buffer, buffer, 0); + des_int(n_size, size, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buffer); + printf(" %d", n_size); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaNewParserCtxt(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlSchemaParserCtxtPtr ret_val; + char * URL; /* the location of the schema */ + int n_URL; + + for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) { + mem_base = xmlMemBlocks(); + URL = gen_const_char_ptr(n_URL, 0); + + ret_val = xmlSchemaNewParserCtxt(URL); + desret_xmlSchemaParserCtxtPtr(ret_val); + call_tests++; + des_const_char_ptr(n_URL, URL, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaNewParserCtxt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_URL); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaNewValidCtxt(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaParse(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaSetParserErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaSetValidErrors(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaSetValidOptions(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + int options; /* a combination of xmlSchemaValidOption */ + int n_options; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_options = 0;n_options < gen_nb_int;n_options++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + options = gen_int(n_options, 1); + + ret_val = xmlSchemaSetValidOptions(ctxt, options); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + des_int(n_options, options, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaSetValidOptions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_options); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidCtxtGetOptions(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + + ret_val = xmlSchemaValidCtxtGetOptions(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateDoc(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + xmlDocPtr doc; /* a parsed document tree */ + int n_doc; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + doc = gen_xmlDocPtr(n_doc, 1); + + ret_val = xmlSchemaValidateDoc(ctxt, doc); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlDocPtr(n_doc, doc, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateDoc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_doc); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateOneElement(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + xmlNodePtr elem; /* an element node */ + int n_elem; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + elem = gen_xmlNodePtr(n_elem, 1); + + ret_val = xmlSchemaValidateOneElement(ctxt, elem); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_elem, elem, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateOneElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_elem); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateStream(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */ + int n_ctxt; + xmlParserInputBufferPtr input; /* the input to use for reading the data */ + int n_input; + xmlCharEncoding enc; /* an optional encoding information */ + int n_enc; + xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */ + int n_sax; + void * user_data; /* the context to provide to the SAX handler. */ + int n_user_data; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) { + for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) { + for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) { + for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) { + for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0); + input = gen_xmlParserInputBufferPtr(n_input, 1); + enc = gen_xmlCharEncoding(n_enc, 2); + sax = gen_xmlSAXHandlerPtr(n_sax, 3); + user_data = gen_userdata(n_user_data, 4); + + ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0); + des_xmlParserInputBufferPtr(n_input, input, 1); + des_xmlCharEncoding(n_enc, enc, 2); + des_xmlSAXHandlerPtr(n_sax, sax, 3); + des_userdata(n_user_data, user_data, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateStream", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_input); + printf(" %d", n_enc); + printf(" %d", n_sax); + printf(" %d", n_user_data); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlschemas(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n"); + test_ret += test_xmlSchemaDump(); + test_ret += test_xmlSchemaGetParserErrors(); + test_ret += test_xmlSchemaGetValidErrors(); + test_ret += test_xmlSchemaNewDocParserCtxt(); + test_ret += test_xmlSchemaNewMemParserCtxt(); + test_ret += test_xmlSchemaNewParserCtxt(); + test_ret += test_xmlSchemaNewValidCtxt(); + test_ret += test_xmlSchemaParse(); + test_ret += test_xmlSchemaSetParserErrors(); + test_ret += test_xmlSchemaSetValidErrors(); + test_ret += test_xmlSchemaSetValidOptions(); + test_ret += test_xmlSchemaValidCtxtGetOptions(); + test_ret += test_xmlSchemaValidateDoc(); + test_ret += test_xmlSchemaValidateOneElement(); + test_ret += test_xmlSchemaValidateStream(); + + if (test_ret != 0) + printf("Module xmlschemas: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaFacetPtr 1 +static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaTypePtr 1 +static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaCheckFacet(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaFacetPtr facet; /* the facet */ + int n_facet; + xmlSchemaTypePtr typeDecl; /* the schema type definition */ + int n_typeDecl; + xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */ + int n_ctxt; + xmlChar * name; /* name of the type */ + int n_name; + + for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { + for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + facet = gen_xmlSchemaFacetPtr(n_facet, 0); + typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1); + ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2); + name = gen_const_xmlChar_ptr(n_name, 3); + + ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, name); + desret_int(ret_val); + call_tests++; + des_xmlSchemaFacetPtr(n_facet, facet, 0); + des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1); + des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2); + des_const_xmlChar_ptr(n_name, name, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaCheckFacet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_facet); + printf(" %d", n_typeDecl); + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaCleanupTypes(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlSchemaCleanupTypes(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaCleanupTypes", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaCollapseString(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlChar * ret_val; + xmlChar * value; /* a value */ + int n_value; + + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + mem_base = xmlMemBlocks(); + value = gen_const_xmlChar_ptr(n_value, 0); + + ret_val = xmlSchemaCollapseString(value); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_value, value, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaCollapseString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_value); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaValPtr 1 +static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaCompareValues(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaValPtr x; /* a first value */ + int n_x; + xmlSchemaValPtr y; /* a second value */ + int n_y; + + for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) { + for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) { + mem_base = xmlMemBlocks(); + x = gen_xmlSchemaValPtr(n_x, 0); + y = gen_xmlSchemaValPtr(n_y, 1); + + ret_val = xmlSchemaCompareValues(x, y); + desret_int(ret_val); + call_tests++; + des_xmlSchemaValPtr(n_x, x, 0); + des_xmlSchemaValPtr(n_y, y, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaCompareValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_x); + printf(" %d", n_y); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlSchemaTypePtr ret_val; + xmlSchemaTypePtr type; /* the built-in simple type. */ + int n_type; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + + ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type); + desret_xmlSchemaTypePtr(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaGetBuiltInType(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + xmlSchemaTypePtr ret_val; + xmlSchemaValType type; /* the type of the built in type */ + int n_type; + + for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) { + type = gen_xmlSchemaValType(n_type, 0); + + ret_val = xmlSchemaGetBuiltInType(type); + desret_xmlSchemaTypePtr(ret_val); + call_tests++; + des_xmlSchemaValType(n_type, type, 0); + xmlResetLastError(); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaGetFacetValueAsULong(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlSchemaGetPredefinedType(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + xmlSchemaTypePtr ret_val; + xmlChar * name; /* the type name */ + int n_name; + xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */ + int n_ns; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + ns = gen_const_xmlChar_ptr(n_ns, 1); + + ret_val = xmlSchemaGetPredefinedType(name, ns); + desret_xmlSchemaTypePtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + des_const_xmlChar_ptr(n_ns, ns, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaGetPredefinedType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf(" %d", n_ns); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaInitTypes(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + + + xmlSchemaInitTypes(); + call_tests++; + xmlResetLastError(); + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaIsBuiltInTypeFacet(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr type; /* the built-in type */ + int n_type; + int facetType; /* the facet type */ + int n_facetType; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + facetType = gen_int(n_facetType, 1); + + ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + des_int(n_facetType, facetType, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_facetType); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaNewFacet(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +#ifdef LIBXML_SCHEMAS_ENABLED + +#define gen_nb_xmlSchemaValPtr_ptr 1 +static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlSchemaValPredefTypeNode(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr type; /* the predefined type */ + int n_type; + xmlChar * value; /* the value to check */ + int n_value; + xmlSchemaValPtr * val; /* the return computed value */ + int n_val; + xmlNodePtr node; /* the node containing the value */ + int n_node; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + val = gen_xmlSchemaValPtr_ptr(n_val, 2); + node = gen_xmlNodePtr(n_node, 3); + + ret_val = xmlSchemaValPredefTypeNode(type, value, val, node); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_xmlSchemaValPtr_ptr(n_val, val, 2); + des_xmlNodePtr(n_node, node, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_value); + printf(" %d", n_val); + printf(" %d", n_node); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValPredefTypeNodeNoNorm(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr type; /* the predefined type */ + int n_type; + xmlChar * value; /* the value to check */ + int n_value; + xmlSchemaValPtr * val; /* the return computed value */ + int n_val; + xmlNodePtr node; /* the node containing the value */ + int n_node; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + val = gen_xmlSchemaValPtr_ptr(n_val, 2); + node = gen_xmlNodePtr(n_node, 3); + + ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, value, val, node); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_xmlSchemaValPtr_ptr(n_val, val, 2); + des_xmlNodePtr(n_node, node, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_value); + printf(" %d", n_val); + printf(" %d", n_node); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateFacet(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr base; /* the base type */ + int n_base; + xmlSchemaFacetPtr facet; /* the facet to check */ + int n_facet; + xmlChar * value; /* the lexical repr of the value to validate */ + int n_value; + xmlSchemaValPtr val; /* the precomputed value */ + int n_val; + + for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) { + for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { + mem_base = xmlMemBlocks(); + base = gen_xmlSchemaTypePtr(n_base, 0); + facet = gen_xmlSchemaFacetPtr(n_facet, 1); + value = gen_const_xmlChar_ptr(n_value, 2); + val = gen_xmlSchemaValPtr(n_val, 3); + + ret_val = xmlSchemaValidateFacet(base, facet, value, val); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_base, base, 0); + des_xmlSchemaFacetPtr(n_facet, facet, 1); + des_const_xmlChar_ptr(n_value, value, 2); + des_xmlSchemaValPtr(n_val, val, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateFacet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_base); + printf(" %d", n_facet); + printf(" %d", n_value); + printf(" %d", n_val); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateLengthFacet(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr type; /* the built-in type */ + int n_type; + xmlSchemaFacetPtr facet; /* the facet to check */ + int n_facet; + xmlChar * value; /* the lexical repr. of the value to be validated */ + int n_value; + xmlSchemaValPtr val; /* the precomputed value */ + int n_val; + unsigned long * length; /* the actual length of the value */ + int n_length; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) { + for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + facet = gen_xmlSchemaFacetPtr(n_facet, 1); + value = gen_const_xmlChar_ptr(n_value, 2); + val = gen_xmlSchemaValPtr(n_val, 3); + length = gen_unsigned_long_ptr(n_length, 4); + + ret_val = xmlSchemaValidateLengthFacet(type, facet, value, val, length); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + des_xmlSchemaFacetPtr(n_facet, facet, 1); + des_const_xmlChar_ptr(n_value, value, 2); + des_xmlSchemaValPtr(n_val, val, 3); + des_unsigned_long_ptr(n_length, length, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_facet); + printf(" %d", n_value); + printf(" %d", n_val); + printf(" %d", n_length); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidateListSimpleTypeFacet(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaFacetPtr facet; /* the facet to check */ + int n_facet; + xmlChar * value; /* the lexical repr of the value to validate */ + int n_value; + unsigned long actualLen; /* the number of list items */ + int n_actualLen; + unsigned long * expectedLen; /* the resulting expected number of list items */ + int n_expectedLen; + + for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) { + for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) { + mem_base = xmlMemBlocks(); + facet = gen_xmlSchemaFacetPtr(n_facet, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + actualLen = gen_unsigned_long(n_actualLen, 2); + expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3); + + ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, value, actualLen, expectedLen); + desret_int(ret_val); + call_tests++; + des_xmlSchemaFacetPtr(n_facet, facet, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_unsigned_long(n_actualLen, actualLen, 2); + des_unsigned_long_ptr(n_expectedLen, expectedLen, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_facet); + printf(" %d", n_value); + printf(" %d", n_actualLen); + printf(" %d", n_expectedLen); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlSchemaValidatePredefinedType(void) { + int test_ret = 0; + +#ifdef LIBXML_SCHEMAS_ENABLED + int mem_base; + int ret_val; + xmlSchemaTypePtr type; /* the predefined type */ + int n_type; + xmlChar * value; /* the value to check */ + int n_value; + xmlSchemaValPtr * val; /* the return computed value */ + int n_val; + + for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) { + for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) { + for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) { + mem_base = xmlMemBlocks(); + type = gen_xmlSchemaTypePtr(n_type, 0); + value = gen_const_xmlChar_ptr(n_value, 1); + val = gen_xmlSchemaValPtr_ptr(n_val, 2); + + ret_val = xmlSchemaValidatePredefinedType(type, value, val); + desret_int(ret_val); + call_tests++; + des_xmlSchemaTypePtr(n_type, type, 0); + des_const_xmlChar_ptr(n_value, value, 1); + des_xmlSchemaValPtr_ptr(n_val, val, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_type); + printf(" %d", n_value); + printf(" %d", n_val); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlschemastypes(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlschemastypes : 15 of 19 functions ...\n"); + test_ret += test_xmlSchemaCheckFacet(); + test_ret += test_xmlSchemaCleanupTypes(); + test_ret += test_xmlSchemaCollapseString(); + test_ret += test_xmlSchemaCompareValues(); + test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType(); + test_ret += test_xmlSchemaGetBuiltInType(); + test_ret += test_xmlSchemaGetFacetValueAsULong(); + test_ret += test_xmlSchemaGetPredefinedType(); + test_ret += test_xmlSchemaInitTypes(); + test_ret += test_xmlSchemaIsBuiltInTypeFacet(); + test_ret += test_xmlSchemaNewFacet(); + test_ret += test_xmlSchemaValPredefTypeNode(); + test_ret += test_xmlSchemaValPredefTypeNodeNoNorm(); + test_ret += test_xmlSchemaValidateFacet(); + test_ret += test_xmlSchemaValidateLengthFacet(); + test_ret += test_xmlSchemaValidateListSimpleTypeFacet(); + test_ret += test_xmlSchemaValidatePredefinedType(); + + if (test_ret != 0) + printf("Module xmlschemastypes: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlCharStrdup(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + char * cur; /* the input char * */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_const_char_ptr(n_cur, 0); + + ret_val = xmlCharStrdup(cur); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_char_ptr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharStrdup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCharStrndup(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + char * cur; /* the input char * */ + int n_cur; + int len; /* the len of @cur */ + int n_len; + + for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + cur = gen_const_char_ptr(n_cur, 0); + len = gen_int(n_len, 1); + + ret_val = xmlCharStrndup(cur, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_char_ptr(n_cur, cur, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCharStrndup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlCheckUTF8(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */ + int n_utf; + + for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) { + mem_base = xmlMemBlocks(); + utf = gen_const_unsigned_char_ptr(n_utf, 0); + + ret_val = xmlCheckUTF8(utf); + desret_int(ret_val); + call_tests++; + des_const_unsigned_char_ptr(n_utf, utf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlCheckUTF8", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlGetUTF8Char(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + unsigned char * utf; /* a sequence of UTF-8 encoded bytes */ + int n_utf; + int * len; /* a pointer to the minimum number of bytes present in the sequence. This is used to assure the next character is completely contained within the sequence. */ + int n_len; + + for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) { + for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) { + mem_base = xmlMemBlocks(); + utf = gen_const_unsigned_char_ptr(n_utf, 0); + len = gen_int_ptr(n_len, 1); + + ret_val = xmlGetUTF8Char(utf, len); + desret_int(ret_val); + call_tests++; + des_const_unsigned_char_ptr(n_utf, utf, 0); + des_int_ptr(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlGetUTF8Char", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrEqual(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str1; /* the first xmlChar * */ + int n_str1; + xmlChar * str2; /* the second xmlChar * */ + int n_str2; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + + ret_val = xmlStrEqual(str1, str2); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrEqual", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrPrintf(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlStrQEqual(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * pref; /* the prefix of the QName */ + int n_pref; + xmlChar * name; /* the localname of the QName */ + int n_name; + xmlChar * str; /* the second xmlChar * */ + int n_str; + + for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + pref = gen_const_xmlChar_ptr(n_pref, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + str = gen_const_xmlChar_ptr(n_str, 2); + + ret_val = xmlStrQEqual(pref, name, str); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_pref, pref, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_str, str, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrQEqual", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_pref); + printf(" %d", n_name); + printf(" %d", n_str); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrVPrintf(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlStrcasecmp(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str1; /* the first xmlChar * */ + int n_str1; + xmlChar * str2; /* the second xmlChar * */ + int n_str2; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + + ret_val = xmlStrcasecmp(str1, str2); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrcasecmp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrcasestr(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlChar * str; /* the xmlChar * array (haystack) */ + int n_str; + xmlChar * val; /* the xmlChar to search (needle) */ + int n_val; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + val = gen_xmlChar_ptr(n_val, 1); + + ret_val = xmlStrcasestr(str, val); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_xmlChar_ptr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrcasestr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrchr(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlChar * str; /* the xmlChar * array */ + int n_str; + xmlChar val; /* the xmlChar to search */ + int n_val; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + val = gen_xmlChar(n_val, 1); + + ret_val = xmlStrchr(str, val); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_xmlChar(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrchr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrcmp(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str1; /* the first xmlChar * */ + int n_str1; + xmlChar * str2; /* the second xmlChar * */ + int n_str2; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + + ret_val = xmlStrcmp(str1, str2); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrcmp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrdup(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * cur; /* the input xmlChar * */ + int n_cur; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + + ret_val = xmlStrdup(cur); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrdup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrlen(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str; /* the xmlChar * array */ + int n_str; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + + ret_val = xmlStrlen(str); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrlen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrncasecmp(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str1; /* the first xmlChar * */ + int n_str1; + xmlChar * str2; /* the second xmlChar * */ + int n_str2; + int len; /* the max comparison length */ + int n_len; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + len = gen_int(n_len, 2); + + ret_val = xmlStrncasecmp(str1, str2, len); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrncasecmp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrncatNew(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * str1; /* first xmlChar string */ + int n_str1; + xmlChar * str2; /* second xmlChar string */ + int n_str2; + int len; /* the len of @str2 */ + int n_len; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + len = gen_int(n_len, 2); + + ret_val = xmlStrncatNew(str1, str2, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrncatNew", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrncmp(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * str1; /* the first xmlChar * */ + int n_str1; + xmlChar * str2; /* the second xmlChar * */ + int n_str2; + int len; /* the max comparison length */ + int n_len; + + for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) { + for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + str1 = gen_const_xmlChar_ptr(n_str1, 0); + str2 = gen_const_xmlChar_ptr(n_str2, 1); + len = gen_int(n_len, 2); + + ret_val = xmlStrncmp(str1, str2, len); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str1, str1, 0); + des_const_xmlChar_ptr(n_str2, str2, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrncmp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str1); + printf(" %d", n_str2); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrndup(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * cur; /* the input xmlChar * */ + int n_cur; + int len; /* the len of @cur */ + int n_len; + + for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + cur = gen_const_xmlChar_ptr(n_cur, 0); + len = gen_int(n_len, 1); + + ret_val = xmlStrndup(cur, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_cur, cur, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrndup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrstr(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlChar * str; /* the xmlChar * array (haystack) */ + int n_str; + xmlChar * val; /* the xmlChar to search (needle) */ + int n_val; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + val = gen_const_xmlChar_ptr(n_val, 1); + + ret_val = xmlStrstr(str, val); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_const_xmlChar_ptr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrstr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlStrsub(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * str; /* the xmlChar * array (haystack) */ + int n_str; + int start; /* the index of the first char (zero based) */ + int n_start; + int len; /* the length of the substring */ + int n_len; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_start = 0;n_start < gen_nb_int;n_start++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + start = gen_int(n_start, 1); + len = gen_int(n_len, 2); + + ret_val = xmlStrsub(str, start, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_int(n_start, start, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlStrsub", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_start); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Charcmp(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * utf1; /* pointer to first UTF8 char */ + int n_utf1; + xmlChar * utf2; /* pointer to second UTF8 char */ + int n_utf2; + + for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) { + for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) { + mem_base = xmlMemBlocks(); + utf1 = gen_const_xmlChar_ptr(n_utf1, 0); + utf2 = gen_const_xmlChar_ptr(n_utf2, 1); + + ret_val = xmlUTF8Charcmp(utf1, utf2); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf1, utf1, 0); + des_const_xmlChar_ptr(n_utf2, utf2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Charcmp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf1); + printf(" %d", n_utf2); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Size(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * utf; /* pointer to the UTF8 character */ + int n_utf; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + + ret_val = xmlUTF8Size(utf); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Size", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strlen(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ + int n_utf; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + + ret_val = xmlUTF8Strlen(utf); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strlen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf("\n"); + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strloc(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * utf; /* the input UTF8 * */ + int n_utf; + xmlChar * utfchar; /* the UTF8 character to be found */ + int n_utfchar; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + utfchar = gen_const_xmlChar_ptr(n_utfchar, 1); + + ret_val = xmlUTF8Strloc(utf, utfchar); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + des_const_xmlChar_ptr(n_utfchar, utfchar, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strloc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_utfchar); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strndup(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * utf; /* the input UTF8 * */ + int n_utf; + int len; /* the len of @utf (in chars) */ + int n_len; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + len = gen_int(n_len, 1); + + ret_val = xmlUTF8Strndup(utf, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strndup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strpos(void) { + int test_ret = 0; + + int mem_base; + const xmlChar * ret_val; + xmlChar * utf; /* the input UTF8 * */ + int n_utf; + int pos; /* the position of the desired UTF8 char (in chars) */ + int n_pos; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + for (n_pos = 0;n_pos < gen_nb_int;n_pos++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + pos = gen_int(n_pos, 1); + + ret_val = xmlUTF8Strpos(utf, pos); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + des_int(n_pos, pos, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strpos", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_pos); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strsize(void) { + int test_ret = 0; + + int mem_base; + int ret_val; + xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ + int n_utf; + int len; /* the number of characters in the array */ + int n_len; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + len = gen_int(n_len, 1); + + ret_val = xmlUTF8Strsize(utf, len); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + des_int(n_len, len, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strsize", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_len); + printf("\n"); + } + } + } + function_tests++; + + return(test_ret); +} + + +static int +test_xmlUTF8Strsub(void) { + int test_ret = 0; + + int mem_base; + xmlChar * ret_val; + xmlChar * utf; /* a sequence of UTF-8 encoded bytes */ + int n_utf; + int start; /* relative pos of first char */ + int n_start; + int len; /* total number to copy */ + int n_len; + + for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) { + for (n_start = 0;n_start < gen_nb_int;n_start++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + utf = gen_const_xmlChar_ptr(n_utf, 0); + start = gen_int(n_start, 1); + len = gen_int(n_len, 2); + + ret_val = xmlUTF8Strsub(utf, start, len); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_utf, utf, 0); + des_int(n_start, start, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUTF8Strsub", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_utf); + printf(" %d", n_start); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; + + return(test_ret); +} + +static int +test_xmlstring(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n"); + test_ret += test_xmlCharStrdup(); + test_ret += test_xmlCharStrndup(); + test_ret += test_xmlCheckUTF8(); + test_ret += test_xmlGetUTF8Char(); + test_ret += test_xmlStrEqual(); + test_ret += test_xmlStrPrintf(); + test_ret += test_xmlStrQEqual(); + test_ret += test_xmlStrVPrintf(); + test_ret += test_xmlStrcasecmp(); + test_ret += test_xmlStrcasestr(); + test_ret += test_xmlStrchr(); + test_ret += test_xmlStrcmp(); + test_ret += test_xmlStrdup(); + test_ret += test_xmlStrlen(); + test_ret += test_xmlStrncasecmp(); + test_ret += test_xmlStrncatNew(); + test_ret += test_xmlStrncmp(); + test_ret += test_xmlStrndup(); + test_ret += test_xmlStrstr(); + test_ret += test_xmlStrsub(); + test_ret += test_xmlUTF8Charcmp(); + test_ret += test_xmlUTF8Size(); + test_ret += test_xmlUTF8Strlen(); + test_ret += test_xmlUTF8Strloc(); + test_ret += test_xmlUTF8Strndup(); + test_ret += test_xmlUTF8Strpos(); + test_ret += test_xmlUTF8Strsize(); + test_ret += test_xmlUTF8Strsub(); + + if (test_ret != 0) + printf("Module xmlstring: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlUCSIsAegeanNumbers(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsAegeanNumbers(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsAlphabeticPresentationForms(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsAlphabeticPresentationForms(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsArabic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsArabic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsArabic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsArabicPresentationFormsA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsArabicPresentationFormsA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsArabicPresentationFormsB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsArabicPresentationFormsB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsArmenian(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsArmenian(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsArmenian", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsArrows(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsArrows(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsArrows", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBasicLatin(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBasicLatin(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBasicLatin", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBengali(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBengali(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBengali", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBlock(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + char * block; /* UCS block name */ + int n_block; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + block = gen_const_char_ptr(n_block, 1); + + ret_val = xmlUCSIsBlock(code, block); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + des_const_char_ptr(n_block, block, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBlock", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf(" %d", n_block); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBlockElements(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBlockElements(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBlockElements", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBopomofo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBopomofo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBopomofo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBopomofoExtended(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBopomofoExtended(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBoxDrawing(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBoxDrawing(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBoxDrawing", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBraillePatterns(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBraillePatterns(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBraillePatterns", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsBuhid(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsBuhid(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsBuhid", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsByzantineMusicalSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsByzantineMusicalSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKCompatibility(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKCompatibility(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKCompatibilityForms(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKCompatibilityForms(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKCompatibilityIdeographs(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKCompatibilityIdeographs(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKRadicalsSupplement(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKRadicalsSupplement(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKSymbolsandPunctuation(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKSymbolsandPunctuation(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKUnifiedIdeographs(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKUnifiedIdeographs(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCat(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + char * cat; /* UCS Category name */ + int n_cat; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + cat = gen_const_char_ptr(n_cat, 1); + + ret_val = xmlUCSIsCat(code, cat); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + des_const_char_ptr(n_cat, cat, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf(" %d", n_cat); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatC(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatC(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatC", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatCc(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatCc(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatCc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatCf(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatCf(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatCf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatCo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatCo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatCo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatCs(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatCs(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatCs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatL(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatL(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatL", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatLl(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatLl(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatLl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatLm(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatLm(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatLm", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatLo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatLo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatLo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatLt(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatLt(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatLt", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatLu(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatLu(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatLu", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatM(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatM(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatM", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatMc(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatMc(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatMc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatMe(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatMe(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatMe", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatMn(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatMn(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatMn", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatN(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatN(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatN", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatNd(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatNd(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatNd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatNl(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatNl(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatNl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatNo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatNo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatNo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatP(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatP(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatP", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPc(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPc(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPd(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPd(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPe(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPe(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPe", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPf(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPf(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPi(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPi(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPi", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatPs(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatPs(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatPs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatS(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatS(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatSc(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatSc(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatSc", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatSk(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatSk(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatSk", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatSm(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatSm(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatSm", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatSo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatSo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatSo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatZ(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatZ(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatZ", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatZl(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatZl(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatZl", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatZp(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatZp(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatZp", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCatZs(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCatZs(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCatZs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCherokee(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCherokee(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCherokee", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCombiningDiacriticalMarks(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCombiningDiacriticalMarks(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCombiningHalfMarks(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCombiningHalfMarks(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCombiningMarksforSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCombiningMarksforSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsControlPictures(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsControlPictures(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsControlPictures", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCurrencySymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCurrencySymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCypriotSyllabary(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCypriotSyllabary(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCyrillic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCyrillic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCyrillic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsCyrillicSupplement(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsCyrillicSupplement(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsDeseret(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsDeseret(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsDeseret", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsDevanagari(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsDevanagari(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsDevanagari", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsDingbats(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsDingbats(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsDingbats", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsEnclosedAlphanumerics(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsEnclosedAlphanumerics(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsEnclosedCJKLettersandMonths(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsEthiopic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsEthiopic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsEthiopic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGeneralPunctuation(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGeneralPunctuation(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGeometricShapes(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGeometricShapes(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGeometricShapes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGeorgian(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGeorgian(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGeorgian", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGothic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGothic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGothic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGreek(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGreek(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGreek", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGreekExtended(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGreekExtended(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGreekExtended", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGreekandCoptic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGreekandCoptic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGujarati(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGujarati(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGujarati", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsGurmukhi(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsGurmukhi(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsGurmukhi", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHalfwidthandFullwidthForms(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHalfwidthandFullwidthForms(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHangulCompatibilityJamo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHangulCompatibilityJamo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHangulJamo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHangulJamo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHangulJamo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHangulSyllables(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHangulSyllables(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHangulSyllables", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHanunoo(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHanunoo(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHanunoo", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHebrew(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHebrew(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHebrew", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHighPrivateUseSurrogates(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHighPrivateUseSurrogates(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHighSurrogates(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHighSurrogates(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHighSurrogates", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsHiragana(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsHiragana(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsHiragana", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsIPAExtensions(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsIPAExtensions(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsIPAExtensions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsIdeographicDescriptionCharacters(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsIdeographicDescriptionCharacters(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKanbun(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKanbun(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKanbun", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKangxiRadicals(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKangxiRadicals(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKannada(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKannada(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKannada", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKatakana(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKatakana(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKatakana", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKatakanaPhoneticExtensions(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKatakanaPhoneticExtensions(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKhmer(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKhmer(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKhmer", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsKhmerSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsKhmerSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLao(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLao(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLao", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLatin1Supplement(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLatin1Supplement(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLatinExtendedA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLatinExtendedA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLatinExtendedAdditional(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLatinExtendedAdditional(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLatinExtendedB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLatinExtendedB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLetterlikeSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLetterlikeSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLimbu(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLimbu(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLimbu", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLinearBIdeograms(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLinearBIdeograms(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLinearBSyllabary(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLinearBSyllabary(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsLowSurrogates(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsLowSurrogates(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsLowSurrogates", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMalayalam(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMalayalam(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMalayalam", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMathematicalAlphanumericSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMathematicalOperators(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMathematicalOperators(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMiscellaneousSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMiscellaneousSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMiscellaneousSymbolsandArrows(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMiscellaneousTechnical(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMiscellaneousTechnical(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMongolian(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMongolian(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMongolian", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMusicalSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMusicalSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsMyanmar(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsMyanmar(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsMyanmar", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsNumberForms(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsNumberForms(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsNumberForms", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsOgham(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsOgham(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsOgham", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsOldItalic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsOldItalic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsOldItalic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsOpticalCharacterRecognition(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsOpticalCharacterRecognition(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsOriya(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsOriya(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsOriya", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsOsmanya(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsOsmanya(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsOsmanya", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsPhoneticExtensions(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsPhoneticExtensions(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsPrivateUse(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsPrivateUse(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsPrivateUse", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsPrivateUseArea(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsPrivateUseArea(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsRunic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsRunic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsRunic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsShavian(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsShavian(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsShavian", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSinhala(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSinhala(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSinhala", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSmallFormVariants(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSmallFormVariants(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSpacingModifierLetters(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSpacingModifierLetters(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSpecials(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSpecials(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSpecials", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSuperscriptsandSubscripts(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSuperscriptsandSubscripts(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSupplementalArrowsA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSupplementalArrowsA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSupplementalArrowsB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSupplementalArrowsB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSupplementalMathematicalOperators(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSupplementalMathematicalOperators(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSupplementaryPrivateUseAreaA(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSupplementaryPrivateUseAreaB(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsSyriac(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsSyriac(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsSyriac", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTagalog(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTagalog(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTagalog", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTagbanwa(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTagbanwa(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTagbanwa", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTags(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTags(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTags", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTaiLe(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTaiLe(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTaiLe", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTaiXuanJingSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTaiXuanJingSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTamil(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTamil(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTamil", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTelugu(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTelugu(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTelugu", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsThaana(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsThaana(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsThaana", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsThai(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsThai(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsThai", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsTibetan(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsTibetan(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsTibetan", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsUgaritic(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsUgaritic(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsUgaritic", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsVariationSelectors(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsVariationSelectors(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsVariationSelectors", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsVariationSelectorsSupplement(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsVariationSelectorsSupplement(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsYiRadicals(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsYiRadicals(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsYiRadicals", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsYiSyllables(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsYiSyllables(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsYiSyllables", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlUCSIsYijingHexagramSymbols(void) { + int test_ret = 0; + +#ifdef LIBXML_UNICODE_ENABLED + int mem_base; + int ret_val; + int code; /* UCS code point */ + int n_code; + + for (n_code = 0;n_code < gen_nb_int;n_code++) { + mem_base = xmlMemBlocks(); + code = gen_int(n_code, 0); + + ret_val = xmlUCSIsYijingHexagramSymbols(code); + desret_int(ret_val); + call_tests++; + des_int(n_code, code, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_code); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xmlunicode(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n"); + test_ret += test_xmlUCSIsAegeanNumbers(); + test_ret += test_xmlUCSIsAlphabeticPresentationForms(); + test_ret += test_xmlUCSIsArabic(); + test_ret += test_xmlUCSIsArabicPresentationFormsA(); + test_ret += test_xmlUCSIsArabicPresentationFormsB(); + test_ret += test_xmlUCSIsArmenian(); + test_ret += test_xmlUCSIsArrows(); + test_ret += test_xmlUCSIsBasicLatin(); + test_ret += test_xmlUCSIsBengali(); + test_ret += test_xmlUCSIsBlock(); + test_ret += test_xmlUCSIsBlockElements(); + test_ret += test_xmlUCSIsBopomofo(); + test_ret += test_xmlUCSIsBopomofoExtended(); + test_ret += test_xmlUCSIsBoxDrawing(); + test_ret += test_xmlUCSIsBraillePatterns(); + test_ret += test_xmlUCSIsBuhid(); + test_ret += test_xmlUCSIsByzantineMusicalSymbols(); + test_ret += test_xmlUCSIsCJKCompatibility(); + test_ret += test_xmlUCSIsCJKCompatibilityForms(); + test_ret += test_xmlUCSIsCJKCompatibilityIdeographs(); + test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement(); + test_ret += test_xmlUCSIsCJKRadicalsSupplement(); + test_ret += test_xmlUCSIsCJKSymbolsandPunctuation(); + test_ret += test_xmlUCSIsCJKUnifiedIdeographs(); + test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA(); + test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB(); + test_ret += test_xmlUCSIsCat(); + test_ret += test_xmlUCSIsCatC(); + test_ret += test_xmlUCSIsCatCc(); + test_ret += test_xmlUCSIsCatCf(); + test_ret += test_xmlUCSIsCatCo(); + test_ret += test_xmlUCSIsCatCs(); + test_ret += test_xmlUCSIsCatL(); + test_ret += test_xmlUCSIsCatLl(); + test_ret += test_xmlUCSIsCatLm(); + test_ret += test_xmlUCSIsCatLo(); + test_ret += test_xmlUCSIsCatLt(); + test_ret += test_xmlUCSIsCatLu(); + test_ret += test_xmlUCSIsCatM(); + test_ret += test_xmlUCSIsCatMc(); + test_ret += test_xmlUCSIsCatMe(); + test_ret += test_xmlUCSIsCatMn(); + test_ret += test_xmlUCSIsCatN(); + test_ret += test_xmlUCSIsCatNd(); + test_ret += test_xmlUCSIsCatNl(); + test_ret += test_xmlUCSIsCatNo(); + test_ret += test_xmlUCSIsCatP(); + test_ret += test_xmlUCSIsCatPc(); + test_ret += test_xmlUCSIsCatPd(); + test_ret += test_xmlUCSIsCatPe(); + test_ret += test_xmlUCSIsCatPf(); + test_ret += test_xmlUCSIsCatPi(); + test_ret += test_xmlUCSIsCatPo(); + test_ret += test_xmlUCSIsCatPs(); + test_ret += test_xmlUCSIsCatS(); + test_ret += test_xmlUCSIsCatSc(); + test_ret += test_xmlUCSIsCatSk(); + test_ret += test_xmlUCSIsCatSm(); + test_ret += test_xmlUCSIsCatSo(); + test_ret += test_xmlUCSIsCatZ(); + test_ret += test_xmlUCSIsCatZl(); + test_ret += test_xmlUCSIsCatZp(); + test_ret += test_xmlUCSIsCatZs(); + test_ret += test_xmlUCSIsCherokee(); + test_ret += test_xmlUCSIsCombiningDiacriticalMarks(); + test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols(); + test_ret += test_xmlUCSIsCombiningHalfMarks(); + test_ret += test_xmlUCSIsCombiningMarksforSymbols(); + test_ret += test_xmlUCSIsControlPictures(); + test_ret += test_xmlUCSIsCurrencySymbols(); + test_ret += test_xmlUCSIsCypriotSyllabary(); + test_ret += test_xmlUCSIsCyrillic(); + test_ret += test_xmlUCSIsCyrillicSupplement(); + test_ret += test_xmlUCSIsDeseret(); + test_ret += test_xmlUCSIsDevanagari(); + test_ret += test_xmlUCSIsDingbats(); + test_ret += test_xmlUCSIsEnclosedAlphanumerics(); + test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths(); + test_ret += test_xmlUCSIsEthiopic(); + test_ret += test_xmlUCSIsGeneralPunctuation(); + test_ret += test_xmlUCSIsGeometricShapes(); + test_ret += test_xmlUCSIsGeorgian(); + test_ret += test_xmlUCSIsGothic(); + test_ret += test_xmlUCSIsGreek(); + test_ret += test_xmlUCSIsGreekExtended(); + test_ret += test_xmlUCSIsGreekandCoptic(); + test_ret += test_xmlUCSIsGujarati(); + test_ret += test_xmlUCSIsGurmukhi(); + test_ret += test_xmlUCSIsHalfwidthandFullwidthForms(); + test_ret += test_xmlUCSIsHangulCompatibilityJamo(); + test_ret += test_xmlUCSIsHangulJamo(); + test_ret += test_xmlUCSIsHangulSyllables(); + test_ret += test_xmlUCSIsHanunoo(); + test_ret += test_xmlUCSIsHebrew(); + test_ret += test_xmlUCSIsHighPrivateUseSurrogates(); + test_ret += test_xmlUCSIsHighSurrogates(); + test_ret += test_xmlUCSIsHiragana(); + test_ret += test_xmlUCSIsIPAExtensions(); + test_ret += test_xmlUCSIsIdeographicDescriptionCharacters(); + test_ret += test_xmlUCSIsKanbun(); + test_ret += test_xmlUCSIsKangxiRadicals(); + test_ret += test_xmlUCSIsKannada(); + test_ret += test_xmlUCSIsKatakana(); + test_ret += test_xmlUCSIsKatakanaPhoneticExtensions(); + test_ret += test_xmlUCSIsKhmer(); + test_ret += test_xmlUCSIsKhmerSymbols(); + test_ret += test_xmlUCSIsLao(); + test_ret += test_xmlUCSIsLatin1Supplement(); + test_ret += test_xmlUCSIsLatinExtendedA(); + test_ret += test_xmlUCSIsLatinExtendedAdditional(); + test_ret += test_xmlUCSIsLatinExtendedB(); + test_ret += test_xmlUCSIsLetterlikeSymbols(); + test_ret += test_xmlUCSIsLimbu(); + test_ret += test_xmlUCSIsLinearBIdeograms(); + test_ret += test_xmlUCSIsLinearBSyllabary(); + test_ret += test_xmlUCSIsLowSurrogates(); + test_ret += test_xmlUCSIsMalayalam(); + test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols(); + test_ret += test_xmlUCSIsMathematicalOperators(); + test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA(); + test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB(); + test_ret += test_xmlUCSIsMiscellaneousSymbols(); + test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows(); + test_ret += test_xmlUCSIsMiscellaneousTechnical(); + test_ret += test_xmlUCSIsMongolian(); + test_ret += test_xmlUCSIsMusicalSymbols(); + test_ret += test_xmlUCSIsMyanmar(); + test_ret += test_xmlUCSIsNumberForms(); + test_ret += test_xmlUCSIsOgham(); + test_ret += test_xmlUCSIsOldItalic(); + test_ret += test_xmlUCSIsOpticalCharacterRecognition(); + test_ret += test_xmlUCSIsOriya(); + test_ret += test_xmlUCSIsOsmanya(); + test_ret += test_xmlUCSIsPhoneticExtensions(); + test_ret += test_xmlUCSIsPrivateUse(); + test_ret += test_xmlUCSIsPrivateUseArea(); + test_ret += test_xmlUCSIsRunic(); + test_ret += test_xmlUCSIsShavian(); + test_ret += test_xmlUCSIsSinhala(); + test_ret += test_xmlUCSIsSmallFormVariants(); + test_ret += test_xmlUCSIsSpacingModifierLetters(); + test_ret += test_xmlUCSIsSpecials(); + test_ret += test_xmlUCSIsSuperscriptsandSubscripts(); + test_ret += test_xmlUCSIsSupplementalArrowsA(); + test_ret += test_xmlUCSIsSupplementalArrowsB(); + test_ret += test_xmlUCSIsSupplementalMathematicalOperators(); + test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA(); + test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB(); + test_ret += test_xmlUCSIsSyriac(); + test_ret += test_xmlUCSIsTagalog(); + test_ret += test_xmlUCSIsTagbanwa(); + test_ret += test_xmlUCSIsTags(); + test_ret += test_xmlUCSIsTaiLe(); + test_ret += test_xmlUCSIsTaiXuanJingSymbols(); + test_ret += test_xmlUCSIsTamil(); + test_ret += test_xmlUCSIsTelugu(); + test_ret += test_xmlUCSIsThaana(); + test_ret += test_xmlUCSIsThai(); + test_ret += test_xmlUCSIsTibetan(); + test_ret += test_xmlUCSIsUgaritic(); + test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(); + test_ret += test_xmlUCSIsVariationSelectors(); + test_ret += test_xmlUCSIsVariationSelectorsSupplement(); + test_ret += test_xmlUCSIsYiRadicals(); + test_ret += test_xmlUCSIsYiSyllables(); + test_ret += test_xmlUCSIsYijingHexagramSymbols(); + + if (test_ret != 0) + printf("Module xmlunicode: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlNewTextWriter(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + xmlTextWriterPtr ret_val; + xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */ + int n_out; + + for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) { + mem_base = xmlMemBlocks(); + out = gen_xmlOutputBufferPtr(n_out, 0); + + ret_val = xmlNewTextWriter(out); + if (ret_val != NULL) out = NULL; + desret_xmlTextWriterPtr(ret_val); + call_tests++; + des_xmlOutputBufferPtr(n_out, out, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextWriter", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_out); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextWriterFilename(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + xmlTextWriterPtr ret_val; + const char * uri; /* the URI of the resource for the output */ + int n_uri; + int compression; /* compress the output? */ + int n_compression; + + for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + uri = gen_fileoutput(n_uri, 0); + compression = gen_int(n_compression, 1); + + ret_val = xmlNewTextWriterFilename(uri, compression); + desret_xmlTextWriterPtr(ret_val); + call_tests++; + des_fileoutput(n_uri, uri, 0); + des_int(n_compression, compression, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextWriterFilename", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_uri); + printf(" %d", n_compression); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextWriterMemory(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + xmlTextWriterPtr ret_val; + xmlBufferPtr buf; /* xmlBufferPtr */ + int n_buf; + int compression; /* compress the output? */ + int n_compression; + + for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + buf = gen_xmlBufferPtr(n_buf, 0); + compression = gen_int(n_compression, 1); + + ret_val = xmlNewTextWriterMemory(buf, compression); + desret_xmlTextWriterPtr(ret_val); + call_tests++; + des_xmlBufferPtr(n_buf, buf, 0); + des_int(n_compression, compression, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextWriterMemory", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_buf); + printf(" %d", n_compression); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextWriterPushParser(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + xmlTextWriterPtr ret_val; + xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */ + int n_ctxt; + int compression; /* compress the output? */ + int n_compression; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); + compression = gen_int(n_compression, 1); + + ret_val = xmlNewTextWriterPushParser(ctxt, compression); + if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL; + desret_xmlTextWriterPtr(ret_val); + call_tests++; + des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); + des_int(n_compression, compression, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextWriterPushParser", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_compression); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlNewTextWriterTree(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + xmlTextWriterPtr ret_val; + xmlDocPtr doc; /* xmlDocPtr */ + int n_doc; + xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */ + int n_node; + int compression; /* compress the output? */ + int n_compression; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_compression = 0;n_compression < gen_nb_int;n_compression++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + node = gen_xmlNodePtr(n_node, 1); + compression = gen_int(n_compression, 2); + + ret_val = xmlNewTextWriterTree(doc, node, compression); + desret_xmlTextWriterPtr(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + des_xmlNodePtr(n_node, node, 1); + des_int(n_compression, compression, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlNewTextWriterTree", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf(" %d", n_node); + printf(" %d", n_compression); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndAttribute(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndCDATA(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndCDATA(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndCDATA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndComment(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndComment(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndComment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndDTD(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndDTDAttlist(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndDTDAttlist(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndDTDElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndDTDElement(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndDTDElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndDTDEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndDTDEntity(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndDocument(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndElement(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterEndPI(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterEndPI(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterEndPI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterFlush(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterFlush(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterFlush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterFullEndElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterFullEndElement(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterFullEndElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterSetIndent(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + int indent; /* do indentation? */ + int n_indent; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_indent = 0;n_indent < gen_nb_int;n_indent++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + indent = gen_int(n_indent, 1); + + ret_val = xmlTextWriterSetIndent(writer, indent); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_int(n_indent, indent, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterSetIndent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_indent); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterSetIndentString(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * str; /* the xmlChar string */ + int n_str; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + str = gen_const_xmlChar_ptr(n_str, 1); + + ret_val = xmlTextWriterSetIndentString(writer, str); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_str, str, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterSetIndentString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_str); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* element name */ + int n_name; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextWriterStartAttribute(writer, name); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartAttributeNS(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * prefix; /* namespace prefix or NULL */ + int n_prefix; + xmlChar * name; /* element local name */ + int n_name; + xmlChar * namespaceURI; /* namespace URI or NULL */ + int n_namespaceURI; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); + + ret_val = xmlTextWriterStartAttributeNS(writer, prefix, name, namespaceURI); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_namespaceURI); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartCDATA(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterStartCDATA(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartCDATA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartComment(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + + ret_val = xmlTextWriterStartComment(writer); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartComment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD */ + int n_name; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + pubid = gen_const_xmlChar_ptr(n_pubid, 2); + sysid = gen_const_xmlChar_ptr(n_sysid, 3); + + ret_val = xmlTextWriterStartDTD(writer, name, pubid, sysid); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_pubid, pubid, 2); + des_const_xmlChar_ptr(n_sysid, sysid, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartDTDAttlist(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD ATTLIST */ + int n_name; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextWriterStartDTDAttlist(writer, name); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartDTDElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD element */ + int n_name; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextWriterStartDTDElement(writer, name); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartDTDElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartDTDEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + int pe; /* TRUE if this is a parameter entity, FALSE if not */ + int n_pe; + xmlChar * name; /* the name of the DTD ATTLIST */ + int n_name; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + pe = gen_int(n_pe, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + + ret_val = xmlTextWriterStartDTDEntity(writer, pe, name); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_int(n_pe, pe, 1); + des_const_xmlChar_ptr(n_name, name, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_pe); + printf(" %d", n_name); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartDocument(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + char * version; /* the xml version ("1.0") or NULL for default ("1.0") */ + int n_version; + char * encoding; /* the encoding or NULL for default */ + int n_encoding; + char * standalone; /* "yes" or "no" or NULL for default */ + int n_standalone; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) { + for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) { + for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + version = gen_const_char_ptr(n_version, 1); + encoding = gen_const_char_ptr(n_encoding, 2); + standalone = gen_const_char_ptr(n_standalone, 3); + + ret_val = xmlTextWriterStartDocument(writer, version, encoding, standalone); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_char_ptr(n_version, version, 1); + des_const_char_ptr(n_encoding, encoding, 2); + des_const_char_ptr(n_standalone, standalone, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartDocument", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_version); + printf(" %d", n_encoding); + printf(" %d", n_standalone); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* element name */ + int n_name; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlTextWriterStartElement(writer, name); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartElementNS(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * prefix; /* namespace prefix or NULL */ + int n_prefix; + xmlChar * name; /* element local name */ + int n_name; + xmlChar * namespaceURI; /* namespace URI or NULL */ + int n_namespaceURI; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); + + ret_val = xmlTextWriterStartElementNS(writer, prefix, name, namespaceURI); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartElementNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_namespaceURI); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterStartPI(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * target; /* PI target */ + int n_target; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + target = gen_const_xmlChar_ptr(n_target, 1); + + ret_val = xmlTextWriterStartPI(writer, target); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_target, target, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterStartPI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_target); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* attribute name */ + int n_name; + xmlChar * content; /* attribute content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlTextWriterWriteAttribute(writer, name, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteAttributeNS(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * prefix; /* namespace prefix */ + int n_prefix; + xmlChar * name; /* attribute local name */ + int n_name; + xmlChar * namespaceURI; /* namespace URI */ + int n_namespaceURI; + xmlChar * content; /* attribute content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); + content = gen_const_xmlChar_ptr(n_content, 4); + + ret_val = xmlTextWriterWriteAttributeNS(writer, prefix, name, namespaceURI, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3); + des_const_xmlChar_ptr(n_content, content, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_namespaceURI); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteBase64(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + char * data; /* binary data */ + int n_data; + int start; /* the position within the data of the first byte to encode */ + int n_start; + int len; /* the number of bytes to encode */ + int n_len; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { + for (n_start = 0;n_start < gen_nb_int;n_start++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + data = gen_const_char_ptr(n_data, 1); + start = gen_int(n_start, 2); + len = gen_int(n_len, 3); + + ret_val = xmlTextWriterWriteBase64(writer, data, start, len); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_char_ptr(n_data, data, 1); + des_int(n_start, start, 2); + des_int(n_len, len, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteBase64", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_data); + printf(" %d", n_start); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteBinHex(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + char * data; /* binary data */ + int n_data; + int start; /* the position within the data of the first byte to encode */ + int n_start; + int len; /* the number of bytes to encode */ + int n_len; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) { + for (n_start = 0;n_start < gen_nb_int;n_start++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + data = gen_const_char_ptr(n_data, 1); + start = gen_int(n_start, 2); + len = gen_int(n_len, 3); + + ret_val = xmlTextWriterWriteBinHex(writer, data, start, len); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_char_ptr(n_data, data, 1); + des_int(n_start, start, 2); + des_int(n_len, len, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteBinHex", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_data); + printf(" %d", n_start); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteCDATA(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * content; /* CDATA content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlTextWriterWriteCDATA(writer, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteCDATA", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteComment(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * content; /* comment string */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlTextWriterWriteComment(writer, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteComment", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTD(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD */ + int n_name; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + xmlChar * subset; /* string content of the DTD */ + int n_subset; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + pubid = gen_const_xmlChar_ptr(n_pubid, 2); + sysid = gen_const_xmlChar_ptr(n_sysid, 3); + subset = gen_const_xmlChar_ptr(n_subset, 4); + + ret_val = xmlTextWriterWriteDTD(writer, name, pubid, sysid, subset); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_pubid, pubid, 2); + des_const_xmlChar_ptr(n_sysid, sysid, 3); + des_const_xmlChar_ptr(n_subset, subset, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTD", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf(" %d", n_subset); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDAttlist(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD ATTLIST */ + int n_name; + xmlChar * content; /* content of the ATTLIST */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlTextWriterWriteDTDAttlist(writer, name, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the DTD element */ + int n_name; + xmlChar * content; /* content of the element */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlTextWriterWriteDTDElement(writer, name, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + int pe; /* TRUE if this is a parameter entity, FALSE if not */ + int n_pe; + xmlChar * name; /* the name of the DTD entity */ + int n_name; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + xmlChar * ndataid; /* the xml notation name. */ + int n_ndataid; + xmlChar * content; /* content of the entity */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + pe = gen_int(n_pe, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + pubid = gen_const_xmlChar_ptr(n_pubid, 3); + sysid = gen_const_xmlChar_ptr(n_sysid, 4); + ndataid = gen_const_xmlChar_ptr(n_ndataid, 5); + content = gen_const_xmlChar_ptr(n_content, 6); + + ret_val = xmlTextWriterWriteDTDEntity(writer, pe, name, pubid, sysid, ndataid, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_int(n_pe, pe, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_pubid, pubid, 3); + des_const_xmlChar_ptr(n_sysid, sysid, 4); + des_const_xmlChar_ptr(n_ndataid, ndataid, 5); + des_const_xmlChar_ptr(n_content, content, 6); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_pe); + printf(" %d", n_name); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf(" %d", n_ndataid); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDExternalEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + int pe; /* TRUE if this is a parameter entity, FALSE if not */ + int n_pe; + xmlChar * name; /* the name of the DTD entity */ + int n_name; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + xmlChar * ndataid; /* the xml notation name. */ + int n_ndataid; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + pe = gen_int(n_pe, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + pubid = gen_const_xmlChar_ptr(n_pubid, 3); + sysid = gen_const_xmlChar_ptr(n_sysid, 4); + ndataid = gen_const_xmlChar_ptr(n_ndataid, 5); + + ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, name, pubid, sysid, ndataid); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_int(n_pe, pe, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_pubid, pubid, 3); + des_const_xmlChar_ptr(n_sysid, sysid, 4); + des_const_xmlChar_ptr(n_ndataid, ndataid, 5); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_pe); + printf(" %d", n_name); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf(" %d", n_ndataid); + printf("\n"); + } + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDExternalEntityContents(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + xmlChar * ndataid; /* the xml notation name. */ + int n_ndataid; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + pubid = gen_const_xmlChar_ptr(n_pubid, 1); + sysid = gen_const_xmlChar_ptr(n_sysid, 2); + ndataid = gen_const_xmlChar_ptr(n_ndataid, 3); + + ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, pubid, sysid, ndataid); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_pubid, pubid, 1); + des_const_xmlChar_ptr(n_sysid, sysid, 2); + des_const_xmlChar_ptr(n_ndataid, ndataid, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf(" %d", n_ndataid); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDInternalEntity(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + int pe; /* TRUE if this is a parameter entity, FALSE if not */ + int n_pe; + xmlChar * name; /* the name of the DTD entity */ + int n_name; + xmlChar * content; /* content of the entity */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_pe = 0;n_pe < gen_nb_int;n_pe++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + pe = gen_int(n_pe, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + content = gen_const_xmlChar_ptr(n_content, 3); + + ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, name, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_int(n_pe, pe, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_content, content, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_pe); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteDTDNotation(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* the name of the xml notation */ + int n_name; + xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */ + int n_pubid; + xmlChar * sysid; /* the system identifier, which is the URI of the DTD */ + int n_sysid; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) { + for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + pubid = gen_const_xmlChar_ptr(n_pubid, 2); + sysid = gen_const_xmlChar_ptr(n_sysid, 3); + + ret_val = xmlTextWriterWriteDTDNotation(writer, name, pubid, sysid); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_pubid, pubid, 2); + des_const_xmlChar_ptr(n_sysid, sysid, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_pubid); + printf(" %d", n_sysid); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteElement(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * name; /* element name */ + int n_name; + xmlChar * content; /* element content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlTextWriterWriteElement(writer, name, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteElement", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_name); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteElementNS(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * prefix; /* namespace prefix */ + int n_prefix; + xmlChar * name; /* element local name */ + int n_name; + xmlChar * namespaceURI; /* namespace URI */ + int n_namespaceURI; + xmlChar * content; /* element content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + name = gen_const_xmlChar_ptr(n_name, 2); + namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3); + content = gen_const_xmlChar_ptr(n_content, 4); + + ret_val = xmlTextWriterWriteElementNS(writer, prefix, name, namespaceURI, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_name, name, 2); + des_const_xmlChar_ptr(n_namespaceURI, namespaceURI, 3); + des_const_xmlChar_ptr(n_content, content, 4); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteElementNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_prefix); + printf(" %d", n_name); + printf(" %d", n_namespaceURI); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatAttribute(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatAttributeNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatCDATA(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatComment(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatDTD(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatDTDAttlist(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatDTDElement(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatDTDInternalEntity(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatElement(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatElementNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatPI(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatRaw(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteFormatString(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWritePI(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * target; /* PI target */ + int n_target; + xmlChar * content; /* PI content */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + target = gen_const_xmlChar_ptr(n_target, 1); + content = gen_const_xmlChar_ptr(n_content, 2); + + ret_val = xmlTextWriterWritePI(writer, target, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_target, target, 1); + des_const_xmlChar_ptr(n_content, content, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWritePI", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_target); + printf(" %d", n_content); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteRaw(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * content; /* text string */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlTextWriterWriteRaw(writer, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteRaw", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteRawLen(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * content; /* text string */ + int n_content; + int len; /* length of the text string */ + int n_len; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + for (n_len = 0;n_len < gen_nb_int;n_len++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + len = gen_int(n_len, 2); + + ret_val = xmlTextWriterWriteRawLen(writer, content, len); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_content, content, 1); + des_int(n_len, len, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteRawLen", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_content); + printf(" %d", n_len); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteString(void) { + int test_ret = 0; + +#ifdef LIBXML_WRITER_ENABLED + int mem_base; + int ret_val; + xmlTextWriterPtr writer; /* the xmlTextWriterPtr */ + int n_writer; + xmlChar * content; /* text string */ + int n_content; + + for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) { + for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) { + mem_base = xmlMemBlocks(); + writer = gen_xmlTextWriterPtr(n_writer, 0); + content = gen_const_xmlChar_ptr(n_content, 1); + + ret_val = xmlTextWriterWriteString(writer, content); + desret_int(ret_val); + call_tests++; + des_xmlTextWriterPtr(n_writer, writer, 0); + des_const_xmlChar_ptr(n_content, content, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlTextWriterWriteString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_writer); + printf(" %d", n_content); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatAttribute(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatAttributeNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatCDATA(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatComment(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatDTD(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatDTDAttlist(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatDTDElement(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatDTDInternalEntity(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatElement(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatElementNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatPI(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatRaw(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlTextWriterWriteVFormatString(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +static int +test_xmlwriter(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n"); + test_ret += test_xmlNewTextWriter(); + test_ret += test_xmlNewTextWriterFilename(); + test_ret += test_xmlNewTextWriterMemory(); + test_ret += test_xmlNewTextWriterPushParser(); + test_ret += test_xmlNewTextWriterTree(); + test_ret += test_xmlTextWriterEndAttribute(); + test_ret += test_xmlTextWriterEndCDATA(); + test_ret += test_xmlTextWriterEndComment(); + test_ret += test_xmlTextWriterEndDTD(); + test_ret += test_xmlTextWriterEndDTDAttlist(); + test_ret += test_xmlTextWriterEndDTDElement(); + test_ret += test_xmlTextWriterEndDTDEntity(); + test_ret += test_xmlTextWriterEndDocument(); + test_ret += test_xmlTextWriterEndElement(); + test_ret += test_xmlTextWriterEndPI(); + test_ret += test_xmlTextWriterFlush(); + test_ret += test_xmlTextWriterFullEndElement(); + test_ret += test_xmlTextWriterSetIndent(); + test_ret += test_xmlTextWriterSetIndentString(); + test_ret += test_xmlTextWriterStartAttribute(); + test_ret += test_xmlTextWriterStartAttributeNS(); + test_ret += test_xmlTextWriterStartCDATA(); + test_ret += test_xmlTextWriterStartComment(); + test_ret += test_xmlTextWriterStartDTD(); + test_ret += test_xmlTextWriterStartDTDAttlist(); + test_ret += test_xmlTextWriterStartDTDElement(); + test_ret += test_xmlTextWriterStartDTDEntity(); + test_ret += test_xmlTextWriterStartDocument(); + test_ret += test_xmlTextWriterStartElement(); + test_ret += test_xmlTextWriterStartElementNS(); + test_ret += test_xmlTextWriterStartPI(); + test_ret += test_xmlTextWriterWriteAttribute(); + test_ret += test_xmlTextWriterWriteAttributeNS(); + test_ret += test_xmlTextWriterWriteBase64(); + test_ret += test_xmlTextWriterWriteBinHex(); + test_ret += test_xmlTextWriterWriteCDATA(); + test_ret += test_xmlTextWriterWriteComment(); + test_ret += test_xmlTextWriterWriteDTD(); + test_ret += test_xmlTextWriterWriteDTDAttlist(); + test_ret += test_xmlTextWriterWriteDTDElement(); + test_ret += test_xmlTextWriterWriteDTDEntity(); + test_ret += test_xmlTextWriterWriteDTDExternalEntity(); + test_ret += test_xmlTextWriterWriteDTDExternalEntityContents(); + test_ret += test_xmlTextWriterWriteDTDInternalEntity(); + test_ret += test_xmlTextWriterWriteDTDNotation(); + test_ret += test_xmlTextWriterWriteElement(); + test_ret += test_xmlTextWriterWriteElementNS(); + test_ret += test_xmlTextWriterWriteFormatAttribute(); + test_ret += test_xmlTextWriterWriteFormatAttributeNS(); + test_ret += test_xmlTextWriterWriteFormatCDATA(); + test_ret += test_xmlTextWriterWriteFormatComment(); + test_ret += test_xmlTextWriterWriteFormatDTD(); + test_ret += test_xmlTextWriterWriteFormatDTDAttlist(); + test_ret += test_xmlTextWriterWriteFormatDTDElement(); + test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity(); + test_ret += test_xmlTextWriterWriteFormatElement(); + test_ret += test_xmlTextWriterWriteFormatElementNS(); + test_ret += test_xmlTextWriterWriteFormatPI(); + test_ret += test_xmlTextWriterWriteFormatRaw(); + test_ret += test_xmlTextWriterWriteFormatString(); + test_ret += test_xmlTextWriterWritePI(); + test_ret += test_xmlTextWriterWriteRaw(); + test_ret += test_xmlTextWriterWriteRawLen(); + test_ret += test_xmlTextWriterWriteString(); + test_ret += test_xmlTextWriterWriteVFormatAttribute(); + test_ret += test_xmlTextWriterWriteVFormatAttributeNS(); + test_ret += test_xmlTextWriterWriteVFormatCDATA(); + test_ret += test_xmlTextWriterWriteVFormatComment(); + test_ret += test_xmlTextWriterWriteVFormatDTD(); + test_ret += test_xmlTextWriterWriteVFormatDTDAttlist(); + test_ret += test_xmlTextWriterWriteVFormatDTDElement(); + test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity(); + test_ret += test_xmlTextWriterWriteVFormatElement(); + test_ret += test_xmlTextWriterWriteVFormatElementNS(); + test_ret += test_xmlTextWriterWriteVFormatPI(); + test_ret += test_xmlTextWriterWriteVFormatRaw(); + test_ret += test_xmlTextWriterWriteVFormatString(); + + if (test_ret != 0) + printf("Module xmlwriter: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlXPathCastBooleanToNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + int val; /* a boolean */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlXPathCastBooleanToNumber(val); + desret_double(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastBooleanToString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + int val; /* a boolean */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlXPathCastBooleanToString(val); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastBooleanToString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNodeSetToBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlNodeSetPtr ns; /* a node-set */ + int n_ns; + + for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { + mem_base = xmlMemBlocks(); + ns = gen_xmlNodeSetPtr(n_ns, 0); + + ret_val = xmlXPathCastNodeSetToBoolean(ns); + desret_int(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_ns, ns, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ns); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNodeSetToNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlNodeSetPtr ns; /* a node-set */ + int n_ns; + + for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { + mem_base = xmlMemBlocks(); + ns = gen_xmlNodeSetPtr(n_ns, 0); + + ret_val = xmlXPathCastNodeSetToNumber(ns); + desret_double(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_ns, ns, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ns); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNodeSetToString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlNodeSetPtr ns; /* a node-set */ + int n_ns; + + for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) { + mem_base = xmlMemBlocks(); + ns = gen_xmlNodeSetPtr(n_ns, 0); + + ret_val = xmlXPathCastNodeSetToString(ns); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_ns, ns, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNodeSetToString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ns); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNodeToNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlXPathCastNodeToNumber(node); + desret_double(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNodeToNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNodeToString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + node = gen_xmlNodePtr(n_node, 0); + + ret_val = xmlXPathCastNodeToString(node); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlNodePtr(n_node, node, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNodeToString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNumberToBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + double val; /* a number */ + int n_val; + + for (n_val = 0;n_val < gen_nb_double;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_double(n_val, 0); + + ret_val = xmlXPathCastNumberToBoolean(val); + desret_int(ret_val); + call_tests++; + des_double(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastNumberToString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + double val; /* a number */ + int n_val; + + for (n_val = 0;n_val < gen_nb_double;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_double(n_val, 0); + + ret_val = xmlXPathCastNumberToString(val); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_double(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastNumberToString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastStringToBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlChar * val; /* a string */ + int n_val; + + for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_const_xmlChar_ptr(n_val, 0); + + ret_val = xmlXPathCastStringToBoolean(val); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastStringToBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastStringToNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlChar * val; /* a string */ + int n_val; + + for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_const_xmlChar_ptr(n_val, 0); + + ret_val = xmlXPathCastStringToNumber(val); + desret_double(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastStringToNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastToBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathCastToBoolean(val); + desret_int(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastToBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastToNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathCastToNumber(val); + desret_double(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastToNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCastToString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathCastToString(val); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCastToString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCmpNodes(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlNodePtr node1; /* the first node */ + int n_node1; + xmlNodePtr node2; /* the second node */ + int n_node2; + + for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) { + for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) { + mem_base = xmlMemBlocks(); + node1 = gen_xmlNodePtr(n_node1, 0); + node2 = gen_xmlNodePtr(n_node2, 1); + + ret_val = xmlXPathCmpNodes(node1, node2); + desret_int(ret_val); + call_tests++; + des_xmlNodePtr(n_node1, node1, 0); + des_xmlNodePtr(n_node2, node2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCmpNodes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_node1); + printf(" %d", n_node2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCompile(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + +#ifdef LIBXML_XPATH_ENABLED + +#define gen_nb_xmlXPathCompExprPtr 1 +static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + +#ifdef LIBXML_XPATH_ENABLED + +#define gen_nb_xmlXPathContextPtr 1 +static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlXPathCompiledEval(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathCompExprPtr comp; /* the compiled XPath expression */ + int n_comp; + xmlXPathContextPtr ctx; /* the XPath context */ + int n_ctx; + + for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { + for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + comp = gen_xmlXPathCompExprPtr(n_comp, 0); + ctx = gen_xmlXPathContextPtr(n_ctx, 1); + + ret_val = xmlXPathCompiledEval(comp, ctx); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathCompExprPtr(n_comp, comp, 0); + des_xmlXPathContextPtr(n_ctx, ctx, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCompiledEval", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_comp); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathConvertBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathConvertBoolean(val); + val = NULL; + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathConvertBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathConvertNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathConvertNumber(val); + val = NULL; + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathConvertNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathConvertString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr val; /* an XPath object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathConvertString(val); + val = NULL; + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathConvertString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCtxtCompile(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathEval(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlChar * str; /* the XPath expression */ + int n_str; + xmlXPathContextPtr ctx; /* the XPath context */ + int n_ctx; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + ctx = gen_xmlXPathContextPtr(n_ctx, 1); + + ret_val = xmlXPathEval(str, ctx); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_xmlXPathContextPtr(n_ctx, ctx, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEval", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathEvalExpression(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlChar * str; /* the XPath expression */ + int n_str; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 1); + + ret_val = xmlXPathEvalExpression(str, ctxt); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_xmlXPathContextPtr(n_ctxt, ctxt, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEvalExpression", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_ctxt); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathEvalPredicate(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */ + int n_res; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + res = gen_xmlXPathObjectPtr(n_res, 1); + + ret_val = xmlXPathEvalPredicate(ctxt, res); + desret_int(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_xmlXPathObjectPtr(n_res, res, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEvalPredicate", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_res); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathInit(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + + mem_base = xmlMemBlocks(); + + xmlXPathInit(); + call_tests++; + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathInit", + xmlMemBlocks() - mem_base); + test_ret++; + printf("\n"); + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathIsInf(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + double val; /* a double value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_double;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_double(n_val, 0); + + ret_val = xmlXPathIsInf(val); + desret_int(ret_val); + call_tests++; + des_double(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathIsInf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathIsNaN(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + double val; /* a double value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_double;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_double(n_val, 0); + + ret_val = xmlXPathIsNaN(val); + desret_int(ret_val); + call_tests++; + des_double(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathIsNaN", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewContext(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathNodeSetCreate(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodePtr val; /* an initial xmlNodePtr, or NULL */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlNodePtr(n_val, 0); + + ret_val = xmlXPathNodeSetCreate(val); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetCreate", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathObjectCopy(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr val; /* the original object */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlXPathObjectPtr(n_val, 0); + + ret_val = xmlXPathObjectCopy(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathObjectCopy", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathOrderDocElems(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + long ret_val; + xmlDocPtr doc; /* an input document */ + int n_doc; + + for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) { + mem_base = xmlMemBlocks(); + doc = gen_xmlDocPtr(n_doc, 0); + + ret_val = xmlXPathOrderDocElems(doc); + desret_long(ret_val); + call_tests++; + des_xmlDocPtr(n_doc, doc, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathOrderDocElems", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_doc); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xpath(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n"); + test_ret += test_xmlXPathCastBooleanToNumber(); + test_ret += test_xmlXPathCastBooleanToString(); + test_ret += test_xmlXPathCastNodeSetToBoolean(); + test_ret += test_xmlXPathCastNodeSetToNumber(); + test_ret += test_xmlXPathCastNodeSetToString(); + test_ret += test_xmlXPathCastNodeToNumber(); + test_ret += test_xmlXPathCastNodeToString(); + test_ret += test_xmlXPathCastNumberToBoolean(); + test_ret += test_xmlXPathCastNumberToString(); + test_ret += test_xmlXPathCastStringToBoolean(); + test_ret += test_xmlXPathCastStringToNumber(); + test_ret += test_xmlXPathCastToBoolean(); + test_ret += test_xmlXPathCastToNumber(); + test_ret += test_xmlXPathCastToString(); + test_ret += test_xmlXPathCmpNodes(); + test_ret += test_xmlXPathCompile(); + test_ret += test_xmlXPathCompiledEval(); + test_ret += test_xmlXPathConvertBoolean(); + test_ret += test_xmlXPathConvertNumber(); + test_ret += test_xmlXPathConvertString(); + test_ret += test_xmlXPathCtxtCompile(); + test_ret += test_xmlXPathEval(); + test_ret += test_xmlXPathEvalExpression(); + test_ret += test_xmlXPathEvalPredicate(); + test_ret += test_xmlXPathInit(); + test_ret += test_xmlXPathIsInf(); + test_ret += test_xmlXPathIsNaN(); + test_ret += test_xmlXPathNewContext(); + test_ret += test_xmlXPathNodeSetCreate(); + test_ret += test_xmlXPathObjectCopy(); + test_ret += test_xmlXPathOrderDocElems(); + + if (test_ret != 0) + printf("Module xpath: %d errors\n", test_ret); + return(test_ret); +} +#ifdef LIBXML_XPATH_ENABLED + +#define gen_nb_xmlXPathParserContextPtr 1 +static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_valuePop(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = valuePop(ctxt); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in valuePop", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_valuePush(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */ + int n_ctxt; + xmlXPathObjectPtr value; /* the XPath object */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + value = gen_xmlXPathObjectPtr(n_value, 1); + + ret_val = valuePush(ctxt, value); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlXPathObjectPtr(n_value, value, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in valuePush", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_value); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathAddValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathAddValues(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathAddValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathBooleanFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathBooleanFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathBooleanFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCeilingFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathCeilingFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCeilingFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCompareValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int inf; /* less than (1) or greater than (0) */ + int n_inf; + int strict; /* is the comparison strict */ + int n_strict; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_inf = 0;n_inf < gen_nb_int;n_inf++) { + for (n_strict = 0;n_strict < gen_nb_int;n_strict++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + inf = gen_int(n_inf, 1); + strict = gen_int(n_strict, 2); + + ret_val = xmlXPathCompareValues(ctxt, inf, strict); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_inf, inf, 1); + des_int(n_strict, strict, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCompareValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_inf); + printf(" %d", n_strict); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathConcatFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathConcatFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathConcatFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathContainsFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathContainsFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathContainsFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathCountFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathCountFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathCountFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDebugDumpCompExpr(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * for the output */ + int n_output; + xmlXPathCompExprPtr comp; /* the precompiled XPath expression */ + int n_comp; + int depth; /* the indentation level. */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + comp = gen_xmlXPathCompExprPtr(n_comp, 1); + depth = gen_int(n_depth, 2); + + xmlXPathDebugDumpCompExpr(output, comp, depth); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlXPathCompExprPtr(n_comp, comp, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_comp); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDebugDumpObject(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED +#ifdef LIBXML_DEBUG_ENABLED + int mem_base; + FILE * output; /* the FILE * to dump the output */ + int n_output; + xmlXPathObjectPtr cur; /* the object to inspect */ + int n_cur; + int depth; /* indentation level */ + int n_depth; + + for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) { + for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) { + for (n_depth = 0;n_depth < gen_nb_int;n_depth++) { + mem_base = xmlMemBlocks(); + output = gen_FILE_ptr(n_output, 0); + cur = gen_xmlXPathObjectPtr(n_cur, 1); + depth = gen_int(n_depth, 2); + + xmlXPathDebugDumpObject(output, cur, depth); + call_tests++; + des_FILE_ptr(n_output, output, 0); + des_xmlXPathObjectPtr(n_cur, cur, 1); + des_int(n_depth, depth, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDebugDumpObject", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_output); + printf(" %d", n_cur); + printf(" %d", n_depth); + printf("\n"); + } + } + } + } + function_tests++; +#endif +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDifference(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathDifference(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDifference", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDistinct(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set */ + int n_nodes; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + + ret_val = xmlXPathDistinct(nodes); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDistinct", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDistinctSorted(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ + int n_nodes; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + + ret_val = xmlXPathDistinctSorted(nodes); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDistinctSorted", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathDivValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathDivValues(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathDivValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathEqualValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathEqualValues(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEqualValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathErr(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* a XPath parser context */ + int n_ctxt; + int error; /* the error code */ + int n_error; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_error = 0;n_error < gen_nb_int;n_error++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + error = gen_int(n_error, 1); + + xmlXPathErr(ctxt, error); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_error, error, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathErr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_error); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathEvalExpr(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathEvalExpr(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEvalExpr", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathEvaluatePredicateResult(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */ + int n_res; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + res = gen_xmlXPathObjectPtr(n_res, 1); + + ret_val = xmlXPathEvaluatePredicateResult(ctxt, res); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlXPathObjectPtr(n_res, res, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_res); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathFalseFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathFalseFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathFalseFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathFloorFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathFloorFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathFloorFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathFunctionLookup(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathFunctionLookupNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathHasSameNodes(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlNodeSetPtr nodes1; /* a node-set */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathHasSameNodes(nodes1, nodes2); + desret_int(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathHasSameNodes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathIdFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathIdFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathIdFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathIntersection(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathIntersection(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathIntersection", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathIsNodeType(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlChar * name; /* a name string */ + int n_name; + + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + name = gen_const_xmlChar_ptr(n_name, 0); + + ret_val = xmlXPathIsNodeType(name); + desret_int(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_name, name, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathIsNodeType", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_name); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathLangFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathLangFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathLangFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathLastFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathLastFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathLastFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathLeading(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathLeading(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathLeading", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathLeadingSorted(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathLeadingSorted(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathLeadingSorted", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathLocalNameFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathLocalNameFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathLocalNameFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathModValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathModValues(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathModValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathMultValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathMultValues(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathMultValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNamespaceURIFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathNamespaceURIFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + int val; /* the boolean value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_int(n_val, 0); + + ret_val = xmlXPathNewBoolean(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_int(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewCString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + char * val; /* the char * value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_const_char_ptr(n_val, 0); + + ret_val = xmlXPathNewCString(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_const_char_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewCString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewFloat(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + double val; /* the double value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_double;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_double(n_val, 0); + + ret_val = xmlXPathNewFloat(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_double(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewFloat", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewNodeSet(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr val; /* the NodePtr value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlNodePtr(n_val, 0); + + ret_val = xmlXPathNewNodeSet(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewNodeSet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewNodeSetList(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodeSetPtr val; /* an existing NodeSet */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlNodeSetPtr(n_val, 0); + + ret_val = xmlXPathNewNodeSetList(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewNodeSetList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNewParserContext(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathNewString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlChar * val; /* the xmlChar * value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_const_xmlChar_ptr(n_val, 0); + + ret_val = xmlXPathNewString(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNewString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextAncestor(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextAncestor(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextAncestor", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextAncestorOrSelf(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextAttribute(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current attribute in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextAttribute(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextAttribute", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextChild(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextChild(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextChild", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextDescendant(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextDescendant(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextDescendant", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextDescendantOrSelf(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextFollowing(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextFollowing(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextFollowing", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextFollowingSibling(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextFollowingSibling(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextFollowingSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextNamespace(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current attribute in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextNamespace(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextNamespace", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextParent(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextParent(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextParent", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextPreceding(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextPreceding(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextPreceding", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextPrecedingSibling(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextPrecedingSibling(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNextSelf(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + xmlNodePtr cur; /* the current node in the traversal */ + int n_cur; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + cur = gen_xmlNodePtr(n_cur, 1); + + ret_val = xmlXPathNextSelf(ctxt, cur); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_xmlNodePtr(n_cur, cur, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNextSelf", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_cur); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeLeading(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set */ + int n_nodes; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlXPathNodeLeading(nodes, node); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeLeading", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeLeadingSorted(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ + int n_nodes; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlXPathNodeLeadingSorted(nodes, node); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetAdd(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr cur; /* the initial node set */ + int n_cur; + xmlNodePtr val; /* a new xmlNodePtr */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + val = gen_xmlNodePtr(n_val, 1); + + xmlXPathNodeSetAdd(cur, val); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_xmlNodePtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetAdd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetAddNs(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr cur; /* the initial node set */ + int n_cur; + xmlNodePtr node; /* the hosting node */ + int n_node; + xmlNsPtr ns; /* a the namespace node */ + int n_ns; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + node = gen_xmlNodePtr(n_node, 1); + ns = gen_xmlNsPtr(n_ns, 2); + + xmlXPathNodeSetAddNs(cur, node, ns); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_xmlNodePtr(n_node, node, 1); + des_xmlNsPtr(n_ns, ns, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetAddNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_node); + printf(" %d", n_ns); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetAddUnique(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr cur; /* the initial node set */ + int n_cur; + xmlNodePtr val; /* a new xmlNodePtr */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + val = gen_xmlNodePtr(n_val, 1); + + xmlXPathNodeSetAddUnique(cur, val); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_xmlNodePtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetContains(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlNodeSetPtr cur; /* the node-set */ + int n_cur; + xmlNodePtr val; /* the node */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + val = gen_xmlNodePtr(n_val, 1); + + ret_val = xmlXPathNodeSetContains(cur, val); + desret_int(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_xmlNodePtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetContains", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetDel(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr cur; /* the initial node set */ + int n_cur; + xmlNodePtr val; /* an xmlNodePtr */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + val = gen_xmlNodePtr(n_val, 1); + + xmlXPathNodeSetDel(cur, val); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_xmlNodePtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetDel", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetMerge(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr val1; /* the first NodeSet or NULL */ + int n_val1; + xmlNodeSetPtr val2; /* the second NodeSet */ + int n_val2; + + for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) { + for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) { + mem_base = xmlMemBlocks(); + val1 = gen_xmlNodeSetPtr(n_val1, 0); + val2 = gen_xmlNodeSetPtr(n_val2, 1); + + ret_val = xmlXPathNodeSetMerge(val1, val2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_val1, val1, 0); + des_xmlNodeSetPtr(n_val2, val2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetMerge", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val1); + printf(" %d", n_val2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetRemove(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr cur; /* the initial node set */ + int n_cur; + int val; /* the index to remove */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlNodeSetPtr(n_cur, 0); + val = gen_int(n_val, 1); + + xmlXPathNodeSetRemove(cur, val); + call_tests++; + des_xmlNodeSetPtr(n_cur, cur, 0); + des_int(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetRemove", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeSetSort(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr set; /* the node set */ + int n_set; + + for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) { + mem_base = xmlMemBlocks(); + set = gen_xmlNodeSetPtr(n_set, 0); + + xmlXPathNodeSetSort(set); + call_tests++; + des_xmlNodeSetPtr(n_set, set, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeSetSort", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_set); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeTrailing(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set */ + int n_nodes; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlXPathNodeTrailing(nodes, node); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeTrailing", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNodeTrailingSorted(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes; /* a node-set, sorted by document order */ + int n_nodes; + xmlNodePtr node; /* a node */ + int n_node; + + for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) { + for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) { + mem_base = xmlMemBlocks(); + nodes = gen_xmlNodeSetPtr(n_nodes, 0); + node = gen_xmlNodePtr(n_node, 1); + + ret_val = xmlXPathNodeTrailingSorted(nodes, node); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes, nodes, 0); + des_xmlNodePtr(n_node, node, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes); + printf(" %d", n_node); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNormalizeFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathNormalizeFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNormalizeFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNotEqualValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathNotEqualValues(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNotEqualValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNotFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathNotFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNotFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNsLookup(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + const xmlChar * ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * prefix; /* the namespace prefix value */ + int n_prefix; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + + ret_val = xmlXPathNsLookup(ctxt, prefix); + desret_const_xmlChar_ptr(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNsLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_prefix); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathNumberFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathNumberFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathNumberFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathParseNCName(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathParseNCName(ctxt); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathParseNCName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathParseName(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathParseName(ctxt); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathParseName", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPopBoolean(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathPopBoolean(ctxt); + desret_int(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPopBoolean", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPopExternal(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + void * ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathPopExternal(ctxt); + desret_void_ptr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPopExternal", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPopNodeSet(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathPopNodeSet(ctxt); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPopNodeSet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPopNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathPopNumber(ctxt); + desret_double(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPopNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPopString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlChar * ret_val; + xmlXPathParserContextPtr ctxt; /* an XPath parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + ret_val = xmlXPathPopString(ctxt); + desret_xmlChar_ptr(ret_val); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPopString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathPositionFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathPositionFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathPositionFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisterAllFunctions(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + + xmlXPathRegisterAllFunctions(ctxt); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisterFunc(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathRegisterFuncLookup(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathRegisterFuncNS(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathRegisterNs(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * prefix; /* the namespace prefix */ + int n_prefix; + xmlChar * ns_uri; /* the namespace name */ + int n_ns_uri; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) { + for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + prefix = gen_const_xmlChar_ptr(n_prefix, 1); + ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); + + ret_val = xmlXPathRegisterNs(ctxt, prefix, ns_uri); + desret_int(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_prefix, prefix, 1); + des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisterNs", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_prefix); + printf(" %d", n_ns_uri); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisterVariable(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * name; /* the variable name */ + int n_name; + xmlXPathObjectPtr value; /* the variable value or NULL */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + value = gen_xmlXPathObjectPtr(n_value, 2); + + ret_val = xmlXPathRegisterVariable(ctxt, name, value); + desret_int(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_xmlXPathObjectPtr(n_value, value, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisterVariable", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisterVariableLookup(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPathRegisterVariableNS(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + int ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * name; /* the variable name */ + int n_name; + xmlChar * ns_uri; /* the variable namespace URI */ + int n_ns_uri; + xmlXPathObjectPtr value; /* the variable value or NULL */ + int n_value; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { + for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); + value = gen_xmlXPathObjectPtr(n_value, 3); + + ret_val = xmlXPathRegisterVariableNS(ctxt, name, ns_uri, value); + desret_int(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2); + des_xmlXPathObjectPtr(n_value, value, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisterVariableNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_ns_uri); + printf(" %d", n_value); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisteredFuncsCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + + xmlXPathRegisteredFuncsCleanup(ctxt); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisteredNsCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + + xmlXPathRegisteredNsCleanup(ctxt); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRegisteredVariablesCleanup(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + + xmlXPathRegisteredVariablesCleanup(ctxt); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRoot(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathRoot(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRoot", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathRoundFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathRoundFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathRoundFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathStartsWithFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathStartsWithFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathStartsWithFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathStringEvalNumber(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + double ret_val; + xmlChar * str; /* A string to scan */ + int n_str; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + + ret_val = xmlXPathStringEvalNumber(str); + desret_double(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathStringEvalNumber", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathStringFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathStringFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathStringFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathStringLengthFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathStringLengthFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathStringLengthFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathSubValues(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathSubValues(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathSubValues", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathSubstringAfterFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathSubstringAfterFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathSubstringBeforeFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathSubstringBeforeFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathSubstringFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathSubstringFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathSubstringFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathSumFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathSumFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathSumFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathTrailing(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathTrailing(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathTrailing", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathTrailingSorted(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlNodeSetPtr ret_val; + xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */ + int n_nodes1; + xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */ + int n_nodes2; + + for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) { + for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) { + mem_base = xmlMemBlocks(); + nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0); + nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1); + + ret_val = xmlXPathTrailingSorted(nodes1, nodes2); + desret_xmlNodeSetPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_nodes1, nodes1, 0); + des_xmlNodeSetPtr(n_nodes2, nodes2, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathTrailingSorted", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_nodes1); + printf(" %d", n_nodes2); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathTranslateFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathTranslateFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathTranslateFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathTrueFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + int nargs; /* the number of arguments */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPathTrueFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathTrueFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathValueFlipSign(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPathValueFlipSign(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathValueFlipSign", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathVariableLookup(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * name; /* the variable name */ + int n_name; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + + ret_val = xmlXPathVariableLookup(ctxt, name); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_name, name, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathVariableLookup", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathVariableLookupNS(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathContextPtr ctxt; /* the XPath context */ + int n_ctxt; + xmlChar * name; /* the variable name */ + int n_name; + xmlChar * ns_uri; /* the variable namespace URI */ + int n_ns_uri; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) { + for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) { + for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathContextPtr(n_ctxt, 0); + name = gen_const_xmlChar_ptr(n_name, 1); + ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2); + + ret_val = xmlXPathVariableLookupNS(ctxt, name, ns_uri); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathContextPtr(n_ctxt, ctxt, 0); + des_const_xmlChar_ptr(n_name, name, 1); + des_const_xmlChar_ptr(n_ns_uri, ns_uri, 2); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathVariableLookupNS", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_name); + printf(" %d", n_ns_uri); + printf("\n"); + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathWrapCString(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + char * val; /* the char * value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_char_ptr(n_val, 0); + + ret_val = xmlXPathWrapCString(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_char_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathWrapCString", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathWrapExternal(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + void * val; /* the user data */ + int n_val; + + for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_void_ptr(n_val, 0); + + ret_val = xmlXPathWrapExternal(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_void_ptr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathWrapExternal", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPathWrapNodeSet(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodeSetPtr val; /* the NodePtr value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlNodeSetPtr(n_val, 0); + + ret_val = xmlXPathWrapNodeSet(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPathWrapNodeSet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPatherror(void) { + int test_ret = 0; + +#ifdef LIBXML_XPATH_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPath Parser context */ + int n_ctxt; + const char * file; /* the file name */ + int n_file; + int line; /* the line number */ + int n_line; + int no; /* the error number */ + int n_no; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_file = 0;n_file < gen_nb_filepath;n_file++) { + for (n_line = 0;n_line < gen_nb_int;n_line++) { + for (n_no = 0;n_no < gen_nb_int;n_no++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + file = gen_filepath(n_file, 1); + line = gen_int(n_line, 2); + no = gen_int(n_no, 3); + + xmlXPatherror(ctxt, file, line, no); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_filepath(n_file, file, 1); + des_int(n_line, line, 2); + des_int(n_no, no, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPatherror", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_file); + printf(" %d", n_line); + printf(" %d", n_no); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xpathInternals(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n"); + test_ret += test_valuePop(); + test_ret += test_valuePush(); + test_ret += test_xmlXPathAddValues(); + test_ret += test_xmlXPathBooleanFunction(); + test_ret += test_xmlXPathCeilingFunction(); + test_ret += test_xmlXPathCompareValues(); + test_ret += test_xmlXPathConcatFunction(); + test_ret += test_xmlXPathContainsFunction(); + test_ret += test_xmlXPathCountFunction(); + test_ret += test_xmlXPathDebugDumpCompExpr(); + test_ret += test_xmlXPathDebugDumpObject(); + test_ret += test_xmlXPathDifference(); + test_ret += test_xmlXPathDistinct(); + test_ret += test_xmlXPathDistinctSorted(); + test_ret += test_xmlXPathDivValues(); + test_ret += test_xmlXPathEqualValues(); + test_ret += test_xmlXPathErr(); + test_ret += test_xmlXPathEvalExpr(); + test_ret += test_xmlXPathEvaluatePredicateResult(); + test_ret += test_xmlXPathFalseFunction(); + test_ret += test_xmlXPathFloorFunction(); + test_ret += test_xmlXPathFunctionLookup(); + test_ret += test_xmlXPathFunctionLookupNS(); + test_ret += test_xmlXPathHasSameNodes(); + test_ret += test_xmlXPathIdFunction(); + test_ret += test_xmlXPathIntersection(); + test_ret += test_xmlXPathIsNodeType(); + test_ret += test_xmlXPathLangFunction(); + test_ret += test_xmlXPathLastFunction(); + test_ret += test_xmlXPathLeading(); + test_ret += test_xmlXPathLeadingSorted(); + test_ret += test_xmlXPathLocalNameFunction(); + test_ret += test_xmlXPathModValues(); + test_ret += test_xmlXPathMultValues(); + test_ret += test_xmlXPathNamespaceURIFunction(); + test_ret += test_xmlXPathNewBoolean(); + test_ret += test_xmlXPathNewCString(); + test_ret += test_xmlXPathNewFloat(); + test_ret += test_xmlXPathNewNodeSet(); + test_ret += test_xmlXPathNewNodeSetList(); + test_ret += test_xmlXPathNewParserContext(); + test_ret += test_xmlXPathNewString(); + test_ret += test_xmlXPathNextAncestor(); + test_ret += test_xmlXPathNextAncestorOrSelf(); + test_ret += test_xmlXPathNextAttribute(); + test_ret += test_xmlXPathNextChild(); + test_ret += test_xmlXPathNextDescendant(); + test_ret += test_xmlXPathNextDescendantOrSelf(); + test_ret += test_xmlXPathNextFollowing(); + test_ret += test_xmlXPathNextFollowingSibling(); + test_ret += test_xmlXPathNextNamespace(); + test_ret += test_xmlXPathNextParent(); + test_ret += test_xmlXPathNextPreceding(); + test_ret += test_xmlXPathNextPrecedingSibling(); + test_ret += test_xmlXPathNextSelf(); + test_ret += test_xmlXPathNodeLeading(); + test_ret += test_xmlXPathNodeLeadingSorted(); + test_ret += test_xmlXPathNodeSetAdd(); + test_ret += test_xmlXPathNodeSetAddNs(); + test_ret += test_xmlXPathNodeSetAddUnique(); + test_ret += test_xmlXPathNodeSetContains(); + test_ret += test_xmlXPathNodeSetDel(); + test_ret += test_xmlXPathNodeSetMerge(); + test_ret += test_xmlXPathNodeSetRemove(); + test_ret += test_xmlXPathNodeSetSort(); + test_ret += test_xmlXPathNodeTrailing(); + test_ret += test_xmlXPathNodeTrailingSorted(); + test_ret += test_xmlXPathNormalizeFunction(); + test_ret += test_xmlXPathNotEqualValues(); + test_ret += test_xmlXPathNotFunction(); + test_ret += test_xmlXPathNsLookup(); + test_ret += test_xmlXPathNumberFunction(); + test_ret += test_xmlXPathParseNCName(); + test_ret += test_xmlXPathParseName(); + test_ret += test_xmlXPathPopBoolean(); + test_ret += test_xmlXPathPopExternal(); + test_ret += test_xmlXPathPopNodeSet(); + test_ret += test_xmlXPathPopNumber(); + test_ret += test_xmlXPathPopString(); + test_ret += test_xmlXPathPositionFunction(); + test_ret += test_xmlXPathRegisterAllFunctions(); + test_ret += test_xmlXPathRegisterFunc(); + test_ret += test_xmlXPathRegisterFuncLookup(); + test_ret += test_xmlXPathRegisterFuncNS(); + test_ret += test_xmlXPathRegisterNs(); + test_ret += test_xmlXPathRegisterVariable(); + test_ret += test_xmlXPathRegisterVariableLookup(); + test_ret += test_xmlXPathRegisterVariableNS(); + test_ret += test_xmlXPathRegisteredFuncsCleanup(); + test_ret += test_xmlXPathRegisteredNsCleanup(); + test_ret += test_xmlXPathRegisteredVariablesCleanup(); + test_ret += test_xmlXPathRoot(); + test_ret += test_xmlXPathRoundFunction(); + test_ret += test_xmlXPathStartsWithFunction(); + test_ret += test_xmlXPathStringEvalNumber(); + test_ret += test_xmlXPathStringFunction(); + test_ret += test_xmlXPathStringLengthFunction(); + test_ret += test_xmlXPathSubValues(); + test_ret += test_xmlXPathSubstringAfterFunction(); + test_ret += test_xmlXPathSubstringBeforeFunction(); + test_ret += test_xmlXPathSubstringFunction(); + test_ret += test_xmlXPathSumFunction(); + test_ret += test_xmlXPathTrailing(); + test_ret += test_xmlXPathTrailingSorted(); + test_ret += test_xmlXPathTranslateFunction(); + test_ret += test_xmlXPathTrueFunction(); + test_ret += test_xmlXPathValueFlipSign(); + test_ret += test_xmlXPathVariableLookup(); + test_ret += test_xmlXPathVariableLookupNS(); + test_ret += test_xmlXPathWrapCString(); + test_ret += test_xmlXPathWrapExternal(); + test_ret += test_xmlXPathWrapNodeSet(); + test_ret += test_xmlXPatherror(); + + if (test_ret != 0) + printf("Module xpathInternals: %d errors\n", test_ret); + return(test_ret); +} + +static int +test_xmlXPtrBuildNodeList(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlNodePtr ret_val; + xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */ + int n_obj; + + for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) { + mem_base = xmlMemBlocks(); + obj = gen_xmlXPathObjectPtr(n_obj, 0); + + ret_val = xmlXPtrBuildNodeList(obj); + desret_xmlNodePtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_obj, obj, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrBuildNodeList", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_obj); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrEval(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlChar * str; /* the XPointer expression */ + int n_str; + xmlXPathContextPtr ctx; /* the XPointer context */ + int n_ctx; + + for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) { + for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) { + mem_base = xmlMemBlocks(); + str = gen_const_xmlChar_ptr(n_str, 0); + ctx = gen_xmlXPathContextPtr(n_ctx, 1); + + ret_val = xmlXPtrEval(str, ctx); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_const_xmlChar_ptr(n_str, str, 0); + des_xmlXPathContextPtr(n_ctx, ctx, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrEval", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_str); + printf(" %d", n_ctx); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrEvalRangePredicate(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ + int n_ctxt; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + + xmlXPtrEvalRangePredicate(ctxt); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +#ifdef LIBXML_XPTR_ENABLED + +#define gen_nb_xmlLocationSetPtr 1 +static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { + return(NULL); +} +static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) { +} +#endif + + +static int +test_xmlXPtrLocationSetAdd(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlLocationSetPtr cur; /* the initial range set */ + int n_cur; + xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlLocationSetPtr(n_cur, 0); + val = gen_xmlXPathObjectPtr(n_val, 1); + + xmlXPtrLocationSetAdd(cur, val); + call_tests++; + des_xmlLocationSetPtr(n_cur, cur, 0); + des_xmlXPathObjectPtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrLocationSetAdd", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrLocationSetCreate(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPtrLocationSetDel(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlLocationSetPtr cur; /* the initial range set */ + int n_cur; + xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlLocationSetPtr(n_cur, 0); + val = gen_xmlXPathObjectPtr(n_val, 1); + + xmlXPtrLocationSetDel(cur, val); + call_tests++; + des_xmlLocationSetPtr(n_cur, cur, 0); + des_xmlXPathObjectPtr(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrLocationSetDel", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrLocationSetMerge(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPtrLocationSetRemove(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlLocationSetPtr cur; /* the initial range set */ + int n_cur; + int val; /* the index to remove */ + int n_val; + + for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) { + for (n_val = 0;n_val < gen_nb_int;n_val++) { + mem_base = xmlMemBlocks(); + cur = gen_xmlLocationSetPtr(n_cur, 0); + val = gen_int(n_val, 1); + + xmlXPtrLocationSetRemove(cur, val); + call_tests++; + des_xmlLocationSetPtr(n_cur, cur, 0); + des_int(n_val, val, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrLocationSetRemove", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_cur); + printf(" %d", n_val); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewCollapsedRange(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the starting and ending node */ + int n_start; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + + ret_val = xmlXPtrNewCollapsedRange(start); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewContext(void) { + int test_ret = 0; + + + /* missing type support */ + return(test_ret); +} + + +static int +test_xmlXPtrNewLocationSetNodeSet(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodeSetPtr set; /* a node set */ + int n_set; + + for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) { + mem_base = xmlMemBlocks(); + set = gen_xmlNodeSetPtr(n_set, 0); + + ret_val = xmlXPtrNewLocationSetNodeSet(set); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodeSetPtr(n_set, set, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_set); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewLocationSetNodes(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the start NodePtr value */ + int n_start; + xmlNodePtr end; /* the end NodePtr value or NULL */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + end = gen_xmlNodePtr(n_end, 1); + + ret_val = xmlXPtrNewLocationSetNodes(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + des_xmlNodePtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRange(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the starting node */ + int n_start; + int startindex; /* the start index */ + int n_startindex; + xmlNodePtr end; /* the ending point */ + int n_end; + int endindex; /* the ending index */ + int n_endindex; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) { + for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { + for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + startindex = gen_int(n_startindex, 1); + end = gen_xmlNodePtr(n_end, 2); + endindex = gen_int(n_endindex, 3); + + ret_val = xmlXPtrNewRange(start, startindex, end, endindex); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + des_int(n_startindex, startindex, 1); + des_xmlNodePtr(n_end, end, 2); + des_int(n_endindex, endindex, 3); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRange", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_startindex); + printf(" %d", n_end); + printf(" %d", n_endindex); + printf("\n"); + } + } + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRangeNodeObject(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the starting node */ + int n_start; + xmlXPathObjectPtr end; /* the ending object */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + end = gen_xmlXPathObjectPtr(n_end, 1); + + ret_val = xmlXPtrNewRangeNodeObject(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + des_xmlXPathObjectPtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRangeNodePoint(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the starting node */ + int n_start; + xmlXPathObjectPtr end; /* the ending point */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + end = gen_xmlXPathObjectPtr(n_end, 1); + + ret_val = xmlXPtrNewRangeNodePoint(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + des_xmlXPathObjectPtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRangeNodes(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlNodePtr start; /* the starting node */ + int n_start; + xmlNodePtr end; /* the ending node */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlNodePtr(n_start, 0); + end = gen_xmlNodePtr(n_end, 1); + + ret_val = xmlXPtrNewRangeNodes(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlNodePtr(n_start, start, 0); + des_xmlNodePtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRangeNodes", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRangePointNode(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr start; /* the starting point */ + int n_start; + xmlNodePtr end; /* the ending node */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlXPathObjectPtr(n_start, 0); + end = gen_xmlNodePtr(n_end, 1); + + ret_val = xmlXPtrNewRangePointNode(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_start, start, 0); + des_xmlNodePtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRangePointNode", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrNewRangePoints(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlXPathObjectPtr start; /* the starting point */ + int n_start; + xmlXPathObjectPtr end; /* the ending point */ + int n_end; + + for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) { + for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) { + mem_base = xmlMemBlocks(); + start = gen_xmlXPathObjectPtr(n_start, 0); + end = gen_xmlXPathObjectPtr(n_end, 1); + + ret_val = xmlXPtrNewRangePoints(start, end); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlXPathObjectPtr(n_start, start, 0); + des_xmlXPathObjectPtr(n_end, end, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrNewRangePoints", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_start); + printf(" %d", n_end); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrRangeToFunction(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */ + int n_ctxt; + int nargs; /* the number of args */ + int n_nargs; + + for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) { + for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) { + mem_base = xmlMemBlocks(); + ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0); + nargs = gen_int(n_nargs, 1); + + xmlXPtrRangeToFunction(ctxt, nargs); + call_tests++; + des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0); + des_int(n_nargs, nargs, 1); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrRangeToFunction", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_ctxt); + printf(" %d", n_nargs); + printf("\n"); + } + } + } + function_tests++; +#endif + + return(test_ret); +} + + +static int +test_xmlXPtrWrapLocationSet(void) { + int test_ret = 0; + +#ifdef LIBXML_XPTR_ENABLED + int mem_base; + xmlXPathObjectPtr ret_val; + xmlLocationSetPtr val; /* the LocationSet value */ + int n_val; + + for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) { + mem_base = xmlMemBlocks(); + val = gen_xmlLocationSetPtr(n_val, 0); + + ret_val = xmlXPtrWrapLocationSet(val); + desret_xmlXPathObjectPtr(ret_val); + call_tests++; + des_xmlLocationSetPtr(n_val, val, 0); + xmlResetLastError(); + if (mem_base != xmlMemBlocks()) { + printf("Leak of %d blocks found in xmlXPtrWrapLocationSet", + xmlMemBlocks() - mem_base); + test_ret++; + printf(" %d", n_val); + printf("\n"); + } + } + function_tests++; +#endif + + return(test_ret); +} + +static int +test_xpointer(void) { + int test_ret = 0; + + if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n"); + test_ret += test_xmlXPtrBuildNodeList(); + test_ret += test_xmlXPtrEval(); + test_ret += test_xmlXPtrEvalRangePredicate(); + test_ret += test_xmlXPtrLocationSetAdd(); + test_ret += test_xmlXPtrLocationSetCreate(); + test_ret += test_xmlXPtrLocationSetDel(); + test_ret += test_xmlXPtrLocationSetMerge(); + test_ret += test_xmlXPtrLocationSetRemove(); + test_ret += test_xmlXPtrNewCollapsedRange(); + test_ret += test_xmlXPtrNewContext(); + test_ret += test_xmlXPtrNewLocationSetNodeSet(); + test_ret += test_xmlXPtrNewLocationSetNodes(); + test_ret += test_xmlXPtrNewRange(); + test_ret += test_xmlXPtrNewRangeNodeObject(); + test_ret += test_xmlXPtrNewRangeNodePoint(); + test_ret += test_xmlXPtrNewRangeNodes(); + test_ret += test_xmlXPtrNewRangePointNode(); + test_ret += test_xmlXPtrNewRangePoints(); + test_ret += test_xmlXPtrRangeToFunction(); + test_ret += test_xmlXPtrWrapLocationSet(); + + if (test_ret != 0) + printf("Module xpointer: %d errors\n", test_ret); + return(test_ret); +} +static int +test_module(const char *module) { + if (!strcmp(module, "HTMLparser")) return(test_HTMLparser()); + if (!strcmp(module, "HTMLtree")) return(test_HTMLtree()); + if (!strcmp(module, "SAX2")) return(test_SAX2()); + if (!strcmp(module, "c14n")) return(test_c14n()); + if (!strcmp(module, "catalog")) return(test_catalog()); + if (!strcmp(module, "chvalid")) return(test_chvalid()); + if (!strcmp(module, "debugXML")) return(test_debugXML()); + if (!strcmp(module, "dict")) return(test_dict()); + if (!strcmp(module, "encoding")) return(test_encoding()); + if (!strcmp(module, "entities")) return(test_entities()); + if (!strcmp(module, "hash")) return(test_hash()); + if (!strcmp(module, "list")) return(test_list()); + if (!strcmp(module, "nanoftp")) return(test_nanoftp()); + if (!strcmp(module, "nanohttp")) return(test_nanohttp()); + if (!strcmp(module, "parser")) return(test_parser()); + if (!strcmp(module, "parserInternals")) return(test_parserInternals()); + if (!strcmp(module, "pattern")) return(test_pattern()); + if (!strcmp(module, "relaxng")) return(test_relaxng()); + if (!strcmp(module, "schemasInternals")) return(test_schemasInternals()); + if (!strcmp(module, "tree")) return(test_tree()); + if (!strcmp(module, "uri")) return(test_uri()); + if (!strcmp(module, "valid")) return(test_valid()); + if (!strcmp(module, "xinclude")) return(test_xinclude()); + if (!strcmp(module, "xmlIO")) return(test_xmlIO()); + if (!strcmp(module, "xmlautomata")) return(test_xmlautomata()); + if (!strcmp(module, "xmlerror")) return(test_xmlerror()); + if (!strcmp(module, "xmlreader")) return(test_xmlreader()); + if (!strcmp(module, "xmlregexp")) return(test_xmlregexp()); + if (!strcmp(module, "xmlsave")) return(test_xmlsave()); + if (!strcmp(module, "xmlschemas")) return(test_xmlschemas()); + if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes()); + if (!strcmp(module, "xmlstring")) return(test_xmlstring()); + if (!strcmp(module, "xmlunicode")) return(test_xmlunicode()); + if (!strcmp(module, "xmlwriter")) return(test_xmlwriter()); + if (!strcmp(module, "xpath")) return(test_xpath()); + if (!strcmp(module, "xpathInternals")) return(test_xpathInternals()); + if (!strcmp(module, "xpointer")) return(test_xpointer()); + return(0); +} @@ -242,6 +242,7 @@ xmlSplitQName2(const xmlChar *name, xmlChar **prefix) { int len = 0; xmlChar *ret = NULL; + if (prefix == NULL) return(NULL); *prefix = NULL; if (name == NULL) return(NULL); @@ -345,6 +346,9 @@ xmlValidateNCName(const xmlChar *value, int space) { const xmlChar *cur = value; int c,l; + if (value == NULL) + return(-1); + /* * First quick algorithm for ASCII range */ @@ -416,6 +420,8 @@ xmlValidateQName(const xmlChar *value, int space) { const xmlChar *cur = value; int c,l; + if (value == NULL) + return(-1); /* * First quick algorithm for ASCII range */ @@ -512,6 +518,8 @@ xmlValidateName(const xmlChar *value, int space) { const xmlChar *cur = value; int c,l; + if (value == NULL) + return(-1); /* * First quick algorithm for ASCII range */ @@ -579,6 +587,8 @@ xmlValidateNMToken(const xmlChar *value, int space) { const xmlChar *cur = value; int c,l; + if (value == NULL) + return(-1); /* * First quick algorithm for ASCII range */ @@ -2145,6 +2155,7 @@ xmlNewDocPI(xmlDocPtr doc, const xmlChar *name, const xmlChar *content) { if (content != NULL) { cur->content = xmlStrdup(content); } + cur->doc = doc; if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue)) xmlRegisterNodeDefaultValue((xmlNodePtr)cur); @@ -2503,6 +2514,9 @@ xmlNodePtr xmlNewCharRef(xmlDocPtr doc, const xmlChar *name) { xmlNodePtr cur; + if (name == NULL) + return(NULL); + /* * Allocate a new node and fill the fields. */ @@ -2544,6 +2558,9 @@ xmlNewReference(xmlDocPtr doc, const xmlChar *name) { xmlNodePtr cur; xmlEntityPtr ent; + if (name == NULL) + return(NULL); + /* * Allocate a new node and fill the fields. */ @@ -3510,10 +3527,11 @@ xmlUnlinkNode(xmlNodePtr cur) { */ xmlNodePtr xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { - if (old == NULL) { + if (old == cur) return(NULL); + if ((old == NULL) || (old->parent == NULL)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, - "xmlReplaceNode : old == NULL\n"); + "xmlReplaceNode : old == NULL or without parent\n"); #endif return(NULL); } @@ -4661,6 +4679,9 @@ xmlNodeGetSpacePreserve(xmlNodePtr cur) { */ void xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { + xmlDocPtr doc; + xmlDictPtr dict; + if (cur == NULL) return; if (name == NULL) return; switch(cur->type) { @@ -4690,8 +4711,19 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { case XML_ENTITY_DECL: break; } - if (cur->name != NULL) xmlFree((xmlChar *) cur->name); - cur->name = xmlStrdup(name); + doc = cur->doc; + if (doc != NULL) + dict = doc->dict; + else + dict = NULL; + if (dict != NULL) { + if ((cur->name != NULL) && (!xmlDictOwns(dict, cur->name))) + xmlFree((xmlChar *) cur->name); + cur->name = xmlDictLookup(dict, name, -1); + } else { + if (cur->name != NULL) xmlFree((xmlChar *) cur->name); + cur->name = xmlStrdup(name); + } } #endif @@ -5674,7 +5706,7 @@ xmlNewReconciliedNs(xmlDocPtr doc, xmlNodePtr tree, xmlNsPtr ns) { #endif return(NULL); } - if (ns == NULL) { + if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) { #ifdef DEBUG_TREE xmlGenericError(xmlGenericErrorContext, "xmlNewReconciliedNs : ns == NULL\n"); @@ -5742,6 +5774,9 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) { xmlAttrPtr attr; int ret = 0, i; + if ((node == NULL) || (node->type != XML_ELEMENT_NODE)) return(-1); + if ((doc == NULL) || (doc->type != XML_DOCUMENT_NODE)) return(-1); + if (node->doc != doc) return(-1); while (node != NULL) { /* * Reconciliate the node namespace @@ -6294,10 +6329,11 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { */ int xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { - xmlAttrPtr prop = node->properties, prev = NULL;; + xmlAttrPtr prop, prev = NULL;; if ((node == NULL) || (name == NULL)) return(-1); + prop = node->properties; if (ns == NULL) return(xmlUnsetProp(node, name)); if (ns->href == NULL) @@ -6672,6 +6708,7 @@ xmlBufferFree(xmlBufferPtr buf) { */ void xmlBufferEmpty(xmlBufferPtr buf) { + if (buf == NULL) return; if (buf->content == NULL) return; buf->use = 0; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) { @@ -6692,6 +6729,7 @@ xmlBufferEmpty(xmlBufferPtr buf) { */ int xmlBufferShrink(xmlBufferPtr buf, unsigned int len) { + if (buf == NULL) return(-1); if (len == 0) return(0); if (len > buf->use) return(-1); @@ -6719,6 +6757,8 @@ xmlBufferGrow(xmlBufferPtr buf, unsigned int len) { int size; xmlChar *newbuf; + if (buf == NULL) return(-1); + if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); if (len + buf->use < buf->size) return(0); @@ -6828,6 +6868,9 @@ xmlBufferResize(xmlBufferPtr buf, unsigned int size) unsigned int newSize; xmlChar* rebuf = NULL; + if (buf == NULL) + return(0); + if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return(0); /* Don't resize if we don't have to */ @@ -6893,11 +6936,7 @@ int xmlBufferAdd(xmlBufferPtr buf, const xmlChar *str, int len) { unsigned int needSize; - if (str == NULL) { -#ifdef DEBUG_BUFFER - xmlGenericError(xmlGenericErrorContext, - "xmlBufferAdd: str == NULL\n"); -#endif + if ((str == NULL) || (buf == NULL)) { return -1; } if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; @@ -6945,6 +6984,8 @@ int xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { unsigned int needSize; + if (buf == NULL) + return(-1); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (str == NULL) { #ifdef DEBUG_BUFFER @@ -6994,6 +7035,8 @@ xmlBufferAddHead(xmlBufferPtr buf, const xmlChar *str, int len) { */ int xmlBufferCat(xmlBufferPtr buf, const xmlChar *str) { + if (buf == NULL) + return(-1); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (str == NULL) return -1; return xmlBufferAdd(buf, str, -1); @@ -7013,6 +7056,8 @@ int xmlBufferCCat(xmlBufferPtr buf, const char *str) { const char *cur; + if (buf == NULL) + return(-1); if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (str == NULL) { #ifdef DEBUG_BUFFER @@ -7044,6 +7089,8 @@ xmlBufferCCat(xmlBufferPtr buf, const char *str) { */ void xmlBufferWriteCHAR(xmlBufferPtr buf, const xmlChar *string) { + if (buf == NULL) + return; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return; xmlBufferCat(buf, string); } @@ -7058,6 +7105,8 @@ xmlBufferWriteCHAR(xmlBufferPtr buf, const xmlChar *string) { */ void xmlBufferWriteChar(xmlBufferPtr buf, const char *string) { + if (buf == NULL) + return; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return; xmlBufferCCat(buf, string); } @@ -7075,6 +7124,8 @@ xmlBufferWriteChar(xmlBufferPtr buf, const char *string) { void xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) { const xmlChar *cur, *base; + if (buf == NULL) + return; if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return; if (xmlStrchr(string, '\"')) { if (xmlStrchr(string, '\'')) { @@ -59,7 +59,12 @@ xmlVErrMemory(xmlValidCtxtPtr ctxt, const char *extra) if (ctxt != NULL) { channel = ctxt->error; data = ctxt->userData; - pctxt = ctxt->userData; + /* Use the special values to detect if it is part of a parsing + context */ + if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || + (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { + pctxt = ctxt->userData; + } } if (extra) __xmlRaiseError(NULL, channel, data, @@ -92,7 +97,12 @@ xmlErrValid(xmlValidCtxtPtr ctxt, xmlParserErrors error, if (ctxt != NULL) { channel = ctxt->error; data = ctxt->userData; - pctxt = ctxt->userData; + /* Use the special values to detect if it is part of a parsing + context */ + if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || + (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { + pctxt = ctxt->userData; + } } if (extra) __xmlRaiseError(NULL, channel, data, @@ -132,7 +142,12 @@ xmlErrValidNode(xmlValidCtxtPtr ctxt, if (ctxt != NULL) { channel = ctxt->error; data = ctxt->userData; - pctxt = ctxt->userData; + /* Use the special values to detect if it is part of a parsing + context */ + if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || + (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { + pctxt = ctxt->userData; + } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, XML_ERR_ERROR, NULL, 0, @@ -168,7 +183,12 @@ xmlErrValidNodeNr(xmlValidCtxtPtr ctxt, if (ctxt != NULL) { channel = ctxt->error; data = ctxt->userData; - pctxt = ctxt->userData; + /* Use the special values to detect if it is part of a parsing + context */ + if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || + (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { + pctxt = ctxt->userData; + } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, XML_ERR_ERROR, NULL, 0, @@ -202,7 +222,12 @@ xmlErrValidWarning(xmlValidCtxtPtr ctxt, if (ctxt != NULL) { channel = ctxt->error; data = ctxt->userData; - pctxt = ctxt->userData; + /* Use the special values to detect if it is part of a parsing + context */ + if ((ctxt->finishDtd == XML_CTXT_FINISH_DTD_0) || + (ctxt->finishDtd == XML_CTXT_FINISH_DTD_1)) { + pctxt = ctxt->userData; + } } __xmlRaiseError(schannel, channel, data, pctxt, node, XML_FROM_VALID, error, XML_ERR_WARNING, NULL, 0, @@ -860,6 +885,10 @@ xmlValidCtxtPtr xmlNewValidCtxt(void) { */ void xmlFreeValidCtxt(xmlValidCtxtPtr cur) { + if (cur->vstateTab != NULL) + xmlFree(cur->vstateTab); + if (cur->nodeTab != NULL) + xmlFree(cur->nodeTab); xmlFree(cur); } @@ -1488,6 +1517,8 @@ xmlCopyElementTable(xmlElementTablePtr table) { */ void xmlDumpElementDecl(xmlBufferPtr buf, xmlElementPtr elem) { + if ((buf == NULL) || (elem == NULL)) + return; switch (elem->etype) { case XML_ELEMENT_TYPE_EMPTY: xmlBufferWriteChar(buf, "<!ELEMENT "); @@ -1558,6 +1589,8 @@ xmlDumpElementDeclScan(xmlElementPtr elem, xmlBufferPtr buf) { */ void xmlDumpElementTable(xmlBufferPtr buf, xmlElementTablePtr table) { + if ((buf == NULL) || (table == NULL)) + return; xmlHashScan(table, (xmlHashScanner) xmlDumpElementDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -1637,7 +1670,8 @@ xmlCopyEnumeration(xmlEnumerationPtr cur) { */ static void xmlDumpEnumeration(xmlBufferPtr buf, xmlEnumerationPtr cur) { - if (cur == NULL) return; + if ((buf == NULL) || (cur == NULL)) + return; xmlBufferWriteCHAR(buf, cur->name); if (cur->next == NULL) @@ -1843,7 +1877,8 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, "Attribute %s of %s: invalid default value\n", elem, name, defaultValue); defaultValue = NULL; - ctxt->valid = 0; + if (ctxt != NULL) + ctxt->valid = 0; } #endif /* LIBXML_VALID_ENABLED */ @@ -1924,7 +1959,8 @@ xmlAddAttributeDecl(xmlValidCtxtPtr ctxt, xmlErrValidNode(ctxt, (xmlNodePtr) dtd, XML_DTD_MULTIPLE_ID, "Element %s has too may ID attributes defined : %s\n", elem, name, NULL); - ctxt->valid = 0; + if (ctxt != NULL) + ctxt->valid = 0; } #endif /* LIBXML_VALID_ENABLED */ @@ -2044,6 +2080,8 @@ xmlCopyAttributeTable(xmlAttributeTablePtr table) { */ void xmlDumpAttributeDecl(xmlBufferPtr buf, xmlAttributePtr attr) { + if ((buf == NULL) || (attr == NULL)) + return; xmlBufferWriteChar(buf, "<!ATTLIST "); xmlBufferWriteCHAR(buf, attr->elem); xmlBufferWriteChar(buf, " "); @@ -2135,6 +2173,8 @@ xmlDumpAttributeDeclScan(xmlAttributePtr attr, xmlBufferPtr buf) { */ void xmlDumpAttributeTable(xmlBufferPtr buf, xmlAttributeTablePtr table) { + if ((buf == NULL) || (table == NULL)) + return; xmlHashScan(table, (xmlHashScanner) xmlDumpAttributeDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -2318,6 +2358,8 @@ xmlCopyNotationTable(xmlNotationTablePtr table) { */ void xmlDumpNotationDecl(xmlBufferPtr buf, xmlNotationPtr nota) { + if ((buf == NULL) || (nota == NULL)) + return; xmlBufferWriteChar(buf, "<!NOTATION "); xmlBufferWriteCHAR(buf, nota->name); if (nota->PublicID != NULL) { @@ -2355,6 +2397,8 @@ xmlDumpNotationDeclScan(xmlNotationPtr nota, xmlBufferPtr buf) { */ void xmlDumpNotationTable(xmlBufferPtr buf, xmlNotationTablePtr table) { + if ((buf == NULL) || (table == NULL)) + return; xmlHashScan(table, (xmlHashScanner) xmlDumpNotationDeclScan, buf); } #endif /* LIBXML_OUTPUT_ENABLED */ @@ -2851,6 +2895,13 @@ xmlFreeRefTable(xmlRefTablePtr table) { */ int xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { + if (attr == NULL) + return(0); + if (doc == NULL) { + doc = attr->doc; + if (doc == NULL) return(0); + } + if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) { return(0); } else if (doc->type == XML_HTML_DOCUMENT_NODE) { @@ -2859,6 +2910,7 @@ xmlIsRef(xmlDocPtr doc, xmlNodePtr elem, xmlAttrPtr attr) { } else { xmlAttributePtr attrDecl; + if (elem == NULL) return(0); attrDecl = xmlGetDtdAttrDesc(doc->intSubset, elem->name, attr->name); if ((attrDecl == NULL) && (doc->extSubset != NULL)) attrDecl = xmlGetDtdAttrDesc(doc->extSubset, @@ -5363,7 +5415,9 @@ xmlValidGetElemDecl(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr elemDecl = NULL; const xmlChar *prefix = NULL; - if ((elem == NULL) || (elem->name == NULL)) return(NULL); + if ((ctxt == NULL) || (doc == NULL) || + (elem == NULL) || (elem->name == NULL)) + return(NULL); if (extsubset != NULL) *extsubset = 0; @@ -5425,6 +5479,8 @@ xmlValidatePushElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc, xmlElementPtr eDecl; int extsubset = 0; + if (ctxt == NULL) + return(0); /* printf("PushElem %s\n", qname); */ if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) { xmlValidStatePtr state = ctxt->vstate; @@ -5514,6 +5570,8 @@ xmlValidatePushCData(xmlValidCtxtPtr ctxt, const xmlChar *data, int len) { int ret = 1; /* printf("CDATA %s %d\n", data, len); */ + if (ctxt == NULL) + return(0); if (len <= 0) return(ret); if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) { @@ -5587,6 +5645,8 @@ xmlValidatePopElement(xmlValidCtxtPtr ctxt, xmlDocPtr doc ATTRIBUTE_UNUSED, const xmlChar *qname ATTRIBUTE_UNUSED) { int ret = 1; + if (ctxt == NULL) + return(0); /* printf("PopElem %s\n", qname); */ if ((ctxt->vstateNr > 0) && (ctxt->vstate != NULL)) { xmlValidStatePtr state = ctxt->vstate; @@ -6274,6 +6334,8 @@ int xmlValidateDocumentFinal(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { xmlRefTablePtr table; + if (ctxt == NULL) + return(0); if (doc == NULL) { xmlErrValid(ctxt, XML_DTD_NO_DOC, "xmlValidateDocumentFinal: doc == NULL\n", NULL); @@ -6505,6 +6567,8 @@ xmlValidateDocument(xmlValidCtxtPtr ctxt, xmlDocPtr doc) { int ret; xmlNodePtr root; + if (doc == NULL) + return(0); if ((doc->intSubset == NULL) && (doc->extSubset == NULL)) { xmlErrValid(ctxt, XML_DTD_NO_DTD, "no DTD found!\n", NULL); diff --git a/win32/libxml2.def.src b/win32/libxml2.def.src index 2b9f6e0..7f35a58 100644 --- a/win32/libxml2.def.src +++ b/win32/libxml2.def.src @@ -976,6 +976,7 @@ xmlMallocAtomicLoc #ifdef DEBUG_MEMORY_LOCATION xmlMallocLoc #endif +xmlMemBlocks xmlMemDisplay xmlMemFree xmlMemGet @@ -1379,6 +1380,9 @@ xmlRelaxNGGetParserErrors xmlRelaxNGGetValidErrors #endif #ifdef LIBXML_SCHEMAS_ENABLED +xmlRelaxNGInitTypes +#endif +#ifdef LIBXML_SCHEMAS_ENABLED xmlRelaxNGNewDocParserCtxt #endif #ifdef LIBXML_SCHEMAS_ENABLED @@ -398,6 +398,9 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) { xmlFree(ctxt->txtTab); if (ctxt->txturlTab != NULL) xmlFree(ctxt->txturlTab); + if (ctxt->base != NULL) { + xmlFree(ctxt->base); + } xmlFree(ctxt); } @@ -681,7 +684,7 @@ xmlXIncludeRecurseDoc(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, /* * Inherit the existing base */ - newctxt->base = ctxt->base; + newctxt->base = xmlStrdup(ctxt->base); /* * Inherit the documents already in use by other includes @@ -1863,7 +1866,7 @@ xmlXIncludeLoadFallback(xmlXIncludeCtxtPtr ctxt, xmlNodePtr fallback, int nr) { newctxt = xmlXIncludeNewContext(ctxt->doc); if (newctxt == NULL) return (-1); - newctxt->base = ctxt->base; /* Inherit the base from the existing context */ + newctxt->base = xmlStrdup(ctxt->base); /* Inherit the base from the existing context */ xmlXIncludeSetFlags(newctxt, ctxt->parseFlags); ret = xmlXIncludeDoProcess(newctxt, ctxt->doc, fallback->children); if (ctxt->nbErrors > 0) @@ -2372,7 +2375,7 @@ xmlXIncludeProcessFlags(xmlDocPtr doc, int flags) { ctxt = xmlXIncludeNewContext(doc); if (ctxt == NULL) return(-1); - ctxt->base = (xmlChar *)doc->URL; + ctxt->base = xmlStrdup((xmlChar *)doc->URL); xmlXIncludeSetFlags(ctxt, flags); ret = xmlXIncludeDoProcess(ctxt, doc, tree); if ((ret >= 0) && (ctxt->nbErrors > 0)) @@ -420,7 +420,8 @@ __xmlLoaderErr(void *ctx, const char *msg, const char *filename) channel = ctxt->sax->warning; level = XML_ERR_WARNING; } - schannel = ctxt->sax->serror; + if (ctxt->sax->initialized == XML_SAX2_MAGIC) + schannel = ctxt->sax->serror; data = ctxt->userData; } __xmlRaiseError(schannel, channel, data, ctxt, NULL, XML_FROM_IO, @@ -554,6 +555,9 @@ xmlCheckFilename (const char *path) #ifdef HAVE_STAT struct stat stat_buffer; + if (path == NULL) + return(0); + if (stat(path, &stat_buffer) == -1) return 0; @@ -563,6 +567,9 @@ xmlCheckFilename (const char *path) } #endif #endif + if (path == NULL) + return(0); + return 1; } @@ -654,6 +661,9 @@ xmlFileOpen_real (const char *filename) { const char *path = NULL; FILE *fd; + if (filename == NULL) + return(NULL); + if (!strcmp(filename, "-")) { fd = stdin; return((void *) fd); @@ -701,13 +711,14 @@ void * xmlFileOpen (const char *filename) { char *unescaped; void *retval; + unescaped = xmlURIUnescapeString(filename, 0, NULL); if (unescaped != NULL) { retval = xmlFileOpen_real(unescaped); + xmlFree(unescaped); } else { retval = xmlFileOpen_real(filename); } - xmlFree(unescaped); return retval; } @@ -763,11 +774,13 @@ xmlFileOpenW (const char *filename) { * * Read @len bytes to @buffer from the I/O channel. * - * Returns the number of bytes written + * Returns the number of bytes written or < 0 in case of failure */ int xmlFileRead (void * context, char * buffer, int len) { int ret; + if ((context == NULL) || (buffer == NULL)) + return(-1); ret = fread(&buffer[0], 1, len, (FILE *) context); if (ret < 0) xmlIOErr(0, "fread()"); return(ret); @@ -788,6 +801,8 @@ static int xmlFileWrite (void * context, const char * buffer, int len) { int items; + if ((context == NULL) || (buffer == NULL)) + return(-1); items = fwrite(&buffer[0], len, 1, (FILE *) context); if ((items == 0) && (ferror((FILE *) context))) { xmlIOErr(0, "fwrite()"); @@ -810,6 +825,8 @@ xmlFileClose (void * context) { FILE *fil; int ret; + if (context == NULL) + return(-1); fil = (FILE *) context; if ((fil == stdout) || (fil == stderr)) { ret = fflush(fil); @@ -834,6 +851,9 @@ xmlFileClose (void * context) { static int xmlFileFlush (void * context) { int ret; + + if (context == NULL) + return(-1); ret = ( fflush((FILE *) context) == EOF ) ? -1 : 0; if (ret < 0) xmlIOErr(0, "fflush()"); @@ -1530,6 +1550,7 @@ xmlIOHTTPDfltOpenW( const char * post_uri ) { */ int xmlIOHTTPRead(void * context, char * buffer, int len) { + if ((buffer == NULL) || (len < 0)) return(-1); return(xmlNanoHTTPRead(context, &buffer[0], len)); } @@ -1808,6 +1829,7 @@ xmlIOFTPOpen (const char *filename) { */ int xmlIOFTPRead(void * context, char * buffer, int len) { + if ((buffer == NULL) || (len < 0)) return(-1); return(xmlNanoFTPRead(context, &buffer[0], len)); } @@ -3033,7 +3055,9 @@ xmlOutputBufferWriteEscape(xmlOutputBufferPtr out, const xmlChar *str, int len; /* number of bytes in str */ int cons; /* byte from str consumed */ - if ((out == NULL) || (out->error) || (str == NULL)) return(-1); + if ((out == NULL) || (out->error) || (str == NULL) || + (out->buffer == NULL) || + (out->buffer->alloc == XML_BUFFER_ALLOC_IMMUTABLE)) return(-1); len = strlen((const char *)str); if (len < 0) return(0); if (out->error) return(-1); @@ -3415,7 +3439,7 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID, /* * Do a local lookup */ - if ((ctxt->catalogs != NULL) && + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && ((pref == XML_CATA_ALLOW_ALL) || (pref == XML_CATA_ALLOW_DOCUMENT))) { resource = xmlCatalogLocalResolve(ctxt->catalogs, @@ -3441,7 +3465,7 @@ xmlDefaultExternalEntityLoader(const char *URL, const char *ID, && (!xmlSysIDExists((const char *) resource))) { xmlChar *tmp = NULL; - if ((ctxt->catalogs != NULL) && + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && ((pref == XML_CATA_ALLOW_ALL) || (pref == XML_CATA_ALLOW_DOCUMENT))) { tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource); @@ -3603,7 +3627,7 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID, /* * Do a local lookup */ - if ((ctxt->catalogs != NULL) && + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && ((pref == XML_CATA_ALLOW_ALL) || (pref == XML_CATA_ALLOW_DOCUMENT))) { resource = xmlCatalogLocalResolve(ctxt->catalogs, @@ -3628,7 +3652,7 @@ xmlNoNetExternalEntityLoader(const char *URL, const char *ID, if ((resource != NULL) && (!xmlNoNetExists((const char *)resource))) { xmlChar *tmp = NULL; - if ((ctxt->catalogs != NULL) && + if ((ctxt != NULL) && (ctxt->catalogs != NULL) && ((pref == XML_CATA_ALLOW_ALL) || (pref == XML_CATA_ALLOW_DOCUMENT))) { tmp = xmlCatalogLocalResolveURI(ctxt->catalogs, resource); @@ -738,6 +738,7 @@ xmlHTMLValidityWarning(void *ctx, const char *msg, ...) * * ************************************************************************/ #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED /** * xmlShellReadline: * @prompt: the prompt value @@ -778,6 +779,7 @@ xmlShellReadline(char *prompt) { return(ret); #endif } +#endif /* LIBXML_XPATH_ENABLED */ #endif /* LIBXML_DEBUG_ENABLED */ /************************************************************************ @@ -1223,12 +1225,14 @@ static void parseAndPrintFile(char *filename, xmlParserCtxtPtr rectxt) { #endif #ifdef LIBXML_DEBUG_ENABLED +#ifdef LIBXML_XPATH_ENABLED /* * shell interaction */ if (shell) xmlShell(doc, filename, xmlShellReadline, stdout); #endif +#endif #ifdef LIBXML_TREE_ENABLED /* diff --git a/xmlmemory.c b/xmlmemory.c index 821e3b9..69de28d 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -50,6 +50,7 @@ static int xmlMemInitialized = 0; static unsigned long debugMemSize = 0; +static unsigned long debugMemBlocks = 0; static unsigned long debugMaxMemSize = 0; static xmlMutexPtr xmlMemMutex = NULL; @@ -186,6 +187,7 @@ xmlMallocLoc(size_t size, const char * file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -253,6 +255,7 @@ xmlMallocAtomicLoc(size_t size, const char * file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -329,6 +332,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) p->mh_tag = ~MEMTAG; xmlMutexLock(xmlMemMutex); debugMemSize -= p->mh_size; + debugMemBlocks--; #ifdef DEBUG_MEMORY oldsize = p->mh_size; #endif @@ -355,6 +359,7 @@ xmlReallocLoc(void *ptr,size_t size, const char * file, int line) p->mh_line = line; xmlMutexLock(xmlMemMutex); debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -428,6 +433,7 @@ xmlMemFree(void *ptr) memset(target, -1, p->mh_size); xmlMutexLock(xmlMemMutex); debugMemSize -= p->mh_size; + debugMemBlocks--; #ifdef DEBUG_MEMORY size = p->mh_size; #endif @@ -487,6 +493,7 @@ xmlMemStrdupLoc(const char *str, const char *file, int line) xmlMutexLock(xmlMemMutex); p->mh_number = ++block; debugMemSize += size; + debugMemBlocks++; if (debugMemSize > debugMaxMemSize) debugMaxMemSize = debugMemSize; #ifdef MEM_LIST debugmem_list_add(p); @@ -543,6 +550,19 @@ xmlMemUsed(void) { return(debugMemSize); } +/** + * xmlMemBlocks: + * + * Provides the number of memory areas currently allocated + * + * Returns an int representing the number of blocks + */ + +int +xmlMemBlocks(void) { + return(debugMemBlocks); +} + #ifdef MEM_LIST /** * xmlMemContentShow: diff --git a/xmlreader.c b/xmlreader.c index e3243b9..a5aba32 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -1825,7 +1825,7 @@ xmlTextReaderNextSibling(xmlTextReaderPtr reader) { if (reader == NULL) return(-1); if (reader->doc == NULL) { - TODO + /* TODO */ return(-1); } @@ -3724,6 +3724,8 @@ xmlTextReaderCurrentDoc(xmlTextReaderPtr reader) { */ int xmlTextReaderRelaxNGSetSchema(xmlTextReaderPtr reader, xmlRelaxNGPtr schema) { + if (reader == NULL) + return(-1); if (schema == NULL) { if (reader->rngSchemas != NULL) { xmlRelaxNGFree(reader->rngSchemas); @@ -3963,6 +3965,8 @@ xmlTextReaderLocatorLineNumber(xmlTextReaderLocatorPtr locator) { xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator; int ret = -1; + if (locator == NULL) + return(-1); if (ctx->node != NULL) { ret = xmlGetLineNo(ctx->node); } @@ -3997,6 +4001,8 @@ xmlTextReaderLocatorBaseURI(xmlTextReaderLocatorPtr locator) { xmlParserCtxtPtr ctx = (xmlParserCtxtPtr)locator; xmlChar *ret = NULL; + if (locator == NULL) + return(NULL); if (ctx->node != NULL) { ret = xmlNodeGetBase(NULL,ctx->node); } @@ -4207,8 +4213,8 @@ void xmlTextReaderGetErrorHandler(xmlTextReaderPtr reader, xmlTextReaderErrorFunc *f, void **arg) { - *f = reader->errorFunc; - *arg = reader->errorFuncArg; + if (f != NULL) *f = reader->errorFunc; + if (arg != NULL) *arg = reader->errorFuncArg; } @@ -4629,6 +4635,9 @@ xmlReaderNewWalker(xmlTextReaderPtr reader, xmlDocPtr doc) if (reader == NULL) return (-1); + if (reader->input != NULL) { + xmlFreeParserInputBuffer(reader->input); + } if (reader->ctxt != NULL) { xmlCtxtReset(reader->ctxt); } diff --git a/xmlregexp.c b/xmlregexp.c index b34cf9c..eb67fa4 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -4062,6 +4062,8 @@ void xmlRegexpPrint(FILE *output, xmlRegexpPtr regexp) { int i; + if (output == NULL) + return; fprintf(output, " regexp: "); if (regexp == NULL) { fprintf(output, "NULL\n"); @@ -445,6 +445,7 @@ xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); static void xmlNodeListDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); +static void xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); /** * xmlNsDumpOutput: @@ -456,7 +457,7 @@ void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); */ static void xmlNsDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur) { - if (cur == NULL) return; + if ((cur == NULL) || (buf == NULL)) return; if ((cur->type == XML_LOCAL_NAMESPACE) && (cur->href != NULL)) { if (xmlStrEqual(cur->prefix, BAD_CAST "xml")) return; @@ -557,6 +558,7 @@ xmlAttrDumpOutput(xmlSaveCtxtPtr ctxt, xmlAttrPtr cur) { if (cur == NULL) return; buf = ctxt->buf; + if (buf == NULL) return; xmlOutputBufferWrite(buf, 1, " "); if ((cur->ns != NULL) && (cur->ns->prefix != NULL)) { xmlOutputBufferWriteString(buf, (const char *)cur->ns->prefix); @@ -634,6 +636,11 @@ xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur) { return; if (cur->type == XML_XINCLUDE_END) return; + if ((cur->type == XML_DOCUMENT_NODE) || + (cur->type == XML_HTML_DOCUMENT_NODE)) { + xmlDocContentDumpOutput(ctxt, (xmlDocPtr) cur); + return; + } if (cur->type == XML_DTD_NODE) { xmlDtdDumpOutput(ctxt, (xmlDtdPtr) cur); return; @@ -1429,6 +1436,7 @@ xmlSaveDoc(xmlSaveCtxtPtr ctxt, xmlDocPtr doc) { long ret = 0; + if ((ctxt == NULL) || (doc == NULL)) return(-1); xmlDocContentDumpOutput(ctxt, doc); return(ret); } @@ -1449,6 +1457,7 @@ xmlSaveTree(xmlSaveCtxtPtr ctxt, xmlNodePtr node) { long ret = 0; + if ((ctxt == NULL) || (node == NULL)) return(-1); xmlNodeDumpOutputInternal(ctxt, node); return(ret); } @@ -1790,6 +1799,8 @@ xmlNodeDumpOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, xmlInitParser(); + if ((buf == NULL) || (cur == NULL)) return; + memset(&ctxt, 0, sizeof(ctxt)); ctxt.doc = doc; ctxt.buf = buf; @@ -2035,6 +2046,8 @@ xmlDocDump(FILE *f, xmlDocPtr cur) { * @encoding: the encoding if any assuming the I/O layer handles the trancoding * * Dump an XML document to an I/O buffer. + * Warning ! This call xmlOutputBufferClose() on buf which is not available + * after this call. * * returns: the number of bytes written or -1 in case of failure. */ @@ -2043,7 +2056,11 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) { xmlSaveCtxt ctxt; int ret; - if (buf == NULL) return(0); + if (buf == NULL) return(-1); + if (cur == NULL) { + xmlOutputBufferClose(buf); + return(-1); + } memset(&ctxt, 0, sizeof(ctxt)); ctxt.doc = cur; ctxt.buf = buf; @@ -2064,7 +2081,8 @@ xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) { * @format: should formatting spaces been added * * Dump an XML document to an I/O buffer. - * NOTE: the I/O buffer is closed as part of the call. + * Warning ! This call xmlOutputBufferClose() on buf which is not available + * after this call. * * returns: the number of bytes written or -1 in case of failure. */ @@ -2075,8 +2093,13 @@ xmlSaveFormatFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, xmlSaveCtxt ctxt; int ret; - if (buf == NULL) - return (0); + if (buf == NULL) return(-1); + if ((cur == NULL) || + ((cur->type != XML_DOCUMENT_NODE) && + (cur->type != XML_HTML_DOCUMENT_NODE))) { + xmlOutputBufferClose(buf); + return(-1); + } memset(&ctxt, 0, sizeof(ctxt)); ctxt.doc = cur; ctxt.buf = buf; diff --git a/xmlschemas.c b/xmlschemas.c index 87fbca3..d7fa515 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -2434,6 +2434,8 @@ xmlSchemaTypeDump(xmlSchemaTypePtr type, FILE * output) void xmlSchemaDump(FILE * output, xmlSchemaPtr schema) { + if (output == NULL) + return; if (schema == NULL) { fprintf(output, "Schemas: NULL\n"); return; @@ -12574,6 +12576,8 @@ xmlSchemaCheckFacet(xmlSchemaFacetPtr facet, xmlSchemaTypePtr nonNegativeIntegerType = NULL; int ret = 0, reuseValCtxt = 0; + if ((facet == NULL) || (typeDecl == NULL)) + return(-1); /* * TODO: will the parser context be given if used from * the relaxNG module? diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 9346ac6..3246362 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -31,6 +31,12 @@ #define DEBUG +#ifndef LIBXML_XPATH_ENABLED +extern double xmlXPathNAN; +extern double xmlXPathPINF; +extern double xmlXPathNINF; +#endif + #define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ @@ -470,6 +476,8 @@ xmlSchemaCleanupTypes(void) { int xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int facetType) { + if (type == NULL) + return (-1); if (type->type != XML_SCHEMA_TYPE_BASIC) return (-1); switch (type->builtInType) { @@ -747,7 +755,7 @@ xmlSchemaGetPredefinedType(const xmlChar *name, const xmlChar *ns) { xmlSchemaTypePtr xmlSchemaGetBuiltInListSimpleTypeItemType(xmlSchemaTypePtr type) { - if (type->type != XML_SCHEMA_TYPE_BASIC) + if ((type == NULL) || (type->type != XML_SCHEMA_TYPE_BASIC)) return (NULL); switch (type->builtInType) { case XML_SCHEMAS_NMTOKENS: @@ -3789,6 +3797,8 @@ xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr facet, unsigned long actualLen, unsigned long *expectedLen) { + if (facet == NULL) + return(-1); /* * TODO: Check if this will work with large numbers. * (compare value.decimal.mi and value.decimal.hi as well?). @@ -3844,6 +3854,8 @@ xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, { unsigned int len = 0; + if ((length == NULL) || (facet == NULL) || (type == NULL)) + return (-1); *length = 0; if ((facet->type != XML_SCHEMA_FACET_LENGTH) && (facet->type != XML_SCHEMA_FACET_MAXLENGTH) && @@ -3918,6 +3930,8 @@ xmlSchemaValidateFacet(xmlSchemaTypePtr base ATTRIBUTE_UNUSED, { int ret; + if ((facet == NULL) || (value == NULL)) + return(-1); switch (facet->type) { case XML_SCHEMA_FACET_PATTERN: ret = xmlRegexpExec(facet->regexp, value); diff --git a/xmlstring.c b/xmlstring.c index af4e5c8..db94432 100644 --- a/xmlstring.c +++ b/xmlstring.c @@ -92,8 +92,10 @@ xmlCharStrndup(const char *cur, int len) { xmlErrMemory(NULL, NULL); return(NULL); } - for (i = 0;i < len;i++) + for (i = 0;i < len;i++) { ret[i] = (xmlChar) cur[i]; + if (ret[i] == 0) return(ret); + } ret[len] = 0; return(ret); } @@ -478,6 +480,8 @@ xmlStrncatNew(const xmlChar *str1, const xmlChar *str2, int len) { int size; xmlChar *ret; + if (len < 0) + len = xmlStrlen(str2); if ((str2 == NULL) || (len == 0)) return(xmlStrdup(str1)); if (str1 == NULL) @@ -743,7 +747,8 @@ xmlGetUTF8Char(const unsigned char *utf, int *len) { return(c); error: - *len = 0; + if (len != NULL) + *len = 0; return(-1); } @@ -766,6 +771,8 @@ xmlCheckUTF8(const unsigned char *utf) int ix; unsigned char c; + if (utf == NULL) + return(0); /* * utf is a string of 1, 2, 3 or 4 bytes. The valid strings * are as follows (in "bit format"): @@ -804,10 +811,10 @@ xmlCheckUTF8(const unsigned char *utf) * @len: the number of characters in the array * * storage size of an UTF8 string + * the behaviour is not garanteed if the input string is not UTF-8 * * Returns the storage size of * the first 'len' characters of ARRAY - * */ int @@ -815,6 +822,9 @@ xmlUTF8Strsize(const xmlChar *utf, int len) { const xmlChar *ptr=utf; xmlChar ch; + if (utf == NULL) + return(0); + if (len <= 0) return(0); @@ -822,8 +832,10 @@ xmlUTF8Strsize(const xmlChar *utf, int len) { if ( !*ptr ) break; if ( (ch = *ptr++) & 0x80) - while ( (ch<<=1) & 0x80 ) + while ((ch<<=1) & 0x80 ) { ptr++; + if (*ptr == 0) break; + } } return (ptr - utf); } @@ -867,7 +879,7 @@ xmlUTF8Strndup(const xmlChar *utf, int len) { * * Returns a pointer to the UTF8 character or NULL */ -xmlChar * +const xmlChar * xmlUTF8Strpos(const xmlChar *utf, int pos) { xmlChar ch; diff --git a/xmlunicode.c b/xmlunicode.c index 4667636..9ef7b77 100644 --- a/xmlunicode.c +++ b/xmlunicode.c @@ -943,6 +943,8 @@ static xmlIntFunc int low, high, mid, cmp; xmlUnicodeRange *sptr; + if ((tptr == NULL) || (tname == NULL)) return(NULL); + low = 0; high = tptr->numentries - 1; sptr = tptr->table; diff --git a/xmlwriter.c b/xmlwriter.c index 2a267cc..099d3f0 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -71,6 +71,7 @@ struct _xmlTextWriter { xmlChar *ichar; /* indent character */ char qchar; /* character used for quoting attribute values */ xmlParserCtxtPtr ctxt; + int no_doc_free; }; static void xmlFreeTextWriterStackEntry(xmlLinkPtr lk); @@ -96,10 +97,57 @@ static int xmlTextWriterStackEntry * p); /** + * xmlWriterErrMsg: + * @ctxt: a writer context + * @error: the error number + * @msg: the error message + * + * Handle a writer error + */ +static void +xmlWriterErrMsg(xmlTextWriterPtr ctxt, xmlParserErrors error, + const char *msg) +{ + if (ctxt != NULL) { + __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, + NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, + NULL, 0, NULL, NULL, NULL, 0, 0, msg); + } else { + __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, msg); + } +} + +/** + * xmlWriterErrMsgInt: + * @ctxt: a writer context + * @error: the error number + * @msg: the error message + * @val: an int + * + * Handle a writer error + */ +static void +xmlWriterErrMsgInt(xmlTextWriterPtr ctxt, xmlParserErrors error, + const char *msg, int val) +{ + if (ctxt != NULL) { + __xmlRaiseError(NULL, NULL, NULL, ctxt->ctxt, + NULL, XML_FROM_WRITER, error, XML_ERR_FATAL, + NULL, 0, NULL, NULL, NULL, val, 0, msg, val); + } else { + __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_WRITER, error, + XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, val, 0, msg, val); + } +} + +/** * xmlNewTextWriter: * @out: an xmlOutputBufferPtr * * Create a new xmlNewTextWriter structure using an xmlOutputBufferPtr + * NOTE: the @out parameter will be deallocated when the writer is closed + * (if the call succeed.) * * Returns the new xmlTextWriterPtr or NULL in case of error */ @@ -110,7 +158,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) ret = (xmlTextWriterPtr) xmlMalloc(sizeof(xmlTextWriter)); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); return NULL; } @@ -121,7 +169,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) (xmlListDataCompare) xmlCmpTextWriterStackEntry); if (ret->nodes == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); xmlFree(ret); return NULL; @@ -132,7 +180,7 @@ xmlNewTextWriter(xmlOutputBufferPtr out) (xmlListDataCompare) xmlCmpTextWriterNsStackEntry); if (ret->nsstack == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); xmlListDelete(ret->nodes); xmlFree(ret); @@ -147,10 +195,11 @@ xmlNewTextWriter(xmlOutputBufferPtr out) xmlListDelete(ret->nodes); xmlListDelete(ret->nsstack); xmlFree(ret); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriter : out of memory!\n"); return NULL; } + ret->no_doc_free = 0; return ret; } @@ -172,14 +221,14 @@ xmlNewTextWriterFilename(const char *uri, int compression) out = xmlOutputBufferCreateFilename(uri, NULL, compression); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterFilename : out of memory!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterFilename : out of memory!\n"); xmlOutputBufferClose(out); return NULL; @@ -213,14 +262,14 @@ xmlNewTextWriterMemory(xmlBufferPtr buf, int compression ATTRIBUTE_UNUSED) xmlTextWriterCloseMemCallback, (void *) buf, NULL); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterMemory : out of memory!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlNewTextWriterMemory : out of memory!\n"); xmlOutputBufferClose(out); return NULL; @@ -235,6 +284,8 @@ xmlNewTextWriterMemory(xmlBufferPtr buf, int compression ATTRIBUTE_UNUSED) * @compression: compress the output? * * Create a new xmlNewTextWriter structure with @ctxt as output + * NOTE: the @ctxt context will be freed with the resulting writer + * (if the call succeeds). * TODO: handle compression * * Returns the new xmlTextWriterPtr or NULL in case of error @@ -247,7 +298,7 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, xmlOutputBufferPtr out; if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : invalid context!\n"); return NULL; } @@ -258,14 +309,14 @@ xmlNewTextWriterPushParser(xmlParserCtxtPtr ctxt, xmlTextWriterCloseDocCallback, (void *) ctxt, NULL); if (out == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : error at xmlOutputBufferCreateIO!\n"); return NULL; } ret = xmlNewTextWriter(out); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterPushParser : error at xmlNewTextWriter!\n"); xmlOutputBufferClose(out); return NULL; @@ -300,7 +351,7 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); return NULL; } @@ -313,22 +364,24 @@ xmlNewTextWriterDoc(xmlDocPtr * doc, int compression) ctxt->myDoc = xmlNewDoc(BAD_CAST XML_DEFAULT_VERSION); if (ctxt->myDoc == NULL) { xmlFreeParserCtxt(ctxt); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewDoc!\n"); return NULL; } ret = xmlNewTextWriterPushParser(ctxt, compression); if (ret == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); return NULL; } xmlSetDocCompressMode(ctxt->myDoc, compression); - if (doc != NULL) + if (doc != NULL) { *doc = ctxt->myDoc; + ret->no_doc_free = 1; + } return ret; } @@ -352,7 +405,7 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) xmlParserCtxtPtr ctxt; if (doc == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterTree : invalid document tree!\n"); return NULL; } @@ -365,7 +418,7 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) ctxt = xmlCreatePushParserCtxt(&saxHandler, NULL, NULL, 0, NULL); if (ctxt == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlCreatePushParserCtxt!\n"); return NULL; } @@ -378,13 +431,14 @@ xmlNewTextWriterTree(xmlDocPtr doc, xmlNodePtr node, int compression) ret = xmlNewTextWriterPushParser(ctxt, compression); if (ret == NULL) { xmlFreeParserCtxt(ctxt); - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "xmlNewTextWriterDoc : error at xmlNewTextWriterPushParser!\n"); return NULL; } ctxt->myDoc = doc; ctxt->node = node; + ret->no_doc_free = 1; xmlSetDocCompressMode(doc, compression); @@ -412,8 +466,13 @@ xmlFreeTextWriter(xmlTextWriterPtr writer) if (writer->nsstack != NULL) xmlListDelete(writer->nsstack); - if (writer->ctxt != NULL) + if (writer->ctxt != NULL) { + if ((writer->ctxt->myDoc != NULL) && (writer->no_doc_free == 0)) { + xmlFreeDoc(writer->ctxt->myDoc); + writer->ctxt->myDoc = NULL; + } xmlFreeParserCtxt(writer->ctxt); + } if (writer->ichar != NULL) xmlFree(writer->ichar); @@ -441,14 +500,14 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, xmlCharEncodingHandlerPtr encoder; if ((writer == NULL) || (writer->out == NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDocument : invalid writer!\n"); return -1; } lk = xmlListFront(writer->nodes); if ((lk != NULL) && (xmlLinkGetData(lk) != NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDocument : not allowed in this context!\n"); return -1; } @@ -457,7 +516,7 @@ xmlTextWriterStartDocument(xmlTextWriterPtr writer, const char *version, if (encoding != NULL) { encoder = xmlFindCharEncodingHandler(encoding); if (encoder == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDocument : out of memory!\n"); return -1; } @@ -555,7 +614,7 @@ xmlTextWriterEndDocument(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndDocument : invalid writer!\n"); return -1; } @@ -638,7 +697,7 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartComment : invalid writer!\n"); return -1; } @@ -675,7 +734,7 @@ xmlTextWriterStartComment(xmlTextWriterPtr writer) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); return -1; } @@ -717,14 +776,14 @@ xmlTextWriterEndComment(xmlTextWriterPtr writer) xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndComment : invalid writer!\n"); return -1; } lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterEndComment : not allowed in this context!\n"); return -1; } @@ -799,7 +858,7 @@ xmlTextWriterWriteVFormatComment(xmlTextWriterPtr writer, xmlChar *buf; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteVFormatComment : invalid writer!\n"); return -1; } @@ -896,14 +955,14 @@ xmlTextWriterStartElement(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartElement : out of memory!\n"); xmlFree(p); return -1; @@ -1201,13 +1260,13 @@ xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content, xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteRawLen : invalid writer!\n"); return -1; } - if ((content == NULL) && (len > 0)) { - xmlGenericError(xmlGenericErrorContext, + if ((content == NULL) || (len < 0)) { + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteRawLen : invalid content!\n"); return -1; } @@ -1268,6 +1327,9 @@ xmlTextWriterWriteFormatString(xmlTextWriterPtr writer, const char *format, int rc; va_list ap; + if ((writer == NULL) || (format == NULL)) + return -1; + va_start(ap, format); rc = xmlTextWriterWriteVFormatString(writer, format, ap); @@ -1293,7 +1355,7 @@ xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer, int rc; xmlChar *buf; - if (writer == NULL) + if ((writer == NULL) || (format == NULL)) return -1; buf = xmlTextWriterVSprintf(format, argptr); @@ -1324,7 +1386,7 @@ xmlTextWriterWriteString(xmlTextWriterPtr writer, const xmlChar * content) xmlTextWriterStackEntry *p; xmlChar *buf; - if (writer == NULL) + if ((writer == NULL) || (content == NULL)) return -1; sum = 0; @@ -1393,6 +1455,9 @@ xmlOutputBufferWriteBase64(xmlOutputBufferPtr out, int len, int count; int sum; + if ((out == NULL) || (len < 0) || (data == NULL)) + return(-1); + linelen = 0; sum = 0; @@ -1465,7 +1530,7 @@ xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data, xmlLinkPtr lk; xmlTextWriterStackEntry *p; - if (writer == NULL) + if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0)) return -1; sum = 0; @@ -1515,7 +1580,7 @@ xmlOutputBufferWriteBinHex(xmlOutputBufferPtr out, {'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int i; - if ((out == NULL) || ((data == 0) && (len != 0))) { + if ((out == NULL) || (data == NULL) || (len < 0)) { return -1; } @@ -1558,7 +1623,7 @@ xmlTextWriterWriteBinHex(xmlTextWriterPtr writer, const char *data, xmlLinkPtr lk; xmlTextWriterStackEntry *p; - if (writer == NULL) + if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0)) return -1; sum = 0; @@ -1698,7 +1763,7 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, p = (xmlTextWriterNsStackEntry *) xmlMalloc(sizeof(xmlTextWriterNsStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartAttributeNS : out of memory!\n"); return -1; } @@ -1706,7 +1771,7 @@ xmlTextWriterStartAttributeNS(xmlTextWriterPtr writer, p->prefix = buf; p->uri = xmlStrdup(namespaceURI); if (p->uri == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartAttributeNS : out of memory!\n"); xmlFree(p); return -1; @@ -1742,12 +1807,14 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) lk = xmlListFront(writer->nodes); if (lk == 0) { xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; } p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk); if (p == 0) { xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; } @@ -1759,6 +1826,7 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) count = xmlOutputBufferWrite(writer->out, 1, &writer->qchar); if (count < 0) { xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; } sum += count; @@ -1772,6 +1840,7 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer) np->uri); if (count < 0) { xmlListDelete(writer->nsstack); + writer->nsstack = NULL; return -1; } sum += count; @@ -2231,7 +2300,7 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) return -1; if (xmlStrcasecmp(target, (const xmlChar *) "xml") == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartPI : target name [Xx][Mm][Ll] is reserved for xml standardization!\n"); return -1; } @@ -2261,7 +2330,7 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) break; case XML_TEXTWRITER_PI: case XML_TEXTWRITER_PI_TEXT: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartPI : nested PI!\n"); return -1; default: @@ -2273,14 +2342,14 @@ xmlTextWriterStartPI(xmlTextWriterPtr writer, const xmlChar * target) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartPI : out of memory!\n"); return -1; } p->name = xmlStrdup(target); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartPI : out of memory!\n"); xmlFree(p); return -1; @@ -2483,7 +2552,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) p->state = XML_TEXTWRITER_TEXT; break; case XML_TEXTWRITER_CDATA: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartCDATA : CDATA not allowed in this context!\n"); return -1; default: @@ -2495,7 +2564,7 @@ xmlTextWriterStartCDATA(xmlTextWriterPtr writer) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartCDATA : out of memory!\n"); return -1; } @@ -2672,7 +2741,7 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, sum = 0; lk = xmlListFront(writer->nodes); if ((lk != NULL) && (xmlLinkGetData(lk) != NULL)) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDTD : DTD allowed only in prolog!\n"); return -1; } @@ -2680,14 +2749,14 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTD : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTD : out of memory!\n"); xmlFree(p); return -1; @@ -2707,7 +2776,7 @@ xmlTextWriterStartDTD(xmlTextWriterPtr writer, if (pubid != 0) { if (sysid == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterStartDTD : system identifier needed!\n"); return -1; } @@ -3019,14 +3088,14 @@ xmlTextWriterStartDTDElement(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); xmlFree(p); return -1; @@ -3256,14 +3325,14 @@ xmlTextWriterStartDTDAttlist(xmlTextWriterPtr writer, const xmlChar * name) p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDAttlist : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDAttlist : out of memory!\n"); xmlFree(p); return -1; @@ -3495,14 +3564,14 @@ xmlTextWriterStartDTDEntity(xmlTextWriterPtr writer, p = (xmlTextWriterStackEntry *) xmlMalloc(sizeof(xmlTextWriterStackEntry)); if (p == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); return -1; } p->name = xmlStrdup(name); if (p->name == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_NO_MEMORY, "xmlTextWriterStartDTDElement : out of memory!\n"); xmlFree(p); return -1; @@ -3814,7 +3883,7 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, xmlTextWriterStackEntry *p; if (writer == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: xmlTextWriterPtr invalid!\n"); return -1; } @@ -3822,7 +3891,7 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, sum = 0; lk = xmlListFront(writer->nodes); if (lk == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: you must call xmlTextWriterStartDTDEntity before the call to this function!\n"); return -1; } @@ -3836,20 +3905,20 @@ xmlTextWriterWriteDTDExternalEntityContents(xmlTextWriterPtr writer, break; case XML_TEXTWRITER_DTD_PENT: if (ndataid != NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: notation not allowed with parameter entities!\n"); return -1; } break; default: - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: you must call xmlTextWriterStartDTDEntity before the call to this function!\n"); return -1; } if (pubid != 0) { if (sysid == 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(writer, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDTDExternalEntityContents: system identifier needed!\n"); return -1; } @@ -4238,7 +4307,7 @@ xmlTextWriterWriteDocCallback(void *context, const xmlChar * str, int len) int rc; if ((rc = xmlParseChunk(ctxt, (const char *) str, len, 0)) != 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDocCallback : XML error %d !\n", rc); return -1; @@ -4262,7 +4331,7 @@ xmlTextWriterCloseDocCallback(void *context) int rc; if ((rc = xmlParseChunk(ctxt, NULL, 0, 1)) != 0) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsgInt(NULL, XML_ERR_INTERNAL_ERROR, "xmlTextWriterWriteDocCallback : XML error %d !\n", rc); return -1; @@ -4290,7 +4359,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) size = BUFSIZ; buf = (xmlChar *) xmlMalloc(size); if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } @@ -4301,7 +4370,7 @@ xmlTextWriterVSprintf(const char *format, va_list argptr) size += BUFSIZ; buf = (xmlChar *) xmlMalloc(size); if (buf == NULL) { - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_NO_MEMORY, "xmlTextWriterVSprintf : out of memory!\n"); return NULL; } @@ -4322,9 +4391,6 @@ xmlTextWriterStartDocumentCallback(void *ctx) xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx; xmlDocPtr doc; -#ifdef DEBUG_SAX - xmlGenericError(xmlGenericErrorContext, "SAX.startDocument()\n"); -#endif if (ctxt->html) { #ifdef LIBXML_HTML_ENABLED if (ctxt->myDoc == NULL) @@ -4339,7 +4405,7 @@ xmlTextWriterStartDocumentCallback(void *ctx) return; } #else - xmlGenericError(xmlGenericErrorContext, + xmlWriterErrMsg(NULL, XML_ERR_INTERNAL_ERROR, "libxml2 built without HTML support\n"); ctxt->errNo = XML_ERR_INTERNAL_ERROR; ctxt->instate = XML_PARSER_EOF; @@ -4390,7 +4456,7 @@ xmlTextWriterStartDocumentCallback(void *ctx) int xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent) { - if (indent < 0) + if ((writer == NULL) || (indent < 0)) return -1; writer->indent = indent; @@ -4411,7 +4477,7 @@ xmlTextWriterSetIndent(xmlTextWriterPtr writer, int indent) int xmlTextWriterSetIndentString(xmlTextWriterPtr writer, const xmlChar * str) { - if (!str) + if ((writer == NULL) || (!str)) return -1; if (writer->ichar != NULL) @@ -207,7 +207,8 @@ static const char *xmlXPathErrorMessages[] = { "Sub resource error\n", "Undefined namespace prefix\n", "Encoding error\n", - "Char out of XML range\n" + "Char out of XML range\n", + "Invalid or inclomplete context\n" }; @@ -774,6 +775,8 @@ xmlXPathDebugDumpObject(FILE *output, xmlXPathObjectPtr cur, int depth) { int i; char shift[100]; + if (output == NULL) return; + for (i = 0;((i < depth) && (i < 25));i++) shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; @@ -1062,6 +1065,8 @@ xmlXPathDebugDumpCompExpr(FILE *output, xmlXPathCompExprPtr comp, int i; char shift[100]; + if ((output == NULL) || (comp == NULL)) return; + for (i = 0;((i < depth) && (i < 25));i++) shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; @@ -1098,7 +1103,7 @@ valuePop(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr ret; - if (ctxt->valueNr <= 0) + if ((ctxt == NULL) || (ctxt->valueNr <= 0)) return (0); ctxt->valueNr--; if (ctxt->valueNr > 0) @@ -1121,6 +1126,7 @@ valuePop(xmlXPathParserContextPtr ctxt) extern int valuePush(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr value) { + if ((ctxt == NULL) || (value == NULL)) return(-1); if (ctxt->valueNr >= ctxt->valueMax) { xmlXPathObjectPtr *tmp; @@ -1234,6 +1240,7 @@ xmlXPathPopNodeSet (xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr obj; xmlNodeSetPtr ret; + if (ctxt == NULL) return(NULL); if (ctxt->value == NULL) { xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); return(NULL); @@ -1267,7 +1274,7 @@ xmlXPathPopExternal (xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr obj; void * ret; - if (ctxt->value == NULL) { + if ((ctxt == NULL) || (ctxt->value == NULL)) { xmlXPathSetError(ctxt, XPATH_INVALID_OPERAND); return(NULL); } @@ -1802,6 +1809,7 @@ int xmlXPathNodeSetContains (xmlNodeSetPtr cur, xmlNodePtr val) { int i; + if ((cur == NULL) || (val == NULL)) return(0); if (val->type == XML_NAMESPACE_DECL) { for (i = 0; i < cur->nodeNr; i++) { if (cur->nodeTab[i]->type == XML_NAMESPACE_DECL) { @@ -1837,7 +1845,9 @@ void xmlXPathNodeSetAddNs(xmlNodeSetPtr cur, xmlNodePtr node, xmlNsPtr ns) { int i; - if ((ns == NULL) || (node == NULL) || (ns->type != XML_NAMESPACE_DECL) || + + if ((cur == NULL) || (ns == NULL) || (node == NULL) || + (ns->type != XML_NAMESPACE_DECL) || (node->type != XML_ELEMENT_NODE)) return; @@ -1892,7 +1902,7 @@ void xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { int i; - if (val == NULL) return; + if ((cur == NULL) || (val == NULL)) return; #if 0 if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' ')) @@ -1950,7 +1960,7 @@ xmlXPathNodeSetAdd(xmlNodeSetPtr cur, xmlNodePtr val) { */ void xmlXPathNodeSetAddUnique(xmlNodeSetPtr cur, xmlNodePtr val) { - if (val == NULL) return; + if ((cur == NULL) || (val == NULL)) return; #if 0 if ((val->type == XML_ELEMENT_NODE) && (val->name[0] == ' ')) @@ -3928,21 +3938,11 @@ xmlXPathFreeContext(xmlXPathContextPtr ctxt) { #define CHECK_CONTEXT(ctxt) \ - if (ctxt == NULL) { \ - xmlGenericError(xmlGenericErrorContext, \ - "%s:%d Internal error: no context\n", \ - __FILE__, __LINE__); \ - } \ - else if (ctxt->doc == NULL) { \ - xmlGenericError(xmlGenericErrorContext, \ - "%s:%d Internal error: no document\n", \ - __FILE__, __LINE__); \ - } \ - else if (ctxt->doc->children == NULL) { \ - xmlGenericError(xmlGenericErrorContext, \ - "%s:%d Internal error: document without root\n", \ - __FILE__, __LINE__); \ - } \ + if ((ctxt == NULL) || (ctxt->doc == NULL) || \ + (ctxt->doc->children == NULL)) { \ + xmlXPatherror(ctxt, __FILE__, __LINE__, XPATH_INVALID_CTXT); \ + return(NULL); \ + } /** @@ -4868,6 +4868,7 @@ xmlXPathEqualValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg1, arg2, argtmp; int ret = 0; + if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { @@ -4951,6 +4952,7 @@ xmlXPathNotEqualValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg1, arg2, argtmp; int ret = 0; + if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { @@ -5050,6 +5052,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) { int ret = 0, arg1i = 0, arg2i = 0; xmlXPathObjectPtr arg1, arg2; + if ((ctxt == NULL) || (ctxt->context == NULL)) return(0); arg2 = valuePop(ctxt); arg1 = valuePop(ctxt); if ((arg1 == NULL) || (arg2 == NULL)) { @@ -5161,6 +5164,7 @@ xmlXPathCompareValues(xmlXPathParserContextPtr ctxt, int inf, int strict) { */ void xmlXPathValueFlipSign(xmlXPathParserContextPtr ctxt) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return; CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); if (xmlXPathIsNaN(ctxt->value->floatval)) @@ -5348,6 +5352,7 @@ typedef xmlNodePtr (*xmlXPathTraversalFunction) */ xmlNodePtr xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) return(ctxt->context->node); return(NULL); @@ -5365,6 +5370,7 @@ xmlXPathNextSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) { if (ctxt->context->node == NULL) return(NULL); switch (ctxt->context->node->type) { @@ -5416,6 +5422,7 @@ xmlXPathNextChild(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) { if (ctxt->context->node == NULL) return(NULL); @@ -5478,6 +5485,7 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) { if (ctxt->context->node == NULL) return(NULL); @@ -5502,6 +5510,7 @@ xmlXPathNextDescendantOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); /* * the parent of an attribute or namespace node is the element * to which the attribute or namespace node is attached @@ -5574,6 +5583,7 @@ xmlXPathNextParent(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); /* * the parent of an attribute or namespace node is the element * to which the attribute or namespace node is attached @@ -5697,6 +5707,7 @@ xmlXPathNextAncestor(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) return(ctxt->context->node); return(xmlXPathNextAncestor(ctxt, cur)); @@ -5715,6 +5726,7 @@ xmlXPathNextAncestorOrSelf(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || (ctxt->context->node->type == XML_NAMESPACE_DECL)) return(NULL); @@ -5739,6 +5751,7 @@ xmlXPathNextFollowingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || (ctxt->context->node->type == XML_NAMESPACE_DECL)) return(NULL); @@ -5769,6 +5782,7 @@ xmlXPathNextPrecedingSibling(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextFollowing(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur != NULL && cur->children != NULL) return cur->children ; if (cur == NULL) cur = ctxt->context->node; @@ -5824,6 +5838,7 @@ xmlXPathIsAncestor(xmlNodePtr ancestor, xmlNodePtr node) { xmlNodePtr xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) cur = ctxt->context->node; if (cur == NULL) @@ -5864,6 +5879,7 @@ static xmlNodePtr xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (cur == NULL) { cur = ctxt->context->node; if (cur == NULL) @@ -5906,6 +5922,7 @@ xmlXPathNextPrecedingInternal(xmlXPathParserContextPtr ctxt, */ xmlNodePtr xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (ctxt->context->node->type != XML_ELEMENT_NODE) return(NULL); if (ctxt->context->tmpNsList == NULL && cur != (xmlNodePtr) xmlXPathXMLNamespace) { if (ctxt->context->tmpNsList != NULL) @@ -5942,6 +5959,7 @@ xmlXPathNextNamespace(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ xmlNodePtr xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if (ctxt->context->node == NULL) return(NULL); if (ctxt->context->node->type != XML_ELEMENT_NODE) @@ -5977,6 +5995,7 @@ xmlXPathNextAttribute(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { */ void xmlXPathRoot(xmlXPathParserContextPtr ctxt) { + if ((ctxt == NULL) || (ctxt->context == NULL)) return; ctxt->context->node = (xmlNodePtr) ctxt->context->doc; valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node)); } @@ -6213,6 +6232,8 @@ void xmlXPathLocalNameFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; + if (ctxt == NULL) return; + if (nargs == 0) { valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node)); nargs = 1; @@ -6268,6 +6289,8 @@ void xmlXPathNamespaceURIFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; + if (ctxt == NULL) return; + if (nargs == 0) { valuePush(ctxt, xmlXPathNewNodeSet(ctxt->context->node)); nargs = 1; @@ -6417,6 +6440,7 @@ void xmlXPathStringFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; + if (ctxt == NULL) return; if (nargs == 0) { valuePush(ctxt, xmlXPathWrapString( @@ -6448,6 +6472,8 @@ xmlXPathStringLengthFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; if (nargs == 0) { + if ((ctxt == NULL) || (ctxt->context == NULL)) + return; if (ctxt->context->node == NULL) { valuePush(ctxt, xmlXPathNewFloat(0)); } else { @@ -6481,6 +6507,7 @@ xmlXPathConcatFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur, newobj; xmlChar *tmp; + if (ctxt == NULL) return; if (nargs < 2) { CHECK_ARITY(2); } @@ -6812,6 +6839,7 @@ xmlXPathNormalizeFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlBufferPtr target; xmlChar blank; + if (ctxt == NULL) return; if (nargs == 0) { /* Use current context node */ valuePush(ctxt, @@ -6883,7 +6911,7 @@ xmlXPathTranslateFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlBufferPtr target; int offset, max; xmlChar ch; - xmlChar *point; + const xmlChar *point; xmlChar *cptr; CHECK_ARITY(3); @@ -7067,6 +7095,7 @@ xmlXPathNumberFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr cur; double res; + if (ctxt == NULL) return; if (nargs == 0) { if (ctxt->context->node == NULL) { valuePush(ctxt, xmlXPathNewFloat(0.0)); @@ -7344,6 +7373,7 @@ xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) { xmlChar *ret; int count = 0; + if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL); /* * Accelerator for simple ASCII names */ @@ -7424,6 +7454,7 @@ xmlXPathParseName(xmlXPathParserContextPtr ctxt) { xmlChar *ret; int count = 0; + if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL); /* * Accelerator for simple ASCII names */ @@ -8012,35 +8043,33 @@ xmlXPathCompFilterExpr(xmlXPathParserContextPtr ctxt) { static xmlChar * xmlXPathScanName(xmlXPathParserContextPtr ctxt) { - xmlChar buf[XML_MAX_NAMELEN]; - int len = 0; + int len = 0, l; + int c; + const xmlChar *cur; + xmlChar *ret; - SKIP_BLANKS; - if (!IS_ASCII_LETTER(CUR) && (CUR != '_') && - (CUR != ':')) { + cur = ctxt->cur; + + c = CUR_CHAR(l); + if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ + (!IS_LETTER(c) && (c != '_') && + (c != ':'))) { return(NULL); } - while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) || - (NXT(len) == '.') || (NXT(len) == '-') || - (NXT(len) == '_') || (NXT(len) == ':') || - (IS_COMBINING_CH(NXT(len))) || - (IS_EXTENDER_CH(NXT(len)))) { - buf[len] = NXT(len); - len++; - if (len >= XML_MAX_NAMELEN) { - xmlGenericError(xmlGenericErrorContext, - "xmlScanName: reached XML_MAX_NAMELEN limit\n"); - while ((IS_ASCII_LETTER(NXT(len))) || (IS_ASCII_DIGIT(NXT(len))) || - (NXT(len) == '.') || (NXT(len) == '-') || - (NXT(len) == '_') || (NXT(len) == ':') || - (IS_COMBINING_CH(NXT(len))) || - (IS_EXTENDER_CH(NXT(len)))) - len++; - break; - } + while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ + ((IS_LETTER(c)) || (IS_DIGIT(c)) || + (c == '.') || (c == '-') || + (c == '_') || (c == ':') || + (IS_COMBINING(c)) || + (IS_EXTENDER(c)))) { + len += l; + NEXTL(l); + c = CUR_CHAR(l); } - return(xmlStrndup(buf, len)); + ret = xmlStrndup(cur, ctxt->cur - cur); + ctxt->cur = cur; + return(ret); } /** @@ -10408,10 +10437,14 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) case XPATH_OP_ARG: bakd = ctxt->context->doc; bak = ctxt->context->node; + pp = ctxt->context->proximityPosition; + cs = ctxt->context->contextSize; if (op->ch1 != -1) total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch1]); - ctxt->context->doc = bakd; + ctxt->context->contextSize = cs; + ctxt->context->proximityPosition = pp; ctxt->context->node = bak; + ctxt->context->doc = bakd; CHECK_ERROR0; if (op->ch2 != -1) { total += xmlXPathCompOpEval(ctxt, &comp->steps[op->ch2]); @@ -10917,7 +10950,7 @@ xmlXPathRunEval(xmlXPathParserContextPtr ctxt) { */ int xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) { - if (res == NULL) return(0); + if ((ctxt == NULL) || (res == NULL)) return(0); switch (res->type) { case XPATH_BOOLEAN: return(res->boolval); @@ -10956,7 +10989,7 @@ xmlXPathEvalPredicate(xmlXPathContextPtr ctxt, xmlXPathObjectPtr res) { int xmlXPathEvaluatePredicateResult(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr res) { - if (res == NULL) return(0); + if ((ctxt == NULL) || (res == NULL)) return(0); switch (res->type) { case XPATH_BOOLEAN: return(res->boolval); @@ -11139,6 +11172,7 @@ xmlXPathCompiledEval(xmlXPathCompExprPtr comp, xmlXPathContextPtr ctx) { */ void xmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) { + if (ctxt == NULL) return; xmlXPathCompileExpr(ctxt); CHECK_ERROR; xmlXPathRunEval(ctxt); @@ -559,7 +559,7 @@ xmlXPtrNewRangeNodeObject(xmlNodePtr start, xmlXPathObjectPtr end) { return(NULL); break; default: - TODO + /* TODO */ return(NULL); } @@ -642,7 +642,7 @@ void xmlXPtrLocationSetAdd(xmlLocationSetPtr cur, xmlXPathObjectPtr val) { int i; - if (val == NULL) return; + if ((cur == NULL) || (val == NULL)) return; /* * check against doublons @@ -2227,6 +2227,7 @@ xmlXPtrRangeToFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlNodeSetPtr oldset; int i; + if (ctxt == NULL) return; CHECK_ARITY(1); /* * Save the expression pointer since we will have to evaluate @@ -2904,6 +2905,8 @@ xmlXPtrEvalRangePredicate(xmlXPathParserContextPtr ctxt) { xmlLocationSetPtr oldset; int i; + if (ctxt == NULL) return; + SKIP_BLANKS; if (CUR != '[') { XP_ERROR(XPATH_INVALID_PREDICATE_ERROR); |