summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@redhat.com>2012-08-08 14:21:51 +0800
committerDaniel Veillard <veillard@redhat.com>2012-08-08 15:40:46 +0800
commit1d62941e10c7419bf2341dbbb17d2ba6a73ed4ae (patch)
tree60cf6489cf610f55be991cbd609debb0b69dfb22
parent0a8c1d7190357eae966c7a4ab3fc3a41fb5a764d (diff)
downloadlibxslt-1d62941e10c7419bf2341dbbb17d2ba6a73ed4ae.tar.gz
libxslt-1d62941e10c7419bf2341dbbb17d2ba6a73ed4ae.tar.bz2
libxslt-1d62941e10c7419bf2341dbbb17d2ba6a73ed4ae.zip
Fix portability to upcoming libxml2-2.9.0
A few place where an output buffer was accessed directly or as an xmlBuf
-rw-r--r--libxslt/xsltutils.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index 44e80a7a..7a4caf02 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -1538,9 +1538,11 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
if (omitXmlDecl != 1) {
xmlOutputBufferWriteString(buf, "<?xml version=");
- if (result->version != NULL)
- xmlBufferWriteQuotedString(buf->buffer, result->version);
- else
+ if (result->version != NULL) {
+ xmlOutputBufferWriteString(buf, "\"");
+ xmlOutputBufferWriteString(buf, (const char *)result->version);
+ xmlOutputBufferWriteString(buf, "\"");
+ } else
xmlOutputBufferWriteString(buf, "\"1.0\"");
if (encoding == NULL) {
if (result->encoding != NULL)
@@ -1552,7 +1554,9 @@ xsltSaveResultTo(xmlOutputBufferPtr buf, xmlDocPtr result,
}
if (encoding != NULL) {
xmlOutputBufferWriteString(buf, " encoding=");
- xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
+ xmlOutputBufferWriteString(buf, "\"");
+ xmlOutputBufferWriteString(buf, (const char *) encoding);
+ xmlOutputBufferWriteString(buf, "\"");
}
switch (standalone) {
case 0:
@@ -1755,6 +1759,15 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
if (buf == NULL)
return(-1);
xsltSaveResultTo(buf, result, style);
+#ifdef LIBXML2_NEW_BUFFER
+ if (buf->conv != NULL) {
+ *doc_txt_len = xmlBufUse(buf->conv);
+ *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->conv), *doc_txt_len);
+ } else {
+ *doc_txt_len = xmlBufUse(buf->buffer);
+ *doc_txt_ptr = xmlStrndup(xmlBufContent(buf->buffer), *doc_txt_len);
+ }
+#else
if (buf->conv != NULL) {
*doc_txt_len = buf->conv->use;
*doc_txt_ptr = xmlStrndup(buf->conv->content, *doc_txt_len);
@@ -1762,6 +1775,7 @@ xsltSaveResultToString(xmlChar **doc_txt_ptr, int * doc_txt_len,
*doc_txt_len = buf->buffer->use;
*doc_txt_ptr = xmlStrndup(buf->buffer->content, *doc_txt_len);
}
+#endif
(void)xmlOutputBufferClose(buf);
return 0;
}