From 7acade3aff61fba034fd74556971cbbcfd2d290c Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 25 Sep 2021 20:57:05 +0300 Subject: [PATCH] GCC warnings. --- src/app/puzzle/scene/vpmaingraphicsview.cpp | 2 +- src/app/puzzle/xml/vplayoutfilewriter.cpp | 30 +++++++++++---------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/app/puzzle/scene/vpmaingraphicsview.cpp b/src/app/puzzle/scene/vpmaingraphicsview.cpp index 20ec84101..7b328a1cf 100644 --- a/src/app/puzzle/scene/vpmaingraphicsview.cpp +++ b/src/app/puzzle/scene/vpmaingraphicsview.cpp @@ -363,7 +363,7 @@ void VPMainGraphicsView::keyReleaseEvent(QKeyEvent *event) } VPSheetPtr sheet = layout->GetFocusedSheet(); - if (sheet.isNull()) + if (not sheet.isNull()) { sheet->SceneData()->RotationControls()->SetIgnorePieceTransformation(false); sheet->SceneData()->RotationControls()->on_UpdateControls(); diff --git a/src/app/puzzle/xml/vplayoutfilewriter.cpp b/src/app/puzzle/xml/vplayoutfilewriter.cpp index 44aa011d4..75e7c1f30 100644 --- a/src/app/puzzle/xml/vplayoutfilewriter.cpp +++ b/src/app/puzzle/xml/vplayoutfilewriter.cpp @@ -186,7 +186,7 @@ void VPLayoutFileWriter::WriteLayoutProperties(const VPLayoutPtr &layout) writeStartElement(ML::TagWatermark); SetAttributeOrRemoveIf(ML::AttrShowPreview, layout->LayoutSettings().GetShowWatermark(), - [](bool show){return not show;}); + [](bool show) noexcept {return not show;}); writeCharacters(layout->LayoutSettings().WatermarkPath()); writeEndElement(); // watermark @@ -215,7 +215,7 @@ void VPLayoutFileWriter::WriteSheet(const VPSheetPtr &sheet) { writeStartElement(ML::TagSheet); SetAttributeOrRemoveIf(ML::AttrGrainlineType, GrainlineTypeToStr(sheet->GetGrainlineType()), - [](const QString &type) + [](const QString &type) noexcept {return type == GrainlineTypeToStr(GrainlineType::NotFixed);}); writeTextElement(ML::TagName, sheet->GetName()); @@ -235,7 +235,7 @@ void VPLayoutFileWriter::WriteTiles(const VPLayoutPtr &layout) SetAttribute(ML::AttrVisible, layout->LayoutSettings().GetShowTiles()); SetAttribute(ML::AttrMatchingMarks, "standard"); // TODO / Fixme get the right value SetAttributeOrRemoveIf(ML::AttrPrintScheme, layout->LayoutSettings().GetPrintTilesScheme(), - [](bool print){return not print;}); + [](bool print) noexcept {return not print;}); WriteSize(layout->LayoutSettings().GetTilesSize()); WriteMargins(layout->LayoutSettings().GetTilesMargins(), layout->LayoutSettings().IgnoreTilesMargins()); @@ -264,13 +264,14 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) SetAttributeOrRemoveIf(ML::AttrMirrored, piece->IsMirror(), [](bool mirrored){return not mirrored;}); SetAttribute(ML::AttrTransform, TransformToString(piece->GetMatrix())); SetAttributeOrRemoveIf(ML::AttrGradationLabel, piece->GetGradationId(), - [](const QString &label){return label.isEmpty();}); + [](const QString &label) noexcept {return label.isEmpty();}); SetAttribute(ML::AttrCopyNumber, piece->CopyNumber()); - SetAttributeOrRemoveIf(ML::AttrShowSeamline, not piece->IsHideMainPath(), [](bool show){return show;}); + SetAttributeOrRemoveIf(ML::AttrShowSeamline, not piece->IsHideMainPath(), + [](bool show) noexcept {return show;}); SetAttributeOrRemoveIf(ML::AttrXScale, piece->GetXScale(), - [](qreal xs){return VFuzzyComparePossibleNulls(xs, 1.0);}); + [](qreal xs) noexcept {return VFuzzyComparePossibleNulls(xs, 1.0);}); SetAttributeOrRemoveIf(ML::AttrYScale, piece->GetYScale(), - [](qreal ys){return VFuzzyComparePossibleNulls(ys, 1.0);}); + [](qreal ys) noexcept {return VFuzzyComparePossibleNulls(ys, 1.0);}); writeStartElement(ML::TagSeamLine); writeCharacters(PathToString(piece->GetContourPoints())); @@ -279,7 +280,7 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) writeStartElement(ML::TagSeamAllowance); SetAttributeOrRemoveIf(ML::AttrEnabled, piece->IsSeamAllowance(), [](bool enabled){return not enabled;}); SetAttributeOrRemoveIf(ML::AttrBuiltIn, piece->IsSeamAllowanceBuiltIn(), - [](bool builtin){return not builtin;}); + [](bool builtin) noexcept {return not builtin;}); if (piece->IsSeamAllowance() && not piece->IsSeamAllowanceBuiltIn()) { writeCharacters(PathToString(piece->GetSeamAllowancePoints())); @@ -287,7 +288,8 @@ void VPLayoutFileWriter::WritePiece(const VPPiecePtr &piece) writeEndElement(); writeStartElement(ML::TagGrainline); - SetAttributeOrRemoveIf(ML::AttrEnabled, piece->IsGrainlineEnabled(), [](bool enabled){return not enabled;}); + SetAttributeOrRemoveIf(ML::AttrEnabled, piece->IsGrainlineEnabled(), + [](bool enabled) noexcept {return not enabled;}); if (piece->IsGrainlineEnabled()) { SetAttribute(ML::AttrAngle, piece->GrainlineAngle()); @@ -381,12 +383,12 @@ void VPLayoutFileWriter::WriteMargins(const QMarginsF &margins, bool ignore) { writeStartElement(ML::TagMargin); - SetAttributeOrRemoveIf(ML::AttrLeft, margins.left(), [](qreal margin){return margin <= 0;}); - SetAttributeOrRemoveIf(ML::AttrTop, margins.top(), [](qreal margin){return margin <= 0;}); - SetAttributeOrRemoveIf(ML::AttrRight, margins.right(), [](qreal margin){return margin <= 0;}); - SetAttributeOrRemoveIf(ML::AttrBottom, margins.bottom(), [](qreal margin){return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrLeft, margins.left(), [](qreal margin) noexcept {return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrTop, margins.top(), [](qreal margin) noexcept {return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrRight, margins.right(), [](qreal margin) noexcept {return margin <= 0;}); + SetAttributeOrRemoveIf(ML::AttrBottom, margins.bottom(), [](qreal margin) noexcept {return margin <= 0;}); - SetAttributeOrRemoveIf(ML::AttrIgnoreMargins, ignore, [](bool ignore){return not ignore;}); + SetAttributeOrRemoveIf(ML::AttrIgnoreMargins, ignore, [](bool ignore) noexcept {return not ignore;}); writeEndElement(); // margin }