diff --git a/scripts/cppcheck.sh b/scripts/cppcheck.sh
index d35b4c53e..4b7228d97 100755
--- a/scripts/cppcheck.sh
+++ b/scripts/cppcheck.sh
@@ -5,7 +5,9 @@
function check_code {
cppcheck \
- --enable=all \
+ -j 4 \
+ --enable=style,performance,portability,missingInclude \
+ --inline-suppr \
--force \
--verbose \
. > /dev/null
diff --git a/src/lib/3rdparty/qtwin.cpp b/src/lib/3rdparty/qtwin.cpp
index 02154cc3d..d59306ec9 100644
--- a/src/lib/3rdparty/qtwin.cpp
+++ b/src/lib/3rdparty/qtwin.cpp
@@ -139,7 +139,7 @@ bool QtWin::isCompositionEnabled()
{
#ifdef Q_OS_WIN
if (resolveLibs()) {
- HRESULT hr = S_OK;
+ HRESULT hr;
BOOL isEnabled = false;
hr = pDwmIsCompositionEnabled(&isEnabled);
if (SUCCEEDED(hr)) {
@@ -164,7 +164,6 @@ bool QtWin::enableBlurBehindWindow(QWidget* widget, bool enable)
#ifdef Q_OS_WIN
if (resolveLibs()) {
DWM_BLURBEHIND bb = {0};
- HRESULT hr = S_OK;
bb.fEnable = enable;
bb.dwFlags = DWM_BB_ENABLE;
bb.hRgnBlur = NULL;
@@ -174,7 +173,7 @@ bool QtWin::enableBlurBehindWindow(QWidget* widget, bool enable)
// Qt5: setting WA_TranslucentBackground without the following line hides the widget!!
widget->setWindowOpacity(1);
- hr = pDwmEnableBlurBehindWindow(hwndOfWidget(widget) , &bb);
+ HRESULT hr = pDwmEnableBlurBehindWindow(hwndOfWidget(widget) , &bb);
if (SUCCEEDED(hr)) {
result = true;
windowNotifier()->addWidget(widget);
@@ -211,7 +210,7 @@ bool QtWin::extendFrameIntoClientArea(QWidget* widget, int left, int top, int ri
#ifdef Q_OS_WIN
if (resolveLibs()) {
QLibrary dwmLib(QString::fromLatin1("dwmapi"));
- HRESULT hr = S_OK;
+ HRESULT hr;
MARGINS m = {left, right, top, bottom};
hr = pDwmExtendFrameIntoClientArea(hwndOfWidget(widget), &m);
if (SUCCEEDED(hr)) {
@@ -241,7 +240,7 @@ QColor QtWin::colorizationColor()
DWORD color = 0;
BOOL opaque = FALSE;
QLibrary dwmLib(QString::fromLatin1("dwmapi"));
- HRESULT hr = S_OK;
+ HRESULT hr;
hr = pDwmGetColorizationColor(&color, &opaque);
if (SUCCEEDED(hr)) {
resultColor = QColor(color);
diff --git a/src/lib/3rdparty/qurlinfo.cpp b/src/lib/3rdparty/qurlinfo.cpp
index 0ebb3f6ba..e97202153 100644
--- a/src/lib/3rdparty/qurlinfo.cpp
+++ b/src/lib/3rdparty/qurlinfo.cpp
@@ -451,6 +451,10 @@ QUrlInfo::~QUrlInfo()
QUrlInfo &QUrlInfo::operator=(const QUrlInfo &ui)
{
+ if (this == &ui) {
+ return *this;
+ }
+
if (ui.d) {
if (!d) {
d = new QUrlInfoPrivate;
diff --git a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp
index 732d837ad..46bfc85be 100644
--- a/src/lib/network/schemehandlers/qupzillaschemehandler.cpp
+++ b/src/lib/network/schemehandlers/qupzillaschemehandler.cpp
@@ -394,26 +394,34 @@ QString QupZillaSchemeReply::configPage()
QString("
%1%2").arg(tr("Themes"), mApp->THEMESDIR) +
QString("%1%2").arg(tr("Translations"), mApp->TRANSLATIONSDIR));
- QString debugBuild = tr("Disabled");
- QString webGLEnabled = tr("Disabled");
- QString w7APIEnabled = tr("Disabled");
- QString KDEIntegration = tr("Disabled");
- QString portableBuild = tr("Disabled");
-
#ifdef QUPZILLA_DEBUG_BUILD
- debugBuild = tr("Enabled");
+ QString debugBuild = tr("Enabled");
+#else
+ QString debugBuild = tr("Disabled");
#endif
+
#if defined (USE_WEBGL) || (QTWEBKIT_FROM_2_3 && defined(QZ_WS_X11))
- webGLEnabled = tr("Enabled");
+ QString webGLEnabled = tr("Enabled");
+#else
+ QString webGLEnabled = tr("Disabled");
#endif
+
#if defined(Q_OS_WIN) && defined(W7API)
- w7APIEnabled = tr("Enabled");
+ QString w7APIEnabled = tr("Enabled");
+#else
+ QString w7APIEnabled = tr("Disabled");
#endif
+
#if defined(QZ_WS_X11) && defined(KDE)
- KDEIntegration = tr("Enabled");
+ QString KDEIntegration = tr("Enabled");
+#else
+ QString KDEIntegration = tr("Disabled");
#endif
+
#ifdef PORTABLE_BUILD
- portableBuild = tr("Enabled");
+ QString portableBuild = tr("Enabled");
+#else
+ QString portableBuild = tr("Disabled");
#endif
cPage.replace(QLatin1String("%BUILD-CONFIG-TEXT%"),
diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp
index 8f1215d7a..11a9bc283 100644
--- a/src/lib/webview/tabbar.cpp
+++ b/src/lib/webview/tabbar.cpp
@@ -196,7 +196,6 @@ QSize TabBar::tabSizeHint(int index) const
QSize size = QTabBar::tabSizeHint(index);
WebTab* webTab = qobject_cast(m_tabWidget->widget(index));
TabBar* tabBar = const_cast (this);
- bool adjustingActiveTab = false;
if (webTab && webTab->isPinned()) {
size.setWidth(PINNED_TAB_WIDTH);
@@ -215,6 +214,8 @@ QSize TabBar::tabSizeHint(int index) const
else {
int maxWidthForTab = availableWidth / normalTabsCount;
int realTabWidth = maxWidthForTab;
+ bool adjustingActiveTab = false;
+
if (realTabWidth < MINIMUM_ACTIVE_TAB_WIDTH) {
maxWidthForTab = (availableWidth - MINIMUM_ACTIVE_TAB_WIDTH) / (normalTabsCount - 1);
realTabWidth = MINIMUM_ACTIVE_TAB_WIDTH;
@@ -275,7 +276,6 @@ QSize TabBar::tabSizeHint(int index) const
else {
m_activeTabWidth = (availableWidth - maxWidthForTab * normalTabsCount) + maxWidthForTab;
}
- adjustingActiveTab = true;
size.setWidth(m_activeTabWidth);
}
else {
diff --git a/src/lib/webview/webview.cpp b/src/lib/webview/webview.cpp
index 1289905b3..3582c50ee 100644
--- a/src/lib/webview/webview.cpp
+++ b/src/lib/webview/webview.cpp
@@ -798,6 +798,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
m_actionStop->setEnabled(isLoading());
}
+ // cppcheck-suppress variableScope
int spellCheckActionCount = 0;
#ifdef USE_HUNSPELL
@@ -821,6 +822,7 @@ void WebView::createContextMenu(QMenu* menu, const QWebHitTestResult &hitTest, c
}
if (hitTest.isContentEditable()) {
+ // This only checks if the menu is empty (only spellchecker actions added)
if (menu->actions().count() == spellCheckActionCount) {
QMenu* pageMenu = page()->createStandardContextMenu();
// Apparently createStandardContextMenu() can return null pointer
diff --git a/src/plugins/MouseGestures/3rdparty/adv_recognizer.cpp b/src/plugins/MouseGestures/3rdparty/adv_recognizer.cpp
index d7201caac..4310fe38e 100644
--- a/src/plugins/MouseGestures/3rdparty/adv_recognizer.cpp
+++ b/src/plugins/MouseGestures/3rdparty/adv_recognizer.cpp
@@ -138,9 +138,10 @@ void RealTimeMouseGestureRecognizer::recognizeGesture()
for (GestureList::const_iterator gi = gestures.begin(); gi != gestures.end(); ++gi) {
int readIndex = directions.getReadPointer();
- bool match = true;
try {
+ bool match = true;
+
for (DirectionList::const_iterator di = gi->directions.begin(); di != gi->directions.end() && match; ++di) {
Direction d = directions.pop();
if (*di != d) {