Commit 7ccfb2eb5f9d91bdb4139cb420a3b5f8deb2f6e8
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
Showing
20 changed files
with
72 additions
and
70 deletions
block-vmdk.c
... | ... | @@ -119,7 +119,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent) |
119 | 119 | BDRVVmdkState *s = bs->opaque; |
120 | 120 | char desc[DESC_SIZE]; |
121 | 121 | uint32_t cid; |
122 | - char *p_name, *cid_str; | |
122 | + const char *p_name, *cid_str; | |
123 | 123 | size_t cid_str_size; |
124 | 124 | |
125 | 125 | /* the descriptor offset = 0x200 */ |
... | ... | @@ -193,7 +193,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) |
193 | 193 | uint32_t gde_entries, gd_size; |
194 | 194 | int64_t gd_offset, rgd_offset, capacity, gt_size; |
195 | 195 | char p_desc[DESC_SIZE], s_desc[DESC_SIZE], hdr[HEADER_SIZE]; |
196 | - char *desc_template = | |
196 | + static const char desc_template[] = | |
197 | 197 | "# Disk DescriptorFile\n" |
198 | 198 | "version=1\n" |
199 | 199 | "CID=%x\n" |
... | ... | @@ -202,7 +202,7 @@ static int vmdk_snapshot_create(const char *filename, const char *backing_file) |
202 | 202 | "parentFileNameHint=\"%s\"\n" |
203 | 203 | "\n" |
204 | 204 | "# Extent description\n" |
205 | - "RW %lu SPARSE \"%s\"\n" | |
205 | + "RW %u SPARSE \"%s\"\n" | |
206 | 206 | "\n" |
207 | 207 | "# The Disk Data Base \n" |
208 | 208 | "#DDB\n" |
... | ... | @@ -702,7 +702,7 @@ static int vmdk_create(const char *filename, int64_t total_size, |
702 | 702 | int fd, i; |
703 | 703 | VMDK4Header header; |
704 | 704 | uint32_t tmp, magic, grains, gd_size, gt_size, gt_count; |
705 | - char *desc_template = | |
705 | + static const char desc_template[] = | |
706 | 706 | "# Disk DescriptorFile\n" |
707 | 707 | "version=1\n" |
708 | 708 | "CID=%x\n" |
... | ... | @@ -791,8 +791,9 @@ static int vmdk_create(const char *filename, int64_t total_size, |
791 | 791 | real_filename = temp_str + 1; |
792 | 792 | if ((temp_str = strrchr(real_filename, ':')) != NULL) |
793 | 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 | 798 | /* write the descriptor */ |
798 | 799 | lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET); | ... | ... |
block.c
... | ... | @@ -190,7 +190,7 @@ void get_tmp_filename(char *filename, int size) |
190 | 190 | void get_tmp_filename(char *filename, int size) |
191 | 191 | { |
192 | 192 | int fd; |
193 | - char *tmpdir; | |
193 | + const char *tmpdir; | |
194 | 194 | /* XXX: race condition possible */ |
195 | 195 | tmpdir = getenv("TMPDIR"); |
196 | 196 | if (!tmpdir) | ... | ... |
exec.c
gdbstub.c
... | ... | @@ -205,7 +205,7 @@ static void hextomem(uint8_t *mem, const char *buf, int len) |
205 | 205 | } |
206 | 206 | |
207 | 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 | 210 | int len, csum, i; |
211 | 211 | uint8_t *p; |
... | ... | @@ -1259,7 +1259,7 @@ static void gdb_vm_stopped(void *opaque, int reason) |
1259 | 1259 | %x - target_ulong argument printed in hex. |
1260 | 1260 | %lx - 64-bit argument printed in hex. |
1261 | 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 | 1264 | va_list va; |
1265 | 1265 | char buf[256]; | ... | ... |
gdbstub.h
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | typedef void (*gdb_syscall_complete_cb)(CPUState *env, |
7 | 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 | 10 | int use_gdb_syscalls(void); |
11 | 11 | #ifdef CONFIG_USER_ONLY |
12 | 12 | int gdb_handlesig (CPUState *, int); | ... | ... |
hw/e1000.c
... | ... | @@ -949,7 +949,7 @@ pci_e1000_init(PCIBus *bus, NICInfo *nd, int devfn) |
949 | 949 | E1000State *d; |
950 | 950 | uint8_t *pci_conf; |
951 | 951 | uint16_t checksum = 0; |
952 | - char *info_str = "e1000"; | |
952 | + static const char info_str[] = "e1000"; | |
953 | 953 | int i; |
954 | 954 | |
955 | 955 | d = (E1000State *)pci_register_device(bus, "e1000", | ... | ... |
hw/sh.h
... | ... | @@ -43,6 +43,6 @@ void sh_serial_init (target_phys_addr_t base, int feat, |
43 | 43 | struct intc_source *bri_source); |
44 | 44 | |
45 | 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 | 48 | #endif | ... | ... |
hw/tc58128.c
... | ... | @@ -26,7 +26,7 @@ static tc58128_dev tc58128_devs[2]; |
26 | 26 | |
27 | 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 | 31 | int ret, blocks; |
32 | 32 | |
... | ... | @@ -175,7 +175,7 @@ static sh7750_io_device tc58128 = { |
175 | 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 | 180 | init_dev(&tc58128_devs[0], zone1); |
181 | 181 | init_dev(&tc58128_devs[1], zone2); | ... | ... |
hw/usb-net.c
... | ... | @@ -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 | 1020 | [STRING_MANUFACTURER] = "QEMU", |
1021 | 1021 | [STRING_PRODUCT] = "RNDIS/QEMU USB Network Device", |
1022 | 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 | 565 | { |
566 | 566 | int dir; |
567 | 567 | size_t len = 0; |
568 | - char *str = NULL; | |
568 | + const char *str = NULL; | |
569 | 569 | int pid; |
570 | 570 | int ret; |
571 | 571 | int i; |
... | ... | @@ -800,7 +800,7 @@ static int ohci_service_td(OHCIState *ohci, struct ohci_ed *ed) |
800 | 800 | { |
801 | 801 | int dir; |
802 | 802 | size_t len = 0; |
803 | - char *str = NULL; | |
803 | + const char *str = NULL; | |
804 | 804 | int pid; |
805 | 805 | int ret; |
806 | 806 | int i; | ... | ... |
linux-user/arm/nwfpe/fpopcode.h
... | ... | @@ -366,19 +366,19 @@ TABLE 5 |
366 | 366 | /* Get the rounding mode from the opcode. */ |
367 | 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 | 371 | extern const floatx80 floatx80Constant[]; |
372 | 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 | 377 | extern const float64 float64Constant[]; |
378 | 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 | 383 | extern const float32 float32Constant[]; |
384 | 384 | return float32Constant[nIndex]; | ... | ... |
linux-user/strace.c
... | ... | @@ -13,12 +13,12 @@ int do_strace=0; |
13 | 13 | |
14 | 14 | struct syscallname { |
15 | 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 | 19 | abi_long, abi_long, abi_long, |
20 | 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 | 131 | static long newselect_arg5 = 0; |
132 | 132 | |
133 | 133 | static void |
134 | -print_newselect(struct syscallname *name, | |
134 | +print_newselect(const struct syscallname *name, | |
135 | 135 | abi_long arg1, abi_long arg2, abi_long arg3, |
136 | 136 | abi_long arg4, abi_long arg5, abi_long arg6) |
137 | 137 | { |
... | ... | @@ -155,7 +155,7 @@ print_newselect(struct syscallname *name, |
155 | 155 | #endif |
156 | 156 | |
157 | 157 | static void |
158 | -print_semctl(struct syscallname *name, | |
158 | +print_semctl(const struct syscallname *name, | |
159 | 159 | abi_long arg1, abi_long arg2, abi_long arg3, |
160 | 160 | abi_long arg4, abi_long arg5, abi_long arg6) |
161 | 161 | { |
... | ... | @@ -165,7 +165,7 @@ print_semctl(struct syscallname *name, |
165 | 165 | } |
166 | 166 | |
167 | 167 | static void |
168 | -print_execve(struct syscallname *name, | |
168 | +print_execve(const struct syscallname *name, | |
169 | 169 | abi_long arg1, abi_long arg2, abi_long arg3, |
170 | 170 | abi_long arg4, abi_long arg5, abi_long arg6) |
171 | 171 | { |
... | ... | @@ -198,14 +198,15 @@ print_execve(struct syscallname *name, |
198 | 198 | |
199 | 199 | #ifdef TARGET_NR_ipc |
200 | 200 | static void |
201 | -print_ipc(struct syscallname *name, | |
201 | +print_ipc(const struct syscallname *name, | |
202 | 202 | abi_long arg1, abi_long arg2, abi_long arg3, |
203 | 203 | abi_long arg4, abi_long arg5, abi_long arg6) |
204 | 204 | { |
205 | 205 | switch(arg1) { |
206 | 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 | 210 | break; |
210 | 211 | default: |
211 | 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 | 220 | */ |
220 | 221 | |
221 | 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 | 225 | if( ret == -1 ) { |
225 | 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 | 239 | |
239 | 240 | #ifdef TARGET_NR__newselect |
240 | 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 | 244 | gemu_log(" = 0x" TARGET_ABI_FMT_lx " (", ret); |
244 | 245 | print_fdset(newselect_arg1,newselect_arg2); |
... | ... | @@ -256,7 +257,7 @@ print_syscall_ret_newselect(struct syscallname *name, abi_long ret) |
256 | 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 | 261 | #include "strace.list" |
261 | 262 | }; |
262 | 263 | |
... | ... | @@ -271,7 +272,7 @@ print_syscall(int num, |
271 | 272 | abi_long arg4, abi_long arg5, abi_long arg6) |
272 | 273 | { |
273 | 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 | 277 | gemu_log("%d ", getpid() ); |
277 | 278 | ... | ... |
m68k-dis.c
... | ... | @@ -546,13 +546,13 @@ extern const int m68k_numopcodes, m68k_numaliases; |
546 | 546 | |
547 | 547 | /* Local function prototypes. */ |
548 | 548 | |
549 | -const char * const fpcr_names[] = | |
549 | +static const char * const fpcr_names[] = | |
550 | 550 | { |
551 | 551 | "", "%fpiar", "%fpsr", "%fpiar/%fpsr", "%fpcr", |
552 | 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 | 557 | "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", |
558 | 558 | "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", |
... | ... | @@ -561,7 +561,7 @@ static char *const reg_names[] = |
561 | 561 | |
562 | 562 | /* Name of register halves for MAC/EMAC. |
563 | 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 | 566 | "%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", |
567 | 567 | "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%a7", |
... | ... | @@ -991,7 +991,7 @@ print_indexed (int basereg, |
991 | 991 | disassemble_info *info) |
992 | 992 | { |
993 | 993 | int word; |
994 | - static char *const scales[] = { "", ":2", ":4", ":8" }; | |
994 | + static const char *const scales[] = { "", ":2", ":4", ":8" }; | |
995 | 995 | bfd_vma base_disp; |
996 | 996 | bfd_vma outer_disp; |
997 | 997 | char buf[40]; |
... | ... | @@ -1106,7 +1106,7 @@ print_insn_arg (const char *d, |
1106 | 1106 | { |
1107 | 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 | 1110 | val = fetch_arg (buffer, place, 2, info); |
1111 | 1111 | (*info->fprintf_func) (info->stream, cacheFieldName[val]); |
1112 | 1112 | break; |
... | ... | @@ -1157,7 +1157,7 @@ print_insn_arg (const char *d, |
1157 | 1157 | /* FIXME: There's a problem here, different m68k processors call the |
1158 | 1158 | same address different names. This table can't get it right |
1159 | 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 | 1161 | = {{"%sfc", 0x000}, {"%dfc", 0x001}, {"%cacr", 0x002}, |
1162 | 1162 | {"%tc", 0x003}, {"%itt0",0x004}, {"%itt1", 0x005}, |
1163 | 1163 | {"%dtt0",0x006}, {"%dtt1",0x007}, {"%buscr",0x008}, |
... | ... | @@ -1201,7 +1201,7 @@ print_insn_arg (const char *d, |
1201 | 1201 | case 'M': |
1202 | 1202 | if (place == 'h') |
1203 | 1203 | { |
1204 | - static char *const scalefactor_name[] = { "<<", ">>" }; | |
1204 | + static const char *const scalefactor_name[] = { "<<", ">>" }; | |
1205 | 1205 | val = fetch_arg (buffer, place, 1, info); |
1206 | 1206 | (*info->fprintf_func) (info->stream, scalefactor_name[val]); |
1207 | 1207 | } |
... | ... | @@ -1633,7 +1633,7 @@ print_insn_arg (const char *d, |
1633 | 1633 | case '3': |
1634 | 1634 | { |
1635 | 1635 | int val = fetch_arg (buffer, place, 5, info); |
1636 | - char *name = 0; | |
1636 | + const char *name = 0; | |
1637 | 1637 | |
1638 | 1638 | switch (val) |
1639 | 1639 | { | ... | ... |
sh4-dis.c
... | ... | @@ -325,7 +325,7 @@ SH4AL-dsp SH4A |
325 | 325 | |
326 | 326 | typedef struct |
327 | 327 | { |
328 | - char *name; | |
328 | + const char *name; | |
329 | 329 | sh_arg_type arg[4]; |
330 | 330 | sh_nibble_type nibbles[9]; |
331 | 331 | unsigned int arch; |
... | ... | @@ -1386,13 +1386,13 @@ print_insn_ppi (field_b, info) |
1386 | 1386 | int field_b; |
1387 | 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 | 1391 | fprintf_ftype fprintf_fn = info->fprintf_func; |
1392 | 1392 | void *stream = info->stream; |
1393 | 1393 | unsigned int nib1, nib2, nib3; |
1394 | 1394 | unsigned int altnib1, nib4; |
1395 | - char *dc = NULL; | |
1395 | + const char *dc = NULL; | |
1396 | 1396 | const sh_opcode_info *op; |
1397 | 1397 | |
1398 | 1398 | if ((field_b & 0xe800) == 0) |
... | ... | @@ -1405,10 +1405,10 @@ print_insn_ppi (field_b, info) |
1405 | 1405 | } |
1406 | 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 | 1413 | if (field_b & 0x2000) |
1414 | 1414 | { | ... | ... |
slirp/ip_icmp.c
... | ... | @@ -207,12 +207,8 @@ end_error: |
207 | 207 | |
208 | 208 | #define ICMP_MAXDATALEN (IP_MSS-28) |
209 | 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 | 213 | unsigned hlen, shlen, s_ip_len; |
218 | 214 | register struct ip *ip; | ... | ... |
slirp/ip_icmp.h
... | ... | @@ -158,7 +158,8 @@ struct icmp { |
158 | 158 | (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) |
159 | 159 | |
160 | 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 | 163 | void icmp_reflect _P((struct mbuf *)); |
163 | 164 | |
164 | 165 | #endif | ... | ... |
slirp/misc.c
... | ... | @@ -307,7 +307,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
307 | 307 | socklen_t addrlen = sizeof(addr); |
308 | 308 | int opt; |
309 | 309 | int master = -1; |
310 | - char *argv[256]; | |
310 | + const char *argv[256]; | |
311 | 311 | #if 0 |
312 | 312 | char buff[256]; |
313 | 313 | #endif |
... | ... | @@ -411,7 +411,7 @@ fork_exec(struct socket *so, const char *ex, int do_pty) |
411 | 411 | } while (c); |
412 | 412 | |
413 | 413 | argv[i] = 0; |
414 | - execvp(argv[0], argv); | |
414 | + execvp(argv[0], (char **)argv); | |
415 | 415 | |
416 | 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 | 411 | int (*cpu_fprintf)(FILE *f, const char *fmt, ...), |
412 | 412 | int flags) |
413 | 413 | { |
414 | - static unsigned char *linux_reg_names[] = { | |
414 | + static const unsigned char *linux_reg_names[] = { | |
415 | 415 | "v0 ", "t0 ", "t1 ", "t2 ", "t3 ", "t4 ", "t5 ", "t6 ", |
416 | 416 | "t7 ", "s0 ", "s1 ", "s2 ", "s3 ", "s4 ", "s5 ", "fp ", |
417 | 417 | "a0 ", "a1 ", "a2 ", "a3 ", "a4 ", "a5 ", "t8 ", "t9 ", | ... | ... |
target-cris/translate.c
... | ... | @@ -123,7 +123,7 @@ typedef struct DisasContext { |
123 | 123 | int singlestep_enabled; |
124 | 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 | 128 | printf ("BUG: pc=%x %s %d\n", dc->pc, file, line); |
129 | 129 | fprintf (logfile, "BUG: pc=%x %s %d\n", dc->pc, file, line); | ... | ... |
vl.c
... | ... | @@ -1898,7 +1898,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) |
1898 | 1898 | return ret; |
1899 | 1899 | } |
1900 | 1900 | |
1901 | -static char *mux_help[] = { | |
1901 | +static const char * const mux_help[] = { | |
1902 | 1902 | "% h print this help\n\r", |
1903 | 1903 | "% x exit emulator\n\r", |
1904 | 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 | 1948 | break; |
1949 | 1949 | case 'x': |
1950 | 1950 | { |
1951 | - char *term = "QEMU: Terminated\n\r"; | |
1951 | + const char *term = "QEMU: Terminated\n\r"; | |
1952 | 1952 | chr->chr_write(chr,(uint8_t *)term,strlen(term)); |
1953 | 1953 | exit(0); |
1954 | 1954 | break; |
... | ... | @@ -3957,6 +3957,7 @@ int parse_host_src_port(struct sockaddr_in *haddr, |
3957 | 3957 | char *str = strdup(input_str); |
3958 | 3958 | char *host_str = str; |
3959 | 3959 | char *src_str; |
3960 | + const char *src_str2; | |
3960 | 3961 | char *ptr; |
3961 | 3962 | |
3962 | 3963 | /* |
... | ... | @@ -3975,10 +3976,11 @@ int parse_host_src_port(struct sockaddr_in *haddr, |
3975 | 3976 | if (parse_host_port(haddr, host_str) < 0) |
3976 | 3977 | goto fail; |
3977 | 3978 | |
3979 | + src_str2 = src_str; | |
3978 | 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 | 3984 | goto fail; |
3983 | 3985 | |
3984 | 3986 | free(str); |
... | ... | @@ -5164,7 +5166,7 @@ static int get_param_value(char *buf, int buf_size, |
5164 | 5166 | } |
5165 | 5167 | |
5166 | 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 | 5171 | const char *p; |
5170 | 5172 | int i; |
... | ... | @@ -5451,9 +5453,10 @@ static int drive_init(struct drive_opt *arg, int snapshot, |
5451 | 5453 | int cache; |
5452 | 5454 | int bdrv_flags; |
5453 | 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 | 5461 | if (check_params(buf, sizeof(buf), params, str) < 0) { |
5459 | 5462 | fprintf(stderr, "qemu: unknown parameter '%s' in '%s'\n", | ... | ... |