mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2024-12-27 03:21:26 +03:00
some warning removal on Igor's patch seems I messed up with #106788 fix
* uri.c parser.c: some warning removal on Igor's patch * tree.c: seems I messed up with #106788 fix * python/libxml.c: fixed some base problems when Python provides the resolver. * relaxng.c: fixed the interleave algorithm found 373 test schemas: 364 success 9 failures found 529 test instances: 525 success 4 failures the resulting failures are bug in the algorithm from 7.3 and lack of support for params Daniel
This commit is contained in:
parent
0046c0fec2
commit
c64b8e984c
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
Mon Feb 24 12:41:54 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* uri.c parser.c: some warning removal on Igor's patch
|
||||||
|
* tree.c: seems I messed up with #106788 fix
|
||||||
|
* python/libxml.c: fixed some base problems when Python provides
|
||||||
|
the resolver.
|
||||||
|
* relaxng.c: fixed the interleave algorithm
|
||||||
|
found 373 test schemas: 364 success 9 failures
|
||||||
|
found 529 test instances: 525 success 4 failures
|
||||||
|
the resulting failures are bug in the algorithm from 7.3 and
|
||||||
|
lack of support for params
|
||||||
|
|
||||||
Sun Feb 23 14:49:39 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Sun Feb 23 14:49:39 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* parser.c: another fix for nodeinfo in entities problem
|
* parser.c: another fix for nodeinfo in entities problem
|
||||||
|
2
parser.c
2
parser.c
@ -10356,7 +10356,7 @@ xmlCreateFileParserCtxt(const char *filename)
|
|||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
canonicFilename = xmlCanonicPath(filename);
|
canonicFilename = (char *) xmlCanonicPath((const xmlChar *) filename);
|
||||||
if (canonicFilename == NULL) {
|
if (canonicFilename == NULL) {
|
||||||
if (xmlDefaultSAXHandler.error != NULL) {
|
if (xmlDefaultSAXHandler.error != NULL) {
|
||||||
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
|
xmlDefaultSAXHandler.error(NULL, "out of memory\n");
|
||||||
|
@ -463,6 +463,9 @@ pythonExternalEntityLoader(const char *URL, const char *ID,
|
|||||||
}
|
}
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
Py_DECREF(ret);
|
Py_DECREF(ret);
|
||||||
|
} else if (URL != NULL) {
|
||||||
|
result->filename = xmlStrdup(URL);
|
||||||
|
result->directory = xmlParserGetDirectory((const char *) URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
184
relaxng.c
184
relaxng.c
@ -6452,14 +6452,16 @@ xmlRelaxNGValidatePartGroup(xmlRelaxNGValidCtxtPtr ctxt,
|
|||||||
static int
|
static int
|
||||||
xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
|
xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
|
||||||
xmlRelaxNGDefinePtr define) {
|
xmlRelaxNGDefinePtr define) {
|
||||||
int ret = 0, nbchildren, nbtot, i, j;
|
int ret = 0, i, nbgroups, left;
|
||||||
xmlRelaxNGPartitionPtr partitions;
|
xmlRelaxNGPartitionPtr partitions;
|
||||||
xmlNodePtr *children = NULL;
|
xmlRelaxNGInterleaveGroupPtr group = NULL;
|
||||||
xmlNodePtr *order = NULL;
|
xmlNodePtr cur, start, last, lastchg = NULL, lastelem;
|
||||||
xmlNodePtr cur, oldseq;
|
xmlNodePtr *list = NULL, *lasts = NULL;
|
||||||
|
|
||||||
if (define->data != NULL) {
|
if (define->data != NULL) {
|
||||||
partitions = (xmlRelaxNGPartitionPtr) define->data;
|
partitions = (xmlRelaxNGPartitionPtr) define->data;
|
||||||
|
nbgroups = partitions->nbgroups;
|
||||||
|
left = nbgroups;
|
||||||
} else {
|
} else {
|
||||||
VALID_CTXT();
|
VALID_CTXT();
|
||||||
VALID_ERROR("Internal: interleave block has no data\n");
|
VALID_ERROR("Internal: interleave block has no data\n");
|
||||||
@ -6467,91 +6469,111 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Build the sequence of child and an array preserving the children
|
* Build arrays to store the first and last node of the chain
|
||||||
* initial order.
|
* pertaining to each group
|
||||||
*/
|
*/
|
||||||
cur = ctxt->state->seq;
|
list = (xmlNodePtr *) xmlMalloc(nbgroups * sizeof(xmlNodePtr));
|
||||||
oldseq = ctxt->state->seq;
|
if (list == NULL) {
|
||||||
nbchildren = 0;
|
VALID_CTXT();
|
||||||
nbtot = 0;
|
VALID_ERROR("Internal: out of memory in interleave check\n");
|
||||||
while (cur != NULL) {
|
return(-1);
|
||||||
if ((cur->type == XML_COMMENT_NODE) ||
|
|
||||||
(cur->type == XML_PI_NODE) ||
|
|
||||||
((cur->type == XML_TEXT_NODE) &&
|
|
||||||
(IS_BLANK_NODE(cur)))) {
|
|
||||||
nbtot++;
|
|
||||||
} else {
|
|
||||||
nbchildren++;
|
|
||||||
nbtot++;
|
|
||||||
}
|
}
|
||||||
cur = cur->next;
|
memset(list, 0, nbgroups * sizeof(xmlNodePtr));
|
||||||
|
lasts = (xmlNodePtr *) xmlMalloc(nbgroups * sizeof(xmlNodePtr));
|
||||||
|
if (lasts == NULL) {
|
||||||
|
VALID_CTXT();
|
||||||
|
VALID_ERROR("Internal: out of memory in interleave check\n");
|
||||||
|
return(-1);
|
||||||
}
|
}
|
||||||
children = (xmlNodePtr *) xmlMalloc(nbchildren * sizeof(xmlNodePtr));
|
memset(lasts, 0, nbgroups * sizeof(xmlNodePtr));
|
||||||
if (children == NULL)
|
|
||||||
goto error;
|
|
||||||
order = (xmlNodePtr *) xmlMalloc(nbtot * sizeof(xmlNodePtr));
|
|
||||||
if (order == NULL)
|
|
||||||
goto error;
|
|
||||||
cur = ctxt->state->seq;
|
|
||||||
i = 0;
|
|
||||||
j = 0;
|
|
||||||
while (cur != NULL) {
|
|
||||||
if ((cur->type == XML_COMMENT_NODE) ||
|
|
||||||
(cur->type == XML_PI_NODE) ||
|
|
||||||
((cur->type == XML_TEXT_NODE) &&
|
|
||||||
(IS_BLANK_NODE(cur)))) {
|
|
||||||
order[j++] = cur;
|
|
||||||
} else {
|
|
||||||
order[j++] = cur;
|
|
||||||
children[i++] = cur;
|
|
||||||
}
|
|
||||||
cur = cur->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: retry with a maller set of child if there is a next... */
|
|
||||||
ret = xmlRelaxNGValidatePartGroup(ctxt, partitions->groups,
|
|
||||||
partitions->nbgroups, children, nbchildren);
|
|
||||||
if (ret != 0)
|
|
||||||
ctxt->state->seq = oldseq;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Cleanup: rebuid the child sequence and free the structure
|
* Walk the sequence of children finding the right group and
|
||||||
|
* sorting them in sequences.
|
||||||
*/
|
*/
|
||||||
if (order != NULL) {
|
cur = ctxt->state->seq;
|
||||||
for (i = 0;i < nbtot;i++) {
|
cur = xmlRelaxNGSkipIgnored(ctxt, cur);
|
||||||
if (i == 0)
|
start = cur;
|
||||||
order[i]->prev = NULL;
|
while (cur != NULL) {
|
||||||
else
|
ctxt->state->seq = cur;
|
||||||
order[i]->prev = order[i - 1];
|
for (i = 0;i < nbgroups;i++) {
|
||||||
if (i == nbtot - 1)
|
group = partitions->groups[i];
|
||||||
order[i]->next = NULL;
|
if (group == NULL)
|
||||||
else
|
continue;
|
||||||
order[i]->next = order[i + 1];
|
if (xmlRelaxNGNodeMatchesList(cur, group->defs))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
xmlFree(order);
|
/*
|
||||||
|
* We break as soon as an element not matched is found
|
||||||
|
*/
|
||||||
|
if (i >= nbgroups) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (lasts[i] != NULL) {
|
||||||
|
lasts[i]->next = cur;
|
||||||
|
lasts[i] = cur;
|
||||||
|
} else {
|
||||||
|
list[i] = cur;
|
||||||
|
lasts[i] = cur;
|
||||||
|
}
|
||||||
|
if (cur->next != NULL)
|
||||||
|
lastchg = cur->next;
|
||||||
|
else
|
||||||
|
lastchg = cur;
|
||||||
|
cur = xmlRelaxNGSkipIgnored(ctxt, cur->next);
|
||||||
|
}
|
||||||
|
if (ret != 0) {
|
||||||
|
VALID_CTXT();
|
||||||
|
VALID_ERROR("Invalid sequence in interleave\n");
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
lastelem = cur;
|
||||||
|
for (i = 0;i < nbgroups;i++) {
|
||||||
|
group = partitions->groups[i];
|
||||||
|
if (lasts[i] != NULL) {
|
||||||
|
last = lasts[i]->next;
|
||||||
|
lasts[i]->next = NULL;
|
||||||
|
}
|
||||||
|
ctxt->state->seq = list[i];
|
||||||
|
ret = xmlRelaxNGValidateDefinition(ctxt, group->rule);
|
||||||
|
if (ret != 0)
|
||||||
|
break;
|
||||||
|
cur = ctxt->state->seq;
|
||||||
|
cur = xmlRelaxNGSkipIgnored(ctxt, cur);
|
||||||
|
if (cur != NULL) {
|
||||||
|
VALID_CTXT();
|
||||||
|
VALID_ERROR2("Extra element %s in interleave\n", cur->name);
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (lasts[i] != NULL) {
|
||||||
|
lasts[i]->next = last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctxt->state->seq = lastelem;
|
||||||
|
if (ret != 0) {
|
||||||
|
VALID_CTXT();
|
||||||
|
VALID_ERROR("Invalid sequence in interleave\n");
|
||||||
|
ret = -1;
|
||||||
|
goto done;
|
||||||
}
|
}
|
||||||
if (children != NULL)
|
|
||||||
xmlFree(children);
|
|
||||||
|
|
||||||
|
done:
|
||||||
|
/*
|
||||||
|
* builds the next links chain from the prev one
|
||||||
|
*/
|
||||||
|
cur = lastchg;
|
||||||
|
while (cur != NULL) {
|
||||||
|
if ((cur == start) || (cur->prev == NULL))
|
||||||
|
break;
|
||||||
|
cur->prev->next = cur;
|
||||||
|
cur = cur->prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlFree(list);
|
||||||
|
xmlFree(lasts);
|
||||||
return(ret);
|
return(ret);
|
||||||
|
|
||||||
error:
|
|
||||||
if (order != NULL) {
|
|
||||||
for (i = 0;i < nbtot;i++) {
|
|
||||||
if (i == 0)
|
|
||||||
order[i]->prev = NULL;
|
|
||||||
else
|
|
||||||
order[i]->prev = order[i - 1];
|
|
||||||
if (i == nbtot - 1)
|
|
||||||
order[i]->next = NULL;
|
|
||||||
else
|
|
||||||
order[i]->next = order[i + 1];
|
|
||||||
}
|
|
||||||
xmlFree(order);
|
|
||||||
}
|
|
||||||
if (children != NULL)
|
|
||||||
xmlFree(children);
|
|
||||||
return(-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -6776,8 +6798,10 @@ xmlRelaxNGValidateDefinition(xmlRelaxNGValidCtxtPtr ctxt,
|
|||||||
* This node was already validated successfully against
|
* This node was already validated successfully against
|
||||||
* this definition.
|
* this definition.
|
||||||
*/
|
*/
|
||||||
if (node->_private == define)
|
if (node->_private == define) {
|
||||||
|
ctxt->state->seq = xmlRelaxNGSkipIgnored(ctxt, node->next);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ret = xmlRelaxNGElementMatch(ctxt, define, node);
|
ret = xmlRelaxNGElementMatch(ctxt, define, node);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
|
4
tree.c
4
tree.c
@ -6457,13 +6457,13 @@ xmlAttrSerializeContent(xmlBufferPtr buf, xmlDocPtr doc, xmlAttrPtr attr)
|
|||||||
} else if (*cur == '\r') {
|
} else if (*cur == '\r') {
|
||||||
if (base != cur)
|
if (base != cur)
|
||||||
xmlBufferAdd(buf, base, cur - base);
|
xmlBufferAdd(buf, base, cur - base);
|
||||||
xmlBufferAdd(buf, BAD_CAST " ", 6);
|
xmlBufferAdd(buf, BAD_CAST " ", 5);
|
||||||
cur++;
|
cur++;
|
||||||
base = cur;
|
base = cur;
|
||||||
} else if (*cur == '\t') {
|
} else if (*cur == '\t') {
|
||||||
if (base != cur)
|
if (base != cur)
|
||||||
xmlBufferAdd(buf, base, cur - base);
|
xmlBufferAdd(buf, base, cur - base);
|
||||||
xmlBufferAdd(buf, BAD_CAST "	", 5);
|
xmlBufferAdd(buf, BAD_CAST "	", 4);
|
||||||
cur++;
|
cur++;
|
||||||
base = cur;
|
base = cur;
|
||||||
#if 0
|
#if 0
|
||||||
|
8
uri.c
8
uri.c
@ -1985,15 +1985,17 @@ done:
|
|||||||
xmlChar*
|
xmlChar*
|
||||||
xmlCanonicPath(const xmlChar *path)
|
xmlCanonicPath(const xmlChar *path)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
xmlChar *ret;
|
|
||||||
xmlChar *p = NULL;
|
xmlChar *p = NULL;
|
||||||
|
#endif
|
||||||
|
xmlChar *ret;
|
||||||
xmlURIPtr uri;
|
xmlURIPtr uri;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if ((uri = xmlParseURI(path)) != NULL) {
|
if ((uri = xmlParseURI((const char *) path)) != NULL) {
|
||||||
xmlFreeURI(uri);
|
xmlFreeURI(uri);
|
||||||
return xmlStrdup(path);
|
return xmlStrdup(path);
|
||||||
}
|
}
|
||||||
@ -2018,7 +2020,7 @@ xmlCanonicPath(const xmlChar *path)
|
|||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
uri->path = xmlStrdup(path);
|
uri->path = (char *) xmlStrdup((const char *) path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = xmlSaveUri(uri);
|
ret = xmlSaveUri(uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user