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> Fri Nov 5 11:02:28 CET 2004 Daniel Veillard <daniel@veillard.com>
* gentest.py testapi.c: fixed the way the generator works, * gentest.py testapi.c: fixed the way the generator works,
......
...@@ -33,7 +33,8 @@ skipped_functions = [ ...@@ -33,7 +33,8 @@ skipped_functions = [
"xmlReaderNewFd", "xmlReaderForFd", "xmlReaderNewFd", "xmlReaderForFd",
"xmlIORead", "xmlReadIO", "xmlCtxtReadIO", "xmlIORead", "xmlReadIO", "xmlCtxtReadIO",
"htmlIORead", "htmlReadIO", "htmlCtxtReadIO", "htmlIORead", "htmlReadIO", "htmlCtxtReadIO",
"xmlReaderNewIO", "xmlBufferDump", "xmlReaderNewIO", "xmlBufferDump", "xmlNanoFTPConnect",
"xmlNanoFTPConnectTo",
# library state cleanup, generate false leak informations and other # library state cleanup, generate false leak informations and other
# troubles, heavillyb tested otherwise. # troubles, heavillyb tested otherwise.
"xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc", "xmlCleanupParser", "xmlRelaxNGCleanupTypes", "xmlSetListDoc",
...@@ -44,7 +45,7 @@ skipped_functions = [ ...@@ -44,7 +45,7 @@ skipped_functions = [
"xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml", "xmlTextReaderReadInnerXml", "xmlTextReaderReadOuterXml",
"xmlTextReaderReadString", "xmlTextReaderReadString",
# destructor # destructor
"xmlListDelete", "xmlOutputBufferClose", "xmlListDelete", "xmlOutputBufferClose", "xmlNanoFTPClose",
# deprecated # deprecated
"xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities", "xmlCatalogGetPublic", "xmlCatalogGetSystem", "xmlEncodeEntities",
# allocators # allocators
...@@ -203,6 +204,9 @@ def type_convert(str, name, info, module, function, pos): ...@@ -203,6 +204,9 @@ def type_convert(str, name, info, module, function, pos):
return('xmlNodePtr_in'); return('xmlNodePtr_in');
if res == 'const xmlBufferPtr': if res == 'const xmlBufferPtr':
res = 'xmlBufferPtr'; res = 'xmlBufferPtr';
if res == 'xmlChar_ptr' and name == 'name' and \
string.find(function, "EatName") != -1:
return('eaten_name')
return res return res
......
...@@ -783,6 +783,8 @@ xmlNanoFTPGetMore(void *ctx) { ...@@ -783,6 +783,8 @@ xmlNanoFTPGetMore(void *ctx) {
int len; int len;
int size; int size;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) { if ((ctxt->controlBufIndex < 0) || (ctxt->controlBufIndex > FTP_BUF_SIZE)) {
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
...@@ -862,6 +864,8 @@ xmlNanoFTPReadResponse(void *ctx) { ...@@ -862,6 +864,8 @@ xmlNanoFTPReadResponse(void *ctx) {
int len; int len;
int res = -1, cur = -1; int res = -1, cur = -1;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
get_more: get_more:
/* /*
* Assumes everything up to controlBuf[controlBufIndex] has been read * Assumes everything up to controlBuf[controlBufIndex] has been read
...@@ -949,6 +953,7 @@ xmlNanoFTPCheckResponse(void *ctx) { ...@@ -949,6 +953,7 @@ xmlNanoFTPCheckResponse(void *ctx) {
fd_set rfd; fd_set rfd;
struct timeval tv; struct timeval tv;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
tv.tv_sec = 0; tv.tv_sec = 0;
tv.tv_usec = 0; tv.tv_usec = 0;
FD_ZERO(&rfd); FD_ZERO(&rfd);
...@@ -1037,6 +1042,8 @@ xmlNanoFTPQuit(void *ctx) { ...@@ -1037,6 +1042,8 @@ xmlNanoFTPQuit(void *ctx) {
char buf[200]; char buf[200];
int len, res; int len, res;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
snprintf(buf, sizeof(buf), "QUIT\r\n"); snprintf(buf, sizeof(buf), "QUIT\r\n");
len = strlen(buf); len = strlen(buf);
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
...@@ -1448,6 +1455,8 @@ xmlNanoFTPConnectTo(const char *server, int port) { ...@@ -1448,6 +1455,8 @@ xmlNanoFTPConnectTo(const char *server, int port) {
xmlNanoFTPInit(); xmlNanoFTPInit();
if (server == NULL) if (server == NULL)
return(NULL); return(NULL);
if (port <= 0)
return(NULL);
ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL); ctxt = (xmlNanoFTPCtxtPtr) xmlNanoFTPNewCtxt(NULL);
ctxt->hostname = xmlMemStrdup(server); ctxt->hostname = xmlMemStrdup(server);
if (port != 0) if (port != 0)
...@@ -1477,6 +1486,8 @@ xmlNanoFTPCwd(void *ctx, const char *directory) { ...@@ -1477,6 +1486,8 @@ xmlNanoFTPCwd(void *ctx, const char *directory) {
int len; int len;
int res; int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
/* /*
* Expected response code for CWD: * Expected response code for CWD:
* *
...@@ -1523,6 +1534,8 @@ xmlNanoFTPDele(void *ctx, const char *file) { ...@@ -1523,6 +1534,8 @@ xmlNanoFTPDele(void *ctx, const char *file) {
int len; int len;
int res; int res;
if ((ctxt == NULL) || (ctxt->controlFd < 0) || (file == NULL)) return(-1);
/* /*
* Expected response code for DELE: * Expected response code for DELE:
* *
...@@ -1578,6 +1591,8 @@ xmlNanoFTPGetConnection(void *ctx) { ...@@ -1578,6 +1591,8 @@ xmlNanoFTPGetConnection(void *ctx) {
#endif #endif
SOCKLEN_T dataAddrLen; SOCKLEN_T dataAddrLen;
if (ctxt == NULL) return(-1);
memset (&dataAddr, 0, sizeof(dataAddr)); memset (&dataAddr, 0, sizeof(dataAddr));
#ifdef SUPPORT_IP6 #ifdef SUPPORT_IP6
if ((ctxt->ftpAddr).ss_family == AF_INET6) { if ((ctxt->ftpAddr).ss_family == AF_INET6) {
...@@ -1741,6 +1756,8 @@ xmlNanoFTPCloseConnection(void *ctx) { ...@@ -1741,6 +1756,8 @@ xmlNanoFTPCloseConnection(void *ctx) {
fd_set rfd, efd; fd_set rfd, efd;
struct timeval tv; struct timeval tv;
if ((ctxt == NULL) || (ctxt->controlFd < 0)) return(-1);
closesocket(ctxt->dataFd); ctxt->dataFd = -1; closesocket(ctxt->dataFd); ctxt->dataFd = -1;
tv.tv_sec = 15; tv.tv_sec = 15;
tv.tv_usec = 0; tv.tv_usec = 0;
...@@ -2025,6 +2042,8 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) { ...@@ -2025,6 +2042,8 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx; xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[300]; char buf[300];
int res, len; int res, len;
if (ctx == NULL)
return(-1);
if ((filename == NULL) && (ctxt->path == NULL)) if ((filename == NULL) && (ctxt->path == NULL))
return(-1); return(-1);
ctxt->dataFd = xmlNanoFTPGetConnection(ctxt); ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
......
This diff is collapsed.
...@@ -6328,10 +6328,11 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) { ...@@ -6328,10 +6328,11 @@ xmlUnsetProp(xmlNodePtr node, const xmlChar *name) {
*/ */
int int
xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) {
xmlAttrPtr prop = node->properties, prev = NULL;; xmlAttrPtr prop, prev = NULL;;
if ((node == NULL) || (name == NULL)) if ((node == NULL) || (name == NULL))
return(-1); return(-1);
prop = node->properties;
if (ns == NULL) if (ns == NULL)
return(xmlUnsetProp(node, name)); return(xmlUnsetProp(node, name));
if (ns->href == NULL) 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