Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] sim: tweak load buffer type to avoid signed warnings
@ 2011-01-02  8:09 Mike Frysinger
  2011-01-05 16:46 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Frysinger @ 2011-01-02  8:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: toolchain-devel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim: tweak load buffer type to avoid signed warnings
  2011-01-02  8:09 [PATCH] sim: tweak load buffer type to avoid signed warnings Mike Frysinger
@ 2011-01-05 16:46 ` Tom Tromey
  2011-01-05 17:14   ` Mike Frysinger
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2011-01-05 16:46 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches, toolchain-devel

>>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:

Mike> 2011-01-02  Mike Frysinger  <vapier@gentoo.org>
Mike> 	* sim-load.c (sim_load_file): Change buffer type to unsigned char *.

I think you could commit this one under the obvious rule.

Tom


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sim: tweak load buffer type to avoid signed warnings
  2011-01-05 16:46 ` Tom Tromey
@ 2011-01-05 17:14   ` Mike Frysinger
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Frysinger @ 2011-01-05 17:14 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches, toolchain-devel

[-- Attachment #1: Type: Text/Plain, Size: 389 bytes --]

On Wednesday, January 05, 2011 11:46:29 Tom Tromey wrote:
> >>>>> "Mike" == Mike Frysinger <vapier@gentoo.org> writes:
> Mike> 2011-01-02  Mike Frysinger  <vapier@gentoo.org>
> Mike> 	* sim-load.c (sim_load_file): Change buffer type to unsigned char *.
> 
> I think you could commit this one under the obvious rule.

hmm, true.  i tend to forget about that and be cautious.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-05 17:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-02  8:09 [PATCH] sim: tweak load buffer type to avoid signed warnings Mike Frysinger
2011-01-05 16:46 ` Tom Tromey
2011-01-05 17:14   ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox