summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Blair <zack_blair@hotmail.com>2010-06-27 20:38:16 (GMT)
committerAndreas Kling <andreas.kling@nokia.com>2010-06-27 20:38:24 (GMT)
commit9acf20771b624132833b2ca1e8bc421f69774f1e (patch)
tree2dac345e7f7b730609341bb4f15f61a362bea8c0
parent211d51adae4d3914544c6b3f82caf66a99af03ec (diff)
downloadQt-9acf20771b624132833b2ca1e8bc421f69774f1e.zip
Qt-9acf20771b624132833b2ca1e8bc421f69774f1e.tar.gz
Qt-9acf20771b624132833b2ca1e8bc421f69774f1e.tar.bz2
Fix suspicious code found by static code analysis:
* Missing break in switch * delete instead of delete[] * Null-pointer check after dereference Merge-request: 716 Reviewed-by: Andreas Kling <andreas.kling@nokia.com>
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp1
-rw-r--r--src/gui/styles/qwindowscestyle.cpp1
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp6
-rw-r--r--src/qt3support/text/q3richtext.cpp4
5 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 883f511..cb48def 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -3763,6 +3763,7 @@ int QCleanlooksStyle::pixelMetric(PixelMetric metric, const QStyleOption *option
break;
case PM_MenuBarItemSpacing:
ret = 6;
+ break;
case PM_MenuBarHMargin:
ret = 0;
break;
diff --git a/src/gui/styles/qwindowscestyle.cpp b/src/gui/styles/qwindowscestyle.cpp
index b027005..bd7246a 100644
--- a/src/gui/styles/qwindowscestyle.cpp
+++ b/src/gui/styles/qwindowscestyle.cpp
@@ -2294,6 +2294,7 @@ int QWindowsCEStyle::styleHint(StyleHint hint, const QStyleOption *opt, const QW
break;
case SH_EtchDisabledText:
ret = false;
+ break;
case SH_RequestSoftwareInputPanel:
ret = RSIP_OnMouseClick;
break;
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index efb1224..8858475 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -4052,7 +4052,7 @@ void QWindowsXPStylePrivate::dumpNativeDIB(int w, int h)
bufferPos += sprintf(bufferPos, "\n};\n\n");
printf(bufferDump);
- delete bufferDump;
+ delete[] bufferDump;
++pCount;
}
}
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
index ecd03e5..19f3b3c 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
@@ -127,7 +127,7 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
}
}
- delete streams;
+ delete[] streams;
}
}
@@ -201,7 +201,7 @@ QList<int> QAudioDeviceInfoInternal::frequencyList()
rc << vr[i].mMaximum;
}
- delete vr;
+ delete[] vr;
}
}
@@ -345,7 +345,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
}
}
- delete audioDevices;
+ delete[] audioDevices;
}
}
diff --git a/src/qt3support/text/q3richtext.cpp b/src/qt3support/text/q3richtext.cpp
index 8614076..625dd95 100644
--- a/src/qt3support/text/q3richtext.cpp
+++ b/src/qt3support/text/q3richtext.cpp
@@ -8079,9 +8079,9 @@ bool Q3TextTable::down(Q3TextCursor *c, Q3TextDocument *&doc, Q3TextParagraph *&
break;
}
}
- doc = cell->richText();
if (!cell)
return false;
+ doc = cell->richText();
parag = doc->firstParagraph();
idx = 0;
ox += cell->geometry().x() + cell->horizontalAlignmentOffset() + outerborder + parent->x();
@@ -8117,9 +8117,9 @@ bool Q3TextTable::up(Q3TextCursor *c, Q3TextDocument *&doc, Q3TextParagraph *&pa
break;
}
}
- doc = cell->richText();
if (!cell)
return false;
+ doc = cell->richText();
parag = doc->lastParagraph();
idx = parag->length() - 1;
ox += cell->geometry().x() + cell->horizontalAlignmentOffset() + outerborder + parent->x();