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

Function xmlParseLookupString

ThirdParty/libxml2/vtklibxml2/parser.c:10818–10850  ·  view source on GitHub ↗

* xmlParseLookupString: * @ctxt: an XML parser context * @startDelta: delta to apply at the start * @str: string * @strLen: length of string * * Check whether the input buffer contains a string. */

Source from the content-addressed store, hash-verified

10816 * Check whether the input buffer contains a string.
10817 */
10818static const xmlChar *
10819xmlParseLookupString(xmlParserCtxtPtr ctxt, size_t startDelta,
10820 const char *str, size_t strLen) {
10821 const xmlChar *cur, *term;
10822
10823 if (ctxt->checkIndex == 0) {
10824 cur = ctxt->input->cur + startDelta;
10825 } else {
10826 cur = ctxt->input->cur + ctxt->checkIndex;
10827 }
10828
10829 term = BAD_CAST strstr((const char *) cur, str);
10830 if (term == NULL) {
10831 const xmlChar *end = ctxt->input->end;
10832 size_t index;
10833
10834 /* Rescan (strLen - 1) characters. */
10835 if ((size_t) (end - cur) < strLen)
10836 end = cur;
10837 else
10838 end -= strLen - 1;
10839 index = end - ctxt->input->cur;
10840 if (index > LONG_MAX) {
10841 ctxt->checkIndex = 0;
10842 return(ctxt->input->end - strLen);
10843 }
10844 ctxt->checkIndex = index;
10845 } else {
10846 ctxt->checkIndex = 0;
10847 }
10848
10849 return(term);
10850}
10851
10852/**
10853 * xmlParseLookupCharData:

Callers 1

parser.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected