Fix clang and coverity warnings
This commit is contained in:
parent
86ef5f8ae7
commit
0f7071a000
|
@ -97,6 +97,7 @@ void CheckOther::checkZeroDivision()
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
static char exename[1024] = {0};
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -115,7 +116,6 @@ int main(int argc, char* argv[])
|
|||
|
||||
CppCheckExecutor exec;
|
||||
#ifdef _WIN32
|
||||
char exename[1024] = {0};
|
||||
GetModuleFileNameA(NULL, exename, sizeof(exename)/sizeof(exename[0])-1);
|
||||
argv[0] = exename;
|
||||
#endif
|
||||
|
|
|
@ -425,14 +425,12 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::functionReturnType(const Function* f
|
|||
if (varid == 0)
|
||||
return No;
|
||||
|
||||
if (this != nullptr) {
|
||||
// If variable is not local then alloctype shall be "No"
|
||||
// Todo: there can be false negatives about mismatching allocation/deallocation.
|
||||
// => Generate "alloc ; use ;" if variable is not local?
|
||||
const Variable *var = tokenizer->getSymbolDatabase()->getVariableFromVarId(varid);
|
||||
if (!var || !var->isLocal() || var->isStatic())
|
||||
return No;
|
||||
}
|
||||
// If variable is not local then alloctype shall be "No"
|
||||
// Todo: there can be false negatives about mismatching allocation/deallocation.
|
||||
// => Generate "alloc ; use ;" if variable is not local?
|
||||
const Variable *var = tokenizer->getSymbolDatabase()->getVariableFromVarId(varid);
|
||||
if (!var || !var->isLocal() || var->isStatic())
|
||||
return No;
|
||||
|
||||
// Check if return pointer is allocated..
|
||||
AllocType allocType = No;
|
||||
|
|
|
@ -289,10 +289,11 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
|
|||
|
||||
else if (strcmp(markupnode->Name(), "codeblocks") == 0) {
|
||||
for (const tinyxml2::XMLElement *blocknode = markupnode->FirstChildElement(); blocknode; blocknode = blocknode->NextSiblingElement()) {
|
||||
if (strcmp(blocknode->Name(), "block") == 0)
|
||||
_executableblocks[extension].addBlock(blocknode->Attribute("name"));
|
||||
|
||||
else if (strcmp(blocknode->Name(), "structure") == 0) {
|
||||
if (strcmp(blocknode->Name(), "block") == 0) {
|
||||
const char * name = blocknode->Attribute("name");
|
||||
if (name)
|
||||
_executableblocks[extension].addBlock(blocknode->Attribute("name"));
|
||||
} else if (strcmp(blocknode->Name(), "structure") == 0) {
|
||||
const char * start = blocknode->Attribute("start");
|
||||
if (start)
|
||||
_executableblocks[extension].setStart(start);
|
||||
|
|
Loading…
Reference in New Issue