From bdf9ac4fd1ab2d069d46e9f8060e3479822d4c37 Mon Sep 17 00:00:00 2001 From: John Ratliff Date: Sat, 17 Sep 2022 16:54:45 -0400 Subject: [PATCH] use braced initializer lists --- source/model/gbgggamegeniecode.cc | 2 +- source/model/genesisgamegeniecode.cc | 2 +- source/model/nesgamegeniecode.cc | 2 +- source/model/snesgamegeniecode.cc | 2 +- source/tools/decoder.cc | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/model/gbgggamegeniecode.cc b/source/model/gbgggamegeniecode.cc index e8141e2..e5df96a 100644 --- a/source/model/gbgggamegeniecode.cc +++ b/source/model/gbgggamegeniecode.cc @@ -30,7 +30,7 @@ const char GBGGGameGenieCode::ALPHABET[] = {'0', '1', '2', '3', '4', '5', auto GBGGGameGenieCode::create(const QString &code) -> GBGGGameGenieCode { if (isValidCode(code)) { - return GBGGGameGenieCode(code); + return {code}; } throw InvalidGameGenieCodeException(); diff --git a/source/model/genesisgamegeniecode.cc b/source/model/genesisgamegeniecode.cc index 7a2d793..7a57bc1 100644 --- a/source/model/genesisgamegeniecode.cc +++ b/source/model/genesisgamegeniecode.cc @@ -31,7 +31,7 @@ const char GenesisGameGenieCode::ALPHABET[] = { auto GenesisGameGenieCode::create(const QString &code) -> GenesisGameGenieCode { if (isValidCode(code)) { - return GenesisGameGenieCode(code); + return {code}; } throw InvalidGameGenieCodeException(); diff --git a/source/model/nesgamegeniecode.cc b/source/model/nesgamegeniecode.cc index 7d20db0..823d7a1 100644 --- a/source/model/nesgamegeniecode.cc +++ b/source/model/nesgamegeniecode.cc @@ -30,7 +30,7 @@ const char NESGameGenieCode::ALPHABET[] = {'A', 'P', 'Z', 'L', 'G', 'I', auto NESGameGenieCode::create(const QString &code) -> NESGameGenieCode { if (isValidCode(code)) { - return NESGameGenieCode(code); + return {code}; } throw InvalidGameGenieCodeException(); diff --git a/source/model/snesgamegeniecode.cc b/source/model/snesgamegeniecode.cc index 8211cb3..9a13b70 100644 --- a/source/model/snesgamegeniecode.cc +++ b/source/model/snesgamegeniecode.cc @@ -30,7 +30,7 @@ const char SNESGameGenieCode::ALPHABET[] = {'D', 'F', '4', '7', '0', '9', auto SNESGameGenieCode::create(const QString &code) -> SNESGameGenieCode { if (isValidCode(code)) { - return SNESGameGenieCode(code); + return {code}; } throw InvalidGameGenieCodeException(); diff --git a/source/tools/decoder.cc b/source/tools/decoder.cc index e225699..66f0701 100644 --- a/source/tools/decoder.cc +++ b/source/tools/decoder.cc @@ -73,7 +73,7 @@ auto Decoder::decodeGBGG(const GameGenieCode &code) -> GBGGRawCode { address = (int)((bitstring >> 16) & 0xFFF) | temp; if (length == 7) { - return GBGGRawCode(address, value); + return {address, value}; } temp = (int)(((bitstring >> 4) & 0xF0) | (bitstring & 0xF)); @@ -81,7 +81,7 @@ auto Decoder::decodeGBGG(const GameGenieCode &code) -> GBGGRawCode { int compare = temp ^ 0xBA; - return GBGGRawCode(address, value, compare); + return {address, value, compare}; } auto Decoder::decodeGenesis(const GameGenieCode &code) -> GenesisRawCode { @@ -137,7 +137,7 @@ auto Decoder::decodeGenesis(const GameGenieCode &code) -> GenesisRawCode { address <<= 8; address |= temp; - return GenesisRawCode(address, value); + return {address, value}; } auto Decoder::decodeNES(const GameGenieCode &code) -> NESRawCode { @@ -198,7 +198,7 @@ auto Decoder::decodeNES(const GameGenieCode &code) -> NESRawCode { address |= temp; if (length == 6) { - return NESRawCode(address, value); + return {address, value}; } int compare; @@ -211,7 +211,7 @@ auto Decoder::decodeNES(const GameGenieCode &code) -> NESRawCode { compare <<= 4; compare |= temp; - return NESRawCode(address, value, compare); + return {address, value, compare}; } auto Decoder::decodeSNES(const GameGenieCode &code) -> SNESRawCode { @@ -270,5 +270,5 @@ auto Decoder::decodeSNES(const GameGenieCode &code) -> SNESRawCode { address <<= 4; address |= temp; - return SNESRawCode(address, value); + return {address, value}; }