parent
77c479a6c4
commit
73251544a4
|
@ -3362,7 +3362,7 @@ The function 'mktemp' is considered to be dangerous due to race conditions and s
|
|||
<use-retval/>
|
||||
<returnValue type="int"/>
|
||||
<noreturn>false</noreturn>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
|
|
@ -444,11 +444,12 @@
|
|||
<!-- QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver, PointerToMemberFunction method, const QKeySequence &shortcut = ...) -->
|
||||
<!-- QAction *QMenu::addAction(const QIcon &icon, const QString &text, Functor functor, const QKeySequence &shortcut = ...) -->
|
||||
<!-- QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *context, Functor functor, const QKeySequence &shortcut = 0) -->
|
||||
<!-- void QWidget::addAction(QAction *action) -->
|
||||
<function name="QMenu::addAction">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="QAction *"/>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
</arg>
|
||||
|
|
22
cfg/std.cfg
22
cfg/std.cfg
|
@ -1584,7 +1584,7 @@
|
|||
<returnValue type="int"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -1595,7 +1595,7 @@
|
|||
<returnValue type="int"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -2290,7 +2290,7 @@
|
|||
<returnValue type="int"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -3815,7 +3815,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="void *"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<minsize type="argvalue" arg="3"/>
|
||||
|
@ -3838,7 +3838,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="wchar_t *"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<minsize type="argvalue" arg="3"/>
|
||||
|
@ -4851,7 +4851,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<valid>0:255</valid>
|
||||
</arg>
|
||||
</function>
|
||||
<!-- wchar_t wcschr(const wchar_t *cs, wchar_t c); -->
|
||||
<!-- wchar_t* wcschr(const wchar_t *cs, wchar_t c); -->
|
||||
<function name="wcschr,std::wcschr">
|
||||
<use-retval/>
|
||||
<returnValue type="wchar_t"/>
|
||||
|
@ -5154,7 +5154,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="char *"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<strz/>
|
||||
|
@ -5172,7 +5172,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="wchar_t *"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<strz/>
|
||||
|
@ -5429,7 +5429,7 @@ The obsolete function 'gets' is called. With 'gets' you'll get a buffer overrun
|
|||
<returnValue type="wchar_t *"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<strz/>
|
||||
|
@ -8263,7 +8263,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<noreturn>false</noreturn>
|
||||
<returnValue type="void"/>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
|
@ -8274,7 +8274,7 @@ initializer list (7) string& replace (const_iterator i1, const_iterator i2, init
|
|||
<noreturn>false</noreturn>
|
||||
<returnValue type="char *"/>
|
||||
<use-retval/>
|
||||
<arg nr="1">
|
||||
<arg nr="1" direction="in">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
|
|
|
@ -1749,7 +1749,7 @@
|
|||
<function name="CloseHandle">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="BOOL"/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
</function>
|
||||
|
@ -3901,7 +3901,7 @@ HFONT CreateFont(
|
|||
<not-uninit/>
|
||||
<not-null/>
|
||||
</arg>
|
||||
<arg nr="4" direction="in">
|
||||
<arg nr="4">
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
<arg nr="5" direction="in">
|
||||
|
@ -4772,7 +4772,7 @@ HFONT CreateFont(
|
|||
<function name="FreeLibrary">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="BOOL"/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
</arg>
|
||||
|
@ -4884,7 +4884,7 @@ HFONT CreateFont(
|
|||
<returnValue type="FARPROC"/>
|
||||
<use-retval/>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
<not-null/>
|
||||
|
@ -4971,7 +4971,7 @@ HFONT CreateFont(
|
|||
<noreturn>false</noreturn>
|
||||
<returnValue type="BOOL"/>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -5364,7 +5364,7 @@ HFONT CreateFont(
|
|||
<returnValue type="BOOL"/>
|
||||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-uninit/>
|
||||
<not-bool/>
|
||||
</arg>
|
||||
|
@ -6324,7 +6324,7 @@ HFONT CreateFont(
|
|||
<function name="LocalFree">
|
||||
<noreturn>false</noreturn>
|
||||
<returnValue type="HLOCAL"/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-bool/>
|
||||
</arg>
|
||||
</function>
|
||||
|
|
|
@ -6820,7 +6820,7 @@
|
|||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<returnValue type="wxSizerItem*"/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<!-- <not-null/> Deactivated due to FPs with overloaded function: wxSizerItem * Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) -->
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
@ -7309,7 +7309,7 @@
|
|||
<noreturn>false</noreturn>
|
||||
<leak-ignore/>
|
||||
<returnValue type="void"/>
|
||||
<arg nr="1" direction="in">
|
||||
<arg nr="1">
|
||||
<not-null/>
|
||||
<not-uninit/>
|
||||
</arg>
|
||||
|
|
|
@ -290,8 +290,8 @@ CodeEditor::CodeEditor(QWidget *parent) :
|
|||
QShortcut *copyText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_C),this);
|
||||
QShortcut *allText = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_A),this);
|
||||
#else
|
||||
QShortcut *copyText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),this);
|
||||
QShortcut *allText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A),this);
|
||||
const QShortcut *copyText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_C),this);
|
||||
const QShortcut *allText = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_A),this);
|
||||
#endif
|
||||
|
||||
connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
|
||||
|
|
|
@ -723,7 +723,7 @@ void ResultsTree::contextMenuEvent(QContextMenuEvent * e)
|
|||
mContextItem = mModel.itemFromIndex(index);
|
||||
if (mContextItem && mApplications->getApplicationCount() > 0 && mContextItem->parent()) {
|
||||
//Disconnect all signals
|
||||
for (QAction* action : actions) {
|
||||
for (const QAction* action : actions) {
|
||||
disconnect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1645,7 +1645,9 @@ void CheckOther::checkConstPointer()
|
|||
if (Token::simpleMatch(parent, "=") && parent->astOperand1() == tok)
|
||||
continue;
|
||||
if (const Token* ftok = getTokenArgumentFunction(tok, argn)) {
|
||||
if (ftok->function() && !parent->isCast()) {
|
||||
if (ftok->function()) {
|
||||
const bool isCastArg = parent->isCast() && !ftok->function()->getOverloadedFunctions().empty(); // assume that cast changes the called function
|
||||
if (!isCastArg) {
|
||||
const Variable* argVar = ftok->function()->getArgumentVar(argn);
|
||||
if (argVar && argVar->valueType() && argVar->valueType()->isConst(vt->pointer)) {
|
||||
bool inconclusive{};
|
||||
|
@ -1653,6 +1655,11 @@ void CheckOther::checkConstPointer()
|
|||
continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const auto dir = mSettings->library.getArgDirection(ftok, argn + 1);
|
||||
if (dir == Library::ArgumentChecks::Direction::DIR_IN)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (Token::simpleMatch(parent, "(")) {
|
||||
if (parent->isCast() && parent->valueType() && var->valueType() && parent->valueType()->isConst(var->valueType()->pointer))
|
||||
|
|
|
@ -4362,7 +4362,7 @@ std::vector<const Function*> Function::getOverloadedFunctions() const
|
|||
it != scope->functionMap.end() && it->first == tokenDef->str();
|
||||
++it) {
|
||||
const Function* func = it->second;
|
||||
if (isMemberFunction == func->isStatic())
|
||||
if (isMemberFunction && isMemberFunction == func->isStatic())
|
||||
continue;
|
||||
result.push_back(func);
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ void unreachableCode_error(void) // #11197
|
|||
}
|
||||
#endif
|
||||
|
||||
int nullPointer_gethostbyname2_r(const char* name, int af, struct hostent* ret, char* buf, size_t buflen, struct hostent** result, int* h_errnop)
|
||||
int nullPointer_gethostbyname2_r(const char* name, int af, struct hostent* ret, const char* buf, size_t buflen, struct hostent** result, const int* h_errnop)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) gethostbyname2_r(NULL, af, ret, buf, buflen, result, h_errnop);
|
||||
|
@ -54,7 +54,7 @@ int nullPointer_gethostbyname2_r(const char* name, int af, struct hostent* ret,
|
|||
return gethostbyname2_r(name, af, ret, buf, buflen, result, h_errnop);
|
||||
}
|
||||
|
||||
int nullPointer_gethostbyname_r(const char* name, struct hostent* ret, char* buf, size_t buflen, struct hostent** result, int* h_errnop)
|
||||
int nullPointer_gethostbyname_r(const char* name, struct hostent* ret, const char* buf, size_t buflen, struct hostent** result, const int* h_errnop)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) gethostbyname_r(NULL, ret, buf, buflen, result, h_errnop);
|
||||
|
@ -70,7 +70,7 @@ int nullPointer_gethostbyname_r(const char* name, struct hostent* ret, char* buf
|
|||
}
|
||||
|
||||
|
||||
int nullPointer_gethostbyaddr_r(const void* addr, socklen_t len, int type, struct hostent* ret, char* buf, size_t buflen, struct hostent** result, int* h_errnop)
|
||||
int nullPointer_gethostbyaddr_r(const void* addr, socklen_t len, int type, struct hostent* ret, const char* buf, size_t buflen, struct hostent** result, const int* h_errnop)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) gethostbyaddr_r(NULL, len, type, ret, buf, buflen, result, h_errnop);
|
||||
|
@ -109,7 +109,7 @@ int nullPointer_getopt_long_only(int argc, char* const* argv, const char* optstr
|
|||
return getopt_long_only(argc, argv, optstring, longopts, longindex);
|
||||
}
|
||||
|
||||
int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict buf, size_t buflen, struct servent **restrict result)
|
||||
int nullPointer_getservent_r(struct servent *restrict result_buf, const char *restrict buf, size_t buflen, struct servent **restrict result)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getservent_r(NULL, buf, buflen, result);
|
||||
|
@ -122,7 +122,7 @@ int nullPointer_getservent_r(struct servent *restrict result_buf, char *restrict
|
|||
|
||||
void *bufferAccessOutOfBounds_memrchr(const void *s, int c, size_t n)
|
||||
{
|
||||
char buf[42]={0};
|
||||
const char buf[42]={0};
|
||||
(void)memrchr(buf,c,42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
(void)memrchr(buf,c,43);
|
||||
|
@ -275,7 +275,7 @@ int no_resourceLeak_mkostemp_02(char *template, int flags)
|
|||
return mkostemp(template, flags);
|
||||
}
|
||||
|
||||
void valid_code(int argInt1, va_list valist_arg, int * parg)
|
||||
void valid_code(int argInt1, va_list valist_arg, const int * parg)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
@ -283,9 +283,9 @@ void valid_code(int argInt1, va_list valist_arg, int * parg)
|
|||
if (__builtin_expect_with_probability(argInt1 + 1, 2, 0.5)) {}
|
||||
if (__glibc_unlikely(argInt1 != 0)) {}
|
||||
if (__glibc_likely(parg != NULL)) {}
|
||||
void *ax1 = __builtin_assume_aligned(parg, 16);
|
||||
const void *ax1 = __builtin_assume_aligned(parg, 16);
|
||||
printf("%p", ax1);
|
||||
void *ax2 = __builtin_assume_aligned(parg, 32, 8);
|
||||
const void *ax2 = __builtin_assume_aligned(parg, 32, 8);
|
||||
printf("%p", ax2);
|
||||
|
||||
p = (char *)malloc(10);
|
||||
|
@ -316,7 +316,7 @@ void valid_code(int argInt1, va_list valist_arg, int * parg)
|
|||
|
||||
if (__alignof__(int) == 4) {}
|
||||
|
||||
void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
||||
const void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
||||
printf("%p", p_mmap);
|
||||
munmap(p_mmap, 1);
|
||||
|
||||
|
@ -368,7 +368,7 @@ void memleak_xmalloc()
|
|||
|
||||
void memleak_mmap()
|
||||
{
|
||||
void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
||||
const void * p_mmap = mmap(NULL, 1, PROT_NONE, MAP_ANONYMOUS | MAP_SHARED, -1, 0);
|
||||
printf("%p", p_mmap);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -391,7 +391,7 @@ void bufferAccessOutOfBounds__builtin_memset(void)
|
|||
|
||||
void bufferAccessOutOfBounds()
|
||||
{
|
||||
char buf[2] = "a";
|
||||
const char buf[2] = "a";
|
||||
// This is valid
|
||||
sethostname(buf, 2);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
|
|
|
@ -77,7 +77,7 @@ void g_malloc_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_malloc(8);
|
||||
|
||||
gpointer gpt = g_malloc(1);
|
||||
gconstpointer gpt = g_malloc(1);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -89,7 +89,7 @@ void g_malloc0_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_malloc0(8);
|
||||
|
||||
gpointer gpt = g_malloc0(1);
|
||||
gconstpointer gpt = g_malloc0(1);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -101,7 +101,7 @@ void g_malloc_n_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_malloc_n(8, 1);
|
||||
|
||||
gpointer gpt = g_malloc_n(1, 2);
|
||||
gconstpointer gpt = g_malloc_n(1, 2);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -113,7 +113,7 @@ void g_malloc0_n_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_malloc0_n(8, 1);
|
||||
|
||||
gpointer gpt = g_malloc0_n(1, 2);
|
||||
gconstpointer gpt = g_malloc0_n(1, 2);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -125,7 +125,7 @@ void g_try_malloc_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_malloc(8);
|
||||
|
||||
gpointer gpt = g_try_malloc(1);
|
||||
gconstpointer gpt = g_try_malloc(1);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -137,7 +137,7 @@ void g_try_malloc0_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_malloc0(8);
|
||||
|
||||
gpointer gpt = g_try_malloc0(1);
|
||||
gconstpointer gpt = g_try_malloc0(1);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -149,7 +149,7 @@ void g_try_malloc_n_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_malloc_n(8, 1);
|
||||
|
||||
gpointer gpt = g_try_malloc_n(1, 2);
|
||||
gconstpointer gpt = g_try_malloc_n(1, 2);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -161,7 +161,7 @@ void g_try_malloc0_n_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_malloc0_n(8, 1);
|
||||
|
||||
gpointer gpt = g_try_malloc0_n(1, 2);
|
||||
gconstpointer gpt = g_try_malloc0_n(1, 2);
|
||||
|
||||
printf("%p", gpt);
|
||||
|
||||
|
@ -258,7 +258,7 @@ void g_new_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_new(struct a, 1);
|
||||
|
||||
struct a * pNew2 = g_new(struct a, 2);
|
||||
const struct a * pNew2 = g_new(struct a, 2);
|
||||
printf("%p", pNew2);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ void g_new0_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_new0(struct a, 1);
|
||||
|
||||
struct a * pNew2 = g_new0(struct a, 2);
|
||||
const struct a * pNew2 = g_new0(struct a, 2);
|
||||
printf("%p", pNew2);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ void g_try_new_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_new(struct a, 1);
|
||||
|
||||
struct a * pNew2 = g_try_new(struct a, 2);
|
||||
const struct a * pNew2 = g_try_new(struct a, 2);
|
||||
printf("%p", pNew2);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ void g_try_new0_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_try_new0(struct a, 1);
|
||||
|
||||
struct a * pNew2 = g_try_new0(struct a, 2);
|
||||
const struct a * pNew2 = g_try_new0(struct a, 2);
|
||||
printf("%p", pNew2);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ void g_error_new_test()
|
|||
// cppcheck-suppress leakReturnValNotUsed
|
||||
g_error_new(1, -2, "a %d", 1);
|
||||
|
||||
GError * pNew2 = g_error_new(1, -2, "a %d", 1);
|
||||
const GError * pNew2 = g_error_new(1, -2, "a %d", 1);
|
||||
printf("%p", pNew2);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ K_GLOBAL_STATIC(k_global_static_testclass1, k_global_static_testinstance1);
|
|||
|
||||
void valid_code(const KConfigGroup& cfgGroup)
|
||||
{
|
||||
k_global_static_testclass1 * pk_global_static_testclass1 = k_global_static_testinstance1;
|
||||
const k_global_static_testclass1 * pk_global_static_testclass1 = k_global_static_testinstance1;
|
||||
printf("%p", pk_global_static_testclass1);
|
||||
|
||||
bool entryTest = cfgGroup.readEntry("test", false);
|
||||
|
|
|
@ -41,21 +41,21 @@ void ignoredReturnValue(CURL * handle)
|
|||
|
||||
void resourceLeak_curl_easy_init()
|
||||
{
|
||||
CURL *curl = curl_easy_init();
|
||||
const CURL *curl = curl_easy_init();
|
||||
printf("%p", curl);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void resourceLeak_curl_easy_duphandle(CURL * handle)
|
||||
{
|
||||
CURL *curl = curl_easy_duphandle(handle);
|
||||
const CURL *curl = curl_easy_duphandle(handle);
|
||||
printf("%p", curl);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void memleak_curl_easy_escape(CURL * handle)
|
||||
{
|
||||
char * pStr = curl_easy_escape(handle, "a", 1);
|
||||
const char * pStr = curl_easy_escape(handle, "a", 1);
|
||||
if (pStr)
|
||||
printf("%s", pStr);
|
||||
// cppcheck-suppress memleak
|
||||
|
@ -76,8 +76,8 @@ void nullPointer(CURL * handle)
|
|||
|
||||
void uninitvar(CURL * handle)
|
||||
{
|
||||
char * bufInit[10] = {0};
|
||||
char * bufUninit;
|
||||
const char * bufInit[10] = {0};
|
||||
const char * bufUninit;
|
||||
size_t len;
|
||||
|
||||
curl_easy_send(handle, bufInit, 10, &len);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <opencv2/opencv.hpp>
|
||||
|
||||
|
||||
void validCode(char* argStr)
|
||||
void validCode(const char* argStr)
|
||||
{
|
||||
cv::Mat image;
|
||||
image = cv::imread(argStr, cv::IMREAD_COLOR);
|
||||
|
|
|
@ -26,7 +26,7 @@ void validCode()
|
|||
|
||||
void memleak_omp_target_alloc()
|
||||
{
|
||||
char * pChars = (char *) omp_target_alloc(2, 0);
|
||||
const char * pChars = (char *) omp_target_alloc(2, 0);
|
||||
printf("pChars: %p", pChars);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@ void valid_code(BIO * bio)
|
|||
}
|
||||
|
||||
// Example for encrypting a string using IDEA (from https://www.openssl.org/docs/man1.1.1/man3/EVP_CIPHER_CTX_new.html)
|
||||
int valid_code_do_crypt(char *outfile)
|
||||
int valid_code_do_crypt(const char *outfile)
|
||||
{
|
||||
unsigned char outbuf[1024];
|
||||
int outlen, tmplen;
|
||||
unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
unsigned char iv[] = {1,2,3,4,5,6,7,8};
|
||||
char intext[] = "Some Crypto Text";
|
||||
const unsigned char key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
|
||||
const unsigned char iv[] = {1,2,3,4,5,6,7,8};
|
||||
const char intext[] = "Some Crypto Text";
|
||||
EVP_CIPHER_CTX *ctx;
|
||||
FILE *out;
|
||||
|
||||
|
@ -62,7 +62,7 @@ void invalidPrintfArgType_test(BIO * bio)
|
|||
|
||||
void EVP_CIPHER_CTX_new_test()
|
||||
{
|
||||
EVP_CIPHER_CTX * ctx = EVP_CIPHER_CTX_new();
|
||||
const EVP_CIPHER_CTX * ctx = EVP_CIPHER_CTX_new();
|
||||
printf("%p", ctx);
|
||||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ int nullPointer_posix_trace_timedgetnext_event(trace_id_t trid, struct posix_tra
|
|||
return posix_trace_timedgetnext_event(trid, event, data, num_bytes, data_len, unavailable, abstime);
|
||||
}
|
||||
|
||||
int nullPointer_posix_trace_getnext_event(trace_id_t trid, struct posix_trace_event_info *restrict event, void *restrict data, size_t num_bytes, size_t *restrict data_len, int *restrict unavailable)
|
||||
int nullPointer_posix_trace_getnext_event(trace_id_t trid, struct posix_trace_event_info *restrict event, const void *restrict data, size_t num_bytes, size_t *restrict data_len, int *restrict unavailable)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) posix_trace_getnext_event(trid, NULL, data, num_bytes, data_len, unavailable);
|
||||
|
@ -118,7 +118,7 @@ void nullPointer_pthread_attr_getstack(const pthread_attr_t *attr, void *stackad
|
|||
(void) pthread_attr_getstack(NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
void nullPointer_pthread_attr_setstack(pthread_attr_t *attr) {
|
||||
void nullPointer_pthread_attr_setstack(const pthread_attr_t *attr) {
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) pthread_attr_setstack(NULL, NULL, 0);
|
||||
(void) pthread_attr_setstack(attr, NULL, 0);
|
||||
|
@ -132,7 +132,7 @@ void nullPointer_setkey(const char *key)
|
|||
setkey(NULL);
|
||||
}
|
||||
|
||||
void nullPointer_encrypt(char block[64], int edflag)
|
||||
void nullPointer_encrypt(const char block[64], int edflag)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
encrypt(NULL, edflag);
|
||||
|
@ -193,7 +193,7 @@ int nullPointer_getpwnam_r(const char *name, struct passwd *pwd, char *buffer, s
|
|||
return getpwnam_r(name, pwd, buffer, bufsize, result);
|
||||
}
|
||||
|
||||
int nullPointer_fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
|
||||
int nullPointer_fgetpwent_r(FILE *restrict stream, const struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) fgetpwent_r(NULL, pwbuf, buf, buflen, pwbufp);
|
||||
|
@ -206,7 +206,7 @@ int nullPointer_fgetpwent_r(FILE *restrict stream, struct passwd *restrict pwbuf
|
|||
return fgetpwent_r(stream, pwbuf, buf, buflen, pwbufp);
|
||||
}
|
||||
|
||||
int nullPointer_getpwent_r(struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
|
||||
int nullPointer_getpwent_r(const struct passwd *restrict pwbuf, char *restrict buf, size_t buflen, struct passwd **restrict pwbufp)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) getpwent_r(NULL, buf, buflen, pwbufp);
|
||||
|
@ -302,7 +302,7 @@ int nullPointer_socketpair(int domain, int t, int protocol, int sv[2])
|
|||
return socketpair(domain, t, protocol, sv);
|
||||
}
|
||||
|
||||
void nullPointer_lcong48(unsigned short param[7])
|
||||
void nullPointer_lcong48(const unsigned short param[7])
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) lcong48(NULL);
|
||||
|
@ -337,7 +337,7 @@ double non_const_parameter_erand48(struct non_const_parameter_erand48_struct *da
|
|||
return erand48(dat->xsubi);
|
||||
}
|
||||
|
||||
unsigned short *nullPointer_seed48(unsigned short seed16v[3])
|
||||
unsigned short *nullPointer_seed48(const unsigned short seed16v[3])
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void) seed48(NULL);
|
||||
|
@ -427,7 +427,7 @@ int nullPointer_wcsnlen(const wchar_t *s, size_t n)
|
|||
|
||||
size_t bufferAccessOutOfBounds_wcsnlen(void) // #10997
|
||||
{
|
||||
wchar_t buf[2]={L'4',L'2'};
|
||||
const wchar_t buf[2]={L'4',L'2'};
|
||||
size_t len = wcsnlen(buf,2);
|
||||
// TODO cppcheck-suppress bufferAccessOutOfBounds
|
||||
len+=wcsnlen(buf,3);
|
||||
|
@ -622,7 +622,7 @@ char * overlappingWriteFunction_stpcpy(char *src, char *dest)
|
|||
return stpcpy(src, src);
|
||||
}
|
||||
|
||||
int nullPointer_strcasecmp(char *a, char *b)
|
||||
int nullPointer_strcasecmp(const char *a, const char *b)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void) strcasecmp(a, b);
|
||||
|
@ -632,7 +632,7 @@ int nullPointer_strcasecmp(char *a, char *b)
|
|||
return strcasecmp(NULL, b);
|
||||
}
|
||||
|
||||
int nullPointer_strncasecmp(char *a, char *b, size_t n)
|
||||
int nullPointer_strncasecmp(const char *a, const char *b, size_t n)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void) strncasecmp(a, b, n);
|
||||
|
@ -703,7 +703,7 @@ size_t nullPointer_strnlen(const char *s, size_t maxlen)
|
|||
return strnlen(NULL, maxlen);
|
||||
}
|
||||
|
||||
char * nullPointer_stpcpy(char *src, char *dest)
|
||||
char * nullPointer_stpcpy(const char *src, char *dest)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void) stpcpy(dest, src);
|
||||
|
@ -747,7 +747,7 @@ void nullPointer_bcopy(const void *src, void *dest, size_t n)
|
|||
bcopy(src, NULL, n);
|
||||
}
|
||||
|
||||
void overlappingWriteFunction_memccpy(unsigned char *src, unsigned char *dest, int c, size_t count)
|
||||
void overlappingWriteFunction_memccpy(const unsigned char *src, unsigned char *dest, int c, size_t count)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void)memccpy(dest, src, c, count);
|
||||
|
@ -777,7 +777,7 @@ wchar_t* overlappingWriteFunction_wcpncpy(wchar_t *src, wchar_t *dest, ssize_t n
|
|||
void overlappingWriteFunction_swab(char *src, char *dest, ssize_t n)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
swab(dest, src, n);
|
||||
swab(src, dest, n);
|
||||
// cppcheck-suppress overlappingWriteFunction
|
||||
swab(src, src+3, 4);
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ void bufferAccessOutOfBounds_swab(char *src, char *dest, ssize_t n)
|
|||
{
|
||||
// No warning shall be shown:
|
||||
swab(dest, src, n);
|
||||
char srcBuf[42] = {0};
|
||||
const char srcBuf[42] = {0};
|
||||
char destBuf[42] = {0};
|
||||
swab(srcBuf, dest, 42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
|
@ -1019,7 +1019,7 @@ int munmap_no_double_free(int tofd, // #11396
|
|||
size_t len)
|
||||
{
|
||||
int rc;
|
||||
void* fptr = mmap(NULL,len,PROT_READ|PROT_WRITE,MAP_SHARED,fromfd,(off_t)0);
|
||||
const void* fptr = mmap(NULL,len,PROT_READ|PROT_WRITE,MAP_SHARED,fromfd,(off_t)0);
|
||||
if (fptr == MAP_FAILED) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1127,7 +1127,7 @@ void noleak(int x, int y, int z)
|
|||
|
||||
// unused return value
|
||||
|
||||
void ignoredReturnValue(void *addr, int fd)
|
||||
void ignoredReturnValue(const void *addr, int fd)
|
||||
{
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
mmap(addr, 255, PROT_NONE, MAP_PRIVATE, fd, 0);
|
||||
|
@ -1170,7 +1170,7 @@ void uninitvar(int fd)
|
|||
char buf[2];
|
||||
int decimal, sign;
|
||||
double d;
|
||||
void *p;
|
||||
const void *p;
|
||||
pthread_mutex_t mutex, mutex1, mutex2, mutex3;
|
||||
// cppcheck-suppress uninitvar
|
||||
write(x1,"ab",2);
|
||||
|
@ -1199,11 +1199,12 @@ void uninitvar(int fd)
|
|||
// cppcheck-suppress gcvtCalled
|
||||
gcvt(3.141, 2, buf);
|
||||
|
||||
char *filename1, *filename2;
|
||||
struct utimbuf *times;
|
||||
const char *filename1, *filename2;
|
||||
const struct utimbuf *times;
|
||||
// cppcheck-suppress uninitvar
|
||||
// cppcheck-suppress utimeCalled
|
||||
utime(filename1, times);
|
||||
// cppcheck-suppress constVariable
|
||||
struct timeval times1[2];
|
||||
// cppcheck-suppress uninitvar
|
||||
// cppcheck-suppress utimeCalled
|
||||
|
@ -1256,9 +1257,10 @@ void uninitvar_types(void)
|
|||
d.d_ino + 1;
|
||||
}
|
||||
|
||||
void timet_h(struct timespec* ptp1)
|
||||
void timet_h(const struct timespec* ptp1)
|
||||
{
|
||||
clockid_t clk_id1, clk_id2, clk_id3;
|
||||
// cppcheck-suppress constVariablePointer
|
||||
struct timespec* ptp;
|
||||
// cppcheck-suppress uninitvar
|
||||
clock_settime(CLOCK_REALTIME, ptp);
|
||||
|
@ -1297,10 +1299,10 @@ void dl(const char* libname, const char* func)
|
|||
// cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void asctime_r_test(struct tm * tm, char * bufSizeUnknown)
|
||||
void asctime_r_test(const struct tm * tm, char * bufSizeUnknown)
|
||||
{
|
||||
struct tm tm_uninit_data;
|
||||
struct tm * tm_uninit_pointer;
|
||||
const struct tm * tm_uninit_pointer;
|
||||
char bufSize5[5];
|
||||
char bufSize25[25];
|
||||
char bufSize26[26];
|
||||
|
@ -1328,10 +1330,10 @@ void asctime_r_test(struct tm * tm, char * bufSizeUnknown)
|
|||
asctime_r(tm, bufSizeUnknown);
|
||||
}
|
||||
|
||||
void ctime_r_test(time_t * timep, char * bufSizeUnknown)
|
||||
void ctime_r_test(const time_t * timep, char * bufSizeUnknown)
|
||||
{
|
||||
time_t time_t_uninit_data;
|
||||
time_t * time_t_uninit_pointer;
|
||||
const time_t * time_t_uninit_pointer;
|
||||
char bufSize5[5];
|
||||
char bufSize25[25];
|
||||
char bufSize26[26];
|
||||
|
|
|
@ -43,7 +43,7 @@ void nullPointer()
|
|||
|
||||
void PyMem_Malloc_memleak()
|
||||
{
|
||||
char * pBuf1 = PyMem_Malloc(1);
|
||||
const char * pBuf1 = PyMem_Malloc(1);
|
||||
printf("%p", pBuf1);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ void PyMem_Malloc_mismatchAllocDealloc()
|
|||
|
||||
void PyMem_New_memleak()
|
||||
{
|
||||
char * pBuf1 = PyMem_New(char, 5);
|
||||
const char * pBuf1 = PyMem_New(char, 5);
|
||||
printf("%p", pBuf1);
|
||||
// cppcheck-suppress memleak
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ void resourceLeak_sqlite3_open()
|
|||
// TODO: cppcheck-suppress resourceLeak
|
||||
}
|
||||
|
||||
void ignoredReturnValue(char * buf)
|
||||
void ignoredReturnValue(const char * buf)
|
||||
{
|
||||
// cppcheck-suppress leakReturnValNotUsed
|
||||
sqlite3_malloc(10);
|
||||
|
|
338
test/cfg/std.c
338
test/cfg/std.c
File diff suppressed because it is too large
Load Diff
287
test/cfg/std.cpp
287
test/cfg/std.cpp
|
@ -464,7 +464,7 @@ void nullPointer_std_ifstream_open(std::ifstream &is, const std::string &strFile
|
|||
|
||||
void bufferAccessOutOfBounds_std_fstream_write(std::fstream &fs, const char* s, std::streamsize n)
|
||||
{
|
||||
char buf[42] = {0};
|
||||
const char buf[42] = {0};
|
||||
(void)fs.write(buf,42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
(void)fs.write(buf,43);
|
||||
|
@ -474,7 +474,7 @@ void bufferAccessOutOfBounds_std_fstream_write(std::fstream &fs, const char* s,
|
|||
|
||||
void bufferAccessOutOfBounds_std_ostream_write(std::ostream &os, const char* s, std::streamsize n)
|
||||
{
|
||||
char buf[42] = {0};
|
||||
const char buf[42] = {0};
|
||||
(void)os.write(buf,42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
(void)os.write(buf,43);
|
||||
|
@ -484,7 +484,7 @@ void bufferAccessOutOfBounds_std_ostream_write(std::ostream &os, const char* s,
|
|||
|
||||
void bufferAccessOutOfBounds_std_ostringstream_write(std::ostringstream &oss, const char* s, std::streamsize n)
|
||||
{
|
||||
char buf[42] = {0};
|
||||
const char buf[42] = {0};
|
||||
(void)oss.write(buf,42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
(void)oss.write(buf,43);
|
||||
|
@ -494,7 +494,7 @@ void bufferAccessOutOfBounds_std_ostringstream_write(std::ostringstream &oss, co
|
|||
|
||||
void bufferAccessOutOfBounds_std_ofstream_write(std::ofstream &os, const char* s, std::streamsize n)
|
||||
{
|
||||
char buf[42] = {0};
|
||||
const char buf[42] = {0};
|
||||
(void)os.write(buf,42);
|
||||
// cppcheck-suppress bufferAccessOutOfBounds
|
||||
(void)os.write(buf,43);
|
||||
|
@ -502,7 +502,7 @@ void bufferAccessOutOfBounds_std_ofstream_write(std::ofstream &os, const char* s
|
|||
(void)os.write(s,n);
|
||||
}
|
||||
|
||||
void invalidFunctionArg_fesetexceptflag(fexcept_t* flagp, int excepts)
|
||||
void invalidFunctionArg_fesetexceptflag(const fexcept_t* flagp, int excepts)
|
||||
{
|
||||
(void)std::fesetexceptflag(flagp, excepts);
|
||||
// cppcheck-suppress invalidFunctionArg
|
||||
|
@ -532,7 +532,7 @@ void invalidFunctionArg_fetestexcept(int excepts)
|
|||
(void)std::fetestexcept(FE_ALL_EXCEPT+1);
|
||||
}
|
||||
|
||||
void nullPointer_fprintf(FILE *Stream, char *Format, int Argument)
|
||||
void nullPointer_fprintf(FILE *Stream, const char *Format, int Argument)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::fprintf(Stream, nullptr, Argument);
|
||||
|
@ -568,7 +568,7 @@ void nullPointer_vfprintf(FILE *Stream, const char *Format, va_list Arg)
|
|||
(void)std::vfprintf(Stream, Format, Arg);
|
||||
}
|
||||
|
||||
void nullPointer_vfwprintf(FILE *Stream, wchar_t *Format, va_list Arg)
|
||||
void nullPointer_vfwprintf(FILE *Stream, const wchar_t *Format, va_list Arg)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::vfwprintf(Stream, nullptr, Arg);
|
||||
|
@ -703,7 +703,7 @@ void overlappingWriteFunction_wcscat(wchar_t *src, wchar_t *dest)
|
|||
(void)wcscat(src, src);
|
||||
}
|
||||
|
||||
void overlappingWriteFunction_wcsxfrm(wchar_t *s1, wchar_t *s2, size_t n)
|
||||
void overlappingWriteFunction_wcsxfrm(wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void)wcsxfrm(s1, s2, n);
|
||||
|
@ -735,7 +735,7 @@ wchar_t* nullPointer_wcsncpy(wchar_t *s, const wchar_t *cs, size_t n)
|
|||
return std::wcsncpy(s,cs,n);
|
||||
}
|
||||
|
||||
char * overlappingWriteFunction_strncat(char *src, char *dest, const std::size_t count)
|
||||
char * overlappingWriteFunction_strncat(const char *src, char *dest, const std::size_t count)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void)strncat(dest, src, 42);
|
||||
|
@ -748,7 +748,7 @@ char * overlappingWriteFunction_strncat(char *src, char *dest, const std::size_t
|
|||
return strncat(buffer, buffer + 1, 3);
|
||||
}
|
||||
|
||||
wchar_t * overlappingWriteFunction_wcsncat(wchar_t *src, wchar_t *dest, const std::size_t count)
|
||||
wchar_t * overlappingWriteFunction_wcsncat(const wchar_t *src, wchar_t *dest, const std::size_t count)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void)wcsncat(dest, src, 42);
|
||||
|
@ -1156,8 +1156,8 @@ void uninitvar_asinh(void)
|
|||
void uninitvar_wcsftime(wchar_t* ptr)
|
||||
{
|
||||
size_t maxsize;
|
||||
wchar_t* format;
|
||||
struct tm* timeptr;
|
||||
const wchar_t* format;
|
||||
const struct tm* timeptr;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsftime(ptr, maxsize, format, timeptr);
|
||||
}
|
||||
|
@ -1269,14 +1269,14 @@ void uninitvar_atan2(void)
|
|||
|
||||
void uninitvar_atof(void)
|
||||
{
|
||||
char * c;
|
||||
const char * c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::atof(c);
|
||||
}
|
||||
|
||||
void uninitvar_atol(void)
|
||||
{
|
||||
char * c1, *c2, *c3;
|
||||
const char * c1, *c2, *c3;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::atoi(c1);
|
||||
|
||||
|
@ -1376,7 +1376,7 @@ void uninitvar_feraiseexcept(void)
|
|||
(void)std::feraiseexcept(expects);
|
||||
}
|
||||
|
||||
void uninitvar_fesetexceptflag(fexcept_t* flagp)
|
||||
void uninitvar_fesetexceptflag(const fexcept_t* flagp)
|
||||
{
|
||||
int expects;
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1392,7 +1392,7 @@ void uninitvar_feclearexcept(void)
|
|||
|
||||
void uninitvar_fesetenv(void)
|
||||
{
|
||||
fenv_t* envp;
|
||||
const fenv_t* envp;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fesetenv(envp);
|
||||
}
|
||||
|
@ -1413,14 +1413,14 @@ void uninitvar_fetestexcept(void)
|
|||
|
||||
void uninitvar_feupdateenv(void)
|
||||
{
|
||||
fenv_t* envp;
|
||||
const fenv_t* envp;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::feupdateenv(envp);
|
||||
}
|
||||
|
||||
void uninitvar_ctime(void)
|
||||
{
|
||||
time_t *tp;
|
||||
const time_t *tp;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::ctime(tp);
|
||||
}
|
||||
|
@ -1689,17 +1689,17 @@ void uninitvar_fmod(void)
|
|||
|
||||
void uninitar_fopen(void)
|
||||
{
|
||||
char *filename;
|
||||
char *mode;
|
||||
const char *filename;
|
||||
const char *mode;
|
||||
// cppcheck-suppress uninitvar
|
||||
FILE * fp = std::fopen(filename, mode);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void uninitar_fprintf(FILE *Stream, char *Format, int Argument)
|
||||
void uninitar_fprintf(FILE *Stream, const char *Format, int Argument)
|
||||
{
|
||||
FILE *stream1, *stream2;
|
||||
char *format1, *format2;
|
||||
const char *format1, *format2;
|
||||
int argument1, argument2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fprintf(stream1, format1, argument1);
|
||||
|
@ -1717,7 +1717,7 @@ void uninitar_fprintf(FILE *Stream, char *Format, int Argument)
|
|||
void uninitar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
|
||||
{
|
||||
FILE *stream1, *stream2;
|
||||
char *format1, *format2;
|
||||
const char *format1, *format2;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1733,10 +1733,10 @@ void uninitar_vfprintf(FILE *Stream, const char *Format, va_list Arg)
|
|||
(void)std::vfprintf(Stream, Format, arg);
|
||||
}
|
||||
|
||||
void uninitar_vfwprintf(FILE *Stream, wchar_t *Format, va_list Arg)
|
||||
void uninitar_vfwprintf(FILE *Stream, const wchar_t *Format, va_list Arg)
|
||||
{
|
||||
FILE *stream1, *stream2;
|
||||
wchar_t *format1, *format2;
|
||||
const wchar_t *format1, *format2;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1770,7 +1770,7 @@ void uninitvar_fputwc(void)
|
|||
|
||||
void uninitvar_fputs(void)
|
||||
{
|
||||
char *string;
|
||||
const char *string;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fputs(string,stream);
|
||||
|
@ -1778,7 +1778,7 @@ void uninitvar_fputs(void)
|
|||
|
||||
void uninitvar_fputws(void)
|
||||
{
|
||||
wchar_t *string;
|
||||
const wchar_t *string;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fputws(string,stream);
|
||||
|
@ -1803,8 +1803,8 @@ void uninitvar_free(void)
|
|||
|
||||
void uninitvar_freopen(void)
|
||||
{
|
||||
char *filename;
|
||||
char *mode;
|
||||
const char *filename;
|
||||
const char *mode;
|
||||
FILE *stream;
|
||||
// cppcheck-suppress uninitvar
|
||||
FILE * p = std::freopen(filename,mode,stream);
|
||||
|
@ -1847,7 +1847,7 @@ void uninitvar_hypot(void)
|
|||
void uninitvar_fscanf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *format;
|
||||
const char *format;
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fscanf(stream,format,i);
|
||||
|
@ -1856,7 +1856,7 @@ void uninitvar_fscanf(void)
|
|||
void uninitvar_vfscanf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
char *format;
|
||||
const char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1866,7 +1866,7 @@ void uninitvar_vfscanf(void)
|
|||
void uninitvar_vfwscanf(void)
|
||||
{
|
||||
FILE *stream;
|
||||
wchar_t *format;
|
||||
const wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1910,7 +1910,7 @@ void invalidFunctionArgBool_fseek(FILE* stream, long int offset, int origin)
|
|||
void uninitvar_fsetpos(void)
|
||||
{
|
||||
FILE* stream;
|
||||
fpos_t *ptr;
|
||||
const fpos_t *ptr;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fsetpos(stream,ptr);
|
||||
}
|
||||
|
@ -1944,7 +1944,7 @@ void nullPointer_memcmp(const void *s1, const void *s2, size_t n)
|
|||
(void)std::memcmp(s1,s2,n);
|
||||
}
|
||||
|
||||
void nullPointer_strncat(char *d, char *s, size_t n)
|
||||
void nullPointer_strncat(char *d, const char *s, size_t n)
|
||||
{
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::strncat(NULL,s,n);
|
||||
|
@ -2040,7 +2040,7 @@ void uninitvar_fwide(void)
|
|||
|
||||
void uninitvar_fwrite(void)
|
||||
{
|
||||
void *ptr;
|
||||
const void *ptr;
|
||||
size_t size;
|
||||
size_t nobj;
|
||||
FILE *stream;
|
||||
|
@ -2050,7 +2050,7 @@ void uninitvar_fwrite(void)
|
|||
|
||||
void uninitvar_mblen(void)
|
||||
{
|
||||
char *string;
|
||||
const char *string;
|
||||
size_t size;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::mblen(string,size);
|
||||
|
@ -2059,7 +2059,7 @@ void uninitvar_mblen(void)
|
|||
void uninitvar_mbtowc(void)
|
||||
{
|
||||
wchar_t* pwc;
|
||||
char* pmb;
|
||||
const char* pmb;
|
||||
size_t max;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::mbtowc(pwc,pmb,max);
|
||||
|
@ -2067,7 +2067,7 @@ void uninitvar_mbtowc(void)
|
|||
|
||||
void uninitvar_mbrlen(const char* p, size_t m, mbstate_t* s)
|
||||
{
|
||||
char* pmb1, *pmb2;
|
||||
const char* pmb1, *pmb2;
|
||||
size_t max1, max2;
|
||||
mbstate_t* ps1, *ps2;
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -2100,7 +2100,7 @@ void uninitvar_btowc(void)
|
|||
|
||||
void uninitvar_mbsinit(void)
|
||||
{
|
||||
mbstate_t* ps;
|
||||
const mbstate_t* ps;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::mbsinit(ps);
|
||||
}
|
||||
|
@ -2108,7 +2108,7 @@ void uninitvar_mbsinit(void)
|
|||
void uninitvar_mbstowcs(void)
|
||||
{
|
||||
wchar_t *ws;
|
||||
char *s;
|
||||
const char *s;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::mbstowcs(ws,s,n);
|
||||
|
@ -2142,7 +2142,7 @@ void uninitvar_wctomb(void)
|
|||
void uninitvar_wcstombs(void)
|
||||
{
|
||||
char *mbstr;
|
||||
wchar_t *wcstr;
|
||||
const wchar_t *wcstr;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcstombs(mbstr,wcstr,n);
|
||||
|
@ -2180,14 +2180,14 @@ void uninitvar_ungetwc(void)
|
|||
|
||||
void uninitvar_getenv(void)
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::getenv(name);
|
||||
}
|
||||
|
||||
void uninitvar_gmtime(void)
|
||||
{
|
||||
time_t *tp;
|
||||
const time_t *tp;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::gmtime(tp);
|
||||
}
|
||||
|
@ -2322,14 +2322,14 @@ void uninitvar_towupper(void)
|
|||
|
||||
void uninitvar_wctrans(void)
|
||||
{
|
||||
char* property;
|
||||
const char* property;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wctrans(property);
|
||||
}
|
||||
|
||||
void uninitvar_wctype(void)
|
||||
{
|
||||
char* property;
|
||||
const char* property;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wctype(property);
|
||||
}
|
||||
|
@ -2475,7 +2475,7 @@ void uninitvar_ldiv(void)
|
|||
|
||||
void uninitvar_localtime(void)
|
||||
{
|
||||
time_t *tp;
|
||||
const time_t *tp;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::localtime(tp);
|
||||
}
|
||||
|
@ -2624,7 +2624,7 @@ void uninitvar_islessgreater(void)
|
|||
|
||||
void uninitvar_nan(void)
|
||||
{
|
||||
char *tagp1, *tagp2, *tagp3;
|
||||
const char *tagp1, *tagp2, *tagp3;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::nanf(tagp1);
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -2795,8 +2795,8 @@ void uninitvar_wmemchr(void)
|
|||
|
||||
void uninitvar_memcmp(void)
|
||||
{
|
||||
void *s1;
|
||||
void *s2;
|
||||
const void *s1;
|
||||
const void *s2;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::memcmp(s1,s2,n);
|
||||
|
@ -2804,8 +2804,8 @@ void uninitvar_memcmp(void)
|
|||
|
||||
void uninitvar_wmemcmp(void)
|
||||
{
|
||||
wchar_t *s1;
|
||||
wchar_t *s2;
|
||||
const wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wmemcmp(s1,s2,n);
|
||||
|
@ -2814,7 +2814,7 @@ void uninitvar_wmemcmp(void)
|
|||
void uninitvar_memcpy(void)
|
||||
{
|
||||
void *ct;
|
||||
void *cs;
|
||||
const void *cs;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::memcpy(ct,cs,n);
|
||||
|
@ -2823,7 +2823,7 @@ void uninitvar_memcpy(void)
|
|||
void uninitvar_wmemcpy(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *c;
|
||||
const wchar_t *c;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wmemcpy(cs,c,n);
|
||||
|
@ -2832,7 +2832,7 @@ void uninitvar_wmemcpy(void)
|
|||
void uninitvar_memmove(void)
|
||||
{
|
||||
void *ct;
|
||||
void *cs;
|
||||
const void *cs;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::memmove(ct,cs,n);
|
||||
|
@ -2892,7 +2892,7 @@ void uninivar_modf(void)
|
|||
|
||||
void uninivar_perror(void)
|
||||
{
|
||||
char *string;
|
||||
const char *string;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::perror(string);
|
||||
}
|
||||
|
@ -2945,9 +2945,9 @@ void uninitvar_remquo(void)
|
|||
(void)std::remquol(ld1,ld2,i3);
|
||||
}
|
||||
|
||||
void uninivar_printf(char *Format, int Argument)
|
||||
void uninivar_printf(const char *Format, int Argument)
|
||||
{
|
||||
char * format_1, * format_2, * format_3;
|
||||
const char * format_1, * format_2, * format_3;
|
||||
int argument1, argument2;
|
||||
// no warning is expected
|
||||
(void)std::printf("x");
|
||||
|
@ -2964,9 +2964,9 @@ void uninivar_printf(char *Format, int Argument)
|
|||
(void)std::printf(Format,Argument);
|
||||
}
|
||||
|
||||
void uninivar_vprintf(char *Format, va_list Arg)
|
||||
void uninivar_vprintf(const char *Format, va_list Arg)
|
||||
{
|
||||
char * format1, *format2;
|
||||
const char * format1, *format2;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -2980,9 +2980,9 @@ void uninivar_vprintf(char *Format, va_list Arg)
|
|||
(void)std::vprintf(Format,arg);
|
||||
}
|
||||
|
||||
void uninivar_vwprintf(wchar_t *Format, va_list Arg)
|
||||
void uninivar_vwprintf(const wchar_t *Format, va_list Arg)
|
||||
{
|
||||
wchar_t * format1, *format2;
|
||||
const wchar_t * format1, *format2;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -2998,8 +2998,8 @@ void uninivar_vwprintf(wchar_t *Format, va_list Arg)
|
|||
|
||||
void uninivar_bsearch(void)
|
||||
{
|
||||
void* key;
|
||||
void* base;
|
||||
const void* key;
|
||||
const void* base;
|
||||
size_t num;
|
||||
size_t size;
|
||||
// cppcheck-suppress [uninitvar, cstyleCast]
|
||||
|
@ -3010,7 +3010,7 @@ void minsize_bsearch(const void* key, const void* base,
|
|||
size_t num, size_t size,
|
||||
int (*compar)(const void*,const void*))
|
||||
{
|
||||
int Base[3] = {42, 43, 44};
|
||||
const int Base[3] = {42, 43, 44};
|
||||
|
||||
(void)std::bsearch(key,Base,2,size,(int (*)(const void*,const void*))strcmp); // cppcheck-suppress cstyleCast
|
||||
(void)std::bsearch(key,Base,3,size,(int (*)(const void*,const void*))strcmp); // cppcheck-suppress cstyleCast
|
||||
|
@ -3095,7 +3095,7 @@ void uninitvar_putwchar(void)
|
|||
|
||||
void uninitvar_puts(void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::puts(s);
|
||||
}
|
||||
|
@ -3111,15 +3111,15 @@ void uninitvar_realloc(void)
|
|||
|
||||
void uninitvar_remove(void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::remove(s);
|
||||
}
|
||||
|
||||
void uninitvar_rename(void)
|
||||
{
|
||||
char *s1;
|
||||
char *s2;
|
||||
const char *s1;
|
||||
const char *s2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::rename(s1,s2);
|
||||
}
|
||||
|
@ -3205,7 +3205,7 @@ void uninivar_raise(void)
|
|||
|
||||
void uninivar_scanf(void)
|
||||
{
|
||||
char *format;
|
||||
const char *format;
|
||||
char str[42];
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::scanf(format, str);
|
||||
|
@ -3213,8 +3213,8 @@ void uninivar_scanf(void)
|
|||
|
||||
void uninivar_vsscanf(void)
|
||||
{
|
||||
char *s;
|
||||
char *format;
|
||||
const char *s;
|
||||
const char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3223,8 +3223,8 @@ void uninivar_vsscanf(void)
|
|||
|
||||
void uninivar_vswscanf(void)
|
||||
{
|
||||
wchar_t *s;
|
||||
wchar_t *format;
|
||||
const wchar_t *s;
|
||||
const wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3233,7 +3233,7 @@ void uninivar_vswscanf(void)
|
|||
|
||||
void uninivar_vscanf(void)
|
||||
{
|
||||
char *format;
|
||||
const char *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3242,7 +3242,7 @@ void uninivar_vscanf(void)
|
|||
|
||||
void uninivar_vwscanf(void)
|
||||
{
|
||||
wchar_t *format;
|
||||
const wchar_t *format;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3294,7 +3294,7 @@ void uninivar_setvbuf(void)
|
|||
void uninitvar_strcat(char *dest, const char * const source)
|
||||
{
|
||||
char *deststr1, *deststr2;
|
||||
char *srcstr1, *srcstr2;
|
||||
const char *srcstr1, *srcstr2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strcat(deststr1,srcstr1);
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3309,7 +3309,7 @@ void uninitvar_strcat(char *dest, const char * const source)
|
|||
void uninitvar_wcscat(wchar_t *dest, const wchar_t * const source)
|
||||
{
|
||||
wchar_t *deststr_1, *deststr_2;
|
||||
wchar_t *srcstr1, *srcstr2;
|
||||
const wchar_t *srcstr1, *srcstr2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcscat(deststr_1,srcstr1);
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3332,7 +3332,7 @@ void uninivar_wcrtomb(void)
|
|||
|
||||
void uninivar_strchr(void)
|
||||
{
|
||||
char *cs;
|
||||
const char *cs;
|
||||
int c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strchr(cs,c);
|
||||
|
@ -3340,7 +3340,7 @@ void uninivar_strchr(void)
|
|||
|
||||
void uninivar_wcschr(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
const wchar_t *cs;
|
||||
wchar_t c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcschr(cs,c);
|
||||
|
@ -3348,16 +3348,16 @@ void uninivar_wcschr(void)
|
|||
|
||||
void uninivar_strcmp(void)
|
||||
{
|
||||
char *str1;
|
||||
char *str2;
|
||||
const char *str1;
|
||||
const char *str2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strcmp(str1,str2);
|
||||
}
|
||||
|
||||
void uninivar_wcscmp(void)
|
||||
{
|
||||
wchar_t *str1;
|
||||
wchar_t *str2;
|
||||
const wchar_t *str1;
|
||||
const wchar_t *str2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcscmp(str1,str2);
|
||||
}
|
||||
|
@ -3365,7 +3365,7 @@ void uninivar_wcscmp(void)
|
|||
void uninivar_strcpy(void)
|
||||
{
|
||||
char *str1;
|
||||
char *str2;
|
||||
const char *str2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strcpy(str1,str2);
|
||||
}
|
||||
|
@ -3373,7 +3373,7 @@ void uninivar_strcpy(void)
|
|||
void uninivar_wcscpy(void)
|
||||
{
|
||||
wchar_t *str1;
|
||||
wchar_t *str2;
|
||||
const wchar_t *str2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcscpy(str1,str2);
|
||||
}
|
||||
|
@ -3382,22 +3382,22 @@ void uninivar_strftime(void)
|
|||
{
|
||||
char *s;
|
||||
size_t max;
|
||||
char *fmt;
|
||||
struct tm *p;
|
||||
const char *fmt;
|
||||
const struct tm *p;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strftime(s,max,fmt,p);
|
||||
}
|
||||
|
||||
void uninivar_strlen(void)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strlen(s);
|
||||
}
|
||||
|
||||
void uninivar_wcslen(void)
|
||||
{
|
||||
wchar_t *s;
|
||||
const wchar_t *s;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcslen(s);
|
||||
}
|
||||
|
@ -3405,7 +3405,7 @@ void uninivar_wcslen(void)
|
|||
void uninivar_strncpy(void)
|
||||
{
|
||||
char *s;
|
||||
char *ct;
|
||||
const char *ct;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncpy(s,ct,n);
|
||||
|
@ -3413,16 +3413,16 @@ void uninivar_strncpy(void)
|
|||
|
||||
void uninivar_strpbrk(void)
|
||||
{
|
||||
char *cs;
|
||||
char *ct;
|
||||
const char *cs;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strpbrk(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_strncat(char *Ct, char *S, size_t N)
|
||||
void uninivar_strncat(char *Ct, const char *S, size_t N)
|
||||
{
|
||||
char *ct_1, *ct_2;
|
||||
char *s1, *s2;
|
||||
const char *s1, *s2;
|
||||
size_t n1, n2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncat(ct_1,s1,n1);
|
||||
|
@ -3437,10 +3437,10 @@ void uninivar_strncat(char *Ct, char *S, size_t N)
|
|||
(void)std::strncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
void uninivar_wcsncat(wchar_t *Ct, const wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct_1, *ct_2;
|
||||
wchar_t *s1, *s2;
|
||||
const wchar_t *s1, *s2;
|
||||
size_t n1, n2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncat(ct_1,s1,n1);
|
||||
|
@ -3455,10 +3455,10 @@ void uninivar_wcsncat(wchar_t *Ct, wchar_t *S, size_t N)
|
|||
(void)std::wcsncat(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_strncmp(char *Ct, char *S, size_t N)
|
||||
void uninivar_strncmp(const char *Ct, const char *S, size_t N)
|
||||
{
|
||||
char *ct1, *ct2;
|
||||
char *s1, *s2;
|
||||
const char *ct1, *ct2;
|
||||
const char *s1, *s2;
|
||||
size_t n1, n2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strncmp(ct1,s1,n1);
|
||||
|
@ -3473,10 +3473,10 @@ void uninivar_strncmp(char *Ct, char *S, size_t N)
|
|||
(void)std::strncmp(Ct,S,N);
|
||||
}
|
||||
|
||||
void uninivar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
|
||||
void uninivar_wcsncmp(const wchar_t *Ct, const wchar_t *S, size_t N)
|
||||
{
|
||||
wchar_t *ct1, *ct2;
|
||||
wchar_t *s1, *s2;
|
||||
const wchar_t *ct1, *ct2;
|
||||
const wchar_t *s1, *s2;
|
||||
size_t n1, n2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncmp(ct1,s1,n1);
|
||||
|
@ -3494,7 +3494,7 @@ void uninivar_wcsncmp(wchar_t *Ct, wchar_t *S, size_t N)
|
|||
void uninivar_strstr(void)
|
||||
{
|
||||
char *cs;
|
||||
char *ct;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strstr(cs,ct);
|
||||
}
|
||||
|
@ -3502,15 +3502,15 @@ void uninivar_strstr(void)
|
|||
void uninivar_wcsstr(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *ct;
|
||||
const wchar_t *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsstr(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_strspn(void)
|
||||
{
|
||||
char *cs;
|
||||
char *ct;
|
||||
const char *cs;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strspn(cs,ct);
|
||||
}
|
||||
|
@ -3518,7 +3518,7 @@ void uninivar_strspn(void)
|
|||
void uninivar_strxfrm(void)
|
||||
{
|
||||
char *ds;
|
||||
char *ss;
|
||||
const char *ss;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strxfrm(ds,ss,n);
|
||||
|
@ -3527,7 +3527,7 @@ void uninivar_strxfrm(void)
|
|||
void uninivar_wcsxfrm(void)
|
||||
{
|
||||
wchar_t *ds;
|
||||
wchar_t *ss;
|
||||
const wchar_t *ss;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsxfrm(ds,ss,n);
|
||||
|
@ -3535,8 +3535,8 @@ void uninivar_wcsxfrm(void)
|
|||
|
||||
void uninivar_wcsspn(void)
|
||||
{
|
||||
wchar_t *ds;
|
||||
wchar_t *ss;
|
||||
const wchar_t *ds;
|
||||
const wchar_t *ss;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsspn(ds,ss);
|
||||
}
|
||||
|
@ -3544,7 +3544,7 @@ void uninivar_wcsspn(void)
|
|||
void uninivar_setlocale(void)
|
||||
{
|
||||
int category;
|
||||
char* locale;
|
||||
const char* locale;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::setlocale(category,locale);
|
||||
}
|
||||
|
@ -3557,24 +3557,24 @@ void uninivar_strerror(void)
|
|||
|
||||
void uninivar_strcspn(void)
|
||||
{
|
||||
char *cs;
|
||||
char *ct;
|
||||
const char *cs;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strcspn(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_wcscspn(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *ct;
|
||||
const wchar_t *cs;
|
||||
const wchar_t *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcscspn(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_wcspbrk(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *ct;
|
||||
const wchar_t *cs;
|
||||
const wchar_t *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcspbrk(cs,ct);
|
||||
}
|
||||
|
@ -3582,7 +3582,7 @@ void uninivar_wcspbrk(void)
|
|||
void uninivar_wcsncpy(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *ct;
|
||||
const wchar_t *ct;
|
||||
size_t n;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcsncpy(cs,ct,n);
|
||||
|
@ -3590,23 +3590,23 @@ void uninivar_wcsncpy(void)
|
|||
|
||||
void uninivar_strcoll(void)
|
||||
{
|
||||
char *cs;
|
||||
char *ct;
|
||||
const char *cs;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strcoll(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_wcscoll(void)
|
||||
{
|
||||
wchar_t *cs;
|
||||
wchar_t *ct;
|
||||
const wchar_t *cs;
|
||||
const wchar_t *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wcscoll(cs,ct);
|
||||
}
|
||||
|
||||
void uninivar_strrchr(void)
|
||||
{
|
||||
char * str;
|
||||
const char * str;
|
||||
int c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strrchr(str,c);
|
||||
|
@ -3633,7 +3633,7 @@ void uninivar_wcsrtombs(void)
|
|||
void uninivar_strtok(void)
|
||||
{
|
||||
char *s;
|
||||
char *ct;
|
||||
const char *ct;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::strtok(s,ct);
|
||||
}
|
||||
|
@ -3894,7 +3894,7 @@ void uninivar_wcstol(void)
|
|||
(void)wcstoumax(s8,endp8,base8);
|
||||
}
|
||||
|
||||
void uninitvar_wprintf(wchar_t *Format, int Argument)
|
||||
void uninitvar_wprintf(const wchar_t *Format, int Argument)
|
||||
{
|
||||
const wchar_t *format1, *format2, *format3;
|
||||
int argument1, argument2;
|
||||
|
@ -3967,10 +3967,10 @@ void uninivar_fwprintf(void)
|
|||
(void)std::fwprintf(stream,format,i);
|
||||
}
|
||||
|
||||
void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
|
||||
void uninivar_snprintf(char *S, size_t N, const char *Format, int Int)
|
||||
{
|
||||
size_t n1, n2;
|
||||
char *format1, *format2;
|
||||
const char *format1, *format2;
|
||||
int i1, i2;
|
||||
char *s1, *s2;
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -3988,11 +3988,11 @@ void uninivar_snprintf(char *S, size_t N, char *Format, int Int)
|
|||
(void)std::snprintf(S,N,Format,Int);
|
||||
}
|
||||
|
||||
void uninivar_vsnprintf(char *S, size_t N, char *Format, va_list Arg)
|
||||
void uninivar_vsnprintf(char *S, size_t N, const char *Format, va_list Arg)
|
||||
{
|
||||
char *s1, *s2;
|
||||
size_t n1, n2;
|
||||
char *format1, *format2;
|
||||
const char *format1, *format2;
|
||||
va_list arg;
|
||||
// cppcheck-suppress va_list_usedBeforeStarted
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -4012,7 +4012,7 @@ void uninivar_vsnprintf(char *S, size_t N, char *Format, va_list Arg)
|
|||
|
||||
void uninivar_wscanf(void)
|
||||
{
|
||||
wchar_t *format1, *format2;
|
||||
const wchar_t *format1, *format2;
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::wscanf(format1);
|
||||
|
@ -4022,7 +4022,7 @@ void uninivar_wscanf(void)
|
|||
|
||||
void uninivar_sscanf(void)
|
||||
{
|
||||
char *string1, *string2;
|
||||
const char *string1, *string2;
|
||||
const char * format;
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -4034,7 +4034,7 @@ void uninivar_sscanf(void)
|
|||
void uninivar_fwscanf(void)
|
||||
{
|
||||
FILE* stream;
|
||||
wchar_t* format1, *format2;
|
||||
const wchar_t* format1, *format2;
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::fwscanf(stream,format1);
|
||||
|
@ -4044,8 +4044,8 @@ void uninivar_fwscanf(void)
|
|||
|
||||
void uninivar_swscanf(void)
|
||||
{
|
||||
wchar_t* s;
|
||||
wchar_t* format1, *format2;
|
||||
const wchar_t* s;
|
||||
const wchar_t* format1, *format2;
|
||||
int i;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::swscanf(s,format1);
|
||||
|
@ -4055,7 +4055,7 @@ void uninivar_swscanf(void)
|
|||
|
||||
void uninitvar_system(void)
|
||||
{
|
||||
char *c;
|
||||
const char *c;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)std::system(c);
|
||||
}
|
||||
|
@ -4093,7 +4093,7 @@ int nullPointer_mtx_timedlock( mtx_t *mutex, const struct timespec *time_point )
|
|||
}
|
||||
#endif
|
||||
|
||||
void nullPointer_system(char *c)
|
||||
void nullPointer_system(const char *c)
|
||||
{
|
||||
// If a null pointer is given, command processor is checked for existence
|
||||
(void)std::system(NULL);
|
||||
|
@ -4200,11 +4200,11 @@ void uninivar_istream_read(std::istream &f)
|
|||
|
||||
void uninitvar_string_compare(std::string &teststr, std::wstring &testwstr)
|
||||
{
|
||||
char *pStrUninit;
|
||||
const char *pStrUninit;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)teststr.compare(pStrUninit);
|
||||
|
||||
wchar_t *pWStrUninit;
|
||||
const wchar_t *pWStrUninit;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)testwstr.compare(pWStrUninit);
|
||||
}
|
||||
|
@ -4275,7 +4275,7 @@ void nullPointer_istream_read(std::istream &f)
|
|||
|
||||
void nullPointer_asctime(void)
|
||||
{
|
||||
struct tm *tm = 0;
|
||||
const struct tm *tm = 0;
|
||||
// cppcheck-suppress asctimeCalled
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::asctime(tm);
|
||||
|
@ -4324,7 +4324,7 @@ void nullPointer_feholdexcept(void)
|
|||
|
||||
void nullPointer_fesetenv(void)
|
||||
{
|
||||
fenv_t* envp = 0;
|
||||
const fenv_t* envp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::fesetenv(envp);
|
||||
// cppcheck-suppress nullPointer
|
||||
|
@ -4333,7 +4333,7 @@ void nullPointer_fesetenv(void)
|
|||
|
||||
void nullPointer_fesetexceptflag(int expects)
|
||||
{
|
||||
fexcept_t* flagp = 0;
|
||||
const fexcept_t* flagp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::fesetexceptflag(flagp,expects);
|
||||
// cppcheck-suppress nullPointer
|
||||
|
@ -4342,7 +4342,7 @@ void nullPointer_fesetexceptflag(int expects)
|
|||
|
||||
void nullPointer_feupdateenv(void)
|
||||
{
|
||||
fenv_t* envp = 0;
|
||||
const fenv_t* envp = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::feupdateenv(envp);
|
||||
// cppcheck-suppress nullPointer
|
||||
|
@ -4357,7 +4357,7 @@ void nullPointer_atexit(void)
|
|||
|
||||
void nullPointer_atof(void)
|
||||
{
|
||||
char * c = 0;
|
||||
const char * c = 0;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)std::atof(c);
|
||||
// cppcheck-suppress nullPointer
|
||||
|
@ -4694,6 +4694,7 @@ void beginEnd()
|
|||
//cppcheck-suppress ignoredReturnValue
|
||||
std::crend(v);
|
||||
|
||||
// cppcheck-suppress constVariable
|
||||
int arr[4];
|
||||
|
||||
//cppcheck-suppress ignoredReturnValue
|
||||
|
|
|
@ -82,7 +82,7 @@ unsigned char * overlappingWriteFunction__mbscat(unsigned char *src, unsigned ch
|
|||
return _mbscat(src, src);
|
||||
}
|
||||
|
||||
unsigned char * overlappingWriteFunction__memccpy(unsigned char *src, unsigned char *dest, int c, size_t count)
|
||||
unsigned char * overlappingWriteFunction__memccpy(const unsigned char *src, unsigned char *dest, int c, size_t count)
|
||||
{
|
||||
// No warning shall be shown:
|
||||
(void)_memccpy(dest, src, c, count);
|
||||
|
@ -117,22 +117,22 @@ SYSTEM_INFO uninitvar_GetSystemInfo(char * envstr)
|
|||
return SystemInfo;
|
||||
}
|
||||
|
||||
void uninitvar__putenv(char * envstr)
|
||||
void uninitvar__putenv(const char * envstr)
|
||||
{
|
||||
// No warning is expected
|
||||
(void)_putenv(envstr);
|
||||
|
||||
char * p;
|
||||
const char * p;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)_putenv(p);
|
||||
}
|
||||
|
||||
void nullPointer__putenv(char * envstr)
|
||||
void nullPointer__putenv(const char * envstr)
|
||||
{
|
||||
// No warning is expected
|
||||
(void)_putenv(envstr);
|
||||
|
||||
char * p=NULL;
|
||||
const char * p=NULL;
|
||||
// cppcheck-suppress nullPointer
|
||||
(void)_putenv(p);
|
||||
}
|
||||
|
@ -763,6 +763,7 @@ void uninitvar()
|
|||
// cppcheck-suppress uninitvar
|
||||
lstrcat(buf, "test");
|
||||
buf[0] = '\0';
|
||||
// cppcheck-suppress constVariable
|
||||
char buf2[2];
|
||||
// cppcheck-suppress lstrcatCalled
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -992,7 +993,7 @@ HANDLE test_CreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes,
|
|||
unsigned char * uninitvar_mbscat(unsigned char *strDestination, const unsigned char *strSource)
|
||||
{
|
||||
unsigned char *uninit_deststr;
|
||||
unsigned char *uninit_srcstr1, *uninit_srcstr2;
|
||||
const unsigned char *uninit_srcstr1, *uninit_srcstr2;
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)_mbscat(uninit_deststr,uninit_srcstr1);
|
||||
// cppcheck-suppress uninitvar
|
||||
|
@ -1019,7 +1020,7 @@ error_t uninitvar_mbscat_s(unsigned char *strDestination, size_t numberOfElement
|
|||
{
|
||||
unsigned char *uninit_strDestination;
|
||||
size_t uninit_numberOfElements;
|
||||
unsigned char *uninit_strSource;
|
||||
const unsigned char *uninit_strSource;
|
||||
|
||||
// cppcheck-suppress uninitvar
|
||||
(void)_mbscat_s(uninit_strDestination, numberOfElements, strSource);
|
||||
|
@ -1077,7 +1078,7 @@ error_t nullPointer__strncpy_s_l(char *strDest, size_t numberOfElements, const c
|
|||
return _strncpy_s_l(strDest, numberOfElements, strSource, count, locale);
|
||||
}
|
||||
|
||||
void GetShortPathName_validCode(TCHAR* lpszPath)
|
||||
void GetShortPathName_validCode(const TCHAR* lpszPath)
|
||||
{
|
||||
long length = GetShortPathName(lpszPath, NULL, 0);
|
||||
if (length == 0) {
|
||||
|
|
|
@ -277,8 +277,9 @@ void invalidFunctionArg(const wxString &str)
|
|||
void uninitvar(wxWindow &w)
|
||||
{
|
||||
wxLogLevel logLevelUninit;
|
||||
// cppcheck-suppress constVariable
|
||||
char cBufUninit[10];
|
||||
char *pcUninit;
|
||||
const char *pcUninit;
|
||||
bool uninitBool;
|
||||
// cppcheck-suppress uninitvar
|
||||
wxLogGeneric(logLevelUninit, "test");
|
||||
|
|
|
@ -3020,7 +3020,10 @@ private:
|
|||
"void ah();\n"
|
||||
"void an();\n"
|
||||
"void h();");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
ASSERT_EQUALS("[test.cpp:131]: (style) Variable 'tm' can be declared as pointer to const\n"
|
||||
"[test.cpp:136]: (style) Variable 'af' can be declared as pointer to const\n"
|
||||
"[test.cpp:137]: (style) Variable 'ag' can be declared as pointer to const\n",
|
||||
errout.str());
|
||||
|
||||
check("class C\n"
|
||||
"{\n"
|
||||
|
@ -3792,6 +3795,11 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (style) Parameter 's' can be declared as pointer to const\n",
|
||||
errout.str());
|
||||
|
||||
check("size_t f(char* p) {\n" // #11842
|
||||
" return strlen(p);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:1]: (style) Parameter 'p' can be declared as pointer to const\n", errout.str());
|
||||
}
|
||||
|
||||
void switchRedundantAssignmentTest() {
|
||||
|
|
Loading…
Reference in New Issue