2018-02-06 15:33:45 +01:00
|
|
|
|
2018-02-20 23:34:01 +01:00
|
|
|
// Test library configuration for wxwidgets.cfg
|
2018-02-06 15:33:45 +01:00
|
|
|
//
|
|
|
|
// Usage:
|
2023-02-24 21:37:56 +01:00
|
|
|
// $ ./cppcheck --check-library --library=wxwidgets --enable=style,information --inconclusive --error-exitcode=1 --suppress=missingIncludeSystem --inline-suppr test/cfg/wxwidgets.cpp
|
2018-02-06 15:33:45 +01:00
|
|
|
// =>
|
|
|
|
// No warnings about bad library configuration, unmatched suppressions, etc. exitcode=0
|
|
|
|
//
|
|
|
|
|
2019-08-25 15:54:50 +02:00
|
|
|
#include <wx/wx.h>
|
2018-02-09 20:34:15 +01:00
|
|
|
#include <wx/app.h>
|
2020-05-01 20:12:42 +02:00
|
|
|
#include <wx/dc.h>
|
2018-02-09 20:34:15 +01:00
|
|
|
#include <wx/log.h>
|
2018-02-06 15:33:45 +01:00
|
|
|
#include <wx/filefn.h>
|
2018-02-09 20:34:15 +01:00
|
|
|
#include <wx/spinctrl.h>
|
|
|
|
#include <wx/artprov.h>
|
|
|
|
#include <wx/calctrl.h>
|
|
|
|
#include <wx/combo.h>
|
|
|
|
#include <wx/icon.h>
|
|
|
|
#include <wx/bitmap.h>
|
2018-02-14 09:53:40 +01:00
|
|
|
#include <wx/dataview.h>
|
2018-02-20 23:34:01 +01:00
|
|
|
#include <wx/memory.h>
|
2018-03-31 13:23:12 +02:00
|
|
|
#include <wx/frame.h>
|
|
|
|
#include <wx/menu.h>
|
2022-07-02 09:24:22 +02:00
|
|
|
#include <wx/regex.h>
|
2018-11-22 13:47:17 +01:00
|
|
|
#include <wx/stattext.h>
|
2018-11-22 14:04:22 +01:00
|
|
|
#include <wx/sizer.h>
|
2019-08-23 19:10:49 +02:00
|
|
|
#include <wx/string.h>
|
2019-12-22 11:11:59 +01:00
|
|
|
#include <wx/textctrl.h>
|
2020-02-25 20:23:20 +01:00
|
|
|
#include <wx/propgrid/property.h>
|
|
|
|
|
2022-07-02 09:24:22 +02:00
|
|
|
void uninitvar_wxRegEx_GetMatch(wxRegEx &obj, size_t *start, size_t *len, size_t index)
|
|
|
|
{
|
|
|
|
size_t s,l;
|
|
|
|
size_t *sPtr,*lPtr;
|
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
(void)obj.GetMatch(&s,lPtr);
|
|
|
|
// TODO cppcheck-suppress uninitvar
|
|
|
|
(void)obj.GetMatch(sPtr,&l);
|
|
|
|
(void)obj.GetMatch(&s,&l);
|
|
|
|
(void)obj.GetMatch(start,len);
|
|
|
|
(void)obj.GetMatch(start,len,0);
|
|
|
|
(void)obj.GetMatch(start,len,index);
|
|
|
|
}
|
|
|
|
|
2021-04-13 13:07:15 +02:00
|
|
|
#ifdef __VISUALC__
|
|
|
|
// Ensure no duplicateBreak warning is issued after wxLogApiError() calls.
|
|
|
|
// This function does not terminate execution.
|
2021-04-13 14:44:59 +02:00
|
|
|
bool duplicateBreak_wxLogApiError(const wxString &msg, const HRESULT &hr, wxString &str)
|
2021-04-13 13:07:15 +02:00
|
|
|
{
|
2021-04-13 14:44:59 +02:00
|
|
|
if (hr) {
|
2021-04-13 13:07:15 +02:00
|
|
|
wxLogApiError(msg,hr);
|
2021-04-13 14:44:59 +02:00
|
|
|
str = "fail";
|
2021-04-13 13:07:15 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2022-04-19 06:53:34 +02:00
|
|
|
void argDirection_wxString_ToDouble(const wxString &str)
|
|
|
|
{
|
2022-04-19 21:13:22 +02:00
|
|
|
// No warning is expected. Ensure both arguments are treated
|
|
|
|
// as output by library configuration
|
|
|
|
double value;
|
|
|
|
const bool convOk = str.ToDouble(&value);
|
|
|
|
if (convOk && value <= 42.0) {}
|
2022-04-19 06:53:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void argDirection_wxString_ToCDouble(const wxString &str)
|
|
|
|
{
|
2022-04-19 21:13:22 +02:00
|
|
|
// No warning is expected. Ensure both arguments are treated
|
|
|
|
// as output by library configuration
|
|
|
|
double value;
|
|
|
|
const bool convOk = str.ToCDouble(&value);
|
|
|
|
if (convOk && value <= 42.0) {}
|
2022-04-19 06:53:34 +02:00
|
|
|
}
|
|
|
|
|
2022-04-18 15:41:50 +02:00
|
|
|
void argDirection_wxTextCtrl_GetSelection(const wxTextCtrl *const textCtrl)
|
|
|
|
{
|
2022-04-19 21:13:22 +02:00
|
|
|
// No warning is expected. Ensure both arguments are treated
|
|
|
|
// as output by library configuration
|
|
|
|
long start;
|
|
|
|
long end;
|
|
|
|
textCtrl->GetSelection(&start, &end);
|
|
|
|
if (start > 0 && end > 0) {}
|
2022-04-18 15:41:50 +02:00
|
|
|
}
|
|
|
|
|
2021-04-13 13:07:15 +02:00
|
|
|
void useRetval_wxString_MakeCapitalized(wxString &str)
|
2021-04-07 07:57:27 +02:00
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
str.MakeCapitalized();
|
|
|
|
}
|
|
|
|
|
2021-04-13 13:07:15 +02:00
|
|
|
void useRetval_wxString_MakeLower(wxString &str)
|
2021-04-07 07:57:27 +02:00
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
str.MakeLower();
|
|
|
|
}
|
|
|
|
|
2021-04-13 13:07:15 +02:00
|
|
|
void useRetval_wxString_MakeUpper(wxString &str)
|
2021-04-07 07:57:27 +02:00
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
str.MakeUpper();
|
|
|
|
}
|
|
|
|
|
2020-05-23 09:24:01 +02:00
|
|
|
wxString containerOutOfBounds_wxArrayString(void)
|
|
|
|
{
|
|
|
|
wxArrayString a;
|
|
|
|
a.Add("42");
|
|
|
|
a.Clear();
|
2020-08-10 05:52:03 +02:00
|
|
|
// TODO: wxArrayString is defined to be a vector
|
|
|
|
// TODO: cppcheck-suppress containerOutOfBounds
|
2020-05-23 09:24:01 +02:00
|
|
|
return a[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
int containerOutOfBounds_wxArrayInt(void)
|
|
|
|
{
|
|
|
|
wxArrayInt a;
|
|
|
|
a.Add(42);
|
|
|
|
a.Clear();
|
2020-08-10 05:52:03 +02:00
|
|
|
// TODO: wxArrayString is defined to be a vector
|
|
|
|
// TODO: cppcheck-suppress containerOutOfBounds
|
2020-05-23 09:24:01 +02:00
|
|
|
return a[0];
|
|
|
|
}
|
|
|
|
|
2020-05-01 20:12:42 +02:00
|
|
|
void ignoredReturnValue_wxDC_GetSize(const wxDC &dc, wxCoord *width, wxCoord *height)
|
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
dc.GetSize(width, height);
|
2020-05-23 09:24:01 +02:00
|
|
|
// No warning is expected for
|
2020-05-01 20:12:42 +02:00
|
|
|
(void)dc.GetSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ignoredReturnValue_wxDC_GetSizeMM(const wxDC &dc, wxCoord *width, wxCoord *height)
|
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
dc.GetSizeMM(width, height);
|
|
|
|
// Now warning is expected for
|
|
|
|
(void)dc.GetSizeMM();
|
|
|
|
}
|
|
|
|
|
2020-02-26 16:10:10 +01:00
|
|
|
wxSizerItem* invalidFunctionArgBool_wxSizer_Add(wxSizer *sizer, wxWindow * window, const wxSizerFlags &flags)
|
|
|
|
{
|
|
|
|
// No warning is expected for
|
|
|
|
return sizer->Add(window,flags);
|
|
|
|
}
|
|
|
|
|
2020-02-25 20:23:20 +01:00
|
|
|
bool invalidFunctionArgBool_wxPGProperty_Hide(wxPGProperty *pg, bool hide, int flags)
|
|
|
|
{
|
|
|
|
// cppcheck-suppress invalidFunctionArgBool
|
|
|
|
(void)pg->Hide(hide, true);
|
|
|
|
// No warning is expected for
|
|
|
|
return pg->Hide(hide, flags);
|
|
|
|
}
|
2019-12-22 11:11:59 +01:00
|
|
|
|
2021-04-18 21:42:27 +02:00
|
|
|
wxTextCtrlHitTestResult nullPointer_wxTextCtrl_HitTest(const wxTextCtrl& txtCtrl, const wxPoint& pos)
|
2019-12-22 11:11:59 +01:00
|
|
|
{
|
|
|
|
// no nullPointer-warning is expected
|
|
|
|
return txtCtrl.HitTest(pos, NULL);
|
|
|
|
}
|
2018-02-06 15:33:45 +01:00
|
|
|
|
|
|
|
void validCode()
|
|
|
|
{
|
|
|
|
wxString str = wxGetCwd();
|
2018-12-13 18:52:56 +01:00
|
|
|
(void)str;
|
2018-02-06 15:33:45 +01:00
|
|
|
|
|
|
|
wxLogGeneric(wxLOG_Message, "test %d", 0);
|
|
|
|
wxLogMessage("test %s", "str");
|
|
|
|
|
|
|
|
wxString translation1 = _("text");
|
|
|
|
wxString translation2 = wxGetTranslation("text");
|
|
|
|
wxString translation3 = wxGetTranslation("string", "domain");
|
2018-12-13 18:52:56 +01:00
|
|
|
(void)translation1;
|
|
|
|
(void)translation2;
|
|
|
|
(void)translation3;
|
2018-02-06 15:33:45 +01:00
|
|
|
}
|
|
|
|
|
2018-02-09 20:34:15 +01:00
|
|
|
#if wxUSE_GUI==1
|
|
|
|
void validGuiCode()
|
|
|
|
{
|
|
|
|
#if wxUSE_SPINCTRL==1
|
|
|
|
extern wxSpinCtrl spinCtrlInstance;
|
|
|
|
spinCtrlInstance.SetBase(10);
|
|
|
|
spinCtrlInstance.SetBase(16);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-04-07 20:27:02 +02:00
|
|
|
void nullPointer(const wxString &str)
|
2018-02-06 15:33:45 +01:00
|
|
|
{
|
2019-03-16 21:21:30 +01:00
|
|
|
// cppcheck-suppress nullPointer
|
2018-02-09 20:34:15 +01:00
|
|
|
wxLogGeneric(wxLOG_Message, (char*)NULL);
|
2019-03-16 21:21:30 +01:00
|
|
|
// cppcheck-suppress nullPointer
|
2018-02-09 20:34:15 +01:00
|
|
|
wxLogMessage((char*)NULL);
|
2018-04-07 20:27:02 +02:00
|
|
|
|
|
|
|
double *doublePtr = NULL;
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
(void)str.ToDouble(doublePtr);
|
2019-03-04 10:26:37 +01:00
|
|
|
double *doublePtr1 = NULL;
|
2018-04-07 20:27:02 +02:00
|
|
|
// cppcheck-suppress nullPointer
|
2019-03-04 10:26:37 +01:00
|
|
|
(void)str.ToCDouble(doublePtr1);
|
2018-04-07 20:27:02 +02:00
|
|
|
|
|
|
|
long * longPtr = NULL;
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
(void)str.ToLong(longPtr);
|
2019-03-04 10:26:37 +01:00
|
|
|
long * longPtr1 = NULL;
|
2018-04-07 20:27:02 +02:00
|
|
|
// cppcheck-suppress nullPointer
|
2019-03-04 10:26:37 +01:00
|
|
|
(void)str.ToCLong(longPtr1);
|
2018-04-07 20:27:02 +02:00
|
|
|
|
|
|
|
unsigned long * ulongPtr = NULL;
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
(void)str.ToULong(ulongPtr);
|
2019-03-04 10:26:37 +01:00
|
|
|
unsigned long * ulongPtr1 = NULL;
|
2018-04-07 20:27:02 +02:00
|
|
|
// cppcheck-suppress nullPointer
|
2019-03-04 10:26:37 +01:00
|
|
|
(void)str.ToCULong(ulongPtr1);
|
2018-04-07 20:27:02 +02:00
|
|
|
|
|
|
|
long long * longLongPtr = NULL;
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
(void)str.ToLongLong(longLongPtr);
|
|
|
|
|
|
|
|
unsigned long long * ulongLongPtr = NULL;
|
|
|
|
// cppcheck-suppress nullPointer
|
|
|
|
(void)str.ToULongLong(ulongLongPtr);
|
2018-11-22 14:04:22 +01:00
|
|
|
}
|
2018-04-07 20:27:02 +02:00
|
|
|
|
2018-11-22 14:04:22 +01:00
|
|
|
void nullPointer_wxSizer_Add(wxSizer &sizer, wxWindow *w)
|
|
|
|
{
|
2018-11-23 06:47:27 +01:00
|
|
|
wxWindow * const ptr = 0;
|
2018-11-23 09:49:08 +01:00
|
|
|
// @todo cppcheck-suppress nullPointer
|
2018-11-23 06:47:27 +01:00
|
|
|
sizer.Add(ptr);
|
|
|
|
// No warning shall be issued for
|
|
|
|
sizer.Add(w);
|
2018-11-22 14:04:22 +01:00
|
|
|
}
|
|
|
|
|
2018-11-23 06:47:27 +01:00
|
|
|
void uninitvar_wxSizer_Add(wxSizer &sizer, wxWindow *w,wxObject* userData)
|
2018-11-22 14:04:22 +01:00
|
|
|
{
|
2019-03-02 19:38:11 +01:00
|
|
|
int uninit1, uninit2, uninit3;
|
2018-11-23 06:47:27 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
sizer.Add(w,uninit1);
|
2018-11-23 06:47:27 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
sizer.Add(w,4,uninit2);
|
2018-11-23 06:47:27 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
sizer.Add(w,4,2,uninit3,userData);
|
2018-02-06 15:33:45 +01:00
|
|
|
}
|
|
|
|
|
2018-04-04 21:29:55 +02:00
|
|
|
void ignoredReturnValue(const wxString &s)
|
2018-02-06 15:33:45 +01:00
|
|
|
{
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
wxGetCwd();
|
2018-04-04 21:29:55 +02:00
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
wxAtoi(s);
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
wxAtol(s);
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
wxAtof(s);
|
2018-02-06 15:33:45 +01:00
|
|
|
}
|
|
|
|
|
2018-04-07 20:27:02 +02:00
|
|
|
void invalidFunctionArg(const wxString &str)
|
2018-02-06 15:33:45 +01:00
|
|
|
{
|
2018-02-09 20:34:15 +01:00
|
|
|
#if wxUSE_SPINCTRL==1
|
|
|
|
extern wxSpinCtrl spinCtrlInstance;
|
2018-02-06 15:33:45 +01:00
|
|
|
// cppcheck-suppress invalidFunctionArg
|
2018-02-09 20:34:15 +01:00
|
|
|
spinCtrlInstance.SetBase(0);
|
2018-02-06 15:33:45 +01:00
|
|
|
// cppcheck-suppress invalidFunctionArg
|
2018-02-09 20:34:15 +01:00
|
|
|
spinCtrlInstance.SetBase(5);
|
|
|
|
#endif
|
2018-04-07 20:27:02 +02:00
|
|
|
|
|
|
|
long l;
|
|
|
|
// cppcheck-suppress invalidFunctionArg
|
|
|
|
(void)str.ToLong(&l, -1);
|
|
|
|
// cppcheck-suppress invalidFunctionArg
|
|
|
|
(void)str.ToLong(&l, 1);
|
|
|
|
// cppcheck-suppress invalidFunctionArg
|
|
|
|
(void)str.ToLong(&l, 37);
|
2018-02-06 15:33:45 +01:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:31:09 +01:00
|
|
|
void uninitvar(wxWindow &w)
|
2018-02-06 15:33:45 +01:00
|
|
|
{
|
|
|
|
wxLogLevel logLevelUninit;
|
|
|
|
char cBufUninit[10];
|
|
|
|
char *pcUninit;
|
2018-11-22 13:31:09 +01:00
|
|
|
bool uninitBool;
|
2018-02-06 15:33:45 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
wxLogGeneric(logLevelUninit, "test");
|
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
wxLogMessage(cBufUninit);
|
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
wxLogMessage(pcUninit);
|
2018-11-22 13:31:09 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
w.Close(uninitBool);
|
2018-04-07 20:27:02 +02:00
|
|
|
}
|
|
|
|
|
2018-11-22 13:47:17 +01:00
|
|
|
void uninitvar_wxStaticText(wxStaticText &s)
|
|
|
|
{
|
|
|
|
// no warning
|
|
|
|
s.Wrap(-1);
|
2020-02-25 21:48:15 +01:00
|
|
|
int uninitInt;
|
2018-11-22 13:47:17 +01:00
|
|
|
// cppcheck-suppress uninitvar
|
2020-02-25 21:48:15 +01:00
|
|
|
s.Wrap(uninitInt);
|
2018-11-22 13:47:17 +01:00
|
|
|
}
|
|
|
|
|
2018-04-07 20:27:02 +02:00
|
|
|
void uninitvar_wxString_NumberConversion(const wxString &str, const int numberBase)
|
|
|
|
{
|
2019-03-02 19:38:11 +01:00
|
|
|
int uninitInteger1;
|
|
|
|
int uninitInteger2;
|
|
|
|
int uninitInteger3;
|
|
|
|
int uninitInteger4;
|
|
|
|
int uninitInteger5;
|
|
|
|
int uninitInteger6;
|
2018-04-07 20:27:02 +02:00
|
|
|
long l;
|
|
|
|
long long ll;
|
|
|
|
unsigned long ul;
|
|
|
|
unsigned long long ull;
|
|
|
|
|
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToLong(&l, uninitInteger1);
|
2018-04-04 21:29:55 +02:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToLongLong(&ll, uninitInteger2);
|
2018-04-07 20:27:02 +02:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToULong(&ul, uninitInteger3);
|
2018-04-07 20:27:02 +02:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToULongLong(&ull, uninitInteger4);
|
2018-04-07 20:27:02 +02:00
|
|
|
|
2018-04-04 21:29:55 +02:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToCLong(&l, uninitInteger5);
|
2018-04-04 21:29:55 +02:00
|
|
|
// cppcheck-suppress uninitvar
|
2019-03-02 19:38:11 +01:00
|
|
|
(void)str.ToCULong(&ul, uninitInteger6);
|
2018-02-06 15:33:45 +01:00
|
|
|
}
|
2018-02-07 11:40:42 +01:00
|
|
|
|
2018-03-31 13:34:40 +02:00
|
|
|
void uninitvar_SetMenuBar(wxFrame * const framePtr, wxMenuBar * const menuBarPtr)
|
2018-03-31 13:23:12 +02:00
|
|
|
{
|
2018-03-31 13:49:47 +02:00
|
|
|
wxMenuBar *menuBar;
|
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
framePtr->SetMenuBar(menuBar);
|
2018-03-31 13:23:12 +02:00
|
|
|
framePtr->SetMenuBar(menuBarPtr);
|
2018-03-31 13:34:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void uninitvar_wxMenuBarAppend(wxMenuBar * const menuBarPtr, wxMenu * const menuPtr, const wxString &title)
|
|
|
|
{
|
2018-03-31 13:49:47 +02:00
|
|
|
wxMenu *menu;
|
|
|
|
// cppcheck-suppress uninitvar
|
|
|
|
menuBarPtr->Append(menu, title);
|
2018-03-31 13:34:40 +02:00
|
|
|
menuBarPtr->Append(menuPtr, title);
|
2018-03-31 13:49:47 +02:00
|
|
|
}
|
2018-03-31 13:23:12 +02:00
|
|
|
|
2018-02-14 09:53:40 +01:00
|
|
|
void deprecatedFunctions_wxDataViewCustomRenderer(wxDataViewCustomRenderer &dataViewCustomRenderer, wxPoint cursor, wxRect cell, wxDataViewModel *model, const wxDataViewItem &item, unsigned int col)
|
|
|
|
{
|
|
|
|
// cppcheck-suppress ActivateCalled
|
|
|
|
dataViewCustomRenderer.Activate(cell, model, item, col);
|
|
|
|
// cppcheck-suppress LeftClickCalled
|
|
|
|
dataViewCustomRenderer.LeftClick(cursor, cell, model, item, col);
|
|
|
|
}
|
|
|
|
|
|
|
|
void deprecatedFunctions(wxApp &a,
|
|
|
|
const wxString &s,
|
|
|
|
wxArtProvider *artProvider,
|
|
|
|
wxCalendarCtrl &calenderCtrl,
|
2018-02-20 23:34:01 +01:00
|
|
|
wxComboCtrl &comboCtrl,
|
|
|
|
wxChar * path)
|
2018-02-07 11:40:42 +01:00
|
|
|
{
|
2018-02-09 20:34:15 +01:00
|
|
|
#ifdef __WXOSX__
|
2018-02-07 11:40:42 +01:00
|
|
|
// cppcheck-suppress MacOpenFileCalled
|
|
|
|
a.MacOpenFile(s);
|
2018-02-09 20:34:15 +01:00
|
|
|
#endif
|
2018-02-11 16:58:39 +01:00
|
|
|
|
|
|
|
#if wxCHECK_VERSION(3, 1, 0) // wxWidets-3.1.0 or higher:
|
|
|
|
// Some functions are not available anymore in newer versions
|
|
|
|
|
|
|
|
// @todo cppcheck-suppress ShowPopupCalled
|
|
|
|
comboCtrl.ShowPopup();
|
|
|
|
#else
|
2018-02-07 11:40:42 +01:00
|
|
|
// cppcheck-suppress InsertCalled
|
|
|
|
wxArtProvider::Insert(artProvider);
|
2018-02-11 16:58:39 +01:00
|
|
|
|
|
|
|
// cppcheck-suppress GetTextIndentCalled
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
comboCtrl.GetTextIndent();
|
|
|
|
|
|
|
|
// cppcheck-suppress HidePopupCalled
|
|
|
|
comboCtrl.HidePopup(true);
|
|
|
|
// cppcheck-suppress HidePopupCalled
|
|
|
|
comboCtrl.HidePopup(false);
|
|
|
|
// cppcheck-suppress HidePopupCalled
|
|
|
|
comboCtrl.HidePopup(/*default=false*/);
|
|
|
|
|
|
|
|
// cppcheck-suppress SetTextIndentCalled
|
|
|
|
comboCtrl.SetTextIndent(0);
|
2018-02-20 23:34:01 +01:00
|
|
|
|
2018-02-21 12:20:56 +01:00
|
|
|
#if wxUSE_DEBUG_CONTEXT==1
|
2018-02-20 23:34:01 +01:00
|
|
|
// cppcheck-suppress GetLevelCalled
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
|
|
|
wxDebugContext::GetLevel();
|
|
|
|
// cppcheck-suppress SetLevelCalled
|
|
|
|
wxDebugContext::SetLevel(42);
|
2018-02-21 12:20:56 +01:00
|
|
|
#endif
|
2018-02-20 23:34:01 +01:00
|
|
|
|
|
|
|
// cppcheck-suppress wxDos2UnixFilenameCalled
|
|
|
|
wxDos2UnixFilename(path);
|
|
|
|
|
|
|
|
// cppcheck-suppress wxFileNameFromPathCalled
|
|
|
|
// cppcheck-suppress ignoredReturnValue
|
2018-02-21 12:20:56 +01:00
|
|
|
wxFileNameFromPath(wxT_2("../test.c"));
|
2018-02-11 16:58:39 +01:00
|
|
|
#endif
|
|
|
|
|
2018-02-09 20:34:15 +01:00
|
|
|
#if defined(__WXMSW__) || defined(__WXGTK__)
|
|
|
|
// EnableYearChange() is not available on these GUI systems
|
|
|
|
#else
|
2018-02-07 13:33:15 +01:00
|
|
|
// cppcheck-suppress EnableYearChangeCalled
|
|
|
|
calenderCtrl.EnableYearChange(false);
|
|
|
|
// cppcheck-suppress EnableYearChangeCalled
|
2018-02-11 16:58:39 +01:00
|
|
|
calenderCtrl.EnableYearChange(true);
|
|
|
|
// cppcheck-suppress EnableYearChangeCalled
|
2018-02-07 13:33:15 +01:00
|
|
|
calenderCtrl.EnableYearChange(/*default=yes*/);
|
2018-02-09 20:34:15 +01:00
|
|
|
#endif
|
2018-02-07 11:40:42 +01:00
|
|
|
}
|
2019-08-23 19:10:49 +02:00
|
|
|
|
|
|
|
void wxString_test1(wxString s)
|
|
|
|
{
|
|
|
|
for (int i = 0; i <= s.size(); ++i) {
|
|
|
|
// cppcheck-suppress stlOutOfBounds
|
|
|
|
s[i] = 'x';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void wxString_test2()
|
|
|
|
{
|
|
|
|
wxString s;
|
|
|
|
// cppcheck-suppress containerOutOfBounds
|
|
|
|
s[1] = 'a';
|
|
|
|
s.append("abc");
|
|
|
|
s[1] = 'B';
|
|
|
|
printf("%s", static_cast<const char*>(s.c_str()));
|
|
|
|
wxPrintf("%s", s);
|
|
|
|
wxPrintf("%s", s.c_str());
|
|
|
|
s.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString::iterator wxString_test3()
|
|
|
|
{
|
|
|
|
wxString wxString1;
|
|
|
|
wxString wxString2;
|
2019-12-25 09:32:50 +01:00
|
|
|
// cppcheck-suppress mismatchingContainers
|
2019-08-23 19:10:49 +02:00
|
|
|
for (wxString::iterator it = wxString1.begin(); it != wxString2.end(); ++it)
|
|
|
|
{}
|
|
|
|
|
|
|
|
wxString::iterator it = wxString1.begin();
|
|
|
|
// cppcheck-suppress returnDanglingLifetime
|
|
|
|
return it;
|
|
|
|
}
|