[libxslt] Fix portability to upcoming libxml2-2.9.0
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Fix portability to upcoming libxml2-2.9.0
- Date: Wed, 8 Aug 2012 07:43:00 +0000 (UTC)
commit 1d62941e10c7419bf2341dbbb17d2ba6a73ed4ae
Author: Daniel Veillard <veillard redhat com>
Date: Wed Aug 8 14:21:51 2012 +0800
Fix portability to upcoming libxml2-2.9.0
A few place where an output buffer was accessed directly or as
an xmlBuf
libxslt/xsltutils.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index 44e80a7..7a4caf0 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]