Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: "Pierre Muller" <muller@ics.u-strasbg.fr>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [Build failure] chartset.c build failure: iconv 2nd argument type problem
Date: Mon, 23 Mar 2009 16:10:00 -0000	[thread overview]
Message-ID: <m3d4c8b4zn.fsf@fleche.redhat.com> (raw)
In-Reply-To: <000f01c9abcd$6b0e8990$412b9cb0$@u-strasbg.fr> (Pierre Muller's message of "Mon\, 23 Mar 2009 16\:38\:30 +0100")

>>>>> "Pierre" == Pierre Muller <muller@ics.u-strasbg.fr> writes:

Pierre>   On cygwin, the current iconv function has a (const char **)
Pierre> type for the second argument, whereas other implementations
Pierre> seem to be using (char **) type.

Oops, I'm sorry about breaking the build for you.

Pierre> Tom, could you please take a look at this?

Please try the appended patch.  If this works for you, I will check it
in.

Tom

diff --git a/gdb/charset.c b/gdb/charset.c
index 5efb849..3c56613 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -86,6 +86,9 @@
 #undef iconv
 #undef iconv_close
 
+#undef ICONV_CONST
+#define ICONV_CONST const
+
 iconv_t
 iconv_open (const char *to, const char *from)
 {
@@ -109,7 +112,7 @@ iconv_close (iconv_t arg)
 }
 
 size_t
-iconv (iconv_t ucs_flag, char **inbuf, size_t *inbytesleft,
+iconv (iconv_t ucs_flag, const char **inbuf, size_t *inbytesleft,
        char **outbuf, size_t *outbytesleft)
 {
   if (ucs_flag)
@@ -440,7 +443,7 @@ convert_between_encodings (const char *from, const char *to,
       outp = obstack_base (output) + old_size;
       outleft = space_request;
 
-      r = iconv (desc, &inp, &inleft, &outp, &outleft);
+      r = iconv (desc, (ICONV_CONST char **) &inp, &inleft, &outp, &outleft);
 
       /* Now make sure that the object on the obstack only includes
 	 bytes we have converted.  */
@@ -580,7 +583,8 @@ wchar_iterate (struct wchar_iterator *iter,
       size_t num;
       gdb_wchar_t result;
 
-      size_t r = iconv (iter->desc, (char **) &iter->input, &iter->bytes,
+      size_t r = iconv (iter->desc,
+			(ICONV_CONST char **) &iter->input, &iter->bytes,
 			&outptr, &out_avail);
       if (r == (size_t) -1)
 	{


  reply	other threads:[~2009-03-23 16:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-23 16:04 Pierre Muller
2009-03-23 16:10 ` Tom Tromey [this message]
2009-03-23 17:27   ` Pierre Muller
2009-03-23 17:54     ` FYI: fix charset.c build failure Tom Tromey

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=m3d4c8b4zn.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=muller@ics.u-strasbg.fr \
    /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