Skip to content
Permalink
Browse files

Fix more clang warnings

  • Loading branch information
nyalldawson committed Jan 5, 2016
1 parent 614c84f commit 1340afdc012ea37a5204f60cc50d5a311c9d381f
Showing with 179 additions and 218 deletions.
  1. +2 −2 src/core/composer/qgsatlascomposition.cpp
  2. +1 −1 src/core/composer/qgscomposerattributetablemodel.cpp
  3. +1 −1 src/core/composer/qgscomposerattributetablemodelv2.cpp
  4. +1 −1 src/core/composer/qgscomposerattributetablev2.cpp
  5. +3 −3 src/core/composer/qgscomposerhtml.cpp
  6. +7 −7 src/core/composer/qgscomposeritem.cpp
  7. +2 −2 src/core/composer/qgscomposeritemgroup.cpp
  8. +3 −3 src/core/composer/qgscomposerlabel.cpp
  9. +2 −2 src/core/composer/qgscomposerlegend.cpp
  10. +4 −4 src/core/composer/qgscomposerlegendstyle.cpp
  11. +22 −22 src/core/composer/qgscomposermap.cpp
  12. +14 −31 src/core/composer/qgscomposermapgrid.cpp
  13. +1 −1 src/core/composer/qgscomposermapoverview.cpp
  14. +4 −15 src/core/composer/qgscomposermodel.cpp
  15. +6 −6 src/core/composer/qgscomposermousehandles.cpp
  16. +1 −1 src/core/composer/qgscomposermultiframe.cpp
  17. +0 −6 src/core/composer/qgscomposerobject.cpp
  18. +9 −9 src/core/composer/qgscomposerpicture.cpp
  19. +3 −3 src/core/composer/qgscomposerscalebar.cpp
  20. +1 −4 src/core/composer/qgscomposershape.cpp
  21. +3 −3 src/core/composer/qgscomposertablecolumn.cpp
  22. +4 −4 src/core/composer/qgscomposerutils.cpp
  23. +14 −14 src/core/composer/qgscomposition.cpp
  24. +2 −2 src/core/composer/qgslegendmodel.cpp
  25. +1 −1 src/core/composer/qgsnumericscalebarstyle.cpp
  26. +2 −2 src/core/composer/qgspaperitem.cpp
  27. +1 −1 src/core/dxf/qgsdxfpaintengine.cpp
  28. +10 −11 src/core/qgsvectorlayer.cpp
  29. +0 −1 src/core/raster/qgscontrastenhancement.cpp
  30. +55 −53 src/core/raster/qgsrasterblock.cpp
  31. +0 −2 src/providers/gdal/qgsgdalprovider.cpp
@@ -756,7 +756,7 @@ void QgsAtlasComposition::readXMLMapSettings( const QDomElement &elem, const QDo

//upgrade pre 2.1 projects
double margin = elem.attribute( "margin", "0.0" ).toDouble();
if ( composerMap && margin != 0 )
if ( composerMap && !qgsDoubleNear( margin, 0.0 ) )
{
composerMap->setAtlasMargin( margin );
}
@@ -905,7 +905,7 @@ void QgsAtlasComposition::setMargin( float margin )
return;
}

map->setAtlasMargin(( double ) margin );
map->setAtlasMargin( static_cast< double >( margin ) );
}

