Commit 7ccfb2eb5f9d91bdb4139cb420a3b5f8deb2f6e8

Authored by blueswir1
1 parent 5d0c5750

Fix warnings that would be caused by gcc flag -Wwrite-strings

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5206 c046a42c-6fe2-441c-8c8c-71466251a162
block-vmdk.c
@@ -119,7 +119,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) @@ -119,7 +119,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
119 BDRVVmdkState *s = bs->opaque; 119 BDRVVmdkState *s = bs->opaque;
120 char desc[DESC_SIZE]; 120 char desc[DESC_SIZE];
121 uint32_t cid; 121 uint32_t cid;
122 - char *p_name, *cid_str; 122 + const char *p_name, *cid_str;
123 size_t cid_str_size; 123 size_t cid_str_size;
124 124
125 /* the descriptor offset = 0x200 */ 125 /* the descriptor offset = 0x200 */
@@ -193,7 +193,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) @@ -193,7 +193,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
193 uint32_t gde_entries, gd_size; 193 uint32_t gde_entries, gd_size;
194 int64_t gd_offset, rgd_offset, capacity, gt_size; 194 int64_t gd_offset, rgd_offset, capacity, gt_size;
195 char p_desc[DESC_SIZE], s_desc[DESC_SIZE], hdr[HEADER_SIZE]; 195 char p_desc[DESC_SIZE], s_desc[DESC_SIZE], hdr[HEADER_SIZE];
196 - char *desc_template = 196 + static const char desc_template[] =
197 "# Disk DescriptorFile\n" 197 "# Disk DescriptorFile\n"
198 "version=1\n" 198 "version=1\n"
199 "CID=%x\n" 199 "CID=%x\n"
@@ -202,7 +202,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) @@ -202,7 +202,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file)
202 "parentFileNameHint=\"%s\"\n" 202 "parentFileNameHint=\"%s\"\n"
203 "\n" 203 "\n"
204 "# Extent description\n" 204 "# Extent description\n"
205 - "RW %lu SPARSE \"%s\"\n" 205 + "RW %u SPARSE \"%s\"\n"
206 "\n" 206 "\n"
207 "# The Disk Data Base \n" 207 "# The Disk Data Base \n"
208 "#DDB\n" 208 "#DDB\n"
@@ -702,7 +702,7 @@ static int vmdk_create(const char *filename, int64_t total_size, @@ -702,7 +702,7 @@ static int vmdk_create(const char *filename, int64_t total_size,
702 int fd, i; 702 int fd, i;
703 VMDK4Header header; 703 VMDK4Header header;
704 uint32_t tmp, magic, grains, gd_size, gt_size, gt_count; 704 uint32_t tmp, magic, grains, gd_size, gt_size, gt_count;
705 - char *desc_template = 705 + static const char desc_template[] =
706 "# Disk DescriptorFile\n" 706 "# Disk DescriptorFile\n"
707 "version=1\n" 707 "version=1\n"
708 "CID=%x\n" 708 "CID=%x\n"
@@ -791,8 +791,9 @@ static int vmdk_create(const char *filename, int64_t total_size, @@ -791,8 +791,9 @@ static int vmdk_create(const char *filename, int64_t total_size,
791 real_filename = temp_str + 1; 791 real_filename = temp_str + 1;
792 if ((temp_str = strrchr(real_filename, ':')) != NULL) 792 if ((temp_str = strrchr(real_filename, ':')) != NULL)
793 real_filename = temp_str + 1; 793 real_filename = temp_str + 1;
794 - snprintf(desc, sizeof(desc), desc_template, time(NULL), (unsigned long)total_size,  
795 - real_filename, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16)); 794 + snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
  795 + (unsigned long)total_size, real_filename,
  796 + (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (63 * 16));
796 797
797 /* write the descriptor */ 798 /* write the descriptor */
798 lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET); 799 lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);
@@ -190,7 +190,7 @@ void get_tmp_filename(char *filename, int size) @@ -190,7 +190,7 @@ void get_tmp_filename(char *filename, int size)
190 void get_tmp_filename(char *filename, int size) 190 void get_tmp_filename(char *filename, int size)
191 { 191 {
192 int fd; 192 int fd;
193 - char *tmpdir; 193 + const char *tmpdir;
194 /* XXX: race condition possible */ 194 /* XXX: race condition possible */
195 tmpdir = getenv("TMPDIR"); 195 tmpdir = getenv("TMPDIR");
196 if (!tmpdir) 196 if (!tmpdir)
@@ -180,7 +180,7 @@ static int io_mem_watch; @@ -180,7 +180,7 @@ static int io_mem_watch;
180 #endif 180 #endif
181 181
182 /* log support */ 182 /* log support */
183 -char *logfilename = "/tmp/qemu.log"; 183 +const char *logfilename = "/tmp/qemu.log";
184 FILE *logfile; 184 FILE *logfile;
185 int loglevel; 185 int loglevel;
186 static int log_append = 0; 186 static int log_append = 0;
gdbstub.c
@@ -205,7 +205,7 @@ static void hextomem(uint8_t *mem, const char *buf, int len) @@ -205,7 +205,7 @@ static void hextomem(uint8_t *mem, const char *buf, int len)
205 } 205 }
206 206
207 /* return -1 if error, 0 if OK */ 207 /* return -1 if error, 0 if OK */
208 -static int put_packet(GDBState *s, char *buf) 208 +static int put_packet(GDBState *s, const char *buf)
209 { 209 {
210 int len, csum, i; 210 int len, csum, i;
211 uint8_t *p; 211 uint8_t *p;
@@ -1259,7 +1259,7 @@ static void gdb_vm_stopped(void *opaque, int reason) @@ -1259,7 +1259,7 @@ static void gdb_vm_stopped(void *opaque, int reason)
1259 %x - target_ulong argument printed in hex. 1259 %x - target_ulong argument printed in hex.
1260 %lx - 64-bit argument printed in hex. 1260 %lx - 64-bit argument printed in hex.
1261 %s - string pointer (target_ulong) and length (int) pair. */ 1261 %s - string pointer (target_ulong) and length (int) pair. */
1262 -void gdb_do_syscall(gdb_syscall_complete_cb cb, char *fmt, ...) 1262 +void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
1263 { 1263 {
1264 va_list va; 1264 va_list va;
1265 char buf[256]; 1265 char buf[256];
gdbstub.h
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 typedef void (*gdb_syscall_complete_cb)(CPUState *env, 6 typedef void (*gdb_syscall_complete_cb)(CPUState *env,
7 target_ulong ret, target_ulong err); 7 target_ulong ret, target_ulong err);
8 8
9 -void gdb_do_syscall(gdb_syscall_complete_cb cb, char *fmt, ...); 9 +void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
10 int use_gdb_syscalls(void); 10 int use_gdb_syscalls(void);
11 #ifdef CONFIG_USER_ONLY 11 #ifdef CONFIG_USER_ONLY
12 int gdb_handlesig (CPUState *, int); 12 int gdb_handlesig (CPUState *, int);
hw/e1000.c
@@ -949,7 +949,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) @@ -949,7 +949,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn)
949 E1000State *d; 949 E1000State *d;
950 uint8_t *pci_conf; 950 uint8_t *pci_conf;
951 uint16_t checksum = 0; 951 uint16_t checksum = 0;
952 - char *info_str = "e1000"; 952 + static const char info_str[] = "e1000";
953 int i; 953 int i;
954 954
955 d = (E1000State *)pci_register_device(bus, "e1000", 955 d = (E1000State *)pci_register_device(bus, "e1000",
@@ -43,6 +43,6 @@ void sh_serial_init (target_phys_addr_t base, int feat, @@ -43,6 +43,6 @@ void sh_serial_init (target_phys_addr_t base, int feat,
43 struct intc_source *bri_source); 43 struct intc_source *bri_source);
44 44
45 /* tc58128.c */ 45 /* tc58128.c */
46 -int tc58128_init(struct SH7750State *s, char *zone1, char *zone2); 46 +int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2);
47 47
48 #endif 48 #endif
hw/tc58128.c
@@ -26,7 +26,7 @@ static tc58128_dev tc58128_devs[2]; @@ -26,7 +26,7 @@ static tc58128_dev tc58128_devs[2];
26 26
27 #define FLASH_SIZE (16*1024*1024) 27 #define FLASH_SIZE (16*1024*1024)
28 28
29 -void init_dev(tc58128_dev * dev, char *filename) 29 +static void init_dev(tc58128_dev * dev, const char *filename)
30 { 30 {
31 int ret, blocks; 31 int ret, blocks;
32 32
@@ -175,7 +175,7 @@ static sh7750_io_device tc58128 = { @@ -175,7 +175,7 @@ static sh7750_io_device tc58128 = {
175 tc58128_cb /* Callback */ 175 tc58128_cb /* Callback */
176 }; 176 };
177 177
178 -int tc58128_init(struct SH7750State *s, char *zone1, char *zone2) 178 +int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2)
179 { 179 {
180 init_dev(&tc58128_devs[0], zone1); 180 init_dev(&tc58128_devs[0], zone1);
181 init_dev(&tc58128_devs[1], zone2); 181 init_dev(&tc58128_devs[1], zone2);
hw/usb-net.c
@@ -1016,7 +1016,7 @@ static void usb_net_handle_reset(USBDevice *dev) @@ -1016,7 +1016,7 @@ static void usb_net_handle_reset(USBDevice *dev)
1016 { 1016 {
1017 } 1017 }
1018 1018
1019 -static char *usb_net_stringtable[] = { 1019 +static const char * const usb_net_stringtable[] = {
1020 [STRING_MANUFACTURER] = "QEMU", 1020 [STRING_MANUFACTURER] = "QEMU",
1021 [STRING_PRODUCT] = "RNDIS/QEMU USB Network Device", 1021 [STRING_PRODUCT] = "RNDIS/QEMU USB Network Device",
1022 [STRING_ETHADDR] = "400102030405", 1022 [STRING_ETHADDR] = "400102030405",
hw/usb-ohci.c
@@ -565,7 +565,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed, @@ -565,7 +565,7 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
565 { 565 {
566 int dir; 566 int dir;
567 size_t len = 0; 567 size_t len = 0;
568 - char *str = NULL; 568 + const char *str = NULL;
569 int pid; 569 int pid;
570 int ret; 570 int ret;
571 int i; 571 int i;
@@ -800,7 +800,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) @@ -800,7 +800,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed)
800 { 800 {
801 int dir; 801 int dir;
802 size_t len = 0; 802 size_t len = 0;
803 - char *str = NULL; 803 + const char *str = NULL;
804 int pid; 804 int pid;
805 int ret; 805 int ret;
806 int i; 806 int i;
linux-user/arm/nwfpe/fpopcode.h
@@ -366,19 +366,19 @@ TABLE 5 @@ -366,19 +366,19 @@ TABLE 5
366 /* Get the rounding mode from the opcode. */ 366 /* Get the rounding mode from the opcode. */
367 #define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5) 367 #define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5)
368 368
369 -static inline const floatx80 getExtendedConstant(const unsigned int nIndex) 369 +static inline floatx80 getExtendedConstant(const unsigned int nIndex)
370 { 370 {
371 extern const floatx80 floatx80Constant[]; 371 extern const floatx80 floatx80Constant[];
372 return floatx80Constant[nIndex]; 372 return floatx80Constant[nIndex];
373 } 373 }
374 374
375 -static inline const float64 getDoubleConstant(const unsigned int nIndex) 375 +static inline float64 getDoubleConstant(const unsigned int nIndex)
376 { 376 {
377 extern const float64 float64Constant[]; 377 extern const float64 float64Constant[];
378 return float64Constant[nIndex]; 378 return float64Constant[nIndex];
379 } 379 }
380 380
381 -static inline const float32 getSingleConstant(const unsigned int nIndex) 381 +static inline float32 getSingleConstant(const unsigned int nIndex)
382 { 382 {
383 extern const float32 float32Constant[]; 383 extern const float32 float32Constant[];
384 return float32Constant[nIndex]; 384 return float32Constant[nIndex];
linux-user/strace.c
@@ -13,12 +13,12 @@ int do_strace=0; @@ -13,12 +13,12 @@ int do_strace=0;
13 13
14 struct syscallname { 14 struct syscallname {
15 int nr; 15 int nr;
16 - char *name;  
17 - char *format;  
18 - void (*call)(struct syscallname *, 16 + const char *name;
  17 + const char *format;
  18 + void (*call)(const struct syscallname *,
19 abi_long, abi_long, abi_long, 19 abi_long, abi_long, abi_long,
20 abi_long, abi_long, abi_long); 20 abi_long, abi_long, abi_long);
21 - void (*result)(struct syscallname *, abi_long); 21 + void (*result)(const struct syscallname *, abi_long);
22 }; 22 };
23 23
24 /* 24 /*
@@ -131,7 +131,7 @@ static long newselect_arg4 = 0; @@ -131,7 +131,7 @@ static long newselect_arg4 = 0;
131 static long newselect_arg5 = 0; 131 static long newselect_arg5 = 0;
132 132
133 static void 133 static void
134 -print_newselect(struct syscallname *name, 134 +print_newselect(const struct syscallname *name,
135 abi_long arg1, abi_long arg2, abi_long arg3, 135 abi_long arg1, abi_long arg2, abi_long arg3,
136 abi_long arg4, abi_long arg5, abi_long arg6) 136 abi_long arg4, abi_long arg5, abi_long arg6)
137 { 137 {
@@ -155,7 +155,7 @@ print_newselect(struct syscallname *name, @@ -155,7 +155,7 @@ print_newselect(struct syscallname *name,
155 #endif 155 #endif
156 156
157 static void 157 static void
158 -print_semctl(struct syscallname *name, 158 +print_semctl(const struct syscallname *name,
159 abi_long arg1, abi_long arg2, abi_long arg3, 159 abi_long arg1, abi_long arg2, abi_long arg3,
160 abi_long arg4, abi_long arg5, abi_long arg6) 160 abi_long arg4, abi_long arg5, abi_long arg6)
161 { 161 {
@@ -165,7 +165,7 @@ print_semctl(struct syscallname *name, @@ -165,7 +165,7 @@ print_semctl(struct syscallname *name,
165 } 165 }
166 166
167 static void 167 static void
168 -print_execve(struct syscallname *name, 168 +print_execve(const struct syscallname *name,
169 abi_long arg1, abi_long arg2, abi_long arg3, 169 abi_long arg1, abi_long arg2, abi_long arg3,
170 abi_long arg4, abi_long arg5, abi_long arg6) 170 abi_long arg4, abi_long arg5, abi_long arg6)
171 { 171 {
@@ -198,14 +198,15 @@ print_execve(struct syscallname *name, @@ -198,14 +198,15 @@ print_execve(struct syscallname *name,
198 198
199 #ifdef TARGET_NR_ipc 199 #ifdef TARGET_NR_ipc
200 static void 200 static void
201 -print_ipc(struct syscallname *name, 201 +print_ipc(const struct syscallname *name,
202 abi_long arg1, abi_long arg2, abi_long arg3, 202 abi_long arg1, abi_long arg2, abi_long arg3,
203 abi_long arg4, abi_long arg5, abi_long arg6) 203 abi_long arg4, abi_long arg5, abi_long arg6)
204 { 204 {
205 switch(arg1) { 205 switch(arg1) {
206 case IPCOP_semctl: 206 case IPCOP_semctl:
207 - name->name = "semctl";  
208 - print_semctl(name,arg2,arg3,arg4,arg5,arg6,0); 207 + gemu_log("semctl(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ",", arg1, arg2);
  208 + print_ipc_cmd(arg3);
  209 + gemu_log(",0x" TARGET_ABI_FMT_lx ")", arg4);
209 break; 210 break;
210 default: 211 default:
211 gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")", 212 gemu_log("%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")",
@@ -219,7 +220,7 @@ print_ipc(struct syscallname *name, @@ -219,7 +220,7 @@ print_ipc(struct syscallname *name,
219 */ 220 */
220 221
221 static void 222 static void
222 -print_syscall_ret_addr(struct syscallname *name, abi_long ret) 223 +print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
223 { 224 {
224 if( ret == -1 ) { 225 if( ret == -1 ) {
225 gemu_log(" = -1 errno=%d (%s)\n", errno, target_strerror(errno)); 226 gemu_log(" = -1 errno=%d (%s)\n", errno, target_strerror(errno));
@@ -238,7 +239,7 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret) @@ -238,7 +239,7 @@ print_syscall_ret_raw(struct syscallname *name, abi_long ret)
238 239
239 #ifdef TARGET_NR__newselect 240 #ifdef TARGET_NR__newselect
240 static void 241 static void
241 -print_syscall_ret_newselect(struct syscallname *name, abi_long ret) 242 +print_syscall_ret_newselect(const struct syscallname *name, abi_long ret)
242 { 243 {
243 gemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret); 244 gemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret);
244 print_fdset(newselect_arg1,newselect_arg2); 245 print_fdset(newselect_arg1,newselect_arg2);
@@ -256,7 +257,7 @@ print_syscall_ret_newselect(struct syscallname *name, abi_long ret) @@ -256,7 +257,7 @@ print_syscall_ret_newselect(struct syscallname *name, abi_long ret)
256 * An array of all of the syscalls we know about 257 * An array of all of the syscalls we know about
257 */ 258 */
258 259
259 -static struct syscallname scnames[] = { 260 +static const struct syscallname scnames[] = {
260 #include "strace.list" 261 #include "strace.list"
261 }; 262 };
262 263
@@ -271,7 +272,7 @@ print_syscall(int num, @@ -271,7 +272,7 @@ print_syscall(int num,
271 abi_long arg4, abi_long arg5, abi_long arg6) 272 abi_long arg4, abi_long arg5, abi_long arg6)
272 { 273 {
273 int i; 274 int i;
274 - char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")"; 275 + const char *format="%s(" TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld "," TARGET_ABI_FMT_ld ")";
275 276
276 gemu_log("%d ", getpid() ); 277 gemu_log("%d ", getpid() );
277 278
m68k-dis.c
@@ -546,13 +546,13 @@ extern const int m68k_numopcodes, m68k_numaliases; @@ -546,13 +546,13 @@ extern const int m68k_numopcodes, m68k_numaliases;
546 546
547 /* Local function prototypes. */ 547 /* Local function prototypes. */
548 548
549 -const char * const fpcr_names[] = 549 +static const char * const fpcr_names[] =
550 { 550 {
551 "", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr", 551 "", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr",
552 "%fpiar/%fpcr", "%fpsr/%fpcr", "%fpiar/%fpsr/%fpcr" 552 "%fpiar/%fpcr", "%fpsr/%fpcr", "%fpiar/%fpsr/%fpcr"
553 }; 553 };
554 554
555 -static char *const reg_names[] = 555 +static const char *const reg_names[] =
556 { 556 {
557 "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", 557 "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
558 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", 558 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp",
@@ -561,7 +561,7 @@ static char *const reg_names[] = @@ -561,7 +561,7 @@ static char *const reg_names[] =
561 561
562 /* Name of register halves for MAC/EMAC. 562 /* Name of register halves for MAC/EMAC.
563 Separate from reg_names since 'spu', 'fpl' look weird. */ 563 Separate from reg_names since 'spu', 'fpl' look weird. */
564 -static char *const reg_half_names[] = 564 +static const char *const reg_half_names[] =
565 { 565 {
566 "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", 566 "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7",
567 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", 567 "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7",
@@ -991,7 +991,7 @@ print_indexed (int basereg, @@ -991,7 +991,7 @@ print_indexed (int basereg,
991 disassemble_info *info) 991 disassemble_info *info)
992 { 992 {
993 int word; 993 int word;
994 - static char *const scales[] = { "", ":2", ":4", ":8" }; 994 + static const char *const scales[] = { "", ":2", ":4", ":8" };
995 bfd_vma base_disp; 995 bfd_vma base_disp;
996 bfd_vma outer_disp; 996 bfd_vma outer_disp;
997 char buf[40]; 997 char buf[40];
@@ -1106,7 +1106,7 @@ print_insn_arg (const char *d, @@ -1106,7 +1106,7 @@ print_insn_arg (const char *d,
1106 { 1106 {
1107 case 'c': /* Cache identifier. */ 1107 case 'c': /* Cache identifier. */
1108 { 1108 {
1109 - static char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" }; 1109 + static const char *const cacheFieldName[] = { "nc", "dc", "ic", "bc" };
1110 val = fetch_arg (buffer, place, 2, info); 1110 val = fetch_arg (buffer, place, 2, info);
1111 (*info->fprintf_func) (info->stream, cacheFieldName[val]); 1111 (*info->fprintf_func) (info->stream, cacheFieldName[val]);
1112 break; 1112 break;
@@ -1157,7 +1157,7 @@ print_insn_arg (const char *d, @@ -1157,7 +1157,7 @@ print_insn_arg (const char *d,
1157 /* FIXME: There's a problem here, different m68k processors call the 1157 /* FIXME: There's a problem here, different m68k processors call the
1158 same address different names. This table can't get it right 1158 same address different names. This table can't get it right
1159 because it doesn't know which processor it's disassembling for. */ 1159 because it doesn't know which processor it's disassembling for. */
1160 - static const struct { char *name; int value; } names[] 1160 + static const struct { const char *name; int value; } names[]
1161 = {{"%sfc", 0x000}, {"%dfc", 0x001}, {"%cacr", 0x002}, 1161 = {{"%sfc", 0x000}, {"%dfc", 0x001}, {"%cacr", 0x002},
1162 {"%tc", 0x003}, {"%itt0",0x004}, {"%itt1", 0x005}, 1162 {"%tc", 0x003}, {"%itt0",0x004}, {"%itt1", 0x005},
1163 {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008}, 1163 {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008},
@@ -1201,7 +1201,7 @@ print_insn_arg (const char *d, @@ -1201,7 +1201,7 @@ print_insn_arg (const char *d,
1201 case 'M': 1201 case 'M':
1202 if (place == 'h') 1202 if (place == 'h')
1203 { 1203 {
1204 - static char *const scalefactor_name[] = { "<<", ">>" }; 1204 + static const char *const scalefactor_name[] = { "<<", ">>" };
1205 val = fetch_arg (buffer, place, 1, info); 1205 val = fetch_arg (buffer, place, 1, info);
1206 (*info->fprintf_func) (info->stream, scalefactor_name[val]); 1206 (*info->fprintf_func) (info->stream, scalefactor_name[val]);
1207 } 1207 }
@@ -1633,7 +1633,7 @@ print_insn_arg (const char *d, @@ -1633,7 +1633,7 @@ print_insn_arg (const char *d,
1633 case '3': 1633 case '3':
1634 { 1634 {
1635 int val = fetch_arg (buffer, place, 5, info); 1635 int val = fetch_arg (buffer, place, 5, info);
1636 - char *name = 0; 1636 + const char *name = 0;
1637 1637
1638 switch (val) 1638 switch (val)
1639 { 1639 {
sh4-dis.c
@@ -325,7 +325,7 @@ SH4AL-dsp SH4A @@ -325,7 +325,7 @@ SH4AL-dsp SH4A
325 325
326 typedef struct 326 typedef struct
327 { 327 {
328 - char *name; 328 + const char *name;
329 sh_arg_type arg[4]; 329 sh_arg_type arg[4];
330 sh_nibble_type nibbles[9]; 330 sh_nibble_type nibbles[9];
331 unsigned int arch; 331 unsigned int arch;
@@ -1386,13 +1386,13 @@ print_insn_ppi (field_b, info) @@ -1386,13 +1386,13 @@ print_insn_ppi (field_b, info)
1386 int field_b; 1386 int field_b;
1387 struct disassemble_info *info; 1387 struct disassemble_info *info;
1388 { 1388 {
1389 - static char *sx_tab[] = { "x0", "x1", "a0", "a1" };  
1390 - static char *sy_tab[] = { "y0", "y1", "m0", "m1" }; 1389 + static const char *sx_tab[] = { "x0", "x1", "a0", "a1" };
  1390 + static const char *sy_tab[] = { "y0", "y1", "m0", "m1" };
1391 fprintf_ftype fprintf_fn = info->fprintf_func; 1391 fprintf_ftype fprintf_fn = info->fprintf_func;
1392 void *stream = info->stream; 1392 void *stream = info->stream;
1393 unsigned int nib1, nib2, nib3; 1393 unsigned int nib1, nib2, nib3;
1394 unsigned int altnib1, nib4; 1394 unsigned int altnib1, nib4;
1395 - char *dc = NULL; 1395 + const char *dc = NULL;
1396 const sh_opcode_info *op; 1396 const sh_opcode_info *op;
1397 1397
1398 if ((field_b & 0xe800) == 0) 1398 if ((field_b & 0xe800) == 0)
@@ -1405,10 +1405,10 @@ print_insn_ppi (field_b, info) @@ -1405,10 +1405,10 @@ print_insn_ppi (field_b, info)
1405 } 1405 }
1406 if ((field_b & 0xc000) == 0x4000 && (field_b & 0x3000) != 0x1000) 1406 if ((field_b & 0xc000) == 0x4000 && (field_b & 0x3000) != 0x1000)
1407 { 1407 {
1408 - static char *du_tab[] = { "x0", "y0", "a0", "a1" };  
1409 - static char *se_tab[] = { "x0", "x1", "y0", "a1" };  
1410 - static char *sf_tab[] = { "y0", "y1", "x0", "a1" };  
1411 - static char *sg_tab[] = { "m0", "m1", "a0", "a1" }; 1408 + static const char *du_tab[] = { "x0", "y0", "a0", "a1" };
  1409 + static const char *se_tab[] = { "x0", "x1", "y0", "a1" };
  1410 + static const char *sf_tab[] = { "y0", "y1", "x0", "a1" };
  1411 + static const char *sg_tab[] = { "m0", "m1", "a0", "a1" };
1412 1412
1413 if (field_b & 0x2000) 1413 if (field_b & 0x2000)
1414 { 1414 {
slirp/ip_icmp.c
@@ -207,12 +207,8 @@ end_error: @@ -207,12 +207,8 @@ end_error:
207 207
208 #define ICMP_MAXDATALEN (IP_MSS-28) 208 #define ICMP_MAXDATALEN (IP_MSS-28)
209 void 209 void
210 -icmp_error(msrc, type, code, minsize, message)  
211 - struct mbuf *msrc;  
212 - u_char type;  
213 - u_char code;  
214 - int minsize;  
215 - char *message; 210 +icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
  211 + const char *message)
216 { 212 {
217 unsigned hlen, shlen, s_ip_len; 213 unsigned hlen, shlen, s_ip_len;
218 register struct ip *ip; 214 register struct ip *ip;
slirp/ip_icmp.h
@@ -158,7 +158,8 @@ struct icmp { @@ -158,7 +158,8 @@ struct icmp {
158 (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) 158 (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
159 159
160 void icmp_input _P((struct mbuf *, int)); 160 void icmp_input _P((struct mbuf *, int));
161 -void icmp_error _P((struct mbuf *, u_char, u_char, int, char *)); 161 +void icmp_error(struct mbuf *msrc, u_char type, u_char code, int minsize,
  162 + const char *message);
162 void icmp_reflect _P((struct mbuf *)); 163 void icmp_reflect _P((struct mbuf *));
163 164
164 #endif 165 #endif
slirp/misc.c
@@ -307,7 +307,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) @@ -307,7 +307,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
307 socklen_t addrlen = sizeof(addr); 307 socklen_t addrlen = sizeof(addr);
308 int opt; 308 int opt;
309 int master = -1; 309 int master = -1;
310 - char *argv[256]; 310 + const char *argv[256];
311 #if 0 311 #if 0
312 char buff[256]; 312 char buff[256];
313 #endif 313 #endif
@@ -411,7 +411,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) @@ -411,7 +411,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty)
411 } while (c); 411 } while (c);
412 412
413 argv[i] = 0; 413 argv[i] = 0;
414 - execvp(argv[0], argv); 414 + execvp(argv[0], (char **)argv);
415 415
416 /* Ooops, failed, let's tell the user why */ 416 /* Ooops, failed, let's tell the user why */
417 { 417 {
target-alpha/helper.c
@@ -411,7 +411,7 @@ void cpu_dump_state (CPUState *env, FILE *f, @@ -411,7 +411,7 @@ void cpu_dump_state (CPUState *env, FILE *f,
411 int (*cpu_fprintf)(FILE *f, const char *fmt, ...), 411 int (*cpu_fprintf)(FILE *f, const char *fmt, ...),
412 int flags) 412 int flags)
413 { 413 {
414 - static unsigned char *linux_reg_names[] = { 414 + static const unsigned char *linux_reg_names[] = {
415 "v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ", 415 "v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ",
416 "t7 ", "s0 ", "s1 ", "s2 ", "s3 ", "s4 ", "s5 ", "fp ", 416 "t7 ", "s0 ", "s1 ", "s2 ", "s3 ", "s4 ", "s5 ", "fp ",
417 "a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "t8 ", "t9 ", 417 "a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "t8 ", "t9 ",
target-cris/translate.c
@@ -123,7 +123,7 @@ typedef struct DisasContext { @@ -123,7 +123,7 @@ typedef struct DisasContext {
123 int singlestep_enabled; 123 int singlestep_enabled;
124 } DisasContext; 124 } DisasContext;
125 125
126 -static void gen_BUG(DisasContext *dc, char *file, int line) 126 +static void gen_BUG(DisasContext *dc, const char *file, int line)
127 { 127 {
128 printf ("BUG: pc=%x %s %d\n", dc->pc, file, line); 128 printf ("BUG: pc=%x %s %d\n", dc->pc, file, line);
129 fprintf (logfile, "BUG: pc=%x %s %d\n", dc->pc, file, line); 129 fprintf (logfile, "BUG: pc=%x %s %d\n", dc->pc, file, line);
@@ -1898,7 +1898,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) @@ -1898,7 +1898,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
1898 return ret; 1898 return ret;
1899 } 1899 }
1900 1900
1901 -static char *mux_help[] = { 1901 +static const char * const mux_help[] = {
1902 "% h print this help\n\r", 1902 "% h print this help\n\r",
1903 "% x exit emulator\n\r", 1903 "% x exit emulator\n\r",
1904 "% s save disk data back to file (if -snapshot)\n\r", 1904 "% s save disk data back to file (if -snapshot)\n\r",
@@ -1948,7 +1948,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) @@ -1948,7 +1948,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
1948 break; 1948 break;
1949 case 'x': 1949 case 'x':
1950 { 1950 {
1951 - char *term = "QEMU: Terminated\n\r"; 1951 + const char *term = "QEMU: Terminated\n\r";
1952 chr->chr_write(chr,(uint8_t *)term,strlen(term)); 1952 chr->chr_write(chr,(uint8_t *)term,strlen(term));
1953 exit(0); 1953 exit(0);
1954 break; 1954 break;
@@ -3957,6 +3957,7 @@ int parse_host_src_port(struct sockaddr_in *haddr, @@ -3957,6 +3957,7 @@ int parse_host_src_port(struct sockaddr_in *haddr,
3957 char *str = strdup(input_str); 3957 char *str = strdup(input_str);
3958 char *host_str = str; 3958 char *host_str = str;
3959 char *src_str; 3959 char *src_str;
  3960 + const char *src_str2;
3960 char *ptr; 3961 char *ptr;
3961 3962
3962 /* 3963 /*
@@ -3975,10 +3976,11 @@ int parse_host_src_port(struct sockaddr_in *haddr, @@ -3975,10 +3976,11 @@ int parse_host_src_port(struct sockaddr_in *haddr,
3975 if (parse_host_port(haddr, host_str) < 0) 3976 if (parse_host_port(haddr, host_str) < 0)
3976 goto fail; 3977 goto fail;
3977 3978
  3979 + src_str2 = src_str;
3978 if (!src_str || *src_str == '\0') 3980 if (!src_str || *src_str == '\0')
3979 - src_str = ":0"; 3981 + src_str2 = ":0";
3980 3982
3981 - if (parse_host_port(saddr, src_str) < 0) 3983 + if (parse_host_port(saddr, src_str2) < 0)
3982 goto fail; 3984 goto fail;
3983 3985
3984 free(str); 3986 free(str);
@@ -5164,7 +5166,7 @@ static int get_param_value(char *buf, int buf_size, @@ -5164,7 +5166,7 @@ static int get_param_value(char *buf, int buf_size,
5164 } 5166 }
5165 5167
5166 static int check_params(char *buf, int buf_size, 5168 static int check_params(char *buf, int buf_size,
5167 - char **params, const char *str) 5169 + const char * const *params, const char *str)
5168 { 5170 {
5169 const char *p; 5171 const char *p;
5170 int i; 5172 int i;
@@ -5451,9 +5453,10 @@ static int drive_init(struct drive_opt *arg, int snapshot, @@ -5451,9 +5453,10 @@ static int drive_init(struct drive_opt *arg, int snapshot,
5451 int cache; 5453 int cache;
5452 int bdrv_flags; 5454 int bdrv_flags;
5453 char *str = arg->opt; 5455 char *str = arg->opt;
5454 - char *params[] = { "bus", "unit", "if", "index", "cyls", "heads",  
5455 - "secs", "trans", "media", "snapshot", "file",  
5456 - "cache", "format", NULL }; 5456 + static const char * const params[] = { "bus", "unit", "if", "index",
  5457 + "cyls", "heads", "secs", "trans",
  5458 + "media", "snapshot", "file",
  5459 + "cache", "format", NULL };
5457 5460
5458 if (check_params(buf, sizeof(buf), params, str) < 0) { 5461 if (check_params(buf, sizeof(buf), params, str) < 0) {
5459 fprintf(stderr, "qemu: unknown parameter '%s' in '%s'\n", 5462 fprintf(stderr, "qemu: unknown parameter '%s' in '%s'\n",