Commit 916a2cdf authored by Stephen Anthony's avatar Stephen Anthony
Browse files

Fixes for suggestions from cppcheck.

parent 21438a82
Pipeline #9193 passed with stages
in 2 minutes and 4 seconds
...@@ -565,7 +565,7 @@ Int32 HighScoresManager::fromBCD(uInt8 bcd) const ...@@ -565,7 +565,7 @@ Int32 HighScoresManager::fromBCD(uInt8 bcd) const
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string HighScoresManager::hash(ScoresData& data) const string HighScoresManager::hash(const ScoresData& data) const
{ {
ostringstream buf; ostringstream buf;
......
...@@ -54,31 +54,31 @@ namespace HSM { ...@@ -54,31 +54,31 @@ namespace HSM {
struct ScoresProps { struct ScoresProps {
// Formats // Formats
uInt32 numDigits; uInt32 numDigits{0};
uInt32 trailingZeroes; uInt32 trailingZeroes{0};
bool scoreBCD; bool scoreBCD{false};
bool scoreInvert; bool scoreInvert{false};
bool varsBCD; bool varsBCD{false};
bool varsZeroBased; bool varsZeroBased{false};
string special; string special;
bool specialBCD; bool specialBCD{false};
bool specialZeroBased; bool specialZeroBased{false};
string notes; string notes;
// Addresses // Addresses
ScoreAddresses scoreAddr; ScoreAddresses scoreAddr;
uInt16 varsAddr; uInt16 varsAddr{0};
uInt16 specialAddr; uInt16 specialAddr{0};
}; };
struct ScoreEntry { struct ScoreEntry {
Int32 score; Int32 score{0};
Int32 special; Int32 special{0};
string name; string name;
string date; string date;
}; };
struct ScoresData { struct ScoresData {
Int32 variation; Int32 variation{0};
string md5; string md5;
ScoreEntry scores[NUM_RANKS]; ScoreEntry scores[NUM_RANKS];
}; };
...@@ -232,7 +232,7 @@ class HighScoresManager ...@@ -232,7 +232,7 @@ class HighScoresManager
uInt16 fromHexStr(const string& addr) const; uInt16 fromHexStr(const string& addr) const;
Int32 fromBCD(uInt8 bcd) const; Int32 fromBCD(uInt8 bcd) const;
string hash(HSM::ScoresData& data) const; string hash(const HSM::ScoresData& data) const;
/** /**
Loads the current high scores for this game and variation from the given JSON object. Loads the current high scores for this game and variation from the given JSON object.
......
...@@ -24,7 +24,7 @@ namespace { ...@@ -24,7 +24,7 @@ namespace {
class ProxyRepository : public KeyValueRepository { class ProxyRepository : public KeyValueRepository {
public: public:
ProxyRepository(KeyValueRepositoryAtomic& kvr, const string& key) ProxyRepository(KeyValueRepositoryAtomic& kvr, const string& key)
: myKvr(kvr), myKey(key) : myKvr{kvr}, myKey{key}
{} {}
std::map<string, Variant> load() override { std::map<string, Variant> load() override {
...@@ -55,7 +55,7 @@ namespace { ...@@ -55,7 +55,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CompositeKVRJsonAdapter::CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr) CompositeKVRJsonAdapter::CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr)
: myKvr(kvr) : myKvr{kvr}
{} {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
class CompositeKVRJsonAdapter : public CompositeKeyValueRepository { class CompositeKVRJsonAdapter : public CompositeKeyValueRepository {
public: public:
CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr); explicit CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr);
shared_ptr<KeyValueRepository> get(const string& key) override; shared_ptr<KeyValueRepository> get(const string& key) override;
......
...@@ -29,11 +29,13 @@ class CompositeKeyValueRepositoryNoop : public CompositeKeyValueRepositoryAtomic ...@@ -29,11 +29,13 @@ class CompositeKeyValueRepositoryNoop : public CompositeKeyValueRepositoryAtomic
using CompositeKeyValueRepositoryAtomic::remove; using CompositeKeyValueRepositoryAtomic::remove;
using CompositeKeyValueRepositoryAtomic::get; using CompositeKeyValueRepositoryAtomic::get;
shared_ptr<KeyValueRepository> get(const string& key) { return make_shared<KeyValueRepositoryNoop>(); } shared_ptr<KeyValueRepository> get(const string& key) override {
return make_shared<KeyValueRepositoryNoop>();
}
bool has(const string& key) { return false; } bool has(const string& key) override { return false; }
void remove(const string& key) {} void remove(const string& key) override {}
}; };
#endif // COMPOSITE_KEY_VALUE_REPOSITORY_NOOP_HXX #endif // COMPOSITE_KEY_VALUE_REPOSITORY_NOOP_HXX
...@@ -27,7 +27,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepositoryFile<KeyValueRepos ...@@ -27,7 +27,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepositoryFile<KeyValueRepos
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::load; using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::load;
using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::save; using KeyValueRepositoryFile<KeyValueRepositoryConfigfile>::save;
KeyValueRepositoryConfigfile(const FilesystemNode& node); explicit KeyValueRepositoryConfigfile(const FilesystemNode& node);
static std::map<string, Variant> load(istream& in); static std::map<string, Variant> load(istream& in);
......
...@@ -46,7 +46,7 @@ class KeyValueRepositoryFile : public KeyValueRepository { ...@@ -46,7 +46,7 @@ class KeyValueRepositoryFile : public KeyValueRepository {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
template<class T> template<class T>
KeyValueRepositoryFile<T>::KeyValueRepositoryFile(const FilesystemNode& node) KeyValueRepositoryFile<T>::KeyValueRepositoryFile(const FilesystemNode& node)
: myNode(node) : myNode{node}
{} {}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
HighScoresMenu::HighScoresMenu(OSystem& osystem) HighScoresMenu::HighScoresMenu(OSystem& osystem)
: DialogContainer(osystem) : DialogContainer{osystem}
{ {
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment