X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=block-vvfat.c;h=623ba986a6630df8dfa03de91f39f1da78d3f432;hb=487414f1cbd638beb0227c7da71fe7b8a821e155;hp=7d4c934d3f6b6c179c5e4ce18cba38de0412d7b5;hpb=cd390083ad1fea1ddb93df9c5560eba0a9f26a0d;p=qemu.git diff --git a/block-vvfat.c b/block-vvfat.c index 7d4c934d3..623ba986a 100644 --- a/block-vvfat.c +++ b/block-vvfat.c @@ -159,7 +159,7 @@ static inline int array_roll(array_t* array,int index_to,int index_from,int coun is=array->item_size; from=array->pointer+index_from*is; to=array->pointer+index_to*is; - buf=malloc(is*count); + buf=qemu_malloc(is*count); memcpy(buf,from,is*count); if(index_tod_name); if(stat(buffer,&st)<0) { @@ -847,8 +846,7 @@ static int init_directories(BDRVVVFATState* s, memset(&(s->first_sectors[0]),0,0x40*0x200); s->cluster_size=s->sectors_per_cluster*0x200; - s->cluster_buffer=malloc(s->cluster_size); - assert(s->cluster_buffer); + s->cluster_buffer=qemu_malloc(s->cluster_size); /* * The formula: sc = spf+1+spf*spc*(512*8/fat_type), @@ -1249,7 +1247,7 @@ static void print_direntry(const direntry_t* direntry) unsigned char* c=(unsigned char*)direntry; int i; for(i=1;i<11 && c[i] && c[i]!=0xff;i+=2) -#define ADD_CHAR(c) {buffer[j] = (c); if (buffer[j] < ' ') buffer[j] = '°'; j++;} +#define ADD_CHAR(c) {buffer[j] = (c); if (buffer[j] < ' ') buffer[j] = 0xb0; j++;} ADD_CHAR(c[i]); for(i=14;i<26 && c[i] && c[i]!=0xff;i+=2) ADD_CHAR(c[i]); @@ -1485,7 +1483,7 @@ static int parse_short_name(BDRVVVFATState* s, if (direntry->name[i] <= ' ' || direntry->name[i] > 0x7f) return -1; else if (s->downcase_short_names) - lfn->name[i] = tolower(direntry->name[i]); + lfn->name[i] = qemu_tolower(direntry->name[i]); else lfn->name[i] = direntry->name[i]; } @@ -1498,7 +1496,7 @@ static int parse_short_name(BDRVVVFATState* s, if (direntry->extension[j] <= ' ' || direntry->extension[j] > 0x7f) return -2; else if (s->downcase_short_names) - lfn->name[i + j] = tolower(direntry->extension[j]); + lfn->name[i + j] = qemu_tolower(direntry->extension[j]); else lfn->name[i + j] = direntry->extension[j]; } @@ -1728,7 +1726,7 @@ static int check_directory_consistency(BDRVVVFATState *s, int cluster_num, const char* path) { int ret = 0; - unsigned char* cluster = malloc(s->cluster_size); + unsigned char* cluster = qemu_malloc(s->cluster_size); direntry_t* direntries = (direntry_t*)cluster; mapping_t* mapping = find_mapping_for_cluster(s, cluster_num); @@ -1869,7 +1867,7 @@ DLOG(checkpoint()); */ if (s->fat2 == NULL) { int size = 0x200 * s->sectors_per_fat; - s->fat2 = malloc(size); + s->fat2 = qemu_malloc(size); memcpy(s->fat2, s->fat.pointer, size); } check = vvfat_read(s->bs, @@ -2211,7 +2209,7 @@ static int commit_one_file(BDRVVVFATState* s, uint32_t first_cluster = c; mapping_t* mapping = find_mapping_for_cluster(s, c); uint32_t size = filesize_of_direntry(direntry); - char* cluster = malloc(s->cluster_size); + char* cluster = qemu_malloc(s->cluster_size); uint32_t i; int fd = 0; @@ -2373,7 +2371,7 @@ static int handle_renames_and_mkdirs(BDRVVVFATState* s) mapping_t* m = find_mapping_for_cluster(s, begin_of_direntry(d)); int l = strlen(m->path); - char* new_path = malloc(l + diff + 1); + char* new_path = qemu_malloc(l + diff + 1); assert(!strncmp(m->path, mapping->path, l2)); @@ -2774,7 +2772,7 @@ static int enable_write_target(BDRVVVFATState *s) array_init(&(s->commits), sizeof(commit_t)); - s->qcow_filename = malloc(1024); + s->qcow_filename = qemu_malloc(1024); get_tmp_filename(s->qcow_filename, 1024); if (bdrv_create(&bdrv_qcow, s->qcow_filename, s->sector_count, "fat:", 0) < 0) @@ -2848,4 +2846,3 @@ static void checkpoint(void) { print_direntry(NULL); } #endif -