summaryrefslogtreecommitdiff
path: root/Source/Core/DiscIO/Src/NANDContentLoader.cpp
diff options
context:
space:
mode:
authorcomex <comexk@gmail.com>2013-10-29 01:09:01 -0400
committercomex <comexk@gmail.com>2013-11-03 20:54:01 -0500
commit965b32be9c38cb8f03632ab15f3a0d3aa98004af (patch)
tree8b27dd92a256dcbe0a41addf9ea4791332ed03dc /Source/Core/DiscIO/Src/NANDContentLoader.cpp
parent00fe5057f13bca3416b9d25a1fe9df27c514b29c (diff)
Run code through clang-modernize -loop-convert to create range-based for loops, and manually fix some stuff up.
Diffstat (limited to 'Source/Core/DiscIO/Src/NANDContentLoader.cpp')
-rw-r--r--Source/Core/DiscIO/Src/NANDContentLoader.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/Source/Core/DiscIO/Src/NANDContentLoader.cpp b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
index 4e722d1397..14845e56ea 100644
--- a/Source/Core/DiscIO/Src/NANDContentLoader.cpp
+++ b/Source/Core/DiscIO/Src/NANDContentLoader.cpp
@@ -44,14 +44,14 @@ CSharedContent::~CSharedContent()
std::string CSharedContent::GetFilenameFromSHA1(const u8* _pHash)
{
- for (size_t i=0; i<m_Elements.size(); i++)
+ for (auto& Element : m_Elements)
{
- if (memcmp(_pHash, m_Elements[i].SHA1Hash, 20) == 0)
+ if (memcmp(_pHash, Element.SHA1Hash, 20) == 0)
{
char szFilename[1024];
sprintf(szFilename, "%sshared1/%c%c%c%c%c%c%c%c.app", File::GetUserPath(D_WIIUSER_IDX).c_str(),
- m_Elements[i].FileName[0], m_Elements[i].FileName[1], m_Elements[i].FileName[2], m_Elements[i].FileName[3],
- m_Elements[i].FileName[4], m_Elements[i].FileName[5], m_Elements[i].FileName[6], m_Elements[i].FileName[7]);
+ Element.FileName[0], Element.FileName[1], Element.FileName[2], Element.FileName[3],
+ Element.FileName[4], Element.FileName[5], Element.FileName[6], Element.FileName[7]);
return szFilename;
}
}
@@ -154,9 +154,9 @@ CNANDContentLoader::CNANDContentLoader(const std::string& _rName)
CNANDContentLoader::~CNANDContentLoader()
{
- for (size_t i=0; i<m_Content.size(); i++)
+ for (auto& content : m_Content)
{
- delete [] m_Content[i].m_pData;
+ delete [] content.m_pData;
}
m_Content.clear();
if (m_TIK)
@@ -168,12 +168,11 @@ CNANDContentLoader::~CNANDContentLoader()
const SNANDContent* CNANDContentLoader::GetContentByIndex(int _Index) const
{
- for (size_t i=0; i<m_Content.size(); i++)
+ for (auto& Content : m_Content)
{
- const SNANDContent* pContent = &m_Content[i];
- if (pContent->m_Index == _Index)
+ if (Content.m_Index == _Index)
{
- return pContent;
+ return &Content;
}
}
return NULL;
@@ -413,11 +412,11 @@ cUIDsys::~cUIDsys()
u32 cUIDsys::GetUIDFromTitle(u64 _Title)
{
- for (size_t i=0; i<m_Elements.size(); i++)
+ for (auto& Element : m_Elements)
{
- if (Common::swap64(_Title) == *(u64*)&(m_Elements[i].titleID))
+ if (Common::swap64(_Title) == *(u64*)&(Element.titleID))
{
- return Common::swap32(m_Elements[i].UID);
+ return Common::swap32(Element.UID);
}
}
return 0;
@@ -445,11 +444,11 @@ void cUIDsys::AddTitle(u64 _TitleID)
void cUIDsys::GetTitleIDs(std::vector<u64>& _TitleIDs, bool _owned)
{
- for (size_t i = 0; i < m_Elements.size(); i++)
+ for (auto& Element : m_Elements)
{
- if ((_owned && Common::CheckTitleTIK(Common::swap64(m_Elements[i].titleID))) ||
- (!_owned && Common::CheckTitleTMD(Common::swap64(m_Elements[i].titleID))))
- _TitleIDs.push_back(Common::swap64(m_Elements[i].titleID));
+ if ((_owned && Common::CheckTitleTIK(Common::swap64(Element.titleID))) ||
+ (!_owned && Common::CheckTitleTMD(Common::swap64(Element.titleID))))
+ _TitleIDs.push_back(Common::swap64(Element.titleID));
}
}