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

Function xmlVRaiseError

ThirdParty/libxml2/vtklibxml2/error.c:687–746  ·  view source on GitHub ↗

* xmlVRaiseError: * @schannel: the structured callback channel * @channel: the old callback channel * @data: the callback data * @ctx: the parser context or NULL * @node: the current node or NULL * @domain: the domain for the error * @code: the code for the error * @level: the xmlErrorLevel for the error * @file: the file source of the error (or NULL) * @line: the line of the error or 0

Source from the content-addressed store, hash-verified

685 * Returns 0 on success, -1 if a memory allocation failed.
686 */
687int
688xmlVRaiseError(xmlStructuredErrorFunc schannel,
689 xmlGenericErrorFunc channel, void *data, void *ctx,
690 xmlNode *node, int domain, int code, xmlErrorLevel level,
691 const char *file, int line, const char *str1,
692 const char *str2, const char *str3, int int1, int col,
693 const char *msg, va_list ap)
694{
695 xmlParserCtxtPtr ctxt = NULL;
696 /* xmlLastError is a macro retrieving the per-thread global. */
697 xmlErrorPtr lastError = &xmlLastError;
698 xmlErrorPtr to = lastError;
699
700 if (code == XML_ERR_OK)
701 return(0);
702#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
703 if (code == XML_ERR_INTERNAL_ERROR) {
704 fprintf(stderr, "Unexpected error: %d\n", code);
705 abort();
706 }
707#endif
708 if ((xmlGetWarningsDefaultValue == 0) && (level == XML_ERR_WARNING))
709 return(0);
710
711 if ((domain == XML_FROM_PARSER) || (domain == XML_FROM_HTML) ||
712 (domain == XML_FROM_DTD) || (domain == XML_FROM_NAMESPACE) ||
713 (domain == XML_FROM_IO) || (domain == XML_FROM_VALID)) {
714 ctxt = (xmlParserCtxtPtr) ctx;
715
716 if (ctxt != NULL)
717 to = &ctxt->lastError;
718 }
719
720 if (xmlVUpdateError(to, ctxt, node, domain, code, level, file, line,
721 str1, str2, str3, int1, col, msg, ap))
722 return(-1);
723
724 if (to != lastError) {
725 if (xmlCopyError(to, lastError) < 0)
726 return(-1);
727 }
728
729 if (schannel != NULL) {
730 schannel(data, to);
731 } else if (xmlStructuredError != NULL) {
732 xmlStructuredError(xmlStructuredErrorContext, to);
733 } else if (channel != NULL) {
734 /* Don't invoke legacy error handlers */
735 if ((channel == xmlGenericErrorDefaultFunc) ||
736 (channel == xmlParserError) ||
737 (channel == xmlParserWarning) ||
738 (channel == xmlParserValidityError) ||
739 (channel == xmlParserValidityWarning))
740 xmlFormatError(to, xmlGenericError, xmlGenericErrorContext);
741 else
742 channel(data, "%s", to->message);
743 }
744

Callers 5

xmlC14NErrFullFunction · 0.85
xmlDoErrValidFunction · 0.85
__xmlRaiseErrorFunction · 0.85
xmlCtxtVErrFunction · 0.85
xmlschemas.cFile · 0.85

Calls 4

fprintfFunction · 0.85
xmlVUpdateErrorFunction · 0.85
xmlCopyErrorFunction · 0.85
xmlFormatErrorFunction · 0.85

Tested by

no test coverage detected