summaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/file_util.cpp4
-rw-r--r--src/common/hash.cpp16
-rw-r--r--src/common/symbols.cpp41
-rw-r--r--src/common/symbols.h21
4 files changed, 29 insertions, 53 deletions
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 2fbb0f260..1e0d33313 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -821,8 +821,8 @@ void SplitFilename83(const std::string& filename, std::array<char, 9>& short_nam
const std::string forbidden_characters = ".\"/\\[]:;=, ";
// On a FAT32 partition, 8.3 names are stored as a 11 bytes array, filled with spaces.
- short_name = {' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\0'};
- extension = {' ', ' ', ' ', '\0'};
+ short_name = {{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '\0'}};
+ extension = {{' ', ' ', ' ', '\0'}};
std::string::size_type point = filename.rfind('.');
if (point == filename.size() - 1)
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index 413e9c6f1..c49c2f60e 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -17,27 +17,11 @@ namespace Common {
// Block read - if your platform needs to do endian-swapping or can only handle aligned reads, do
// the conversion here
-
-static FORCE_INLINE u32 getblock32(const u32* p, int i) {
- return p[i];
-}
-
static FORCE_INLINE u64 getblock64(const u64* p, int i) {
return p[i];
}
// Finalization mix - force all bits of a hash block to avalanche
-
-static FORCE_INLINE u32 fmix32(u32 h) {
- h ^= h >> 16;
- h *= 0x85ebca6b;
- h ^= h >> 13;
- h *= 0xc2b2ae35;
- h ^= h >> 16;
-
- return h;
-}
-
static FORCE_INLINE u64 fmix64(u64 k) {
k ^= k >> 33;
k *= 0xff51afd7ed558ccdllu;
diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp
index f23e51c9d..db8340043 100644
--- a/src/common/symbols.cpp
+++ b/src/common/symbols.cpp
@@ -8,46 +8,43 @@ TSymbolsMap g_symbols;
namespace Symbols
{
- bool HasSymbol(u32 _address)
+ bool HasSymbol(u32 address)
{
- return g_symbols.find(_address) != g_symbols.end();
+ return g_symbols.find(address) != g_symbols.end();
}
- void Add(u32 _address, const std::string& _name, u32 _size, u32 _type)
+ void Add(u32 address, const std::string& name, u32 size, u32 type)
{
- if (!HasSymbol(_address))
+ if (!HasSymbol(address))
{
TSymbol symbol;
- symbol.address = _address;
- symbol.name = _name;
- symbol.size = _size;
- symbol.type = _type;
+ symbol.address = address;
+ symbol.name = name;
+ symbol.size = size;
+ symbol.type = type;
- g_symbols.insert(TSymbolsPair(_address, symbol));
+ g_symbols.emplace(address, symbol);
}
}
- TSymbol GetSymbol(u32 _address)
+ TSymbol GetSymbol(u32 address)
{
- TSymbolsMap::iterator foundSymbolItr;
- TSymbol symbol;
+ const auto iter = g_symbols.find(address);
- foundSymbolItr = g_symbols.find(_address);
- if (foundSymbolItr != g_symbols.end())
- {
- symbol = (*foundSymbolItr).second;
- }
+ if (iter != g_symbols.end())
+ return iter->second;
- return symbol;
+ return {};
}
- const std::string GetName(u32 _address)
+
+ const std::string GetName(u32 address)
{
- return GetSymbol(_address).name;
+ return GetSymbol(address).name;
}
- void Remove(u32 _address)
+ void Remove(u32 address)
{
- g_symbols.erase(_address);
+ g_symbols.erase(address);
}
void Clear()
diff --git a/src/common/symbols.h b/src/common/symbols.h
index 6b62b011e..5ed16009c 100644
--- a/src/common/symbols.h
+++ b/src/common/symbols.h
@@ -12,15 +12,10 @@
struct TSymbol
{
- TSymbol() :
- address(0),
- size(0),
- type(0)
- {}
- u32 address;
+ u32 address = 0;
std::string name;
- u32 size;
- u32 type;
+ u32 size = 0;
+ u32 type = 0;
};
typedef std::map<u32, TSymbol> TSymbolsMap;
@@ -28,12 +23,12 @@ typedef std::pair<u32, TSymbol> TSymbolsPair;
namespace Symbols
{
- bool HasSymbol(u32 _address);
+ bool HasSymbol(u32 address);
- void Add(u32 _address, const std::string& _name, u32 _size, u32 _type);
- TSymbol GetSymbol(u32 _address);
- const std::string GetName(u32 _address);
- void Remove(u32 _address);
+ void Add(u32 address, const std::string& name, u32 size, u32 type);
+ TSymbol GetSymbol(u32 address);
+ const std::string GetName(u32 address);
+ void Remove(u32 address);
void Clear();
}