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

Function xmlSaveErr

ThirdParty/libxml2/vtklibxml2/xmlsave.c:79–121  ·  view source on GitHub ↗

* xmlSaveErr: * @code: the error number * @node: the location of the error. * @extra: extra information * * Handle an out of memory condition */

Source from the content-addressed store, hash-verified

77 * Handle an out of memory condition
78 */
79static void
80xmlSaveErr(xmlOutputBufferPtr out, int code, xmlNodePtr node,
81 const char *extra)
82{
83 const char *msg = NULL;
84 int res;
85
86 /* Don't overwrite memory errors */
87 if ((out != NULL) && (out->error == XML_ERR_NO_MEMORY))
88 return;
89
90 if (code == XML_ERR_NO_MEMORY) {
91 xmlSaveErrMemory(out);
92 return;
93 }
94
95 if (out != NULL)
96 out->error = code;
97
98 switch(code) {
99 case XML_SAVE_NOT_UTF8:
100 msg = "string is not in UTF-8\n";
101 break;
102 case XML_SAVE_CHAR_INVALID:
103 msg = "invalid character value\n";
104 break;
105 case XML_SAVE_UNKNOWN_ENCODING:
106 msg = "unknown encoding %s\n";
107 break;
108 case XML_SAVE_NO_DOCTYPE:
109 msg = "document has no DOCTYPE\n";
110 break;
111 default:
112 msg = "unexpected error number\n";
113 }
114
115 res = __xmlRaiseError(NULL, NULL, NULL, NULL, node,
116 XML_FROM_OUTPUT, code, XML_ERR_ERROR, NULL, 0,
117 extra, NULL, NULL, 0, 0,
118 msg, extra);
119 if (res < 0)
120 xmlSaveErrMemory(out);
121}
122
123/************************************************************************
124 * *

Callers 3

xmlNewSaveCtxtFunction · 0.85
xmlSaveSwitchEncodingFunction · 0.85

Calls 2

xmlSaveErrMemoryFunction · 0.85
__xmlRaiseErrorFunction · 0.85

Tested by

no test coverage detected