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