Fix char* signedness, by Andre Przywara.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3816 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2007-12-16 03:16:05 +00:00
parent 60fe76f386
commit ffe8ab83da
5 changed files with 24 additions and 23 deletions

View file

@ -81,7 +81,7 @@ typedef struct BDRVVPCState {
static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename) static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename)
{ {
if (buf_size >= 8 && !strncmp(buf, "conectix", 8)) if (buf_size >= 8 && !strncmp((char *)buf, "conectix", 8))
return 100; return 100;
return 0; return 0;
} }

View file

@ -565,7 +565,7 @@ static inline uint32_t fat_get(BDRVVVFATState* s,unsigned int cluster)
uint16_t* entry=array_get(&(s->fat),cluster); uint16_t* entry=array_get(&(s->fat),cluster);
return le16_to_cpu(*entry); return le16_to_cpu(*entry);
} else { } else {
const uint8_t* x=s->fat.pointer+cluster*3/2; const uint8_t* x=(uint8_t*)(s->fat.pointer)+cluster*3/2;
return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff; return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff;
} }
} }
@ -626,7 +626,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
entry=array_get_next(&(s->directory)); entry=array_get_next(&(s->directory));
memset(entry->name,0x20,11); memset(entry->name,0x20,11);
strncpy(entry->name,filename,i); strncpy((char*)entry->name,filename,i);
if(j > 0) if(j > 0)
for (i = 0; i < 3 && filename[j+1+i]; i++) for (i = 0; i < 3 && filename[j+1+i]; i++)
@ -868,7 +868,7 @@ static int init_directories(BDRVVVFATState* s,
{ {
direntry_t* entry=array_get_next(&(s->directory)); direntry_t* entry=array_get_next(&(s->directory));
entry->attributes=0x28; /* archive | volume label */ entry->attributes=0x28; /* archive | volume label */
snprintf(entry->name,11,"QEMU VVFAT"); snprintf((char*)entry->name,11,"QEMU VVFAT");
} }
/* Now build FAT, and write back information into directory */ /* Now build FAT, and write back information into directory */
@ -1187,7 +1187,7 @@ static inline int read_cluster(BDRVVVFATState *s,int cluster_num)
s->current_mapping = mapping; s->current_mapping = mapping;
read_cluster_directory: read_cluster_directory:
offset = s->cluster_size*(cluster_num-s->current_mapping->begin); offset = s->cluster_size*(cluster_num-s->current_mapping->begin);
s->cluster = s->directory.pointer+offset s->cluster = (unsigned char*)s->directory.pointer+offset
+ 0x20*s->current_mapping->info.dir.first_dir_index; + 0x20*s->current_mapping->info.dir.first_dir_index;
assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0); assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0);
assert((char*)s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size); assert((char*)s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size);
@ -1457,7 +1457,7 @@ static int parse_long_name(long_file_name* lfn,
} }
if (pointer[0] & 0x40) if (pointer[0] & 0x40)
lfn->len = offset + strlen(lfn->name + offset); lfn->len = offset + strlen((char*)lfn->name + offset);
return 0; return 0;
} }
@ -1496,7 +1496,7 @@ static int parse_short_name(BDRVVVFATState* s,
} else } else
lfn->name[i + j + 1] = '\0'; lfn->name[i + j + 1] = '\0';
lfn->len = strlen(lfn->name); lfn->len = strlen((char*)lfn->name);
return 0; return 0;
} }
@ -1792,8 +1792,8 @@ DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i)
fprintf(stderr, "Error in short name (%d)\n", subret); fprintf(stderr, "Error in short name (%d)\n", subret);
goto fail; goto fail;
} }
if (subret > 0 || !strcmp(lfn.name, ".") if (subret > 0 || !strcmp((char*)lfn.name, ".")
|| !strcmp(lfn.name, "..")) || !strcmp((char*)lfn.name, ".."))
continue; continue;
} }
lfn.checksum = 0x100; /* cannot use long name twice */ lfn.checksum = 0x100; /* cannot use long name twice */
@ -1802,7 +1802,7 @@ DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i)
fprintf(stderr, "Name too long: %s/%s\n", path, lfn.name); fprintf(stderr, "Name too long: %s/%s\n", path, lfn.name);
goto fail; goto fail;
} }
strcpy(path2 + path_len + 1, lfn.name); strcpy(path2 + path_len + 1, (char*)lfn.name);
if (is_directory(direntries + i)) { if (is_directory(direntries + i)) {
if (begin_of_direntry(direntries + i) == 0) { if (begin_of_direntry(direntries + i) == 0) {
@ -2234,7 +2234,7 @@ static int commit_one_file(BDRVVVFATState* s,
assert(size >= 0); assert(size >= 0);
ret = vvfat_read(s->bs, cluster2sector(s, c), ret = vvfat_read(s->bs, cluster2sector(s, c),
cluster, (rest_size + 0x1ff) / 0x200); (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
if (ret < 0) if (ret < 0)
return ret; return ret;

View file

@ -209,7 +209,7 @@ static int put_packet(GDBState *s, char *buf)
*(p++) = tohex((csum) & 0xf); *(p++) = tohex((csum) & 0xf);
s->last_packet_len = p - s->last_packet; s->last_packet_len = p - s->last_packet;
put_buffer(s, s->last_packet, s->last_packet_len); put_buffer(s, (uint8_t *)s->last_packet, s->last_packet_len);
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
i = get_char(s); i = get_char(s);
@ -1189,7 +1189,7 @@ static void gdb_read_byte(GDBState *s, int ch)
#ifdef DEBUG_GDB #ifdef DEBUG_GDB
printf("Got NACK, retransmitting\n"); printf("Got NACK, retransmitting\n");
#endif #endif
put_buffer(s, s->last_packet, s->last_packet_len); put_buffer(s, (uint8_t *)s->last_packet, s->last_packet_len);
} }
#ifdef DEBUG_GDB #ifdef DEBUG_GDB
else if (ch == '+') else if (ch == '+')

View file

@ -552,7 +552,7 @@ static void load_linux(const char *kernel_filename,
initrd_max = ram_size-ACPI_DATA_SIZE-1; initrd_max = ram_size-ACPI_DATA_SIZE-1;
/* kernel command line */ /* kernel command line */
pstrcpy(cmdline_addr, 4096, kernel_cmdline); pstrcpy((char*)cmdline_addr, 4096, kernel_cmdline);
if (protocol >= 0x202) { if (protocol >= 0x202) {
stl_p(header+0x228, cmdline_addr-phys_ram_base); stl_p(header+0x228, cmdline_addr-phys_ram_base);

19
vl.c
View file

@ -1610,7 +1610,7 @@ void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(buf, sizeof(buf), fmt, ap); vsnprintf(buf, sizeof(buf), fmt, ap);
qemu_chr_write(s, buf, strlen(buf)); qemu_chr_write(s, (uint8_t *)buf, strlen(buf));
va_end(ap); va_end(ap);
} }
@ -1699,7 +1699,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
(secs / 60) % 60, (secs / 60) % 60,
secs % 60, secs % 60,
(int)((ti / 1000000) % 1000)); (int)((ti / 1000000) % 1000));
d->drv->chr_write(d->drv, buf1, strlen(buf1)); d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1));
} }
} }
} }
@ -1728,15 +1728,16 @@ static void mux_print_help(CharDriverState *chr)
sprintf(cbuf,"\n\r"); sprintf(cbuf,"\n\r");
sprintf(ebuf,"C-%c", term_escape_char - 1 + 'a'); sprintf(ebuf,"C-%c", term_escape_char - 1 + 'a');
} else { } else {
sprintf(cbuf,"\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r", term_escape_char); sprintf(cbuf,"\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r",
term_escape_char);
} }
chr->chr_write(chr, cbuf, strlen(cbuf)); chr->chr_write(chr, (uint8_t *)cbuf, strlen(cbuf));
for (i = 0; mux_help[i] != NULL; i++) { for (i = 0; mux_help[i] != NULL; i++) {
for (j=0; mux_help[i][j] != '\0'; j++) { for (j=0; mux_help[i][j] != '\0'; j++) {
if (mux_help[i][j] == '%') if (mux_help[i][j] == '%')
chr->chr_write(chr, ebuf, strlen(ebuf)); chr->chr_write(chr, (uint8_t *)ebuf, strlen(ebuf));
else else
chr->chr_write(chr, &mux_help[i][j], 1); chr->chr_write(chr, (uint8_t *)&mux_help[i][j], 1);
} }
} }
} }
@ -1755,7 +1756,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
case 'x': case 'x':
{ {
char *term = "QEMU: Terminated\n\r"; char *term = "QEMU: Terminated\n\r";
chr->chr_write(chr,term,strlen(term)); chr->chr_write(chr,(uint8_t *)term,strlen(term));
exit(0); exit(0);
break; break;
} }
@ -5778,7 +5779,7 @@ static int qemu_savevm_state(QEMUFile *f)
/* ID string */ /* ID string */
len = strlen(se->idstr); len = strlen(se->idstr);
qemu_put_byte(f, len); qemu_put_byte(f, len);
qemu_put_buffer(f, se->idstr, len); qemu_put_buffer(f, (uint8_t *)se->idstr, len);
qemu_put_be32(f, se->instance_id); qemu_put_be32(f, se->instance_id);
qemu_put_be32(f, se->version_id); qemu_put_be32(f, se->version_id);
@ -5839,7 +5840,7 @@ static int qemu_loadvm_state(QEMUFile *f)
if (qemu_ftell(f) >= end_pos) if (qemu_ftell(f) >= end_pos)
break; break;
len = qemu_get_byte(f); len = qemu_get_byte(f);
qemu_get_buffer(f, idstr, len); qemu_get_buffer(f, (uint8_t *)idstr, len);
idstr[len] = '\0'; idstr[len] = '\0';
instance_id = qemu_get_be32(f); instance_id = qemu_get_be32(f);
version_id = qemu_get_be32(f); version_id = qemu_get_be32(f);