From 08bc19bf515e4f8b4775f9b9ba20d27b01257e89 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 6 Aug 2016 16:16:41 -0400 Subject: [PATCH] SysConf: Use range-based for loops in sysconf generation Same thing, nicer looking --- Source/Core/Common/SysConf.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/Core/Common/SysConf.cpp b/Source/Core/Common/SysConf.cpp index 2c9e3e5347..d6aed4f29e 100644 --- a/Source/Core/Common/SysConf.cpp +++ b/Source/Core/Common/SysConf.cpp @@ -330,9 +330,9 @@ void SysConf::GenerateSysConf() // Write the header and item offsets g.WriteBytes(&s_Header.version, sizeof(s_Header.version)); g.WriteBytes(&s_Header.numEntries, sizeof(u16)); - for (int i = 0; i != 27; ++i) + for (const auto& item : items) { - const u16 tmp_offset = Common::swap16(items[i].offset); + const u16 tmp_offset = Common::swap16(item.offset); g.WriteBytes(&tmp_offset, 2); } const u16 end_data_offset = Common::swap16(current_offset); @@ -340,30 +340,30 @@ void SysConf::GenerateSysConf() // Write the items const u8 null_byte = 0; - for (int i = 0; i != 27; ++i) + for (const auto& item : items) { - u8 description = (items[i].type << 5) | (items[i].nameLength - 1); + u8 description = (item.type << 5) | (item.nameLength - 1); g.WriteBytes(&description, sizeof(description)); - g.WriteBytes(&items[i].name, items[i].nameLength); - switch (items[i].type) + g.WriteBytes(&item.name, item.nameLength); + switch (item.type) { case Type_BigArray: { - const u16 tmpDataLength = Common::swap16(items[i].dataLength); + const u16 tmpDataLength = Common::swap16(item.dataLength); g.WriteBytes(&tmpDataLength, 2); - g.WriteBytes(items[i].data, items[i].dataLength); + g.WriteBytes(item.data, item.dataLength); g.WriteBytes(&null_byte, 1); } break; case Type_SmallArray: - g.WriteBytes(&items[i].dataLength, 1); - g.WriteBytes(items[i].data, items[i].dataLength); + g.WriteBytes(&item.dataLength, 1); + g.WriteBytes(item.data, item.dataLength); g.WriteBytes(&null_byte, 1); break; default: - g.WriteBytes(items[i].data, items[i].dataLength); + g.WriteBytes(item.data, item.dataLength); break; } }