Skip to content

Commit

Permalink
use braced initializer lists
Browse files Browse the repository at this point in the history
  • Loading branch information
jdratlif committed Sep 17, 2022
1 parent d3c2f65 commit bdf9ac4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/model/gbgggamegeniecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion source/model/genesisgamegeniecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion source/model/nesgamegeniecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion source/model/snesgamegeniecode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions source/tools/decoder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ 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));
temp = (temp >> 2) | ((temp << 6) & 0xFC);

int compare = temp ^ 0xBA;

return GBGGRawCode(address, value, compare);
return {address, value, compare};
}

auto Decoder::decodeGenesis(const GameGenieCode &code) -> GenesisRawCode {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -270,5 +270,5 @@ auto Decoder::decodeSNES(const GameGenieCode &code) -> SNESRawCode {
address <<= 4;
address |= temp;

return SNESRawCode(address, value);
return {address, value};
}

0 comments on commit bdf9ac4

Please sign in to comment.