* 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 */
| 2684 | * Returns the bytes written (may be 0 because of buffering) or -1 in case of error |
| 2685 | */ |
| 2686 | int |
| 2687 | xmlTextWriterEndCDATA(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: |
no test coverage detected