diff --git a/ChangeLog b/ChangeLog index af752562..b73c0f8b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Fri Oct 12 00:53:03 CEST 2001 Daniel Veillard + + * HTMLtree.c catalog.c debugXML.c entities.c nanoftp.c + parser.c valid.c xmlmemory.c xpath.c xpointer.c: started + integrating the non-controversial parts of Gary Pennington + multithread patches + * catalog.c: corrected a small bug introduced + Thu Oct 11 20:58:15 CEST 2001 Daniel Veillard * catalog.c include/libxml/catalog.h: very serious cleanup, diff --git a/HTMLtree.c b/HTMLtree.c index cc61ef94..030dce6e 100644 --- a/HTMLtree.c +++ b/HTMLtree.c @@ -451,8 +451,8 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur, } if (cur->type == HTML_TEXT_NODE) { if (cur->content != NULL) { - if (((cur->name == xmlStringText) || - (cur->name != xmlStringTextNoenc)) && + if (((cur->name == (const xmlChar *)xmlStringText) || + (cur->name != (const xmlChar *)xmlStringTextNoenc)) && ((cur->parent == NULL) || (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) { xmlChar *buffer; @@ -949,8 +949,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc, } if (cur->type == HTML_TEXT_NODE) { if (cur->content != NULL) { - if (((cur->name == xmlStringText) || - (cur->name != xmlStringTextNoenc)) && + if (((cur->name == (const xmlChar *)xmlStringText) || + (cur->name != (const xmlChar *)xmlStringTextNoenc)) && ((cur->parent == NULL) || (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) { xmlChar *buffer; diff --git a/catalog.c b/catalog.c index 1b7bd8da..ef8a0c72 100644 --- a/catalog.c +++ b/catalog.c @@ -2607,7 +2607,7 @@ xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) { if ((URI == NULL) || (catal == NULL)) return(NULL); - if (catal->type == XML_XML_CATALOG_TYPE) + if (xmlDebugCatalogs) xmlGenericError(xmlGenericErrorContext, "Resolve URI %s\n", URI); @@ -2734,7 +2734,7 @@ xmlInitializeCatalog(void) { const char *catalogs; xmlCatalogPtr catal; - catalogs = getenv("XML_CATALOG_FILES"); + catalogs = (const char *) getenv("XML_CATALOG_FILES"); if (catalogs == NULL) catalogs = XML_XML_DEFAULT_CATALOG; diff --git a/debugXML.c b/debugXML.c index 6c7d9a40..dbdd1f37 100644 --- a/debugXML.c +++ b/debugXML.c @@ -567,7 +567,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth) break; case XML_TEXT_NODE: fprintf(output, shift); - if (node->name == xmlStringTextNoenc) + if (node->name == (const xmlChar *) xmlStringTextNoenc) fprintf(output, "TEXT no enc\n"); else fprintf(output, "TEXT\n"); diff --git a/entities.c b/entities.c index a2306665..09f46d34 100644 --- a/entities.c +++ b/entities.c @@ -38,7 +38,7 @@ static struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = { * TODO: This is GROSS, allocation of a 256 entry hash for * a fixed number of 4 elements ! */ -xmlHashTablePtr xmlPredefinedEntities = NULL; +static xmlHashTablePtr xmlPredefinedEntities = NULL; /* * xmlFreeEntity : clean-up an entity record. diff --git a/nanoftp.c b/nanoftp.c index 1080e6d1..1d078fda 100644 --- a/nanoftp.c +++ b/nanoftp.c @@ -74,8 +74,6 @@ #define SOCKET int #endif -static char hostname[100]; - #define FTP_COMMAND_OK 200 #define FTP_SYNTAX_ERROR 500 #define FTP_GET_PASSWD 331 @@ -99,6 +97,7 @@ typedef struct xmlNanoFTPCtxt { int controlBufIndex; int controlBufUsed; int controlBufAnswer; + char localhostname[100]; } xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr; static int initialized = 0; @@ -131,8 +130,6 @@ xmlNanoFTPInit(void) { return; #endif - gethostname(hostname, sizeof(hostname)); - proxyPort = 21; env = getenv("no_proxy"); if (env != NULL) @@ -177,7 +174,6 @@ xmlNanoFTPCleanup(void) { xmlFree(proxyPasswd); proxyPasswd = NULL; } - hostname[0] = 0; #ifdef _WINSOCKAPI_ if (initialized) WSACleanup(); @@ -480,6 +476,7 @@ xmlNanoFTPNewCtxt(const char *URL) { ret->returnValue = 0; ret->controlBufIndex = 0; ret->controlBufUsed = 0; + gethostname(ret->localhostname, sizeof(ret->localhostname)); if (URL != NULL) xmlNanoFTPScanURL(ret, URL); @@ -778,7 +775,7 @@ xmlNanoFTPSendPasswd(void *ctx) { int res; if (ctxt->passwd == NULL) - snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname); + snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", ctxt->localhostname); else snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); buf[sizeof(buf) - 1] = 0; @@ -951,7 +948,7 @@ xmlNanoFTPConnect(void *ctx) { snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd); else snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", - hostname); + ctxt->localhostname); buf[sizeof(buf) - 1] = 0; len = strlen(buf); #ifdef DEBUG_FTP @@ -1040,7 +1037,8 @@ xmlNanoFTPConnect(void *ctx) { return(0); } if (ctxt->passwd == NULL) - snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", hostname); + snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", + ctxt->localhostname); else snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); buf[sizeof(buf) - 1] = 0; diff --git a/parser.c b/parser.c index c52529bf..31eb8ff1 100644 --- a/parser.c +++ b/parser.c @@ -86,7 +86,7 @@ int xmlParserDebugEntities = 0; * List of XML prefixed PI allowed by W3C specs */ -const char *xmlW3CPIs[] = { +static const char *xmlW3CPIs[] = { "xml-stylesheet", NULL }; @@ -1187,7 +1187,7 @@ xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len) { return 0; } -static xmlChar casemap[256] = { +static const xmlChar casemap[256] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, diff --git a/valid.c b/valid.c index 723ada4c..c27c3c29 100644 --- a/valid.c +++ b/valid.c @@ -70,7 +70,7 @@ scope type name##VPop(xmlValidCtxtPtr ctxt) { \ } \ /* - * I will use a home made algorithm less complex and easier to + * I use a home made algorithm less complex and easier to * debug/maintin than a generic NFA -> DFA state based algo. The * only restriction is on the deepness of the tree limited by the * size of the occurs bitfield @@ -81,7 +81,7 @@ scope type name##VPop(xmlValidCtxtPtr ctxt) { \ #define ROLLBACK_OR 0 #define ROLLBACK_PARENT 1 -struct _xmlValidState { +typedef struct _xmlValidState { xmlElementContentPtr cont; /* pointer to the content model subtree */ xmlNodePtr node; /* pointer to the current node in the list */ long occurs;/* bitfield for multiple occurences */ diff --git a/xmlmemory.c b/xmlmemory.c index ba74cafa..f6892364 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -94,9 +94,9 @@ typedef struct memnod { static unsigned long debugMemSize = 0; static unsigned long debugMaxMemSize = 0; static int block=0; -int xmlMemStopAtBlock = 0; -void *xmlMemTraceBlockAt = NULL; -int xmlMemInitialized = 0; +static int xmlMemStopAtBlock = 0; +static void *xmlMemTraceBlockAt = NULL; +static int xmlMemInitialized = 0; #ifdef MEM_LIST static MEMHDR *memlist = NULL; #endif @@ -625,7 +625,7 @@ void debugmem_tag_error(void *p) #endif } -FILE *xmlMemoryDumpFile = NULL; +static FILE *xmlMemoryDumpFile = NULL; /** diff --git a/xpath.c b/xpath.c index 3283283c..b63f8b7f 100644 --- a/xpath.c +++ b/xpath.c @@ -1176,7 +1176,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize) ************************************************************************/ -const char *xmlXPathErrorMessages[] = { +static const char *xmlXPathErrorMessages[] = { "Ok", "Number encoding", "Unfinished litteral", @@ -3830,7 +3830,6 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict, return(xmlXPathCompareValues(ctxt, inf, strict)); default: TODO - return(0); } return(0); } @@ -9280,7 +9279,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op) "xmlXPathRunEval: function %s not found\n", op->value4); XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR); - return (total); } op->cache = (void *) func; op->cacheURI = (void *) URI; diff --git a/xpointer.c b/xpointer.c index 77645786..692ea71e 100644 --- a/xpointer.c +++ b/xpointer.c @@ -2027,7 +2027,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) { xmlXPtrGetArity(node))); } default: - return(NULL); + break; } return(NULL); } @@ -2064,7 +2064,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) { xmlXPtrGetArity(node))); } default: - return(NULL); + break; } return(NULL); } @@ -2629,7 +2629,7 @@ xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) { *indx = obj->index; return(0); default: - return(-1); + break; } return(-1); } @@ -2665,7 +2665,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) { *indx = obj->index; return(0); default: - return(-1); + break; } return(-1); }