Some cleanup

This commit is contained in:
Baptiste Wicht 2016-08-25 22:49:43 +02:00
parent d936fbae19
commit 623294dd35
4 changed files with 9 additions and 19 deletions

View File

@ -955,9 +955,7 @@ fat32::cluster_entry* fat32::fat32_file_system::find_free_entry(std::unique_heap
//remove the end of directory markers //remove the end of directory markers
if(end_found){ if(end_found){
//Remove all the end of directory marker in the cluster //Remove all the end of directory marker in the cluster
for(size_t i = 0; i < directory_cluster.size(); ++i){ for(auto& entry : directory_cluster){
auto& entry = directory_cluster[i];
if(end_of_directory(entry)){ if(end_of_directory(entry)){
entry.name[0] = 0xE5; entry.name[0] = 0xE5;
} }
@ -1018,9 +1016,7 @@ fat32::cluster_entry* fat32::fat32_file_system::extend_directory(std::unique_hea
} }
//Remove all the end of directory marker in the previous cluster //Remove all the end of directory marker in the previous cluster
for(size_t i = 0; i < directory_cluster.size(); ++i){ for(auto& entry : directory_cluster){
auto& entry = directory_cluster[i];
if(end_of_directory(entry)){ if(end_of_directory(entry)){
entry.name[0] = 0xE5; entry.name[0] = 0xE5;
} }

View File

@ -243,9 +243,7 @@ void sc_pwd(interrupt::syscall_regs* regs){
auto p = wd.string(); auto p = wd.string();
auto buffer = reinterpret_cast<char*>(regs->rbx); auto buffer = reinterpret_cast<char*>(regs->rbx);
for(size_t i = 0; i < p.size(); ++i){ std::copy(p.begin(), p.end(), buffer);
buffer[i] = p[i];
}
buffer[p.size()] = '\0'; buffer[p.size()] = '\0';
} }

View File

@ -214,10 +214,10 @@ void stdio::virtual_terminal::set_mouse(bool m){
} }
void stdio::init_terminals(){ void stdio::init_terminals(){
for(size_t i = 0; i < MAX_TERMINALS; ++i){ size_t id = 0;
auto& terminal = terminals[i];
terminal.id = i; for(auto& terminal : terminals){
terminal.id = i++;
terminal.active = false; terminal.active = false;
terminal.canonical = true; terminal.canonical = true;
terminal.mouse = false; terminal.mouse = false;
@ -228,9 +228,7 @@ void stdio::init_terminals(){
} }
void stdio::finalize(){ void stdio::finalize(){
for(size_t i = 0; i < MAX_TERMINALS; ++i){ for(auto& terminal : terminals){
auto& terminal = terminals[i];
auto* user_stack = new char[scheduler::user_stack_size]; auto* user_stack = new char[scheduler::user_stack_size];
auto* kernel_stack = new char[scheduler::kernel_stack_size]; auto* kernel_stack = new char[scheduler::kernel_stack_size];

View File

@ -122,7 +122,7 @@ mounted_fs& get_fs(const path& base_path){
} }
} }
return mount_point_list[best_match];; return mount_point_list[best_match];
} }
path get_fs_path(const path& base_path, const mounted_fs& fs){ path get_fs_path(const path& base_path, const mounted_fs& fs){
@ -547,9 +547,7 @@ int64_t vfs::entries(size_t fd, char* buffer, size_t size){
} }
char* name_buffer = &(entry->name); char* name_buffer = &(entry->name);
for(size_t j = 0; j < file.file_name.size(); ++j){ std::copy(file.file_name.begin(), file.file_name.end(), name_buffer);
name_buffer[j] = file.file_name[j];
}
name_buffer[file.file_name.size()] = '\0'; name_buffer[file.file_name.size()] = '\0';
} }