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

Function xmlSaveSwitchEncoding

ThirdParty/libxml2/vtklibxml2/xmlsave.c:796–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

794 ************************************************************************/
795
796static int xmlSaveSwitchEncoding(xmlSaveCtxtPtr ctxt, const char *encoding) {
797 xmlOutputBufferPtr buf = ctxt->buf;
798
799 if ((encoding != NULL) && (buf->encoder == NULL) && (buf->conv == NULL)) {
800 xmlCharEncodingHandler *handler;
801 int res;
802
803 res = xmlOpenCharEncodingHandler(encoding, /* output */ 1, &handler);
804 if (res != XML_ERR_OK) {
805 xmlSaveErr(buf, res, NULL, encoding);
806 return(-1);
807 }
808 buf->conv = xmlBufCreate();
809 if (buf->conv == NULL) {
810 xmlCharEncCloseFunc(handler);
811 xmlSaveErrMemory(buf);
812 return(-1);
813 }
814 buf->encoder = handler;
815 /*
816 * initialize the state, e.g. if outputting a BOM
817 */
818 xmlCharEncOutput(buf, 1);
819 }
820 return(0);
821}
822
823static int xmlSaveClearEncoding(xmlSaveCtxtPtr ctxt) {
824 xmlOutputBufferPtr buf = ctxt->buf;

Callers 2

xmlDocContentDumpOutputFunction · 0.85

Calls 6

xmlSaveErrFunction · 0.85
xmlBufCreateFunction · 0.85
xmlCharEncCloseFuncFunction · 0.85
xmlSaveErrMemoryFunction · 0.85
xmlCharEncOutputFunction · 0.85

Tested by

no test coverage detected