Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/libxml/src/xpointer.c

Issue 2792873002: Roll libxml to e905f08123e4a6e7731549e6f09dadff4cab65bd (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/libxml/src/xpath.c ('k') | third_party/libxml/win32/xmlversion.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * xpointer.c : Code to handle XML Pointer 2 * xpointer.c : Code to handle XML Pointer
3 * 3 *
4 * Base implementation was made accordingly to 4 * Base implementation was made accordingly to
5 * W3C Candidate Recommendation 7 June 2000 5 * W3C Candidate Recommendation 7 June 2000
6 * http://www.w3.org/TR/2000/CR-xptr-20000607 6 * http://www.w3.org/TR/2000/CR-xptr-20000607
7 * 7 *
8 * Added support for the element() scheme described in: 8 * Added support for the element() scheme described in:
9 * W3C Proposed Recommendation 13 November 2002 9 * W3C Proposed Recommendation 13 November 2002
10 * http://www.w3.org/TR/2002/PR-xptr-element-20021113/ 10 * http://www.w3.org/TR/2002/PR-xptr-element-20021113/
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 endIndex = end->index; 535 endIndex = end->index;
536 break; 536 break;
537 case XPATH_RANGE: 537 case XPATH_RANGE:
538 endNode = end->user2; 538 endNode = end->user2;
539 endIndex = end->index2; 539 endIndex = end->index2;
540 break; 540 break;
541 case XPATH_NODESET: 541 case XPATH_NODESET:
542 /* 542 /*
543 * Empty set ... 543 * Empty set ...
544 */ 544 */
545 » if (end->nodesetval->nodeNr <= 0) 545 » if ((end->nodesetval == NULL) || (end->nodesetval->nodeNr <= 0))
546 return(NULL); 546 return(NULL);
547 endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1]; 547 endNode = end->nodesetval->nodeTab[end->nodesetval->nodeNr - 1];
548 endIndex = -1; 548 endIndex = -1;
549 break; 549 break;
550 default: 550 default:
551 /* TODO */ 551 /* TODO */
552 return(NULL); 552 return(NULL);
553 } 553 }
554 554
555 ret = xmlXPtrNewRangeInternal(start, -1, endNode, endIndex); 555 ret = xmlXPtrNewRangeInternal(start, -1, endNode, endIndex);
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 do { 1354 do {
1355 tmp = valuePop(ctxt); 1355 tmp = valuePop(ctxt);
1356 if (tmp != NULL) { 1356 if (tmp != NULL) {
1357 if (tmp != init) { 1357 if (tmp != init) {
1358 if (tmp->type == XPATH_NODESET) { 1358 if (tmp->type == XPATH_NODESET) {
1359 /* 1359 /*
1360 * Evaluation may push a root nodeset which is unused 1360 * Evaluation may push a root nodeset which is unused
1361 */ 1361 */
1362 xmlNodeSetPtr set; 1362 xmlNodeSetPtr set;
1363 set = tmp->nodesetval; 1363 set = tmp->nodesetval;
1364 » » if ((set->nodeNr != 1) || 1364 » » if ((set == NULL) || (set->nodeNr != 1) ||
1365 (set->nodeTab[0] != (xmlNodePtr) ctx->doc)) 1365 (set->nodeTab[0] != (xmlNodePtr) ctx->doc))
1366 stack++; 1366 stack++;
1367 } else 1367 } else
1368 stack++; 1368 stack++;
1369 } 1369 }
1370 xmlXPathFreeObject(tmp); 1370 xmlXPathFreeObject(tmp);
1371 } 1371 }
1372 } while (tmp != NULL); 1372 } while (tmp != NULL);
1373 if (stack != 0) { 1373 if (stack != 0) {
1374 xmlXPtrErr(ctxt, XML_XPTR_EXTRA_OBJECTS, 1374 xmlXPtrErr(ctxt, XML_XPTR_EXTRA_OBJECTS,
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 if (tmp == NULL) 1789 if (tmp == NULL)
1790 continue; 1790 continue;
1791 point = NULL; 1791 point = NULL;
1792 switch (tmp->type) { 1792 switch (tmp->type) {
1793 case XPATH_POINT: 1793 case XPATH_POINT:
1794 point = xmlXPtrNewPoint(tmp->user, tmp->index); 1794 point = xmlXPtrNewPoint(tmp->user, tmp->index);
1795 break; 1795 break;
1796 case XPATH_RANGE: { 1796 case XPATH_RANGE: {
1797 xmlNodePtr node = tmp->user; 1797 xmlNodePtr node = tmp->user;
1798 if (node != NULL) { 1798 if (node != NULL) {
1799 » » » if (node->type == XML_ATTRIBUTE_NODE) { 1799 » » » if ((node->type == XML_ATTRIBUTE_NODE) ||
1800 » » » /* TODO: Namespace Nodes ??? */ 1800 (node->type == XML_NAMESPACE_DECL)) {
1801 xmlXPathFreeObject(obj); 1801 xmlXPathFreeObject(obj);
1802 xmlXPtrFreeLocationSet(newset); 1802 xmlXPtrFreeLocationSet(newset);
1803 XP_ERROR(XPTR_SYNTAX_ERROR); 1803 XP_ERROR(XPTR_SYNTAX_ERROR);
1804 } 1804 }
1805 point = xmlXPtrNewPoint(node, tmp->index); 1805 point = xmlXPtrNewPoint(node, tmp->index);
1806 } 1806 }
1807 break; 1807 break;
1808 } 1808 }
1809 default: 1809 default:
1810 /*** Should we raise an error ? 1810 /*** Should we raise an error ?
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1885 if (tmp == NULL) 1885 if (tmp == NULL)
1886 continue; 1886 continue;
1887 point = NULL; 1887 point = NULL;
1888 switch (tmp->type) { 1888 switch (tmp->type) {
1889 case XPATH_POINT: 1889 case XPATH_POINT:
1890 point = xmlXPtrNewPoint(tmp->user, tmp->index); 1890 point = xmlXPtrNewPoint(tmp->user, tmp->index);
1891 break; 1891 break;
1892 case XPATH_RANGE: { 1892 case XPATH_RANGE: {
1893 xmlNodePtr node = tmp->user2; 1893 xmlNodePtr node = tmp->user2;
1894 if (node != NULL) { 1894 if (node != NULL) {
1895 » » » if (node->type == XML_ATTRIBUTE_NODE) { 1895 » » » if ((node->type == XML_ATTRIBUTE_NODE) ||
1896 » » » /* TODO: Namespace Nodes ??? */ 1896 (node->type == XML_NAMESPACE_DECL)) {
1897 xmlXPathFreeObject(obj); 1897 xmlXPathFreeObject(obj);
1898 xmlXPtrFreeLocationSet(newset); 1898 xmlXPtrFreeLocationSet(newset);
1899 XP_ERROR(XPTR_SYNTAX_ERROR); 1899 XP_ERROR(XPTR_SYNTAX_ERROR);
1900 } 1900 }
1901 point = xmlXPtrNewPoint(node, tmp->index2); 1901 point = xmlXPtrNewPoint(node, tmp->index2);
1902 } else if (tmp->user == NULL) { 1902 } else if (tmp->user == NULL) {
1903 point = xmlXPtrNewPoint(node, 1903 point = xmlXPtrNewPoint(node,
1904 xmlXPtrNbLocChildren(node)); 1904 xmlXPtrNbLocChildren(node));
1905 } 1905 }
1906 break; 1906 break;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 oldset = (xmlLocationSetPtr) set->user; 2027 oldset = (xmlLocationSetPtr) set->user;
2028 2028
2029 /* 2029 /*
2030 * The loop is to compute the covering range for each item and add it 2030 * The loop is to compute the covering range for each item and add it
2031 */ 2031 */
2032 newset = xmlXPtrLocationSetCreate(NULL); 2032 newset = xmlXPtrLocationSetCreate(NULL);
2033 if (newset == NULL) { 2033 if (newset == NULL) {
2034 xmlXPathFreeObject(set); 2034 xmlXPathFreeObject(set);
2035 XP_ERROR(XPATH_MEMORY_ERROR); 2035 XP_ERROR(XPATH_MEMORY_ERROR);
2036 } 2036 }
2037 for (i = 0;i < oldset->locNr;i++) { 2037 if (oldset != NULL) {
2038 » xmlXPtrLocationSetAdd(newset, 2038 for (i = 0;i < oldset->locNr;i++) {
2039 » » xmlXPtrCoveringRange(ctxt, oldset->locTab[i])); 2039 xmlXPtrLocationSetAdd(newset,
2040 xmlXPtrCoveringRange(ctxt, oldset->locTab[i]));
2041 }
2040 } 2042 }
2041 2043
2042 /* 2044 /*
2043 * Save the new value and cleanup 2045 * Save the new value and cleanup
2044 */ 2046 */
2045 valuePush(ctxt, xmlXPtrWrapLocationSet(newset)); 2047 valuePush(ctxt, xmlXPtrWrapLocationSet(newset));
2046 xmlXPathFreeObject(set); 2048 xmlXPathFreeObject(set);
2047 } 2049 }
2048 2050
2049 /** 2051 /**
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
2921 } 2923 }
2922 2924
2923 NEXT; 2925 NEXT;
2924 SKIP_BLANKS; 2926 SKIP_BLANKS;
2925 } 2927 }
2926 2928
2927 #define bottom_xpointer 2929 #define bottom_xpointer
2928 #include "elfgcchack.h" 2930 #include "elfgcchack.h"
2929 #endif 2931 #endif
2930 2932
OLDNEW
« no previous file with comments | « third_party/libxml/src/xpath.c ('k') | third_party/libxml/win32/xmlversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698