mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-22 16:58:28 -05:00
fsp_srv: Use std::string_view's copy() function instead of strncpy()
Given elements inserted into a vector are zeroed out, we can just copy MAX_LEN - 1 elements and the data will already be properly null terminated.
This commit is contained in:
@ -196,11 +196,7 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
|
||||
entries.reserve(entries.size() + new_data.size());
|
||||
|
||||
for (const auto& new_entry : new_data) {
|
||||
auto& entry = entries.emplace_back();
|
||||
entry.filename[0] = '\0';
|
||||
std::strncat(entry.filename, new_entry->GetName().c_str(), FileSys::FILENAME_LENGTH - 1);
|
||||
entry.type = type;
|
||||
entry.file_size = new_entry->GetSize();
|
||||
entries.emplace_back(new_entry->GetName(), type, new_entry->GetSize());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user