summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2012-08-09 20:56:16 +0100
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2012-08-09 21:01:25 +0100
commit4d4db712cf4df4feb4d7b98bb1b5b448218500b3 (patch)
tree2aea12868b38a50a02a936e3731f48613e8bebaf
parent75672f0b3ac006737b954a7f92a97216986803cf (diff)
downloadclasspath-4d4db712cf4df4feb4d7b98bb1b5b448218500b3.tar.gz
Use accessor functions to manipulate xmlOutputBuffer
This is a fix to prepare the xmlj_io.c file of gnu classpath to a coming API change in libxml2. Basically, we were previously accessing fields inside the xmlOutputBuffer struct of libxml2. In a coming version of libxml2, that won't be possible anymore. Client code will have to use accessor functions instead. For the gory details, there is an interestin note of Daniel Veillard (author of libxml2) at https://mail.gnome.org/archives/desktop-devel-list/2012-August/msg00007.html. This patch defines too accessor macros that, depending on the version of libxml2 we are using will either access the fields of xmlOutputBuffer directly, or use the new accessor function. Tested on x86_64-unknown-linux-gnu against trunk. 2012-08-09 Dodji Seketeli <dodji@redhat.com> Use accessor functions to manipulate xmlOutputBuffer * native/jni/xmlj/xmlj_io.c (GET_XML_OUTPUT_BUFFER_CONTENT) (GET_XML_OUTPUT_BUFFER_SIZE): New macros. (xmljOutputWriteCallback): Use them. Signed-off-by: Andrew John Hughes <gnu_andrew@member.fsf.org>
-rw-r--r--ChangeLog7
-rw-r--r--native/jni/xmlj/xmlj_io.c20
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 2591ebad1..6a91ed313 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-08-09 Dodji Seketeli <dodji@redhat.com>
+
+ Use accessor functions to manipulate xmlOutputBuffer
+ * native/jni/xmlj/xmlj_io.c (GET_XML_OUTPUT_BUFFER_CONTENT)
+ (GET_XML_OUTPUT_BUFFER_SIZE): New macros.
+ (xmljOutputWriteCallback): Use them.
+
2012-08-09 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/util/TimeZone.java:
diff --git a/native/jni/xmlj/xmlj_io.c b/native/jni/xmlj/xmlj_io.c
index aa2964dc3..a55e48df8 100644
--- a/native/jni/xmlj/xmlj_io.c
+++ b/native/jni/xmlj/xmlj_io.c
@@ -102,6 +102,19 @@ xmljFreeOutputStreamContext (OutputStreamContext * outContext);
xmlCharEncoding
xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer);
+
+#ifdef LIBXML2_NEW_BUFFER
+#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) (gchar *) \
+ (char *) xmlOutputBufferGetContent(buf)
+#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
+ xmlOutputBufferGetSize(buf)
+#else
+#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) \
+ (buf)->buffer->content
+#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
+ (buf)->buffer->use
+#endif
+
int
xmljOutputWriteCallback (void *context, const char *buffer, int len)
{
@@ -752,9 +765,10 @@ xmljLoadExternalEntity (const char *URL, const char *ID,
inputStream->directory = NULL;
inputStream->buf = inputBuffer;
- inputStream->base = inputStream->buf->buffer->content;
- inputStream->cur = inputStream->buf->buffer->content;
- inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
+ inputStream->base = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
+ inputStream->cur = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
+ inputStream->end =
+ &inputStream->base[GET_XML_OUTPUT_BUFFER_SIZE (inputStream->buf)];
if ((ctxt->directory == NULL) && (inputStream->directory != NULL))
ctxt->directory =
(char *) xmlStrdup ((const xmlChar *) inputStream->directory);