cppcheck.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2015-03-02 19:54:33 +02:00
parent 22055ab684
commit 850d51adac
11 changed files with 14 additions and 25 deletions

View File

@ -746,7 +746,7 @@ void VSpline::SetKcurve(qreal factor)
}
//---------------------------------------------------------------------------------------------------------------------
int VSpline::Sign(long double ld) const
int VSpline::Sign(long double ld)
{
if (qAbs(ld)<0.00000000001)
{
@ -774,7 +774,7 @@ int VSpline::Sign(long double ld) const
* 1 - 1 real root + 2 complex;
* 2 - 1 real root + complex roots imaginary part is zero (i.e. 2 real roots).
*/
qint32 VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) const
qint32 VSpline::Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c)
{
//To find cubic equation roots in the case of real coefficients, calculated at the beginning
const qreal q = (pow(a, 2) - 3*b)/9.;

View File

@ -83,8 +83,8 @@ private:
void CreateName();
QVector<qreal> CalcT(qreal curveCoord1, qreal curveCoord2, qreal curveCoord3, qreal curveCoord4,
qreal pointCoord) const;
qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c) const;
int Sign(long double ld) const;
static qint32 Cubic(QVector<qreal> &x, qreal a, qreal b, qreal c);
static int Sign(long double ld);
};
#endif // VSPLINE_H

View File

@ -45,7 +45,7 @@ const QString VToolSpline::ToolType = QStringLiteral("simple");
* @param typeCreation way we create this tool.
* @param parent parent object.
*/
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
VToolSpline::VToolSpline(VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
QGraphicsItem *parent)
:VAbstractSpline(doc, data, id, parent), oldPosition()
{

View File

@ -38,7 +38,7 @@ class VToolSpline:public VAbstractSpline
{
Q_OBJECT
public:
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const QString color, const Source &typeCreation,
VToolSpline (VPattern *doc, VContainer *data, quint32 id, const QString &color, const Source &typeCreation,
QGraphicsItem * parent = nullptr );
virtual ~VToolSpline();
virtual void setDialog();

View File

@ -53,14 +53,15 @@ QString compilerString()
#elif defined(Q_CC_MSVC)
if (_MSC_VER >= 1800) // 1800: MSVC 2013 (yearly release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
compiler = QLatin1String("MSVC ") + QString::number(2008 + ((_MSC_VER / 100) - 13));
}
if (_MSC_VER >= 1500) // 1500: MSVC 2008, 1600: MSVC 2010, ... (2-year release cycle)
{
return QLatin1String("MSVC ") + QString::number(2008 + 2 * ((_MSC_VER / 100) - 15));
}
#endif
#else
return QLatin1String("<unknown compiler>");
#endif
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -1647,9 +1647,9 @@ void VPattern::ParseLineElement(VMainGraphicsScene *scene, const QDomElement &do
{
SCASSERT(scene != nullptr);
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
quint32 id = 0;
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 firstPoint = GetParametrUInt(domElement, VAbstractTool::AttrFirstPoint, NULL_ID_STR);
const quint32 secondPoint = GetParametrUInt(domElement, VAbstractTool::AttrSecondPoint, NULL_ID_STR);
@ -2065,7 +2065,6 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
quint32 id = 0;
QStringList tools{VToolUnionDetails::ToolType};
switch (tools.indexOf(type))
@ -2073,6 +2072,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
case 0: //VToolUnionDetails::ToolType
try
{
quint32 id = 0;
ToolsCommonAttributes(domElement, id);
const quint32 indexD1 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD1, "-1");
const quint32 indexD2 = GetParametrUInt(domElement, VToolUnionDetails::AttrIndexD2, "-1");

View File

@ -366,7 +366,7 @@ QVector<QPointF> VLayoutDetail::Map(const QVector<QPointF> &points) const
}
//---------------------------------------------------------------------------------------------------------------------
QVector<QPointF> VLayoutDetail::RoundPoints(const QVector<QPointF> &points) const
QVector<QPointF> VLayoutDetail::RoundPoints(const QVector<QPointF> &points)
{
QVector<QPointF> p;
for (int i=0; i < points.size(); ++i)

View File

@ -82,7 +82,7 @@ private:
QSharedDataPointer<VLayoutDetailData> d;
QVector<QPointF> Map(const QVector<QPointF> &points) const;
QVector<QPointF> RoundPoints(const QVector<QPointF> &points) const;
static QVector<QPointF> RoundPoints(const QVector<QPointF> &points);
};
#endif // VLAYOUTDETAIL_H

View File

@ -258,17 +258,6 @@ bool VLayoutPaper::SaveResult(const VBestSquare &bestResult, const VLayoutDetail
return bestResult.ValideResult(); // Do we have the best result?
}
//---------------------------------------------------------------------------------------------------------------------
void VLayoutPaper::SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ,
BestFrom type)
{
QVector<QPointF> newGContour = d->globalContour.UniteWithContour(detail, globalI, detJ, type);
newGContour.append(newGContour.first());
const QRectF rec = QPolygonF(newGContour).boundingRect();
bestResult.NewResult(static_cast<qint64>(rec.width()*rec.height()), globalI, detJ,
detail.GetMatrix(), detail.IsMirror(), type);
}
//---------------------------------------------------------------------------------------------------------------------
QGraphicsRectItem *VLayoutPaper::GetPaperItem() const
{

View File

@ -78,7 +78,6 @@ private:
bool AddToSheet(const VLayoutDetail &detail, bool &stop);
bool SaveResult(const VBestSquare &bestResult, const VLayoutDetail &detail);
void SaveCandidate(VBestSquare &bestResult, const VLayoutDetail &detail, int globalI, int detJ, BestFrom type);
};

View File

@ -47,7 +47,7 @@ VPosition::VPosition(const VContour &gContour, int j, const VLayoutDetail &detai
{
if ((rotationIncrease >= 1 && rotationIncrease <= 180 && 360 % rotationIncrease == 0) == false)
{
rotationIncrease = 180;
this->rotationIncrease = 180;
}
}