QgsGeometry QgsAtlasComposition::currentGeometry( const QgsCoordinateReferenceSystem& crs ) const
@@ -602,7 +602,7 @@ bool QgsComposerTableSortColumnsProxyModel::setData( const QModelIndex& index, c

if ( index.column() == 1 )
{
column->setSortOrder(( Qt::SortOrder )value.toInt() );
column->setSortOrder( static_cast< Qt::SortOrder >( value.toInt() ) );
emit dataChanged( index, index );
return true;
}
@@ -620,7 +620,7 @@ bool QgsComposerTableSortColumnsProxyModelV2::setData( const QModelIndex& index,

if ( index.column() == 1 )
{
column->setSortOrder(( Qt::SortOrder )value.toInt() );
column->setSortOrder( static_cast< Qt::SortOrder >( value.toInt() ) );
emit dataChanged( index, index );
return true;
}
@@ -687,7 +687,7 @@ void QgsComposerAttributeTableV2::setWrapString( const QString &wrapString )
bool QgsComposerAttributeTableV2::writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames ) const
{
QDomElement composerTableElem = doc.createElement( "ComposerAttributeTableV2" );
composerTableElem.setAttribute( "source", QString::number(( int )mSource ) );
composerTableElem.setAttribute( "source", QString::number( static_cast< int >( mSource ) ) );
composerTableElem.setAttribute( "relationId", mRelationId );
composerTableElem.setAttribute( "showUniqueRowsOnly", mShowUniqueRowsOnly );
composerTableElem.setAttribute( "showOnlyVisibleFeatures", mShowOnlyVisibleFeatures );
@@ -223,7 +223,7 @@ double QgsComposerHtml::maxFrameWidth() const
QList<QgsComposerFrame*>::const_iterator frameIt = mFrameItems.constBegin();
for ( ; frameIt != mFrameItems.constEnd(); ++frameIt )
{
maxWidth = qMax( maxWidth, ( double )(( *frameIt )->boundingRect().width() ) );
maxWidth = qMax( maxWidth, static_cast< double >(( *frameIt )->boundingRect().width() ) );
}

return maxWidth;
@@ -467,7 +467,7 @@ QString QgsComposerHtml::displayName() const
bool QgsComposerHtml::writeXML( QDomElement& elem, QDomDocument & doc, bool ignoreFrames ) const
{
QDomElement htmlElem = doc.createElement( "ComposerHtml" );
htmlElem.setAttribute( "contentMode", QString::number(( int ) mContentMode ) );
htmlElem.setAttribute( "contentMode", QString::number( static_cast< int >( mContentMode ) ) );
htmlElem.setAttribute( "url", mUrl.toString() );
htmlElem.setAttribute( "html", mHtml );
htmlElem.setAttribute( "evaluateExpressions", mEvaluateExpressions ? "true" : "false" );
@@ -495,7 +495,7 @@ bool QgsComposerHtml::readXML( const QDomElement& itemElem, const QDomDocument&
}

bool contentModeOK;
mContentMode = ( QgsComposerHtml::ContentMode )itemElem.attribute( "contentMode" ).toInt( &contentModeOK );
mContentMode = static_cast< QgsComposerHtml::ContentMode >( itemElem.attribute( "contentMode" ).toInt( &contentModeOK ) );
if ( !contentModeOK )
{
mContentMode = QgsComposerHtml::Url;
@@ -202,7 +202,7 @@ bool QgsComposerItem::_writeXML( QDomElement& itemElem, QDomDocument& doc ) cons
composerItemElem.setAttribute( "pagey", QString::number( pagepos.y() ) );
composerItemElem.setAttribute( "width", QString::number( rect().width() ) );
composerItemElem.setAttribute( "height", QString::number( rect().height() ) );
composerItemElem.setAttribute( "positionMode", QString::number(( int ) mLastUsedPositionMode ) );
composerItemElem.setAttribute( "positionMode", QString::number( static_cast< int >( mLastUsedPositionMode ) ) );
composerItemElem.setAttribute( "zValue", QString::number( zValue() ) );
composerItemElem.setAttribute( "outlineWidth", QString::number( pen().widthF() ) );
composerItemElem.setAttribute( "frameJoinStyle", QgsSymbolLayerV2Utils::encodePenJoinStyle( mFrameJoinStyle ) );
@@ -325,7 +325,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
pagey = itemElem.attribute( "pagey" ).toDouble( &pageyOk );
width = itemElem.attribute( "width" ).toDouble( &widthOk );
height = itemElem.attribute( "height" ).toDouble( &heightOk );
mLastUsedPositionMode = ( ItemPositionMode )itemElem.attribute( "positionMode" ).toInt( &positionModeOK );
mLastUsedPositionMode = static_cast< ItemPositionMode >( itemElem.attribute( "positionMode" ).toInt( &positionModeOK ) );
if ( !positionModeOK )
{
mLastUsedPositionMode = UpperLeft;
@@ -391,7 +391,7 @@ bool QgsComposerItem::_readXML( const QDomElement& itemElem, const QDomDocument&
}

//blend mode
setBlendMode( QgsMapRenderer::getCompositionMode(( QgsMapRenderer::BlendMode ) itemElem.attribute( "blendMode", "0" ).toUInt() ) );
setBlendMode( QgsMapRenderer::getCompositionMode( static_cast< QgsMapRenderer::BlendMode >( itemElem.attribute( "blendMode", "0" ).toUInt() ) ) );

//transparency
setTransparency( itemElem.attribute( "transparency", "0" ).toInt() );
@@ -433,7 +433,7 @@ void QgsComposerItem::setFrameOutlineColor( const QColor &color )
void QgsComposerItem::setFrameOutlineWidth( const double outlineWidth )
{
QPen itemPen = pen();
if ( itemPen.widthF() == outlineWidth )
if ( qgsDoubleNear( itemPen.widthF(), outlineWidth ) )
{
//no change
return;
@@ -652,7 +652,7 @@ void QgsComposerItem::setItemPosition( double x, double y, double width, double
{
//adjust position to account for frame size

if ( mEvaluatedItemRotation == 0 )
if ( qgsDoubleNear( mEvaluatedItemRotation, 0.0 ) )
{
upperLeftX += estimatedFrameBleed();
upperLeftY += estimatedFrameBleed();
@@ -1061,7 +1061,7 @@ void QgsComposerItem::setItemRotation( const double r, const bool adjustPosition
{
if ( r >= 360 )
{
mItemRotation = (( int )r ) % 360;
mItemRotation = ( static_cast< int >( r ) ) % 360;
}
else
{
@@ -1089,7 +1089,7 @@ void QgsComposerItem::refreshRotation( const bool updateItem, const bool adjustP
}
}

if ( rotation == mEvaluatedItemRotation )
if ( qgsDoubleNear( rotation, mEvaluatedItemRotation ) )
{
return;
}
@@ -71,14 +71,14 @@ void QgsComposerItemGroup::addItem( QgsComposerItem* item )
//call method of superclass to avoid repositioning of items
QgsComposerItem::setSceneRect( QRectF( item->pos().x(), item->pos().y(), item->rect().width(), item->rect().height() ) );

if ( item->itemRotation() != 0 )
if ( !qgsDoubleNear( item->itemRotation(), 0.0 ) )
{
setItemRotation( item->itemRotation() );
}
}
else
{
if ( item->itemRotation() != itemRotation() )
if ( !qgsDoubleNear( item->itemRotation(), itemRotation() ) )
{
//items have mixed rotation, so reset rotation of group
mBoundingRectangle = mapRectToScene( mBoundingRectangle );
@@ -448,10 +448,10 @@ bool QgsComposerLabel::readXML( const QDomElement& itemElem, const QDomDocument&
}

//Horizontal alignment
mHAlignment = ( Qt::AlignmentFlag )( itemElem.attribute( "halign" ).toInt() );
mHAlignment = static_cast< Qt::AlignmentFlag >( itemElem.attribute( "halign" ).toInt() );

//Vertical alignment
mVAlignment = ( Qt::AlignmentFlag )( itemElem.attribute( "valign" ).toInt() );
mVAlignment = static_cast< Qt::AlignmentFlag >( itemElem.attribute( "valign" ).toInt() );

//font
QgsFontUtils::setFromXmlChildNode( mFont, itemElem, "LabelFont" );
@@ -478,7 +478,7 @@ bool QgsComposerLabel::readXML( const QDomElement& itemElem, const QDomDocument&
QDomElement composerItemElem = composerItemList.at( 0 ).toElement();

//rotation
if ( composerItemElem.attribute( "rotation", "0" ).toDouble() != 0 )
if ( !qgsDoubleNear( composerItemElem.attribute( "rotation", "0" ).toDouble(), 0.0 ) )
{
//check for old (pre 2.1) rotation attribute
setItemRotation( composerItemElem.attribute( "rotation", "0" ).toDouble() );
@@ -322,7 +322,7 @@ bool QgsComposerLegend::writeXML( QDomElement& elem, QDomDocument & doc ) const

//write general properties
composerLegendElem.setAttribute( "title", mSettings.title() );
composerLegendElem.setAttribute( "titleAlignment", QString::number(( int ) mSettings.titleAlignment() ) );
composerLegendElem.setAttribute( "titleAlignment", QString::number( static_cast< int >( mSettings.titleAlignment() ) ) );
composerLegendElem.setAttribute( "columnCount", QString::number( mSettings.columnCount() ) );
composerLegendElem.setAttribute( "splitLayer", QString::number( mSettings.splitLayer() ) );
composerLegendElem.setAttribute( "equalColumnWidth", QString::number( mSettings.equalColumnWidth() ) );
@@ -421,7 +421,7 @@ bool QgsComposerLegend::readXML( const QDomElement& itemElem, const QDomDocument
mSettings.setTitle( itemElem.attribute( "title" ) );
if ( !itemElem.attribute( "titleAlignment" ).isEmpty() )
{
mSettings.setTitleAlignment(( Qt::AlignmentFlag )itemElem.attribute( "titleAlignment" ).toInt() );
mSettings.setTitleAlignment( static_cast< Qt::AlignmentFlag >( itemElem.attribute( "titleAlignment" ).toInt() ) );
}
int colCount = itemElem.attribute( "columnCount", "1" ).toInt();
if ( colCount < 1 ) colCount = 1;
@@ -57,10 +57,10 @@ void QgsComposerLegendStyle::writeXML( const QString& name, QDomElement& elem, Q

styleElem.setAttribute( "name", name );

if ( mMarginMap[Top] != 0 ) styleElem.setAttribute( "marginTop", QString::number( mMarginMap[Top] ) );
if ( mMarginMap[Bottom] != 0 ) styleElem.setAttribute( "marginBottom", QString::number( mMarginMap[Bottom] ) );
if ( mMarginMap[Left] != 0 ) styleElem.setAttribute( "marginLeft", QString::number( mMarginMap[Left] ) );
if ( mMarginMap[Right] != 0 ) styleElem.setAttribute( "marginRight", QString::number( mMarginMap[Right] ) );
if ( !qgsDoubleNear( mMarginMap[Top], 0.0 ) ) styleElem.setAttribute( "marginTop", QString::number( mMarginMap[Top] ) );
if ( !qgsDoubleNear( mMarginMap[Bottom], 0.0 ) ) styleElem.setAttribute( "marginBottom", QString::number( mMarginMap[Bottom] ) );
if ( !qgsDoubleNear( mMarginMap[Left], 0.0 ) ) styleElem.setAttribute( "marginLeft", QString::number( mMarginMap[Left] ) );
if ( !qgsDoubleNear( mMarginMap[Right], 0.0 ) ) styleElem.setAttribute( "marginRight", QString::number( mMarginMap[Right] ) );

styleElem.appendChild( QgsFontUtils::toXmlElement( mFont, doc, "styleFont" ) );

0 comments on commit 1340afd

Please sign in to comment.
You can’t perform that action at this time.