Commit ffe8ab83da7a3c8cf19c0f8ebeb19db857707410

Authored by ths
1 parent 60fe76f3

Fix char* signedness, by Andre Przywara.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3816 c046a42c-6fe2-441c-8c8c-71466251a162
block-vpc.c
@@ -81,7 +81,7 @@ typedef struct BDRVVPCState { @@ -81,7 +81,7 @@ typedef struct BDRVVPCState {
81 81
82 static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename) 82 static int vpc_probe(const uint8_t *buf, int buf_size, const char *filename)
83 { 83 {
84 - if (buf_size >= 8 && !strncmp(buf, "conectix", 8)) 84 + if (buf_size >= 8 && !strncmp((char *)buf, "conectix", 8))
85 return 100; 85 return 100;
86 return 0; 86 return 0;
87 } 87 }
block-vvfat.c
@@ -565,7 +565,7 @@ static inline uint32_t fat_get(BDRVVVFATState* s,unsigned int cluster) @@ -565,7 +565,7 @@ static inline uint32_t fat_get(BDRVVVFATState* s,unsigned int cluster)
565 uint16_t* entry=array_get(&(s->fat),cluster); 565 uint16_t* entry=array_get(&(s->fat),cluster);
566 return le16_to_cpu(*entry); 566 return le16_to_cpu(*entry);
567 } else { 567 } else {
568 - const uint8_t* x=s->fat.pointer+cluster*3/2; 568 + const uint8_t* x=(uint8_t*)(s->fat.pointer)+cluster*3/2;
569 return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff; 569 return ((x[0]|(x[1]<<8))>>(cluster&1?4:0))&0x0fff;
570 } 570 }
571 } 571 }
@@ -626,7 +626,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s, @@ -626,7 +626,7 @@ static inline direntry_t* create_short_and_long_name(BDRVVVFATState* s,
626 626
627 entry=array_get_next(&(s->directory)); 627 entry=array_get_next(&(s->directory));
628 memset(entry->name,0x20,11); 628 memset(entry->name,0x20,11);
629 - strncpy(entry->name,filename,i); 629 + strncpy((char*)entry->name,filename,i);
630 630
631 if(j > 0) 631 if(j > 0)
632 for (i = 0; i < 3 && filename[j+1+i]; i++) 632 for (i = 0; i < 3 && filename[j+1+i]; i++)
@@ -868,7 +868,7 @@ static int init_directories(BDRVVVFATState* s, @@ -868,7 +868,7 @@ static int init_directories(BDRVVVFATState* s,
868 { 868 {
869 direntry_t* entry=array_get_next(&(s->directory)); 869 direntry_t* entry=array_get_next(&(s->directory));
870 entry->attributes=0x28; /* archive | volume label */ 870 entry->attributes=0x28; /* archive | volume label */
871 - snprintf(entry->name,11,"QEMU VVFAT"); 871 + snprintf((char*)entry->name,11,"QEMU VVFAT");
872 } 872 }
873 873
874 /* Now build FAT, and write back information into directory */ 874 /* Now build FAT, and write back information into directory */
@@ -1187,7 +1187,7 @@ static inline int read_cluster(BDRVVVFATState *s,int cluster_num) @@ -1187,7 +1187,7 @@ static inline int read_cluster(BDRVVVFATState *s,int cluster_num)
1187 s->current_mapping = mapping; 1187 s->current_mapping = mapping;
1188 read_cluster_directory: 1188 read_cluster_directory:
1189 offset = s->cluster_size*(cluster_num-s->current_mapping->begin); 1189 offset = s->cluster_size*(cluster_num-s->current_mapping->begin);
1190 - s->cluster = s->directory.pointer+offset 1190 + s->cluster = (unsigned char*)s->directory.pointer+offset
1191 + 0x20*s->current_mapping->info.dir.first_dir_index; 1191 + 0x20*s->current_mapping->info.dir.first_dir_index;
1192 assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0); 1192 assert(((s->cluster-(unsigned char*)s->directory.pointer)%s->cluster_size)==0);
1193 assert((char*)s->cluster+s->cluster_size <= s->directory.pointer+s->directory.next*s->directory.item_size); 1193 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, @@ -1457,7 +1457,7 @@ static int parse_long_name(long_file_name* lfn,
1457 } 1457 }
1458 1458
1459 if (pointer[0] & 0x40) 1459 if (pointer[0] & 0x40)
1460 - lfn->len = offset + strlen(lfn->name + offset); 1460 + lfn->len = offset + strlen((char*)lfn->name + offset);
1461 1461
1462 return 0; 1462 return 0;
1463 } 1463 }
@@ -1496,7 +1496,7 @@ static int parse_short_name(BDRVVVFATState* s, @@ -1496,7 +1496,7 @@ static int parse_short_name(BDRVVVFATState* s,
1496 } else 1496 } else
1497 lfn->name[i + j + 1] = '\0'; 1497 lfn->name[i + j + 1] = '\0';
1498 1498
1499 - lfn->len = strlen(lfn->name); 1499 + lfn->len = strlen((char*)lfn->name);
1500 1500
1501 return 0; 1501 return 0;
1502 } 1502 }
@@ -1792,8 +1792,8 @@ DLOG(fprintf(stderr, &quot;check direntry %d: \n&quot;, i); print_direntry(direntries + i) @@ -1792,8 +1792,8 @@ DLOG(fprintf(stderr, &quot;check direntry %d: \n&quot;, i); print_direntry(direntries + i)
1792 fprintf(stderr, "Error in short name (%d)\n", subret); 1792 fprintf(stderr, "Error in short name (%d)\n", subret);
1793 goto fail; 1793 goto fail;
1794 } 1794 }
1795 - if (subret > 0 || !strcmp(lfn.name, ".")  
1796 - || !strcmp(lfn.name, "..")) 1795 + if (subret > 0 || !strcmp((char*)lfn.name, ".")
  1796 + || !strcmp((char*)lfn.name, ".."))
