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

Function xmlOutputBufferFlush

ThirdParty/libxml2/vtklibxml2/xmlIO.c:2832–2881  ·  view source on GitHub ↗

* xmlOutputBufferFlush: * @out: a buffered output * * flushes the output I/O channel * * Returns the number of byte written or -1 in case of error. */

Source from the content-addressed store, hash-verified

2830 * Returns the number of byte written or -1 in case of error.
2831 */
2832int
2833xmlOutputBufferFlush(xmlOutputBufferPtr out) {
2834 int nbchars = 0, ret = 0;
2835
2836 if ((out == NULL) || (out->error)) return(-1);
2837 /*
2838 * first handle encoding stuff.
2839 */
2840 if ((out->conv != NULL) && (out->encoder != NULL)) {
2841 /*
2842 * convert as much as possible to the parser output buffer.
2843 */
2844 do {
2845 nbchars = xmlCharEncOutput(out, 0);
2846 if (nbchars < 0)
2847 return(-1);
2848 } while (nbchars);
2849 }
2850
2851 /*
2852 * second flush the stuff to the I/O channel
2853 */
2854 if ((out->conv != NULL) && (out->encoder != NULL) &&
2855 (out->writecallback != NULL)) {
2856 ret = out->writecallback(out->context,
2857 (const char *)xmlBufContent(out->conv),
2858 xmlBufUse(out->conv));
2859 if (ret >= 0)
2860 xmlBufShrink(out->conv, ret);
2861 } else if (out->writecallback != NULL) {
2862 ret = out->writecallback(out->context,
2863 (const char *)xmlBufContent(out->buffer),
2864 xmlBufUse(out->buffer));
2865 if (ret >= 0)
2866 xmlBufShrink(out->buffer, ret);
2867 }
2868 if (ret < 0) {
2869 int errNo = (ret == -1) ? XML_IO_WRITE : -ret;
2870
2871 xmlIOErr(errNo, NULL);
2872 out->error = errNo;
2873 return(ret);
2874 }
2875 if (out->written > INT_MAX - ret)
2876 out->written = INT_MAX;
2877 else
2878 out->written += ret;
2879
2880 return(ret);
2881}
2882#endif /* LIBXML_OUTPUT_ENABLED */
2883
2884/**

Callers 8

xmlC14NExecuteFunction · 0.85
htmlDocDumpMemoryFormatFunction · 0.85
xmlSaveClearEncodingFunction · 0.85
xmlSaveFlushFunction · 0.85
xmlTextWriterFlushFunction · 0.85
xmlOutputBufferCloseFunction · 0.85

Calls 5

xmlCharEncOutputFunction · 0.85
xmlBufContentFunction · 0.85
xmlBufUseFunction · 0.85
xmlBufShrinkFunction · 0.85
xmlIOErrFunction · 0.85

Tested by

no test coverage detected