mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-19 18:26:34 +01:00
[Code] Improved cppcheck script and fixed all warnings.
This commit is contained in:
parent
f8e9516a5a
commit
087eb93ecb
@ -5,7 +5,9 @@
|
||||
|
||||
function check_code {
|
||||
cppcheck \
|
||||
--enable=all \
|
||||
-j 4 \
|
||||
--enable=style,performance,portability,missingInclude \
|
||||
--inline-suppr \
|
||||
--force \
|
||||
--verbose \
|
||||
. > /dev/null
|
||||
|
9
src/lib/3rdparty/qtwin.cpp
vendored
9
src/lib/3rdparty/qtwin.cpp
vendored
@ -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);
|
||||
|
4
src/lib/3rdparty/qurlinfo.cpp
vendored
4
src/lib/3rdparty/qurlinfo.cpp
vendored
@ -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;
|
||||
|
@ -394,26 +394,34 @@ QString QupZillaSchemeReply::configPage()
|
||||
QString("<dt>%1</dt><dd>%2<dd>").arg(tr("Themes"), mApp->THEMESDIR) +
|
||||
QString("<dt>%1</dt><dd>%2<dd>").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("<b>Enabled</b>");
|
||||
QString debugBuild = tr("<b>Enabled</b>");
|
||||
#else
|
||||
QString debugBuild = tr("Disabled");
|
||||
#endif
|
||||
|
||||
#if defined (USE_WEBGL) || (QTWEBKIT_FROM_2_3 && defined(QZ_WS_X11))
|
||||
webGLEnabled = tr("<b>Enabled</b>");
|
||||
QString webGLEnabled = tr("<b>Enabled</b>");
|
||||
#else
|
||||
QString webGLEnabled = tr("Disabled");
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(W7API)
|
||||
w7APIEnabled = tr("<b>Enabled</b>");
|
||||
QString w7APIEnabled = tr("<b>Enabled</b>");
|
||||
#else
|
||||
QString w7APIEnabled = tr("Disabled");
|
||||
#endif
|
||||
|
||||
#if defined(QZ_WS_X11) && defined(KDE)
|
||||
KDEIntegration = tr("<b>Enabled</b>");
|
||||
QString KDEIntegration = tr("<b>Enabled</b>");
|
||||
#else
|
||||
QString KDEIntegration = tr("Disabled");
|
||||
#endif
|
||||
|
||||
#ifdef PORTABLE_BUILD
|
||||
portableBuild = tr("<b>Enabled</b>");
|
||||
QString portableBuild = tr("<b>Enabled</b>");
|
||||
#else
|
||||
QString portableBuild = tr("Disabled");
|
||||
#endif
|
||||
|
||||
cPage.replace(QLatin1String("%BUILD-CONFIG-TEXT%"),
|
||||
|
@ -196,7 +196,6 @@ QSize TabBar::tabSizeHint(int index) const
|
||||
QSize size = QTabBar::tabSizeHint(index);
|
||||
WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(index));
|
||||
TabBar* tabBar = const_cast <TabBar*>(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 {
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user