Commit e43cc574 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

more fixes and extending the tests coverage more hardeing of APIs skip

* 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.
Daniel
parent 348636d2
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
......
......@@ -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 = {
......
......@@ -234,8 +234,9 @@ def type_convert(str, name, info, module, function, pos):
return res
known_param_types = [ "int", "const_char_ptr", "const_xmlChar_ptr",
"xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput" ,
"xmlNodePtr", "xmlNodePtr_in", "userdata", "xmlChar_ptr" ];
"xmlParserCtxtPtr", "xmlDocPtr", "filepath", "fileoutput",
"xmlNodePtr", "xmlNodePtr_in", "userdata", "xmlChar_ptr",
"xmlTextWriterPtr" ];
def is_known_param_type(name):
for type in known_param_types:
......@@ -369,6 +370,15 @@ static xmlNodePtr gen_xmlNodePtr_in(int no) {
static void des_xmlNodePtr_in(int no ATTRIBUTE_UNUSED, xmlNodePtr val ATTRIBUTE_UNUSED) {
}
#define gen_nb_xmlTextWriterPtr 2
static xmlTextWriterPtr gen_xmlTextWriterPtr(int no) {
if (no == 0) return(xmlNewTextWriterFilename("test.out", 0));
return(NULL);
}
static void des_xmlTextWriterPtr(int no ATTRIBUTE_UNUSED, xmlTextWriterPtr val) {
if (val != NULL) xmlFreeTextWriter(val);
}
""");
#
......
......@@ -316,6 +316,9 @@ int xmlListAppend(xmlListPtr l, void *data)
*/
void xmlListDelete(xmlListPtr l)
{
if (l == NULL)
return;
xmlListClear(l);
xmlFree(l->sentinel);
xmlFree(l);
......
This diff is collapsed.
......@@ -1206,7 +1206,7 @@ xmlTextWriterWriteRawLen(xmlTextWriterPtr writer, const xmlChar * content,
return -1;
}
if ((content == NULL) && (len > 0)) {
if ((content == NULL) || (len < 0)) {
xmlGenericError(xmlGenericErrorContext,
"xmlTextWriterWriteRawLen : invalid content!\n");
return -1;
......@@ -1268,6 +1268,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 +1296,7 @@ xmlTextWriterWriteVFormatString(xmlTextWriterPtr writer,
int rc;
xmlChar *buf;
if (writer == NULL)
if ((writer == NULL) || (format == NULL))
return -1;
buf = xmlTextWriterVSprintf(format, argptr);
......@@ -1324,7 +1327,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 +1396,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 +1471,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 +1521,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 +1564,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;
......@@ -1742,12 +1748,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 +1767,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 +1781,7 @@ xmlTextWriterEndAttribute(xmlTextWriterPtr writer)
np->uri);
if (count < 0) {
xmlListDelete(writer->nsstack);
writer->nsstack = NULL;
return -1;
}
sum += count;
......@@ -4390,7 +4400,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 +4421,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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment