Skip to content

Commit

Permalink
Add comments for every intentional case fall-through
Browse files Browse the repository at this point in the history
Improves code maintainability/readability
  • Loading branch information
nyalldawson committed Feb 18, 2015
1 parent 0df6dee commit 342a0cb
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/analysis/interpolation/qgsinterpolator.cpp
Expand Up @@ -117,6 +117,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
{
case QGis::WKBPoint25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBPoint:
{
currentWkbPtr >> theVertex.x >> theVertex.y;
Expand All @@ -133,6 +134,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
}
case QGis::WKBLineString25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBLineString:
{
int nPoints;
Expand All @@ -155,6 +157,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
#if 0
case QGis::WKBPolygon25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBPolygon:
{
int nRings;
Expand Down Expand Up @@ -199,6 +202,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
}
case QGis::WKBMultiPoint25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBMultiPoint:
{
int nPoints;
Expand All @@ -223,6 +227,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
}
case QGis::WKBMultiLineString25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBMultiLineString:
{
int nLines;
Expand Down Expand Up @@ -268,6 +273,7 @@ int QgsInterpolator::addVerticesToCache( QgsGeometry* geom, bool zCoord, double
}
case QGis::WKBMultiPolygon25D:
hasZValue = true;
//intentional fall-through
case QGis::WKBMultiPolygon:
{
int nPolys;
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsdecorationscalebar.cpp
Expand Up @@ -233,6 +233,7 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
break;
case QGis::UnknownUnit:
myScaleBarUnitLabel = tr( " unknown" );
//intentional fall-through
default:
QgsDebugMsg( QString( "Error: not picked up map units - actual value = %1" ).arg( myMapUnits ) );
}
Expand Down
1 change: 1 addition & 0 deletions src/core/gps/tok.c
Expand Up @@ -165,6 +165,7 @@ int nmea_scanf( const char *buff, int buff_sz, const char *format, ... )
width = 0;
beg_fmt = format;
tok_type = NMEA_TOKS_WIDTH;
//intentional fall-through
case NMEA_TOKS_WIDTH:
if ( isdigit( *format ) )
break;
Expand Down
7 changes: 7 additions & 0 deletions src/core/qgsdistancearea.cpp
Expand Up @@ -278,13 +278,15 @@ double QgsDistanceArea::measure( QgsGeometry* geometry )
{
case QGis::WKBLineString25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBLineString:
measureLine( wkb, &res, hasZptr );
QgsDebugMsg( "returning " + QString::number( res ) );
return res;

case QGis::WKBMultiLineString25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBMultiLineString:
wkbPtr >> count;
for ( i = 0; i < count; i++ )
Expand All @@ -297,13 +299,15 @@ double QgsDistanceArea::measure( QgsGeometry* geometry )

case QGis::WKBPolygon25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBPolygon:
measurePolygon( wkb, &res, 0, hasZptr );
QgsDebugMsg( "returning " + QString::number( res ) );
return res;

case QGis::WKBMultiPolygon25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBMultiPolygon:
wkbPtr >> count;
for ( i = 0; i < count; i++ )
Expand Down Expand Up @@ -354,13 +358,15 @@ double QgsDistanceArea::measurePerimeter( QgsGeometry* geometry )

case QGis::WKBPolygon25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBPolygon:
measurePolygon( wkb, 0, &res, hasZptr );
QgsDebugMsg( "returning " + QString::number( res ) );
return res;

case QGis::WKBMultiPolygon25D:
hasZptr = true;
//intentional fall-through
case QGis::WKBMultiPolygon:
wkbPtr >> count;
for ( i = 0; i < count; i++ )
Expand Down Expand Up @@ -1017,6 +1023,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, QGis::UnitType u,
break;
case QGis::UnknownUnit:
unitLabel = QObject::tr( " unknown" );
//intentional fall-through
default:
QgsDebugMsg( QString( "Error: not picked up map units - actual value = %1" ).arg( u ) );
};
Expand Down
1 change: 1 addition & 0 deletions src/core/qgsexpression.cpp
Expand Up @@ -2239,6 +2239,7 @@ QVariant QgsExpression::NodeBinaryOperator::eval( QgsExpression* parent, const Q
QString sR = getStringValue( vR, parent ); ENSURE_NO_EVAL_ERROR;
return QVariant( sL + sR );
}
//intentional fall-through
case boMinus:
case boMul:
case boDiv:
Expand Down

0 comments on commit 342a0cb

Please sign in to comment.