MCPcopy Create free account
hub / github.com/Kitware/CMake / doContent

Function doContent

Utilities/cmexpat/lib/xmlparse.c:3306–3786  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3304}
3305
3306static enum XML_Error
3307doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc,
3308 const char *s, const char *end, const char **nextPtr,
3309 XML_Bool haveMore, enum XML_Account account) {
3310 /* save one level of indirection */
3311 DTD *const dtd = parser->m_dtd;
3312
3313 const char **eventPP;
3314 const char **eventEndPP;
3315 if (enc == parser->m_encoding) {
3316 eventPP = &parser->m_eventPtr;
3317 eventEndPP = &parser->m_eventEndPtr;
3318 } else {
3319 eventPP = &(parser->m_openInternalEntities->internalEventPtr);
3320 eventEndPP = &(parser->m_openInternalEntities->internalEventEndPtr);
3321 }
3322 *eventPP = s;
3323
3324 for (;;) {
3325 const char *next = s; /* XmlContentTok doesn't always set the last arg */
3326 int tok = XmlContentTok(enc, s, end, &next);
3327#if XML_GE == 1
3328 const char *accountAfter
3329 = ((tok == XML_TOK_TRAILING_RSQB) || (tok == XML_TOK_TRAILING_CR))
3330 ? (haveMore ? s /* i.e. 0 bytes */ : end)
3331 : next;
3332 if (! accountingDiffTolerated(parser, tok, s, accountAfter, __LINE__,
3333 account)) {
3334 accountingOnAbort(parser);
3335 return XML_ERROR_AMPLIFICATION_LIMIT_BREACH;
3336 }
3337#endif
3338 *eventEndPP = next;
3339 switch (tok) {
3340 case XML_TOK_TRAILING_CR:
3341 if (haveMore) {
3342 *nextPtr = s;
3343 return XML_ERROR_NONE;
3344 }
3345 *eventEndPP = end;
3346 if (parser->m_characterDataHandler) {
3347 XML_Char c = 0xA;
3348 parser->m_characterDataHandler(parser->m_handlerArg, &c, 1);
3349 } else if (parser->m_defaultHandler)
3350 reportDefault(parser, enc, s, end);
3351 /* We are at the end of the final buffer, should we check for
3352 XML_SUSPENDED, XML_FINISHED?
3353 */
3354 if (startTagLevel == 0)
3355 return XML_ERROR_NO_ELEMENTS;
3356 if (parser->m_tagLevel != startTagLevel)
3357 return XML_ERROR_ASYNC_ENTITY;
3358 *nextPtr = end;
3359 return XML_ERROR_NONE;
3360 case XML_TOK_NONE:
3361 if (haveMore) {
3362 *nextPtr = s;
3363 return XML_ERROR_NONE;

Callers 3

contentProcessorFunction · 0.85
internalEntityProcessorFunction · 0.85

Calls 14

accountingDiffToleratedFunction · 0.85
accountingOnAbortFunction · 0.85
reportDefaultFunction · 0.85
poolStoreStringFunction · 0.85
processEntityFunction · 0.85
getContextFunction · 0.85
storeAttsFunction · 0.85
poolClearFunction · 0.85
freeBindingsFunction · 0.85
epilogProcessorFunction · 0.85
doCdataSectionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…