1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

started integrating the non-controversial parts of Gary Pennington

* 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
Daniel
This commit is contained in:
Daniel Veillard
2001-10-11 22:55:55 +00:00
parent 75b96824bc
commit b44025c72b
11 changed files with 35 additions and 31 deletions

View File

@ -1,3 +1,11 @@
Fri Oct 12 00:53:03 CEST 2001 Daniel Veillard <daniel@veillard.com>
* 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 <daniel@veillard.com> Thu Oct 11 20:58:15 CEST 2001 Daniel Veillard <daniel@veillard.com>
* catalog.c include/libxml/catalog.h: very serious cleanup, * catalog.c include/libxml/catalog.h: very serious cleanup,

View File

@ -451,8 +451,8 @@ htmlNodeDumpFormat(xmlBufferPtr buf, xmlDocPtr doc, xmlNodePtr cur,
} }
if (cur->type == HTML_TEXT_NODE) { if (cur->type == HTML_TEXT_NODE) {
if (cur->content != NULL) { if (cur->content != NULL) {
if (((cur->name == xmlStringText) || if (((cur->name == (const xmlChar *)xmlStringText) ||
(cur->name != xmlStringTextNoenc)) && (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
((cur->parent == NULL) || ((cur->parent == NULL) ||
(!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) { (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
xmlChar *buffer; xmlChar *buffer;
@ -949,8 +949,8 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
} }
if (cur->type == HTML_TEXT_NODE) { if (cur->type == HTML_TEXT_NODE) {
if (cur->content != NULL) { if (cur->content != NULL) {
if (((cur->name == xmlStringText) || if (((cur->name == (const xmlChar *)xmlStringText) ||
(cur->name != xmlStringTextNoenc)) && (cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
((cur->parent == NULL) || ((cur->parent == NULL) ||
(!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) { (!xmlStrEqual(cur->parent->name, BAD_CAST "script")))) {
xmlChar *buffer; xmlChar *buffer;

View File

@ -2607,7 +2607,7 @@ xmlACatalogResolveURI(xmlCatalogPtr catal, const xmlChar *URI) {
if ((URI == NULL) || (catal == NULL)) if ((URI == NULL) || (catal == NULL))
return(NULL); return(NULL);
if (catal->type == XML_XML_CATALOG_TYPE) if (xmlDebugCatalogs)
xmlGenericError(xmlGenericErrorContext, xmlGenericError(xmlGenericErrorContext,
"Resolve URI %s\n", URI); "Resolve URI %s\n", URI);
@ -2734,7 +2734,7 @@ xmlInitializeCatalog(void) {
const char *catalogs; const char *catalogs;
xmlCatalogPtr catal; xmlCatalogPtr catal;
catalogs = getenv("XML_CATALOG_FILES"); catalogs = (const char *) getenv("XML_CATALOG_FILES");
if (catalogs == NULL) if (catalogs == NULL)
catalogs = XML_XML_DEFAULT_CATALOG; catalogs = XML_XML_DEFAULT_CATALOG;

View File

@ -567,7 +567,7 @@ xmlDebugDumpOneNode(FILE * output, xmlNodePtr node, int depth)
break; break;
case XML_TEXT_NODE: case XML_TEXT_NODE:
fprintf(output, shift); fprintf(output, shift);
if (node->name == xmlStringTextNoenc) if (node->name == (const xmlChar *) xmlStringTextNoenc)
fprintf(output, "TEXT no enc\n"); fprintf(output, "TEXT no enc\n");
else else
fprintf(output, "TEXT\n"); fprintf(output, "TEXT\n");

View File

@ -38,7 +38,7 @@ static struct xmlPredefinedEntityValue xmlPredefinedEntityValues[] = {
* TODO: This is GROSS, allocation of a 256 entry hash for * TODO: This is GROSS, allocation of a 256 entry hash for
* a fixed number of 4 elements ! * a fixed number of 4 elements !
*/ */
xmlHashTablePtr xmlPredefinedEntities = NULL; static xmlHashTablePtr xmlPredefinedEntities = NULL;
/* /*
* xmlFreeEntity : clean-up an entity record. * xmlFreeEntity : clean-up an entity record.

View File

@ -74,8 +74,6 @@
#define SOCKET int #define SOCKET int
#endif #endif
static char hostname[100];
#define FTP_COMMAND_OK 200 #define FTP_COMMAND_OK 200
#define FTP_SYNTAX_ERROR 500 #define FTP_SYNTAX_ERROR 500
#define FTP_GET_PASSWD 331 #define FTP_GET_PASSWD 331
@ -99,6 +97,7 @@ typedef struct xmlNanoFTPCtxt {
int controlBufIndex; int controlBufIndex;
int controlBufUsed; int controlBufUsed;
int controlBufAnswer; int controlBufAnswer;
char localhostname[100];
} xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr; } xmlNanoFTPCtxt, *xmlNanoFTPCtxtPtr;
static int initialized = 0; static int initialized = 0;
@ -131,8 +130,6 @@ xmlNanoFTPInit(void) {
return; return;
#endif #endif
gethostname(hostname, sizeof(hostname));
proxyPort = 21; proxyPort = 21;
env = getenv("no_proxy"); env = getenv("no_proxy");
if (env != NULL) if (env != NULL)
@ -177,7 +174,6 @@ xmlNanoFTPCleanup(void) {
xmlFree(proxyPasswd); xmlFree(proxyPasswd);
proxyPasswd = NULL; proxyPasswd = NULL;
} }
hostname[0] = 0;
#ifdef _WINSOCKAPI_ #ifdef _WINSOCKAPI_
if (initialized) if (initialized)
WSACleanup(); WSACleanup();
@ -480,6 +476,7 @@ xmlNanoFTPNewCtxt(const char *URL) {
ret->returnValue = 0; ret->returnValue = 0;
ret->controlBufIndex = 0; ret->controlBufIndex = 0;
ret->controlBufUsed = 0; ret->controlBufUsed = 0;
gethostname(ret->localhostname, sizeof(ret->localhostname));
if (URL != NULL) if (URL != NULL)
xmlNanoFTPScanURL(ret, URL); xmlNanoFTPScanURL(ret, URL);
@ -778,7 +775,7 @@ xmlNanoFTPSendPasswd(void *ctx) {
int res; int res;
if (ctxt->passwd == NULL) 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 else
snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
buf[sizeof(buf) - 1] = 0; buf[sizeof(buf) - 1] = 0;
@ -951,7 +948,7 @@ xmlNanoFTPConnect(void *ctx) {
snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd); snprintf(buf, sizeof(buf), "PASS %s\r\n", proxyPasswd);
else else
snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n", snprintf(buf, sizeof(buf), "PASS libxml@%s\r\n",
hostname); ctxt->localhostname);
buf[sizeof(buf) - 1] = 0; buf[sizeof(buf) - 1] = 0;
len = strlen(buf); len = strlen(buf);
#ifdef DEBUG_FTP #ifdef DEBUG_FTP
@ -1040,7 +1037,8 @@ xmlNanoFTPConnect(void *ctx) {
return(0); return(0);
} }
if (ctxt->passwd == NULL) 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 else
snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd); snprintf(buf, sizeof(buf), "PASS %s\r\n", ctxt->passwd);
buf[sizeof(buf) - 1] = 0; buf[sizeof(buf) - 1] = 0;

View File

@ -86,7 +86,7 @@ int xmlParserDebugEntities = 0;
* List of XML prefixed PI allowed by W3C specs * List of XML prefixed PI allowed by W3C specs
*/ */
const char *xmlW3CPIs[] = { static const char *xmlW3CPIs[] = {
"xml-stylesheet", "xml-stylesheet",
NULL NULL
}; };
@ -1187,7 +1187,7 @@ xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len) {
return 0; return 0;
} }
static xmlChar casemap[256] = { static const xmlChar casemap[256] = {
0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,
0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,
0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,

View File

@ -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 * debug/maintin than a generic NFA -> DFA state based algo. The
* only restriction is on the deepness of the tree limited by the * only restriction is on the deepness of the tree limited by the
* size of the occurs bitfield * size of the occurs bitfield
@ -81,7 +81,7 @@ scope type name##VPop(xmlValidCtxtPtr ctxt) { \
#define ROLLBACK_OR 0 #define ROLLBACK_OR 0
#define ROLLBACK_PARENT 1 #define ROLLBACK_PARENT 1
struct _xmlValidState { typedef struct _xmlValidState {
xmlElementContentPtr cont; /* pointer to the content model subtree */ xmlElementContentPtr cont; /* pointer to the content model subtree */
xmlNodePtr node; /* pointer to the current node in the list */ xmlNodePtr node; /* pointer to the current node in the list */
long occurs;/* bitfield for multiple occurences */ long occurs;/* bitfield for multiple occurences */

View File

@ -94,9 +94,9 @@ typedef struct memnod {
static unsigned long debugMemSize = 0; static unsigned long debugMemSize = 0;
static unsigned long debugMaxMemSize = 0; static unsigned long debugMaxMemSize = 0;
static int block=0; static int block=0;
int xmlMemStopAtBlock = 0; static int xmlMemStopAtBlock = 0;
void *xmlMemTraceBlockAt = NULL; static void *xmlMemTraceBlockAt = NULL;
int xmlMemInitialized = 0; static int xmlMemInitialized = 0;
#ifdef MEM_LIST #ifdef MEM_LIST
static MEMHDR *memlist = NULL; static MEMHDR *memlist = NULL;
#endif #endif
@ -625,7 +625,7 @@ void debugmem_tag_error(void *p)
#endif #endif
} }
FILE *xmlMemoryDumpFile = NULL; static FILE *xmlMemoryDumpFile = NULL;
/** /**

View File

@ -1176,7 +1176,7 @@ xmlXPathFormatNumber(double number, char buffer[], int buffersize)
************************************************************************/ ************************************************************************/
const char *xmlXPathErrorMessages[] = { static const char *xmlXPathErrorMessages[] = {
"Ok", "Ok",
"Number encoding", "Number encoding",
"Unfinished litteral", "Unfinished litteral",
@ -3830,7 +3830,6 @@ xmlXPathCompareNodeSetValue(xmlXPathParserContextPtr ctxt, int inf, int strict,
return(xmlXPathCompareValues(ctxt, inf, strict)); return(xmlXPathCompareValues(ctxt, inf, strict));
default: default:
TODO TODO
return(0);
} }
return(0); return(0);
} }
@ -9280,7 +9279,6 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
"xmlXPathRunEval: function %s not found\n", "xmlXPathRunEval: function %s not found\n",
op->value4); op->value4);
XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR); XP_ERROR0(XPATH_UNKNOWN_FUNC_ERROR);
return (total);
} }
op->cache = (void *) func; op->cache = (void *) func;
op->cacheURI = (void *) URI; op->cacheURI = (void *) URI;

View File

@ -2027,7 +2027,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
xmlXPtrGetArity(node))); xmlXPtrGetArity(node)));
} }
default: default:
return(NULL); break;
} }
return(NULL); return(NULL);
} }
@ -2064,7 +2064,7 @@ xmlXPtrInsideRange(xmlXPathParserContextPtr ctxt, xmlXPathObjectPtr loc) {
xmlXPtrGetArity(node))); xmlXPtrGetArity(node)));
} }
default: default:
return(NULL); break;
} }
return(NULL); return(NULL);
} }
@ -2629,7 +2629,7 @@ xmlXPtrGetStartPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
*indx = obj->index; *indx = obj->index;
return(0); return(0);
default: default:
return(-1); break;
} }
return(-1); return(-1);
} }
@ -2665,7 +2665,7 @@ xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) {
*indx = obj->index; *indx = obj->index;
return(0); return(0);
default: default:
return(-1); break;
} }
return(-1); return(-1);
} }