Skip to content
Permalink
Browse files

Add comments for every intentional case fall-through

Improves code maintainability/readability
  • Loading branch information
nyalldawson committed Feb 18, 2015
1 parent 0df6dee commit 342a0cbdfb9118e7f1476d4d7d32a0195b5bdc4f
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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 ) );
}
@@ -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;
@@ -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++ )
@@ -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++ )
@@ -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++ )
@@ -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 ) );
};
@@ -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:

0 comments on commit 342a0cb

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