Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cleanup: replace boolean comparison (x==true => x / x==false => x) (f…
…ollowup b40868c)
  • Loading branch information
jef-n committed Apr 22, 2014
1 parent 59c0ff2 commit bc7a551
Show file tree
Hide file tree
Showing 22 changed files with 71 additions and 71 deletions.
2 changes: 1 addition & 1 deletion src/app/qgscustomprojectiondialog.cpp
Expand Up @@ -408,7 +408,7 @@ void QgsCustomProjectionDialog::on_buttonBox_accepted()
for ( size_t i = 0; i < customCRSids.size(); ++i )
{
CRS.createFromProj4( customCRSparameters[i] );
if ( CRS.isValid() == false )
if ( !CRS.isValid() )
{
QMessageBox::information( this, tr( "QGIS Custom Projection" ),
tr( "The proj4 definition of '%1' is not valid." ).arg( customCRSnames[i] ) );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrotatefeature.cpp
Expand Up @@ -45,7 +45,7 @@ QgsMapToolRotateFeature::~QgsMapToolRotateFeature()

void QgsMapToolRotateFeature::canvasMoveEvent( QMouseEvent * e )
{
if ( mCtrl == true )
if ( mCtrl )
{
if ( !mAnchorPoint )
{
Expand Down Expand Up @@ -76,7 +76,7 @@ void QgsMapToolRotateFeature::canvasMoveEvent( QMouseEvent * e )
void QgsMapToolRotateFeature::canvasPressEvent( QMouseEvent * e )
{
mRotation = 0;
if ( mCtrl == true )
if ( mCtrl )
{
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsoptions.cpp
Expand Up @@ -483,7 +483,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :

// set if base unit of measure tool should be changed
bool baseUnit = settings.value( "qgis/measure/keepbaseunit", false ).toBool();
if ( baseUnit == true )
if ( baseUnit )
{
mKeepBaseUnitCheckBox->setChecked( true );
}
Expand Down
4 changes: 2 additions & 2 deletions src/astyle/ASFormatter.cpp
Expand Up @@ -391,15 +391,15 @@ string ASFormatter::nextLine()
isAppendPostBlockEmptyLineRequested = false;
isInLineComment = true;
// do not indent if in column 1 or 2
if (lineCommentNoIndent == false)
if (!lineCommentNoIndent)
{
if (charNum == 0)
lineCommentNoIndent = true;
else if (charNum == 1 && currentLine[0] == ' ')
lineCommentNoIndent = true;
}
// move comment if spaces were added or deleted
if (lineCommentNoIndent == false && spacePadNum != 0)
if (!lineCommentNoIndent && spacePadNum != 0)
adjustComments();
formattedLineCommentNum = formattedLine.length();
appendSequence(AS_OPEN_LINE_COMMENT);
Expand Down
2 changes: 1 addition & 1 deletion src/astyle/astyle_main.cpp
Expand Up @@ -1865,7 +1865,7 @@ int main(int argc, char *argv[])

// check for unprocessed excludes
for (size_t ix = 0; ix < g_excludeHitsVector.size(); ix++)
if (g_excludeHitsVector[ix] == false)
if (!g_excludeHitsVector[ix])
error("Unmatched exclude", g_excludeVector[ix].c_str());

// check if files were found (probably an input error if not)
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerattributetable.cpp
Expand Up @@ -313,7 +313,7 @@ bool QgsComposerAttributeTable::writeXML( QDomElement& elem, QDomDocument & doc
{
QDomElement columnElem = doc.createElement( "column" );
columnElem.setAttribute( "index", QString::number( sortIt->first ) );
columnElem.setAttribute( "ascending", sortIt->second == true ? "true" : "false" );
columnElem.setAttribute( "ascending", sortIt->second ? "true" : "false" );
sortColumnsElem.appendChild( columnElem );
}
composerTableElem.appendChild( sortColumnsElem );
Expand Down
4 changes: 2 additions & 2 deletions src/mapserver/qgswmsprojectparser.cpp
Expand Up @@ -990,7 +990,7 @@ void QgsWMSProjectParser::addLayers( QDomDocument &doc,
if ( !hrefString.isEmpty() )
{
QStringList getLayerLegendGraphicFormats;
if ( customHrefString == false )
if ( !customHrefString )
{
getLayerLegendGraphicFormats << "image/png"; // << "jpeg" << "image/jpeg"

Expand All @@ -1010,7 +1010,7 @@ void QgsWMSProjectParser::addLayers( QDomDocument &doc,
}

// no parameters on custom hrefUrl, because should link directly to graphic
if ( customHrefString == false )
if ( !customHrefString )
{
QUrl mapUrl( hrefString );
mapUrl.addQueryItem( "SERVICE", "WMS" );
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/dxf2shp_converter/dxflib/src/dl_dxf.cpp
Expand Up @@ -1628,8 +1628,8 @@ bool DL_Dxf::handleHatchData( DL_CreationInterface* /*creationInterface*/ )
// QgsDebugMsg(QString("92 flag: '%1'").arg(values[92]));
// QgsDebugMsg(QString("92 flag (int): '%1'").arg(atoi(values[92])));

if ( hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].defined == false )
if ( !hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].defined )
{
if ( hatchEdges[hatchLoopIndex]
[hatchEdgeIndex[hatchLoopIndex]].type == 1 )
Expand Down Expand Up @@ -2277,7 +2277,7 @@ int DL_Dxf::stringToInt( const char* s, bool* ok )
}
else if ( s[i] == '.' )
{
if ( dot == true )
if ( dot )
{
// QgsDebugMsg("two dots");
*ok = false;
Expand All @@ -2294,7 +2294,7 @@ int DL_Dxf::stringToInt( const char* s, bool* ok )
}
i++;
}
while ( s[i] != '\0' && *ok == true );
while ( s[i] != '\0' && *ok );
}

return atoi( s );
Expand Down Expand Up @@ -3287,7 +3287,7 @@ void DL_Dxf::writeHatch1( DL_WriterA& dw,
dw.dxfReal( 210, 0.0 ); // extrusion dir.
dw.dxfReal( 220, 0.0 );
dw.dxfReal( 230, 1.0 );
if ( data.solid == false )
if ( !data.solid )
{
dw.dxfString( 2, data.pattern );
}
Expand Down Expand Up @@ -3316,7 +3316,7 @@ void DL_Dxf::writeHatch2( DL_WriterA& dw,

dw.dxfInt( 75, 0 ); // odd parity
dw.dxfInt( 76, 1 ); // pattern type
if ( data.solid == false )
if ( !data.solid )
{
dw.dxfReal( 52, data.angle );
dw.dxfReal( 41, data.scale );
Expand Down
36 changes: 18 additions & 18 deletions src/plugins/globe/osgEarthUtil/Controls.cpp
Expand Up @@ -319,7 +319,7 @@ void
Control::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( cx );
if ( visible() == true )
if ( visible() )
{
_renderSize.set(
width().value() + padding().x(),
Expand Down Expand Up @@ -394,7 +394,7 @@ Control::draw(const ControlContext& cx, DrawableList& out )
{
// by default, rendering a Control directly results in a colored quad. Usually however
// you will not render a Control directly, but rather one of its subclasses.
if ( visible() == true )
if ( visible() )
{
if ( !(_backColor.isSet() && _backColor->a() == 0) && _renderSize.x() > 0 && _renderSize.y() > 0 )
{
Expand Down Expand Up @@ -499,7 +499,7 @@ void
ImageControl::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( cx );
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

Expand Down Expand Up @@ -546,7 +546,7 @@ ImageControl::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
void
ImageControl::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true && _image.valid() )
if ( visible() && _image.valid() )
{
//TODO: this is not precisely correct..images get deformed slightly..
osg::Geometry* g = new osg::Geometry();
Expand All @@ -558,7 +558,7 @@ ImageControl::draw( const ControlContext& cx, DrawableList& out )
osg::Vec3Array* verts = new osg::Vec3Array(4);
g->setVertexArray( verts );

if ( _rotation_rad != 0.0f || _fixSizeForRot == true )
if ( _rotation_rad != 0.0f || _fixSizeForRot )
{
osg::Vec2f rc( rx+_renderSize.x()/2, (vph-ry)-_renderSize.y()/2 );
float ra = osg::PI - _rotation_rad;
Expand Down Expand Up @@ -711,7 +711,7 @@ HSliderControl::draw( const ControlContext& cx, DrawableList& out )
{
Control::draw( cx, out );

if ( visible() == true )
if ( visible() )
{
osg::ref_ptr<osg::Geometry> g = new osg::Geometry();

Expand Down Expand Up @@ -806,7 +806,7 @@ CheckBoxControl::draw( const ControlContext& cx, DrawableList& out )
{
Control::draw( cx, out );

if ( visible() == true )
if ( visible() )
{
osg::Geometry* g = new osg::Geometry();

Expand Down Expand Up @@ -1016,7 +1016,7 @@ void
Container::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
Q_UNUSED( out_size );
if ( visible() == true )
if ( visible() )
{
if ( _frame.valid() )
{
Expand Down Expand Up @@ -1049,7 +1049,7 @@ Container::calcPos(const ControlContext& context, const osg::Vec2f& cursor, cons
Control::calcPos( context, cursor, parentSize );

// process the frame.. it's not a child of the container
if ( visible() == true && _frame.valid() )
if ( visible() && _frame.valid() )
{
_frame->calcPos( context, _renderPos - padding().offset(), parentSize );
}
Expand All @@ -1058,7 +1058,7 @@ Container::calcPos(const ControlContext& context, const osg::Vec2f& cursor, cons
void
Container::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true )
if ( visible() )
{
Control::draw( cx, out );
if ( _frame.valid() )
Expand Down Expand Up @@ -1121,7 +1121,7 @@ VBox::clearControls()
void
VBox::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

Expand Down Expand Up @@ -1218,7 +1218,7 @@ VBox::calcPos(const ControlContext& cx, const osg::Vec2f& cursor, const osg::Vec
void
VBox::draw( const ControlContext& cx, DrawableList& out )
{
if ( visible() == true )
if ( visible() )
{
Container::draw( cx, out );
for( ControlList::const_iterator i = _controls.begin(); i != _controls.end(); ++i )
Expand Down Expand Up @@ -1257,7 +1257,7 @@ HBox::clearControls()
void
HBox::calcSize(const ControlContext& cx, osg::Vec2f& out_size)
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

Expand Down Expand Up @@ -1451,7 +1451,7 @@ Grid::clearControls()
void
Grid::calcSize( const ControlContext& cx, osg::Vec2f& out_size )
{
if ( visible() == true )
if ( visible() )
{
_renderSize.set( 0, 0 );

Expand Down Expand Up @@ -1560,7 +1560,7 @@ Grid::calcPos( const ControlContext& cx, const osg::Vec2f& cursor, const osg::Ve
void
Grid::draw( const ControlContext& cx, DrawableList& out )
{
if (visible() == true)
if ( visible() )
{
Container::draw( cx, out );
for( ControlList::const_iterator i = _children.begin(); i != _children.end(); ++i )
Expand Down Expand Up @@ -1730,7 +1730,7 @@ ControlNode::traverse( osg::NodeVisitor& nv )
{
data._obscured = true;
}
else if ( data._obscured == true )
else if ( data._obscured )
{
data._obscured = false;
data._visibleTime = cv->getFrameStamp()->getReferenceTime();
Expand Down Expand Up @@ -1848,7 +1848,7 @@ ControlNodeBin::draw( const ControlContext& context, bool newContext, int bin )
visible = false;
}

else if ( nodeData._obscured == false )
else if ( !nodeData._obscured )
{
const osg::Vec3f& nPos = nodeData._screenPos;
const osg::Vec2f& size = control->renderSize();
Expand Down Expand Up @@ -1889,7 +1889,7 @@ ControlNodeBin::draw( const ControlContext& context, bool newContext, int bin )
}
}

if ( nodeData._obscured == false )
if ( !nodeData._obscured )
{
if ( _sortingEnabled )
_taken.push_back( bbox );
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/Pty.cpp
Expand Up @@ -213,7 +213,7 @@ int Pty::start( const QString& program,

pty()->setWinSize( _windowLines, _windowColumns );

if ( K3Process::start( NotifyOnExit, ( Communication )( Stdin | Stdout ) ) == false )
if ( !K3Process::start( NotifyOnExit, ( Communication )( Stdin | Stdout ) ) )
return -1;

resume(); // Start...
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/grass/qtermwidget/Session.cpp
Expand Up @@ -505,7 +505,7 @@ void Session::updateTerminalSize()
while ( viewIter.hasNext() )
{
TerminalDisplay* view = viewIter.next();
if ( view->isHidden() == false &&
if ( !view->isHidden() &&
view->lines() >= VIEW_LINES_THRESHOLD &&
view->columns() >= VIEW_COLUMNS_THRESHOLD )
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/spatialquery/qgsspatialquerydialog.cpp
Expand Up @@ -760,7 +760,7 @@ void QgsSpatialQueryDialog::apply()
void QgsSpatialQueryDialog::visibleResult( bool show )
{
blockSignals( true );
if ( show == false )
if ( !show )
{
mRubberSelectId->reset();
}
Expand Down
6 changes: 3 additions & 3 deletions src/plugins/topology/topolTest.cpp
Expand Up @@ -500,7 +500,7 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg

QgsGeometry* g1 = it->feature.geometry();

if ( g1->isGeosValid() == false )
if ( !g1->isGeosValid() )
{
qDebug() << "invalid geometry(g1) found..skipping.." << it->feature.id();
continue;
Expand Down Expand Up @@ -538,7 +538,7 @@ ErrorList topolTest::checkOverlaps( double tolerance, QgsVectorLayer *layer1, Qg
continue;
}

if ( g2->isGeosValid() == false )
if ( !g2->isGeosValid() )
{
QgsMessageLog::logMessage( tr( "Skipping invalid second geometry of feature %1 in overlaps test." ).arg( it->feature.id() ), tr( "Topology plugin" ) );
continue;
Expand Down Expand Up @@ -633,7 +633,7 @@ ErrorList topolTest::checkGaps( double tolerance, QgsVectorLayer *layer1, QgsVec
continue;
}

if ( g1->isGeosValid() == false )
if ( !g1->isGeosValid() )
{
qDebug() << "invalid geometry found..skipping.." << it->feature.id();
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdaldataitems.cpp
Expand Up @@ -229,7 +229,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
}

// return item without testing if:
// scanExtSetting == true
// scanExtSetting
// or zipfile and scan zip == "Basic scan"
if ( scanExtSetting ||
(( is_vsizip || is_vsitar ) && scanZipSetting == "basic" ) )
Expand Down
2 changes: 1 addition & 1 deletion src/providers/ogr/qgsogrdataitems.cpp
Expand Up @@ -330,7 +330,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )
}

// return item without testing if:
// scanExtSetting == true
// scanExtSetting
// or zipfile and scan zip == "Basic scan"
if ( scanExtSetting ||
(( is_vsizip || is_vsitar ) && scanZipSetting == "basic" ) )
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialiteconnection.cpp
Expand Up @@ -86,7 +86,7 @@ QgsSpatiaLiteConnection::Error QgsSpatiaLiteConnection::fetchTables( bool loadGe
recentVersion = true;
#endif

if ( ret == LayoutCurrent && recentVersion == false )
if ( ret == LayoutCurrent && !recentVersion )
{
// obsolete library version
mErrorMsg = tr( "obsolete libspatialite: connecting to this DB requires using v.4.0 (or any subsequent)" );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -4104,7 +4104,7 @@ bool QgsSpatiaLiteProvider::checkLayerTypeAbstractInterface( gaiaVectorLayerPtr
if ( lyr->AuthInfos->IsReadOnly )
mReadOnly = true;
}
else if ( mViewBased == true )
else if ( mViewBased )
{
mReadOnly = !hasTriggers();
}
Expand Down
2 changes: 1 addition & 1 deletion src/providers/spatialite/qgsspatialitesourceselect.cpp
Expand Up @@ -156,7 +156,7 @@ void QgsSpatiaLiteSourceSelect::updateStatistics()

// trying to connect to SpatiaLite DB
QgsSpatiaLiteConnection conn( subKey );
if ( conn.updateStatistics() == true )
if ( conn.updateStatistics() )
{
QMessageBox::information( this, tr( "Update Statistics" ),
tr( "Internal statistics successfully updated for: %1" ).arg( subKey ) );
Expand Down

0 comments on commit bc7a551

Please sign in to comment.