From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15106 invoked by alias); 10 Apr 2010 21:58:37 -0000 Received: (qmail 15091 invoked by uid 22791); 10 Apr 2010 21:58:35 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 10 Apr 2010 21:58:30 +0000 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 40BF61B40CF for ; Sat, 10 Apr 2010 21:58:27 +0000 (UTC) From: Mike Frysinger To: gdb-patches@sourceware.org Subject: [PATCH] sim: constify sim_write source buffer Date: Sat, 10 Apr 2010 21:58:00 -0000 Message-Id: <1270936687-26687-1-git-send-email-vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-04/txt/msg00313.txt.bz2 Most the sim write functions declare their source buffer const because they only ever read from it. The global sim_write() function does not follow this convention though which causes some warnings when trying to pass it const strings or buffers. Signed-off-by: Mike Frysinger --- include/gdb/: 2010-04-10 Mike Frysinger * remote-sim.h (sim_write): Add const to buf arg. sim/common/: 2010-04-10 Mike Frysinger * sim-hrw.c (sim_write): Add const to buf arg. * sim-utils.h (sim_write_fn): Likewise. include/gdb/remote-sim.h | 2 +- sim/common/sim-hrw.c | 2 +- sim/common/sim-utils.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gdb/remote-sim.h b/include/gdb/remote-sim.h index cfb1c11..37f029a 100644 --- a/include/gdb/remote-sim.h +++ b/include/gdb/remote-sim.h @@ -175,7 +175,7 @@ int sim_read PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) memory. Store bytes starting at virtual address MEM. Result is number of bytes write, or zero if error. */ -int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)); +int sim_write PARAMS ((SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length)); /* Fetch register REGNO storing its raw (target endian) value in the diff --git a/sim/common/sim-hrw.c b/sim/common/sim-hrw.c index e76a196..cedae87 100644 --- a/sim/common/sim-hrw.c +++ b/sim/common/sim-hrw.c @@ -32,7 +32,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) } int -sim_write (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length) +sim_write (SIM_DESC sd, SIM_ADDR mem, const unsigned char *buf, int length) { SIM_ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); return sim_core_write_buffer (sd, NULL, write_map, diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h index 75d2fb4..e3ff63a 100644 --- a/sim/common/sim-utils.h +++ b/sim/common/sim-utils.h @@ -63,7 +63,7 @@ SIM_RC sim_analyze_program (SIM_DESC sd, char *prog_name, This is still accommodated for backward compatibility reasons. */ typedef int sim_write_fn PARAMS ((SIM_DESC sd, SIM_ADDR mem, - unsigned char *buf, int length)); + const unsigned char *buf, int length)); struct bfd *sim_load_file (SIM_DESC sd, const char *myname, host_callback *callback, char *prog, struct bfd *prog_bfd, int verbose_p, -- 1.7.0.2