Commit 27f20100 authored by Daniel Veillard's avatar Daniel Veillard
Browse files

more coverage more fixes Daniel

* gentest.py testapi.c: more coverage
* nanoftp.c tree.c: more fixes
Daniel
parent ce244ad5
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,
......
......@@ -33,7 +33,8 @@ skipped_functions = [
"xmlReaderNewFd", "xmlReaderForFd",
"xmlIORead", "xmlReadIO", "xmlCtxtReadIO",
"htmlIORead", "htmlReadIO", "htmlCtxtReadIO",
"xmlReaderNewIO", "xmlBufferDump",
"xmlReaderNewIO", "xmlBufferDump", "xmlNanoFTPConnect",
"xmlNanoFTPConnectTo",
# library state cleanup, generate false leak informations and other
# troubles, heavillyb tested otherwise.
"xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc",
......@@ -44,7 +45,7 @@ skipped_functions = [
"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml",
"xmlTextReaderReadString",
# destructor
"xmlListDelete", "xmlOutputBufferClose",
"xmlListDelete", "xmlOutputBufferClose", "xmlNanoFTPClose",
# deprecated
"xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities",
# allocators
......@@ -203,6 +204,9 @@ def type_convert(str, name, info, module, function, pos):
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')
return res
......
......@@ -783,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,
......@@ -862,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
......@@ -949,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);
......@@ -1037,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
......@@ -1448,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)
......@@ -1477,6 +1486,8 @@ xmlNanoFTPCwd(void *ctx, const char *directory) {
int len;
int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
/*
* Expected response code for CWD:
*
......@@ -1523,6 +1534,8 @@ xmlNanoFTPDele(void *ctx, const char *file) {
int len;
int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1);
/*
* Expected response code for DELE:
*
......@@ -1578,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) {
......@@ -1741,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;
......@@ -2025,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);
......
This diff is collapsed.
......@@ -6328,10 +6328,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)
......
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