Skip to content

Commit

Permalink
Fix compiler warnings introduced recently in master
Browse files Browse the repository at this point in the history
Fixes:
```
/home/even/qgis/qgis/src/core/symbology/qgsmapinfosymbolconverter.cpp: In static member function ‘static QgsMarkerSymbol* QgsMapInfoSymbolConverter::convertMarkerSymbol(int, QgsMapInfoSymbolConversionContext&, const QColor&, double, QgsUnitTypes::RenderUnit)’:
/home/even/qgis/qgis/src/core/symbology/qgsmapinfosymbolconverter.cpp:1521:61: warning: ‘shape’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1521 |   if ( isFilled && QgsSimpleMarkerSymbolLayer::shapeIsFilled( shape ) )
      |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~

/home/even/qgis/qgis/src/core/qgsogrutils.cpp: In static member function ‘static std::unique_ptr<QgsSymbol> QgsOgrUtils::symbolFromStyleString(const QString&, QgsSymbol::SymbolType)’:
/home/even/qgis/qgis/src/core/qgsogrutils.cpp:1585:65: warning: ‘shape’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1585 |       if ( isFilled && QgsSimpleMarkerSymbolLayer::shapeIsFilled( shape ) )
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
```
  • Loading branch information
rouault authored and nyalldawson committed May 11, 2021
1 parent a11baa0 commit 3cc7f8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/core/qgsogrutils.cpp
Expand Up @@ -1576,8 +1576,18 @@ std::unique_ptr<QgsSymbol> QgsOgrUtils::symbolFromStyleString( const QString &st
case 10:
shape = QgsSimpleMarkerSymbolLayer::Shape::Line;
break;

default:
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
break;
}
}
else
{
isFilled = false;
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
}

std::unique_ptr< QgsSimpleMarkerSymbolLayer > simpleMarker = std::make_unique< QgsSimpleMarkerSymbolLayer >( shape, symbolSize, -angle );
simpleMarker->setSizeUnit( symbolSizeUnit );
Expand Down
3 changes: 2 additions & 1 deletion src/core/symbology/qgsmapinfosymbolconverter.cpp
Expand Up @@ -1400,6 +1400,7 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
{
case 31:
// null symbol
shape = QgsSimpleMarkerSymbolLayer::Shape::Square; // to initialize the variable
isNull = true;
break;

Expand Down Expand Up @@ -1518,7 +1519,7 @@ QgsMarkerSymbol *QgsMapInfoSymbolConverter::convertMarkerSymbol( int identifier,
simpleMarker->setFillColor( QColor( 0, 0, 0, 0 ) );
simpleMarker->setStrokeStyle( Qt::NoPen );
}
if ( isFilled && QgsSimpleMarkerSymbolLayer::shapeIsFilled( shape ) )
else if ( isFilled && QgsSimpleMarkerSymbolLayer::shapeIsFilled( shape ) )
{
simpleMarker->setColor( color );
simpleMarker->setStrokeColor( QColor( 0, 0, 0 ) );
Expand Down

0 comments on commit 3cc7f8b

Please sign in to comment.