MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPtrGetLastChar

Function xmlXPtrGetLastChar

ThirdParty/libxml2/vtklibxml2/xpointer.c:2531–2565  ·  view source on GitHub ↗

* xmlXPtrGetLastChar: * @node: the node * @index: the index * * Computes the point coordinates of the last char of this point * * Returns -1 in case of failure, 0 otherwise */

Source from the content-addressed store, hash-verified

2529 * Returns -1 in case of failure, 0 otherwise
2530 */
2531static int
2532xmlXPtrGetLastChar(xmlNodePtr *node, int *indx) {
2533 xmlNodePtr cur;
2534 int pos, len = 0;
2535
2536 if ((node == NULL) || (*node == NULL) ||
2537 ((*node)->type == XML_NAMESPACE_DECL) || (indx == NULL))
2538 return(-1);
2539 cur = *node;
2540 pos = *indx;
2541
2542 if ((cur->type == XML_ELEMENT_NODE) ||
2543 (cur->type == XML_DOCUMENT_NODE) ||
2544 (cur->type == XML_HTML_DOCUMENT_NODE)) {
2545 if (pos > 0) {
2546 cur = xmlXPtrGetNthChild(cur, pos);
2547 }
2548 }
2549 while (cur != NULL) {
2550 if (cur->last != NULL)
2551 cur = cur->last;
2552 else if ((cur->type != XML_ELEMENT_NODE) &&
2553 (cur->content != NULL)) {
2554 len = xmlStrlen(cur->content);
2555 break;
2556 } else {
2557 return(-1);
2558 }
2559 }
2560 if (cur == NULL)
2561 return(-1);
2562 *node = cur;
2563 *indx = len;
2564 return(0);
2565}
2566
2567/**
2568 * xmlXPtrGetStartPoint:

Callers 1

Calls 2

xmlXPtrGetNthChildFunction · 0.85
xmlStrlenFunction · 0.85

Tested by

no test coverage detected