public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Haley <aph@redhat.com>
To: Dodji Seketeli <dodji@redhat.com>
Cc: GCJ-patches <java-patches@gcc.gnu.org>
Subject: Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
Date: Thu, 09 Aug 2012 09:08:00 -0000	[thread overview]
Message-ID: <50237E0B.6030701@redhat.com> (raw)
In-Reply-To: <m3txwdvxyj.fsf@redhat.com>

On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
> Hello,
> 
> 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.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
> 
> OK to commit?

OK.

Thanks,
Andrew.


> libjava/classpath/
> 
> 	* native/jni/xmlj/xmlj_io.c (GET_XML_OUTPUT_BUFFER_CONTENT)
> 	(GET_XML_OUTPUT_BUFFER_SIZE): New macros.
> 	(xmljOutputWriteCallback): Use them.
> ---
>  libjava/classpath/native/jni/xmlj/xmlj_io.c |   20 +++++++++++++++++---
>  1 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/libjava/classpath/native/jni/xmlj/xmlj_io.c b/libjava/classpath/native/jni/xmlj/xmlj_io.c
> index aa2964d..a55e48d 100644
> --- a/libjava/classpath/native/jni/xmlj/xmlj_io.c
> +++ b/libjava/classpath/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);
> 

       reply	other threads:[~2012-08-09  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m3txwdvxyj.fsf@redhat.com>
2012-08-09  9:08 ` Andrew Haley [this message]
2012-08-09 10:49   ` Andrew Hughes
2012-08-09 12:00     ` Andrew Haley
2012-08-09 13:42     ` Dodji Seketeli
2012-08-09 14:40       ` Andrew Hughes
2012-08-09 15:02         ` Dodji Seketeli
2012-08-09 20:04           ` Andrew Hughes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50237E0B.6030701@redhat.com \
    --to=aph@redhat.com \
    --cc=dodji@redhat.com \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).