1
0
Fork 0

DBG: fixed various cppcheck warnings

This commit is contained in:
mrexodia 2017-07-06 16:15:40 +02:00
parent 66c006d703
commit 4631fbfc0f
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
4 changed files with 16 additions and 14 deletions

View File

@ -325,7 +325,6 @@ bool disasmgetstringat(duint addr, STRING_TYPE* type, char* ascii, char* unicode
// Save a few pointer casts
auto asciiData = (char*)data();
auto unicodeData = (wchar_t*)data();
// First check if this was an ASCII only string
if(isasciistring(data(), maxlen))
@ -346,9 +345,6 @@ bool disasmgetstringat(duint addr, STRING_TYPE* type, char* ascii, char* unicode
if(type)
*type = str_unicode;
// Determine string length only once, limited to output buffer size
int unicodeLength = min(int(wcslen(unicodeData)), maxlen);
// Convert UTF-16 string to UTF-8
std::string asciiData2 = StringUtils::Utf16ToUtf8((const wchar_t*)data());
memcpy(asciiData, asciiData2.c_str(), min((size_t(maxlen) + 1) * 2, asciiData2.size() + 1));

View File

@ -60,7 +60,6 @@ bool ModLoad(duint Base, duint Size, const char* FullPath)
// Copy the module path in the struct
MODINFO info;
memset(&info, 0, sizeof(info));
strcpy_s(info.path, FullPath);
// Break the module path into a directory and file name

View File

@ -19,10 +19,10 @@ struct MODIMPORTINFO
struct MODINFO
{
duint base; // Module base
duint size; // Module size
duint hash; // Full module name hash
duint entry; // Entry point
duint base = 0; // Module base
duint size = 0; // Module size
duint hash = 0; // Full module name hash
duint entry = 0; // Entry point
char name[MAX_MODULE_SIZE]; // Module name (without extension)
char extension[MAX_MODULE_SIZE]; // File extension
@ -31,12 +31,19 @@ struct MODINFO
std::vector<MODSECTIONINFO> sections;
std::vector<MODIMPORTINFO> imports;
HANDLE fileHandle;
DWORD loadedSize;
HANDLE fileMap;
ULONG_PTR fileMapVA;
HANDLE fileHandle = nullptr;
DWORD loadedSize = 0;
HANDLE fileMap = nullptr;
ULONG_PTR fileMapVA = 0;
int party; // Party. Currently used value: 0: User, 1: System
MODINFO()
{
memset(name, 0, sizeof(name));
memset(extension, 0, sizeof(extension));
memset(path, 0, sizeof(path));
}
};
bool ModLoad(duint Base, duint Size, const char* FullPath);

View File

@ -157,7 +157,7 @@ void SymDownloadAllSymbols(const char* SymbolStore)
return;
// Skip loading if there aren't any found modules
if(modList.size() <= 0)
if(modList.empty())
return;
// Backup the current symbol search path