Changed the constructor of fs::dir_entry to take 'std::string &&name' instead of 'const std::string &name' (#9913)

This commit is contained in:
npwoods 2022-06-11 08:24:49 -04:00 committed by GitHub
parent f47f9c3db3
commit 7f0905bec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View File

@ -286,10 +286,10 @@ std::vector<dir_entry> impl::root_dir::contents()
std::string fname = read_file_name(bdir.rodata()+off+3);
bool system = ref == 0 && id == 0 && bdir.r32b(off+0xb) == 0x2e535953;
if(system)
res.emplace_back(dir_entry(fname, dir_entry_type::system_file, 0));
res.emplace_back(dir_entry(std::move(fname), dir_entry_type::system_file, 0));
else if(m_fs.ref_valid(ref))
res.emplace_back(dir_entry(fname, dir_entry_type::file, id));
res.emplace_back(dir_entry(std::move(fname), dir_entry_type::file, id));
id++;
}

View File

@ -351,9 +351,9 @@ std::vector<dir_entry> impl::root_dir::contents()
auto name = blk.rstr(off+1, type & 0xf);
type >>= 4;
if(type == 0xd)
res.emplace_back(dir_entry(name, dir_entry_type::dir, id));
res.emplace_back(dir_entry(std::move(name), dir_entry_type::dir, id));
else if(type != 0)
res.emplace_back(dir_entry(name, dir_entry_type::file, id));
res.emplace_back(dir_entry(std::move(name), dir_entry_type::file, id));
off += 39;
id ++;
}

View File

@ -137,7 +137,7 @@ std::vector<dir_entry> vtech_image::impl::root_dir::contents()
if(bdir.r8(off+1) != ':')
continue;
std::string fname = trim_end_spaces(bdir.rstr(off+2, 8));
res.emplace_back(dir_entry(fname, dir_entry_type::file, id));
res.emplace_back(dir_entry(std::move(fname), dir_entry_type::file, id));
id++;
}
}

View File

@ -126,7 +126,7 @@ struct dir_entry {
dir_entry_type m_type;
u64 m_key;
dir_entry(const std::string &name, dir_entry_type type, u64 key) : m_name(name), m_type(type), m_key(key) {}
dir_entry(std::string &&name, dir_entry_type type, u64 key) : m_name(std::move(name)), m_type(type), m_key(key) {}
};
class fsblk_t {