Skip to content

Commit

Permalink
Fix clazy warnings in dxf export
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 7, 2021
1 parent 4e25c6b commit eeee133
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -90,6 +90,7 @@ void QgsDxfExport::addLayers( const QList<DxfLayer> &layers )

mLayerNameAttribute.clear();

layerList.reserve( layers.size() );
for ( const DxfLayer &dxfLayer : layers )
{
layerList << dxfLayer.layer();
Expand Down Expand Up @@ -1231,11 +1232,15 @@ void QgsDxfExport::writePolygon( const QgsCurvePolygon &polygon, const QString &
QVector<QVector<QgsPoint>> points;
QVector<QVector<double>> bulges;

const int ringCount = polygon.numInteriorRings();
points.reserve( ringCount + 1 );
bulges.reserve( ringCount + 1 );

points << QVector<QgsPoint>();
bulges << QVector<double>();
appendCurve( *polygon.exteriorRing(), points.last(), bulges.last() );

for ( int i = 0; i < polygon.numInteriorRings(); i++ )
for ( int i = 0; i < ringCount; i++ )
{
points << QVector<QgsPoint>();
bulges << QVector<double>();
Expand Down Expand Up @@ -1344,10 +1349,6 @@ void QgsDxfExport::writeText( const QString &layer, const QString &text, pal::La
hali = HAlign::HLeft;
vali = VAlign::VTop;
break;
default: // OverHali
hali = HAlign::HCenter;
vali = VAlign::VTop;
break;
}
}

Expand Down Expand Up @@ -1883,7 +1884,7 @@ QList< QPair< QgsSymbolLayer *, QgsSymbol * > > QgsDxfExport::symbolLayers( QgsR
{
QList< QPair< QgsSymbolLayer *, QgsSymbol * > > symbolLayers;

for ( DxfLayerJob *job : mJobs )
for ( DxfLayerJob *job : std::as_const( mJobs ) )
{
const QgsSymbolList symbols = job->renderer->symbols( context );

Expand Down Expand Up @@ -2200,6 +2201,7 @@ QStringList QgsDxfExport::encodings()
{
QStringList encodings;
const QList< QByteArray > codecs = QTextCodec::availableCodecs();
encodings.reserve( codecs.size() );
for ( const QByteArray &codec : codecs )
{
int i;
Expand Down Expand Up @@ -2347,7 +2349,7 @@ void QgsDxfExport::drawLabel( const QString &layerId, QgsRenderContext &context,
txt.replace( QString( QChar( QChar::CarriageReturn ) ) + QString( QChar( QChar::LineFeed ) ), QStringLiteral( "\\P" ) );
txt.replace( QChar( QChar::CarriageReturn ), QStringLiteral( "\\P" ) );
txt = txt.replace( wrapchr, QLatin1String( "\\P" ) );
txt.replace( " ", "\\~" );
txt.replace( QLatin1String( " " ), QLatin1String( "\\~" ) );

if ( tmpLyr.format().font().underline() )
{
Expand Down

0 comments on commit eeee133

Please sign in to comment.