Cppcheck warnings.

--HG--
branch : develop
This commit is contained in:
dismine 2014-09-11 20:15:07 +03:00
parent 2766628037
commit 1964b15704
16 changed files with 25 additions and 30 deletions

View File

@ -153,11 +153,10 @@ void Calculator::InitVariables(const VContainer *data, const QMap<int, QString>
const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables(); const QHash<QString, QSharedPointer<VInternalVariable> > *vars = data->DataVariables();
bool found = false;
QMap<int, QString>::const_iterator i = tokens.constBegin(); QMap<int, QString>::const_iterator i = tokens.constBegin();
while (i != tokens.constEnd()) while (i != tokens.constEnd())
{ {
found = false; bool found = false;
if (vars->contains(i.value())) if (vars->contains(i.value()))
{ {
QSharedPointer<VInternalVariable> var = vars->value(i.value()); QSharedPointer<VInternalVariable> var = vars->value(i.value());

View File

@ -495,7 +495,7 @@ void VContainer::SetHeightName(const QString &name)
* @brief size return size * @brief size return size
* @return size in mm * @return size in mm
*/ */
qreal VContainer::size() const qreal VContainer::size()
{ {
return _size; return _size;
} }
@ -511,7 +511,7 @@ QString VContainer::SizeName() const
* @brief height return height * @brief height return height
* @return height in pattern units * @return height in pattern units
*/ */
qreal VContainer::height() const qreal VContainer::height()
{ {
return _height; return _height;
} }

View File

@ -200,13 +200,13 @@ public:
void ClearDetails(); void ClearDetails();
static void ClearUniqueNames(); static void ClearUniqueNames();
void SetSize(qreal size); static void SetSize(qreal size);
void SetSizeName(const QString &name); void SetSizeName(const QString &name);
void SetHeight(qreal height); static void SetHeight(qreal height);
void SetHeightName(const QString &name); void SetHeightName(const QString &name);
qreal size() const; static qreal size();
QString SizeName() const; QString SizeName() const;
qreal height() const; static qreal height();
QString HeightName()const; QString HeightName()const;
bool VariableExist(const QString& name); bool VariableExist(const QString& name);

View File

@ -44,7 +44,7 @@
DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent) DialogBisector::DialogBisector(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), typeLine(QString()), :DialogTool(data, toolId, parent), ui(new Ui::DialogBisector), number(0), typeLine(QString()),
formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), thirdPointId(NULL_ID), formulaBaseHeight(0), formula(QString()), firstPointId(NULL_ID), secondPointId(NULL_ID), thirdPointId(NULL_ID), formulaBaseHeight(0),
line(nullptr), prepare(false) line(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
InitVariables(ui); InitVariables(ui);

View File

@ -110,7 +110,6 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */ /** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight; int formulaBaseHeight;
VisToolBisector *line; VisToolBisector *line;
bool prepare;
}; };

View File

@ -54,13 +54,9 @@ public:
{} {}
VArcData(VPointF center, qreal radius, qreal f1, qreal f2) VArcData(VPointF center, qreal radius, qreal f1, qreal f2)
: f1(f1), formulaF1(QStringLiteral("")), f2(f2), formulaF2(QStringLiteral("")), radius(radius), : f1(f1), formulaF1(QString("%1").arg(f1)), f2(f2), formulaF2(QString("%1").arg(f2)), radius(radius),
formulaRadius(QStringLiteral("")), center(center) formulaRadius(QString("%1").arg(radius)), center(center)
{ {}
formulaF1 = QString("%1").arg(f1);
formulaF2 = QString("%1").arg(f2);
formulaRadius = QString("%1").arg(radius);
}
VArcData(const VArcData &arc) VArcData(const VArcData &arc)
: QSharedData(arc), f1(arc.f1), formulaF1(arc.formulaF1), f2(arc.f2), formulaF2(arc.formulaF2), : QSharedData(arc), f1(arc.f1), formulaF1(arc.formulaF1), f2(arc.f2), formulaF2(arc.formulaF2),

View File

@ -303,7 +303,7 @@ QVector<QPointF> VSpline::GetPoints (const QPointF &p1, const QPointF &p2, const
* @param p4 last spline point. * @param p4 last spline point.
* @return length. * @return length.
*/ */
qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const qreal VSpline::LengthBezier ( const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 )
{ {
QPainterPath splinePath; QPainterPath splinePath;
QVector<QPointF> points = GetPoints (p1, p2, p3, p4); QVector<QPointF> points = GetPoints (p1, p2, p3, p4);

View File

@ -77,7 +77,7 @@ protected:
static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ); static QVector<QPointF> GetPoints (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
private: private:
QSharedDataPointer<VSplineData> d; QSharedDataPointer<VSplineData> d;
qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 ) const; static qreal LengthBezier (const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4 );
static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4, static void PointBezier_r ( qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4,
qint16 level, QVector<qreal> &px, QVector<qreal> &py); qint16 level, QVector<qreal> &px, QVector<qreal> &py);
static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2); static qreal CalcSqDistance ( qreal x1, qreal y1, qreal x2, qreal y2);

View File

@ -113,7 +113,6 @@ void VisToolSplinePath::setMode(const Mode &value)
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QGraphicsEllipseItem *VisToolSplinePath::getPoint(unsigned int i) QGraphicsEllipseItem *VisToolSplinePath::getPoint(unsigned int i)
{ {
SCASSERT(i >= 0)
if (static_cast<unsigned int>(points.size() - 1) >= i && points.isEmpty() == false) if (static_cast<unsigned int>(points.size() - 1) >= i && points.isEmpty() == false)
{ {
return points.at(static_cast<int>(i)); return points.at(static_cast<int>(i));

View File

@ -105,7 +105,7 @@ void VFormulaPropertyEditor::onToolButtonClicked()
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
bool VFormulaPropertyEditor::eventFilter(QObject *obj, QEvent *ev) bool VFormulaPropertyEditor::eventFilter(QObject *obj, QEvent *ev)
{ {
if (obj == ToolButton && (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyPress)) if (obj == ToolButton && ev->type() == QEvent::KeyPress)
{ {
// Ignore the event, so that eventually the delegate gets the event. // Ignore the event, so that eventually the delegate gets the event.
ev->ignore(); ev->ignore();

View File

@ -328,7 +328,7 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template < class FunctionPtr > template < class FunctionPtr >
FunctionPtr union_cast( void* objectPtr ) const static FunctionPtr union_cast( void* objectPtr )
{ {
union union
{ {

View File

@ -112,7 +112,7 @@ void VColorPropertyEditor::onToolButtonClicked()
bool VColorPropertyEditor::eventFilter(QObject *obj, QEvent *ev) bool VColorPropertyEditor::eventFilter(QObject *obj, QEvent *ev)
{ {
if (obj == ToolButton && (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyPress)) if (obj == ToolButton && ev->type() == QEvent::KeyPress)
{ {
// Ignore the event, so that eventually the delegate gets the event. // Ignore the event, so that eventually the delegate gets the event.
ev->ignore(); ev->ignore();

View File

@ -132,7 +132,7 @@ bool VFileEditWidget::eventFilter(QObject *obj, QEvent *ev)
else else
return QWidget::eventFilter(obj, ev); return QWidget::eventFilter(obj, ev);
} }
else if (obj == ToolButton && (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyPress)) else if (obj == ToolButton && ev->type() == QEvent::KeyPress)
{ {
// Ignore the event, so that eventually the delegate gets the event. // Ignore the event, so that eventually the delegate gets the event.
ev->ignore(); ev->ignore();

View File

@ -63,7 +63,6 @@ QWidget* VShortcutProperty::createEditor(QWidget * parent, const QStyleOptionVie
} }
return tmpWidget; return tmpWidget;
return nullptr;
} }

View File

@ -47,13 +47,16 @@ public:
bool IgnoreDataChangedSignal; bool IgnoreDataChangedSignal;
VPropertyFormViewPrivate() VPropertyFormViewPrivate()
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false) {} : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(NULL), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {}
VPropertyFormViewPrivate(VPropertyModel* prop_model) VPropertyFormViewPrivate(VPropertyModel* prop_model)
: VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false) {} : VPropertyFormWidgetPrivate(), Model(prop_model), PropertySet(NULL), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {}
VPropertyFormViewPrivate(VPropertySet* prop_set) VPropertyFormViewPrivate(VPropertySet* prop_set)
: VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false) {} : VPropertyFormWidgetPrivate(), Model(NULL), PropertySet(prop_set), NeedsRebuild(false),
IgnoreDataChangedSignal(false) {}
}; };
} }

View File

@ -85,7 +85,7 @@ VProperty* VPropertyModel::createProperty(const QString& id, const QString& name
{ {
VProperty* tmpProp = new VProperty(name); VProperty* tmpProp = new VProperty(name);
tmpProp->setValue(data); tmpProp->setValue(data);
if (tmpProp && addProperty(tmpProp, id, parentid)) if (addProperty(tmpProp, id, parentid))
{ {
return tmpProp; return tmpProp;
} }