Change pointer casts to uint32_t to char*

This commit is contained in:
pjht 2019-04-22 08:48:13 -05:00
parent d8dade3fb3
commit c8bd8918cd
3 changed files with 6 additions and 6 deletions

View File

@ -75,10 +75,10 @@ void* kmalloc(uint32_t size) {
set_bmap_bit(bmap_index+i);
}
uint32_t data_offset=(bmap_index*8)+8;
uint32_t* info=(void*)(((uint32_t)data)+data_offset-8);
uint32_t* info=(void*)(((char*)data)+data_offset-8);
info[0]=num_4b_grps;
info[1]=bmap_index;
return (void*)(((uint32_t)data)+data_offset);
return (void*)(((char*)data)+data_offset);
}

View File

@ -250,7 +250,7 @@ dir_entry* get_dir_listing(uint32_t inode_num,FILE* f,int num) {
entries[num_entries_used].name[(int)current_entry->name_len]='\0';
num_entries_used++;
tot_size+=current_entry->rec_len;
current_entry=(ext2_dir_entry*)(((uint32_t)current_entry)+current_entry->rec_len);
current_entry=(ext2_dir_entry*)(((char*)current_entry)+current_entry->rec_len);
}
if(num_entries_used==max_len) {
max_len+=1;
@ -283,7 +283,7 @@ ext2_dir_entry* read_dir_entry(uint32_t inode_num,uint32_t dir_entry_num,FILE* f
}
ent_num++;
tot_size+=current_entry->rec_len;
current_entry=(ext2_dir_entry*)(((uint32_t)current_entry)+current_entry->rec_len);
current_entry=(ext2_dir_entry*)(((char*)current_entry)+current_entry->rec_len);
}
return NULL;
}

View File

@ -116,12 +116,12 @@ void* malloc(uint32_t size) {
set_bmap_bit(entry.bitmap,bmap_index+i);
}
uint32_t data_offset=(bmap_index*8)+12;
uint32_t* info=(void*)(((uint32_t)entry.data_block)+data_offset-12);
uint32_t* info=(void*)(((char*)entry.data_block)+data_offset-12);
info[0]=num_4b_grps;
info[1]=bmap_index;
info[2]=blk_indx;
entry.avail_data_size-=size+12;
return (void*)(((uint32_t)entry.data_block)+data_offset);
return (void*)(((char*)entry.data_block)+data_offset);
}