Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: gdb-patches@sourceware.org
Cc: toolchain-devel@blackfin.uclinux.org
Subject: [PATCH] sim: tweak load buffer type to avoid signed warnings
Date: Sun, 02 Jan 2011 08:09:00 -0000	[thread overview]
Message-ID: <1293955743-14564-1-git-send-email-vapier@gentoo.org> (raw)

The sim_load_file func creates a buffer with arbitrary data in it (reads
it via the bfd).  It then passes it on to a sim_write_fn which expects a
unsigned char buffer.  Since sim_load_file itself doesn't care about the
contents, tweak the type to avoid signed mismatch warnings from gcc:

common/sim-load.c: In function ‘sim_load_file’:
common/sim-load.c:143: warning: pointer targets in passing argument 3 of ‘do_write’ differ in signedness
common/sim-load.c:143: note: expected ‘const unsigned char *’ but argument is of type ‘char *’

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

2011-01-02  Mike Frysinger  <vapier@gentoo.org>

	* sim-load.c (sim_load_file): Change buffer type to unsigned char *.
---
 sim/common/sim-load.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sim/common/sim-load.c b/sim/common/sim-load.c
index b265cd9..9b3b809 100644
--- a/sim/common/sim-load.c
+++ b/sim/common/sim-load.c
@@ -111,7 +111,7 @@ sim_load_file (sd, myname, callback, prog, prog_bfd, verbose_p, lma_p, do_write)
 	  size = bfd_get_section_size (s);
 	  if (size > 0)
 	    {
-	      char *buffer;
+	      unsigned char *buffer;
 	      bfd_vma lma;
 
 	      buffer = malloc (size);
-- 
1.7.3.1


             reply	other threads:[~2011-01-02  8:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-02  8:09 Mike Frysinger [this message]
2011-01-05 16:46 ` Tom Tromey
2011-01-05 17:14   ` Mike Frysinger

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=1293955743-14564-1-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=toolchain-devel@blackfin.uclinux.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