Coverity scan warnings.
--HG-- branch : release
This commit is contained in:
parent
ef9f9c6af4
commit
a0262e260b
|
@ -472,13 +472,14 @@ QString VApplication::LogPath() const
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::CreateLogDir() const
|
bool VApplication::CreateLogDir() const
|
||||||
{
|
{
|
||||||
QDir logDir(LogDirPath());
|
QDir logDir(LogDirPath());
|
||||||
if (logDir.exists() == false)
|
if (logDir.exists() == false)
|
||||||
{
|
{
|
||||||
logDir.mkpath("."); // Create directory for log if need
|
return logDir.mkpath("."); // Create directory for log if need
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -600,13 +601,15 @@ QStringList VApplication::LabelLanguages()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VApplication::StartLogging()
|
void VApplication::StartLogging()
|
||||||
{
|
{
|
||||||
CreateLogDir();
|
if (CreateLogDir())
|
||||||
|
{
|
||||||
BeginLogging();
|
BeginLogging();
|
||||||
ClearOldLogs();
|
ClearOldLogs();
|
||||||
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#if defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
ClearOldReports();
|
ClearOldReports();
|
||||||
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
#endif // defined(Q_OS_WIN) && defined(Q_CC_GNU)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
QTextStream *VApplication::LogFile()
|
QTextStream *VApplication::LogFile()
|
||||||
|
|
|
@ -109,7 +109,7 @@ private:
|
||||||
|
|
||||||
QString LogDirPath()const;
|
QString LogDirPath()const;
|
||||||
QString LogPath()const;
|
QString LogPath()const;
|
||||||
void CreateLogDir()const;
|
bool CreateLogDir()const;
|
||||||
void BeginLogging();
|
void BeginLogging();
|
||||||
void ClearOldLogs()const;
|
void ClearOldLogs()const;
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
||||||
const quint32 id = item->data(Qt::UserRole).toUInt();
|
const quint32 id = item->data(Qt::UserRole).toUInt();
|
||||||
if (allDetails->contains(id))
|
if (allDetails->contains(id))
|
||||||
{
|
{
|
||||||
if (not select == allDetails->value(id).IsInLayout())
|
if (not (select == allDetails->value(id).IsInLayout()))
|
||||||
{
|
{
|
||||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||||
|
|
|
@ -1498,7 +1498,7 @@ void MainWindow::LoadStandard()
|
||||||
|
|
||||||
if (qApp->patternType() == MeasurementsType::Standard)
|
if (qApp->patternType() == MeasurementsType::Standard)
|
||||||
{
|
{
|
||||||
if (not hText.isEmpty() && not gradationSizes.isNull())
|
if (not hText.isEmpty() && not gradationHeights.isNull())
|
||||||
{
|
{
|
||||||
gradationHeights->setCurrentText(hText);
|
gradationHeights->setCurrentText(hText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
#include "../exception/vexceptionemptyparameter.h"
|
#include "../exception/vexceptionemptyparameter.h"
|
||||||
#include "../exception/vexceptionobjecterror.h"
|
#include "../exception/vexceptionobjecterror.h"
|
||||||
|
#include "../exception/vexceptionconversionerror.h"
|
||||||
#include "../qmuparser/qmutokenparser.h"
|
#include "../qmuparser/qmutokenparser.h"
|
||||||
#include "../ifc/exception/vexceptionbadid.h"
|
#include "../ifc/exception/vexceptionbadid.h"
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
|
@ -2263,6 +2264,8 @@ QMap<quint32, QPair<QString, bool> > VAbstractPattern::GetGroups()
|
||||||
{
|
{
|
||||||
QMap<quint32, QPair<QString, bool> > data;
|
QMap<quint32, QPair<QString, bool> > data;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
QDomElement groups = CreateGroups();
|
QDomElement groups = CreateGroups();
|
||||||
if (not groups.isNull())
|
if (not groups.isNull())
|
||||||
{
|
{
|
||||||
|
@ -2291,6 +2294,11 @@ QMap<quint32, QPair<QString, bool> > VAbstractPattern::GetGroups()
|
||||||
{
|
{
|
||||||
qDebug("Can't get tag Groups.");
|
qDebug("Can't get tag Groups.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (const VExceptionConversionError &)
|
||||||
|
{
|
||||||
|
return QMap<quint32, QPair<QString, bool> >();
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2556,7 +2556,7 @@ DL_WriterA* DL_Dxf::out(const char* file, DL_Codes::version version)
|
||||||
{
|
{
|
||||||
const size_t size = strlen(file)+1;
|
const size_t size = strlen(file)+1;
|
||||||
char* f = new char[size];
|
char* f = new char[size];
|
||||||
strlcpy(f, file, size); // Strange thing the sizeof(f) doesn't return correct value
|
strlcpy(f, file, size);
|
||||||
this->version = version;
|
this->version = version;
|
||||||
|
|
||||||
DL_WriterA* dw = new DL_WriterA(f, version);
|
DL_WriterA* dw = new DL_WriterA(f, version);
|
||||||
|
@ -5925,19 +5925,21 @@ int DL_Dxf::getLibVersion(const std::string& str)
|
||||||
*/
|
*/
|
||||||
void DL_Dxf::test()
|
void DL_Dxf::test()
|
||||||
{
|
{
|
||||||
char* buf1 = new char[10];
|
const size_t bufSize = 10;
|
||||||
char* buf2 = new char[10];
|
|
||||||
char* buf3 = new char[10];
|
|
||||||
char* buf4 = new char[10];
|
|
||||||
char* buf5 = new char[10];
|
|
||||||
char* buf6 = new char[10];
|
|
||||||
|
|
||||||
strlcpy(buf1, " 10\n", sizeof(buf1));
|
char* buf1 = new char[bufSize];
|
||||||
strlcpy(buf2, "10", sizeof(buf2));
|
char* buf2 = new char[bufSize];
|
||||||
strlcpy(buf3, "10\n", sizeof(buf3));
|
char* buf3 = new char[bufSize];
|
||||||
strlcpy(buf4, " 10 \n", sizeof(buf4));
|
char* buf4 = new char[bufSize];
|
||||||
strlcpy(buf5, " 10 \r", sizeof(buf5));
|
char* buf5 = new char[bufSize];
|
||||||
strlcpy(buf6, "\t10 \n", sizeof(buf6));
|
char* buf6 = new char[bufSize];
|
||||||
|
|
||||||
|
strlcpy(buf1, " 10\n", bufSize);
|
||||||
|
strlcpy(buf2, "10", bufSize);
|
||||||
|
strlcpy(buf3, "10\n", bufSize);
|
||||||
|
strlcpy(buf4, " 10 \n", bufSize);
|
||||||
|
strlcpy(buf5, " 10 \r", bufSize);
|
||||||
|
strlcpy(buf6, "\t10 \n", bufSize);
|
||||||
|
|
||||||
// Try to avoid deleting array from an offset
|
// Try to avoid deleting array from an offset
|
||||||
char* buf1Copy = buf1;
|
char* buf1Copy = buf1;
|
||||||
|
|
|
@ -233,7 +233,7 @@ void VPE::VPropertyFormWidget::commitData(int row)
|
||||||
}
|
}
|
||||||
else if (parent->propertyType() == Property::Complex)
|
else if (parent->propertyType() == Property::Complex)
|
||||||
{
|
{
|
||||||
tmpProperty->UpdateParent(newValue);
|
parent->UpdateParent(newValue);
|
||||||
emit propertyDataSubmitted(parent);
|
emit propertyDataSubmitted(parent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ void VAbstractOperation::GroupVisibility(quint32 object, bool visible)
|
||||||
if (operatedObjects.contains(object))
|
if (operatedObjects.contains(object))
|
||||||
{
|
{
|
||||||
VAbstractSimple *obj = operatedObjects.value(object);
|
VAbstractSimple *obj = operatedObjects.value(object);
|
||||||
if (obj->GetType() == GOType::Point)
|
if (obj && obj->GetType() == GOType::Point)
|
||||||
{
|
{
|
||||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(obj);
|
VSimplePoint *item = qobject_cast<VSimplePoint *>(obj);
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
|
@ -392,7 +392,7 @@ void VAbstractOperation::LabelChangePosition(const QPointF &pos, quint32 labelId
|
||||||
if (operatedObjects.contains(labelId))
|
if (operatedObjects.contains(labelId))
|
||||||
{
|
{
|
||||||
VAbstractSimple *obj = operatedObjects.value(labelId);
|
VAbstractSimple *obj = operatedObjects.value(labelId);
|
||||||
if (obj->GetType() == GOType::Point)
|
if (obj && obj->GetType() == GOType::Point)
|
||||||
{
|
{
|
||||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(obj);
|
VSimplePoint *item = qobject_cast<VSimplePoint *>(obj);
|
||||||
SCASSERT(item != nullptr)
|
SCASSERT(item != nullptr)
|
||||||
|
|
|
@ -210,7 +210,7 @@ QPointF VToolPointFromArcAndTangent::FindPoint(const QPointF &p, const VArc *arc
|
||||||
case 3:
|
case 3:
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
return QPointF();
|
break;
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ QPointF VToolPointOfContact::FindPoint(const qreal &radius, const QPointF ¢e
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
qDebug() << "Unxpected value" << res;
|
qDebug() << "Unxpected value" << res;
|
||||||
return QPointF();
|
break;
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,7 +217,7 @@ QPointF VToolPointOfIntersectionArcs::FindPoint(const VArc *arc1, const VArc *ar
|
||||||
case 3:
|
case 3:
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
return QPointF();
|
break;
|
||||||
}
|
}
|
||||||
return QPointF();
|
return QPointF();
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,8 @@ void GraphicsViewZoom::VerticalScrollingTime(qreal x)
|
||||||
// Try to adapt scrolling to speed of rotating mouse wheel and scale factor
|
// Try to adapt scrolling to speed of rotating mouse wheel and scale factor
|
||||||
// Value of _numScheduledScrollings is too short, so we scale the value
|
// Value of _numScheduledScrollings is too short, so we scale the value
|
||||||
|
|
||||||
qreal scroll = (qAbs(_numScheduledVerticalScrollings)*(10 + 10/_view->transform().m22()))/(duration/updateInterval);
|
qreal scroll = static_cast<qreal>(qAbs(_numScheduledVerticalScrollings))*(10. + 10./_view->transform().m22())
|
||||||
|
/(static_cast<qreal>(duration)/static_cast<qreal>(updateInterval));
|
||||||
|
|
||||||
if (qAbs(scroll) < 1)
|
if (qAbs(scroll) < 1)
|
||||||
{
|
{
|
||||||
|
@ -152,8 +153,8 @@ void GraphicsViewZoom::HorizontalScrollingTime(qreal x)
|
||||||
// Try to adapt scrolling to speed of rotating mouse wheel and scale factor
|
// Try to adapt scrolling to speed of rotating mouse wheel and scale factor
|
||||||
// Value of _numScheduledScrollings is too short, so we scale the value
|
// Value of _numScheduledScrollings is too short, so we scale the value
|
||||||
|
|
||||||
qreal scroll = (qAbs(_numScheduledHorizontalScrollings)*(10 + 10/_view->transform().m11()))/
|
qreal scroll = static_cast<qreal>(qAbs(_numScheduledHorizontalScrollings))*(10. + 10./_view->transform().m11())
|
||||||
(duration/updateInterval);
|
/(static_cast<qreal>(duration)/static_cast<qreal>(updateInterval));
|
||||||
|
|
||||||
if (qAbs(scroll) < 1)
|
if (qAbs(scroll) < 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ void TST_VPiece::ClearLoop()
|
||||||
// See file <root>/src/app/share/collection/jacketМ6_30-110.val
|
// See file <root>/src/app/share/collection/jacketМ6_30-110.val
|
||||||
// Check correct seam allowance
|
// Check correct seam allowance
|
||||||
const Unit unit = Unit::Mm;
|
const Unit unit = Unit::Mm;
|
||||||
VContainer *data = new VContainer(nullptr, &unit);
|
QScopedPointer<VContainer> data(new VContainer(nullptr, &unit));
|
||||||
qApp->setPatternUnit(unit);
|
qApp->setPatternUnit(unit);
|
||||||
|
|
||||||
data->UpdateGObject(304, new VPointF(61.866708661417327, 446.92270866141735, "Ф1", 5.0000125984251973,
|
data->UpdateGObject(304, new VPointF(61.866708661417327, 446.92270866141735, "Ф1", 5.0000125984251973,
|
||||||
|
@ -103,7 +103,7 @@ void TST_VPiece::ClearLoop()
|
||||||
detail.GetPath()[0].SetFormulaSABefore("0");
|
detail.GetPath()[0].SetFormulaSABefore("0");
|
||||||
detail.GetPath()[detail.GetPath().CountNodes()-1].SetFormulaSAAfter("0");
|
detail.GetPath()[detail.GetPath().CountNodes()-1].SetFormulaSAAfter("0");
|
||||||
|
|
||||||
const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data);
|
const QVector<QPointF> pointsEkv = detail.SeamAllowancePoints(data.data());
|
||||||
|
|
||||||
QVector<QPointF> origPoints;
|
QVector<QPointF> origPoints;
|
||||||
origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
|
origPoints.append(QPointF(42.46405659601932, 415.2845470563871));
|
||||||
|
@ -152,7 +152,7 @@ void TST_VPiece::Issue620()
|
||||||
// See file <root>/src/app/share/collection/bugs/Issue_#620.vit
|
// See file <root>/src/app/share/collection/bugs/Issue_#620.vit
|
||||||
// Check main path
|
// Check main path
|
||||||
const Unit unit = Unit::Cm;
|
const Unit unit = Unit::Cm;
|
||||||
VContainer *data = new VContainer(nullptr, &unit);
|
QScopedPointer<VContainer> data(new VContainer(nullptr, &unit));
|
||||||
qApp->setPatternUnit(unit);
|
qApp->setPatternUnit(unit);
|
||||||
|
|
||||||
data->UpdateGObject(1, new VPointF(30, 39.999874015748034, "A", 5.0000125984251973, 9.9999874015748045));
|
data->UpdateGObject(1, new VPointF(30, 39.999874015748034, "A", 5.0000125984251973, 9.9999874015748045));
|
||||||
|
@ -208,7 +208,7 @@ void TST_VPiece::Issue620()
|
||||||
detail.GetPath().Append(VPieceNode(8, Tool::NodeSpline));
|
detail.GetPath().Append(VPieceNode(8, Tool::NodeSpline));
|
||||||
detail.GetPath().Append(VPieceNode(7, Tool::NodeSplinePath));
|
detail.GetPath().Append(VPieceNode(7, Tool::NodeSplinePath));
|
||||||
|
|
||||||
const QVector<QPointF> pointsEkv = detail.MainPathPoints(data);
|
const QVector<QPointF> pointsEkv = detail.MainPathPoints(data.data());
|
||||||
|
|
||||||
QVector<QPointF> origPoints;
|
QVector<QPointF> origPoints;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user