This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] sim: tweak load buffer type to avoid signed warnings


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]