Re: [3/3] msxml3: Added IStream support to IMXWriter
On 06/19/2011 09:32 PM, Thomas Mullaly wrote:
+static inline void reset_output_buffer(mxwriter *This, LPCSTR encoding) +{ + xmlOutputBufferClose(This->buffer); + + if (encoding) + This->buffer = xmlAllocOutputBuffer(xmlFindCharEncodingHandler(encoding)); + else if (!This->dest) + This->buffer = xmlAllocOutputBuffer(xmlFindCharEncodingHandler("UTF-16")); + else { + LPSTR enc = heap_strdupWtoA(This->encoding); + This->buffer = xmlAllocOutputBuffer(xmlFindCharEncodingHandler(enc)); + heap_free(enc); + } + + This->dest_written = 0; +}
Libxml2 has the various encodings enum'd out as xmlCharEncoding; better to pass the enum around and avoid the string comparison. Then you can use xmlGetCharEncodingHandler() instead of xmlFindCharEncodingHandler().
participants (1)
-
Adam Martinson