* 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 */
| 2529 | * Returns -1 in case of failure, 0 otherwise |
| 2530 | */ |
| 2531 | static int |
| 2532 | xmlXPtrGetLastChar(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: |
no test coverage detected