Coverity scan.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-10-19 09:10:39 +03:00
parent 65d2213ef9
commit 03b6ce08cc
5 changed files with 16 additions and 2 deletions

View File

@ -144,6 +144,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con
break; break;
#endif #endif
case QtDebugMsg: case QtDebugMsg:
Q_UNREACHABLE();
default: default:
break; break;
} }

View File

@ -316,6 +316,12 @@ bool DL_Dxf::getStrippedLine(std::string &s, unsigned int size,
*/ */
bool DL_Dxf::stripWhiteSpace(char** s) bool DL_Dxf::stripWhiteSpace(char** s)
{ {
// No need to check if string is null
if (not (*s))
{
return false;
}
// last non-NULL char: // last non-NULL char:
int lastChar = static_cast<int>(strlen(*s) - 1); int lastChar = static_cast<int>(strlen(*s) - 1);
@ -5927,6 +5933,12 @@ void DL_Dxf::test()
stripWhiteSpace(&buf6); stripWhiteSpace(&buf6);
std::cout << "2 buf6: '" << buf6 << "'\n"; std::cout << "2 buf6: '" << buf6 << "'\n";
delete[] buf1;
delete[] buf2;
delete[] buf3;
delete[] buf4;
delete[] buf5;
delete[] buf6;
} }

View File

@ -146,7 +146,7 @@ QPointF VToolCurveIntersectAxis::FindPoint(const QPointF &point, qreal angle,
const QSharedPointer<VAbstractCurve> &curve) const QSharedPointer<VAbstractCurve> &curve)
{ {
QRectF rec = QRectF(0, 0, INT_MAX, INT_MAX); QRectF rec = QRectF(0, 0, INT_MAX, INT_MAX);
rec.translate(static_cast<qreal>(-INT_MAX/2), static_cast<qreal>(-INT_MAX/2)); rec.translate(-INT_MAX/2.0, -INT_MAX/2.0);
const QLineF axis = VGObject::BuildAxis(point, angle, rec); const QLineF axis = VGObject::BuildAxis(point, angle, rec);
QVector<QPointF> points = curve->IntersectLine(axis); QVector<QPointF> points = curve->IntersectLine(axis);

View File

@ -114,7 +114,7 @@ void VToolSinglePoint::NameChangePosition(const QPointF &pos)
*/ */
void VToolSinglePoint::UpdateNamePosition(quint32 id) void VToolSinglePoint::UpdateNamePosition(quint32 id)
{ {
VPointF *point = new VPointF(*VAbstractTool::data.GeometricObject<VPointF>(id)); const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(id);
MoveLabel *moveLabel = new MoveLabel(doc, point->mx(), point->my(), id, this->scene()); MoveLabel *moveLabel = new MoveLabel(doc, point->mx(), point->my(), id, this->scene());
connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
qApp->getUndoStack()->push(moveLabel); qApp->getUndoStack()->push(moveLabel);

View File

@ -132,6 +132,7 @@ void TST_MeasurementRegExp::TestMeasurementRegExp()
} }
delete pmsTranslator; delete pmsTranslator;
} }
break;
} }
default: default:
QWARN("Unexpected state"); QWARN("Unexpected state");