Common/CommonFuncs: Remove now-unneccessary ArraySize function

Since C++17, non-member std::size() is present in the standard library
which also operates on regular C arrays. Given that, we can just replace
usages of ArraySize with that where applicable.

In many cases, we can just change the actual C array ArraySize() was
called on into a std::array and just use its .size() member function
instead.

In some other cases, we can collapse the loops they were used in, into a
ranged-for loop, eliminating the need for en explicit bounds query.
This commit is contained in:
Lioncash 2019-06-01 07:55:09 -04:00
parent a4837a5c5d
commit a9663669dc
26 changed files with 280 additions and 229 deletions

View file

@ -4,11 +4,11 @@
#include "DiscIO/WiiSaveBanner.h"
#include <iterator>
#include <string>
#include <vector>
#include "Common/ColorUtil.h"
#include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h"
#include "Common/File.h"
#include "Common/NandPaths.h"
@ -47,12 +47,12 @@ WiiSaveBanner::WiiSaveBanner(const std::string& path) : m_path(path)
std::string WiiSaveBanner::GetName() const
{
return UTF16BEToUTF8(m_header.name, ArraySize(m_header.name));
return UTF16BEToUTF8(m_header.name, std::size(m_header.name));
}
std::string WiiSaveBanner::GetDescription() const
{
return UTF16BEToUTF8(m_header.description, ArraySize(m_header.description));
return UTF16BEToUTF8(m_header.description, std::size(m_header.description));
}
std::vector<u32> WiiSaveBanner::GetBanner(u32* width, u32* height) const