1797 continue; 1797 continue;
1798 } 1798 }
1799 lfn.checksum = 0x100; /* cannot use long name twice */ 1799 lfn.checksum = 0x100; /* cannot use long name twice */
@@ -1802,7 +1802,7 @@ DLOG(fprintf(stderr, &quot;check direntry %d: \n&quot;, i); print_direntry(direntries + i) @@ -1802,7 +1802,7 @@ DLOG(fprintf(stderr, &quot;check direntry %d: \n&quot;, i); print_direntry(direntries + i)
1802 fprintf(stderr, "Name too long: %s/%s\n", path, lfn.name); 1802 fprintf(stderr, "Name too long: %s/%s\n", path, lfn.name);
1803 goto fail; 1803 goto fail;
1804 } 1804 }
1805 - strcpy(path2 + path_len + 1, lfn.name); 1805 + strcpy(path2 + path_len + 1, (char*)lfn.name);
1806 1806
1807 if (is_directory(direntries + i)) { 1807 if (is_directory(direntries + i)) {
1808 if (begin_of_direntry(direntries + i) == 0) { 1808 if (begin_of_direntry(direntries + i) == 0) {
@@ -2234,7 +2234,7 @@ static int commit_one_file(BDRVVVFATState* s, @@ -2234,7 +2234,7 @@ static int commit_one_file(BDRVVVFATState* s,
2234 assert(size >= 0); 2234 assert(size >= 0);
2235 2235
2236 ret = vvfat_read(s->bs, cluster2sector(s, c), 2236 ret = vvfat_read(s->bs, cluster2sector(s, c),
2237 - cluster, (rest_size + 0x1ff) / 0x200); 2237 + (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
2238 2238
2239 if (ret < 0) 2239 if (ret < 0)
2240 return ret; 2240 return ret;
gdbstub.c
@@ -209,7 +209,7 @@ static int put_packet(GDBState *s, char *buf) @@ -209,7 +209,7 @@ static int put_packet(GDBState *s, char *buf)
209 *(p++) = tohex((csum) & 0xf); 209 *(p++) = tohex((csum) & 0xf);
210 210
211 s->last_packet_len = p - s->last_packet; 211 s->last_packet_len = p - s->last_packet;
212 - put_buffer(s, s->last_packet, s->last_packet_len); 212 + put_buffer(s, (uint8_t *)s->last_packet, s->last_packet_len);
213 213
214 #ifdef CONFIG_USER_ONLY 214 #ifdef CONFIG_USER_ONLY
215 i = get_char(s); 215 i = get_char(s);
@@ -1189,7 +1189,7 @@ static void gdb_read_byte(GDBState *s, int ch) @@ -1189,7 +1189,7 @@ static void gdb_read_byte(GDBState *s, int ch)
1189 #ifdef DEBUG_GDB 1189 #ifdef DEBUG_GDB
1190 printf("Got NACK, retransmitting\n"); 1190 printf("Got NACK, retransmitting\n");
1191 #endif 1191 #endif
1192 - put_buffer(s, s->last_packet, s->last_packet_len); 1192 + put_buffer(s, (uint8_t *)s->last_packet, s->last_packet_len);
1193 } 1193 }
1194 #ifdef DEBUG_GDB 1194 #ifdef DEBUG_GDB
1195 else if (ch == '+') 1195 else if (ch == '+')
@@ -552,7 +552,7 @@ static void load_linux(const char *kernel_filename, @@ -552,7 +552,7 @@ static void load_linux(const char *kernel_filename,
552 initrd_max = ram_size-ACPI_DATA_SIZE-1; 552 initrd_max = ram_size-ACPI_DATA_SIZE-1;
553 553
554 /* kernel command line */ 554 /* kernel command line */
555 - pstrcpy(cmdline_addr, 4096, kernel_cmdline); 555 + pstrcpy((char*)cmdline_addr, 4096, kernel_cmdline);
556 556
557 if (protocol >= 0x202) { 557 if (protocol >= 0x202) {
558 stl_p(header+0x228, cmdline_addr-phys_ram_base); 558 stl_p(header+0x228, cmdline_addr-phys_ram_base);
@@ -1610,7 +1610,7 @@ void qemu_chr_printf(CharDriverState *s, const char *fmt, ...) @@ -1610,7 +1610,7 @@ void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
1610 va_list ap; 1610 va_list ap;
1611 va_start(ap, fmt); 1611 va_start(ap, fmt);
1612 vsnprintf(buf, sizeof(buf), fmt, ap); 1612 vsnprintf(buf, sizeof(buf), fmt, ap);
1613 - qemu_chr_write(s, buf, strlen(buf)); 1613 + qemu_chr_write(s, (uint8_t *)buf, strlen(buf));
1614 va_end(ap); 1614 va_end(ap);
1615 } 1615 }
1616 1616
@@ -1699,7 +1699,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) @@ -1699,7 +1699,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
1699 (secs / 60) % 60, 1699 (secs / 60) % 60,
1700 secs % 60, 1700 secs % 60,
1701 (int)((ti / 1000000) % 1000)); 1701 (int)((ti / 1000000) % 1000));
1702 - d->drv->chr_write(d->drv, buf1, strlen(buf1)); 1702 + d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1));
1703 } 1703 }
1704 } 1704 }
1705 } 1705 }
@@ -1728,15 +1728,16 @@ static void mux_print_help(CharDriverState *chr) @@ -1728,15 +1728,16 @@ static void mux_print_help(CharDriverState *chr)
1728 sprintf(cbuf,"\n\r"); 1728 sprintf(cbuf,"\n\r");
1729 sprintf(ebuf,"C-%c", term_escape_char - 1 + 'a'); 1729 sprintf(ebuf,"C-%c", term_escape_char - 1 + 'a');
1730 } else { 1730 } else {
1731 - sprintf(cbuf,"\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r", term_escape_char); 1731 + sprintf(cbuf,"\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r",
  1732 + term_escape_char);
1732 } 1733 }
1733 - chr->chr_write(chr, cbuf, strlen(cbuf)); 1734 + chr->chr_write(chr, (uint8_t *)cbuf, strlen(cbuf));
1734 for (i = 0; mux_help[i] != NULL; i++) { 1735 for (i = 0; mux_help[i] != NULL; i++) {
1735 for (j=0; mux_help[i][j] != '\0'; j++) { 1736 for (j=0; mux_help[i][j] != '\0'; j++) {
1736 if (mux_help[i][j] == '%') 1737 if (mux_help[i][j] == '%')
1737 - chr->chr_write(chr, ebuf, strlen(ebuf)); 1738 + chr->chr_write(chr, (uint8_t *)ebuf, strlen(ebuf));
1738 else 1739 else
1739 - chr->chr_write(chr, &mux_help[i][j], 1); 1740 + chr->chr_write(chr, (uint8_t *)&mux_help[i][j], 1);
1740 } 1741 }
1741 } 1742 }
1742 } 1743 }
@@ -1755,7 +1756,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) @@ -1755,7 +1756,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch)
1755 case 'x': 1756 case 'x':
1756 { 1757 {
1757 char *term = "QEMU: Terminated\n\r"; 1758 char *term = "QEMU: Terminated\n\r";
1758 - chr->chr_write(chr,term,strlen(term)); 1759 + chr->chr_write(chr,(uint8_t *)term,strlen(term));
1759 exit(0); 1760 exit(0);
1760 break; 1761 break;
1761 } 1762 }
@@ -5778,7 +5779,7 @@ static int qemu_savevm_state(QEMUFile *f) @@ -5778,7 +5779,7 @@ static int qemu_savevm_state(QEMUFile *f)
5778 /* ID string */ 5779 /* ID string */
5779 len = strlen(se->idstr); 5780 len = strlen(se->idstr);
5780 qemu_put_byte(f, len); 5781 qemu_put_byte(f, len);
5781 - qemu_put_buffer(f, se->idstr, len); 5782 + qemu_put_buffer(f, (uint8_t *)se->idstr, len);
5782 5783
5783 qemu_put_be32(f, se->instance_id); 5784 qemu_put_be32(f, se->instance_id);
5784 qemu_put_be32(f, se->version_id); 5785 qemu_put_be32(f, se->version_id);
@@ -5839,7 +5840,7 @@ static int qemu_loadvm_state(QEMUFile *f) @@ -5839,7 +5840,7 @@ static int qemu_loadvm_state(QEMUFile *f)
5839 if (qemu_ftell(f) >= end_pos) 5840 if (qemu_ftell(f) >= end_pos)
5840 break; 5841 break;
5841 len = qemu_get_byte(f); 5842 len = qemu_get_byte(f);
5842 - qemu_get_buffer(f, idstr, len); 5843 + qemu_get_buffer(f, (uint8_t *)idstr, len);
5843 idstr[len] = '\0'; 5844 idstr[len] = '\0';
5844 instance_id = qemu_get_be32(f); 5845 instance_id = qemu_get_be32(f);
5845 version_id = qemu_get_be32(f); 5846 version_id = qemu_get_be32(f);