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

Function xmlTextWriterEndCDATA

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:2686–2719  ·  view source on GitHub ↗

* xmlTextWriterEndCDATA: * @writer: the xmlTextWriterPtr * * End an xml CDATA section. * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */

Source from the content-addressed store, hash-verified

2684 * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
2685 */
2686int
2687xmlTextWriterEndCDATA(xmlTextWriterPtr writer)
2688{
2689 int count;
2690 int sum;
2691 xmlLinkPtr lk;
2692 xmlTextWriterStackEntry *p;
2693
2694 if (writer == NULL)
2695 return -1;
2696
2697 lk = xmlListFront(writer->nodes);
2698 if (lk == 0)
2699 return -1;
2700
2701 p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk);
2702 if (p == 0)
2703 return -1;
2704
2705 sum = 0;
2706 switch (p->state) {
2707 case XML_TEXTWRITER_CDATA:
2708 count = xmlOutputBufferWriteString(writer->out, "]]>");
2709 if (count < 0)
2710 return -1;
2711 sum += count;
2712 break;
2713 default:
2714 return -1;
2715 }
2716
2717 xmlListPopFront(writer->nodes);
2718 return sum;
2719}
2720
2721/**
2722 * xmlTextWriterWriteFormatCDATA:

Callers 2

xmlTextWriterEndDocumentFunction · 0.85
xmlTextWriterWriteCDATAFunction · 0.85

Calls 4

xmlListFrontFunction · 0.85
xmlLinkGetDataFunction · 0.85
xmlListPopFrontFunction · 0.85

Tested by

no test coverage detected