VolumeDirectory: Use a range-based for loop in ComputeNameSize

This commit is contained in:
JosJuice 2016-12-25 23:01:42 +01:00
parent f3987d13ea
commit 3196f697bb
1 changed files with 2 additions and 5 deletions

View File

@ -477,14 +477,11 @@ void CVolumeDirectory::WriteEntry(const File::FSTEntry& entry, u32& fstOffset, u
static u32 ComputeNameSize(const File::FSTEntry& parentEntry) static u32 ComputeNameSize(const File::FSTEntry& parentEntry)
{ {
u32 nameSize = 0; u32 nameSize = 0;
const std::vector<File::FSTEntry>& children = parentEntry.children; for (const File::FSTEntry& entry : parentEntry.children)
for (auto it = children.cbegin(); it != children.cend(); ++it)
{ {
const File::FSTEntry& entry = *it;
if (entry.isDirectory) if (entry.isDirectory)
{
nameSize += ComputeNameSize(entry); nameSize += ComputeNameSize(entry);
}
nameSize += (u32)entry.virtualName.length() + 1; nameSize += (u32)entry.virtualName.length() + 1;
} }
return nameSize; return nameSize;