Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix clazy and fallthrough warnings
  • Loading branch information
troopa81 authored and nyalldawson committed Jan 8, 2020
1 parent 0caea59 commit 8713d96
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 23 deletions.
23 changes: 12 additions & 11 deletions src/providers/oracle/ocispatial/qsql_ocispatial.cpp
Expand Up @@ -48,7 +48,7 @@
#if __cplusplus >= 201500
#define FALLTHROUGH [[fallthrough]];
#elif defined(__clang__)
#define FALLTHROUGH //[[clang::fallthrough]]
#define FALLTHROUGH [[clang::fallthrough]];
#elif defined(__GNUC__) && __GNUC__ >= 7
#define FALLTHROUGH [[gnu::fallthrough]];
#else
Expand Down Expand Up @@ -719,9 +719,8 @@ int QOCISpatialResultPrivate::bindValue( OCIStmt *sql, OCIBind **hbnd, OCIError
setCharset( *hbnd, OCI_HTYPE_BIND );
break;
}

FALLTHROUGH
}
FALLTHROUGH

default:
{
Expand Down Expand Up @@ -2743,7 +2742,7 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
line[ partNum ].second.append( line.at( partNum + 1 ).second.first() );
}

for ( const CurvePart &part : line )
for ( const CurvePart &part : qAsConst( line ) )
{
const PointSequence &pts = part.second;
if ( part.first == WKBCompoundCurve )
Expand All @@ -2758,7 +2757,7 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
}
}

for ( const CurvePart &part : line )
for ( const CurvePart &part : qAsConst( line ) )
{
const PointSequence &pts = part.second;
if ( part.first == WKBCompoundCurve )
Expand Down Expand Up @@ -2818,7 +2817,7 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
if ( lines.size() > 1 )
*ptr.iPtr++ = lines.size();

for ( const auto &line : lines )
for ( const auto &line : qAsConst( lines ) )
{
if ( lines.size() > 1 )
{
Expand Down Expand Up @@ -2874,7 +2873,6 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
SurfaceRings currentPart;
WKBType currentPartWkbType = WKBUnknown;

QVector<int> nPolygonRings;
bool isCurved = false;
bool isCompoundCurve = false;

Expand Down Expand Up @@ -3026,7 +3024,7 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
}
}

for ( const CurvePart &curvePart : ring )
for ( const CurvePart &curvePart : qAsConst( ring ) )
{
if ( isCurved )
wkbSize += 1 + sizeof( int );
Expand Down Expand Up @@ -3057,7 +3055,7 @@ bool QOCISpatialCols::convertToWkb( QVariant &v, int index )
*ptr.iPtr++ = nPolygons;
}

for ( const QPair< WKBType, SurfaceRings > &rings : parts )
for ( const QPair< WKBType, SurfaceRings > &rings : qAsConst( parts ) )
{
if ( nPolygons > 1 )
{
Expand Down Expand Up @@ -3322,7 +3320,9 @@ void QOCISpatialCols::getValues( QVector<QVariant> &v, int index )
break;
}
}
// else fall through

FALLTHROUGH

case QVariant::String:
qDebug() << "String";
v[index + i] = QString( reinterpret_cast<const QChar *>( fld.data ) );
Expand Down Expand Up @@ -3460,7 +3460,8 @@ bool QOCISpatialResult::gotoNext( QSqlCachedResult::ValueCache &values, int inde
r = OCI_SUCCESS; /* ignore it */
break;
}
// fall through
FALLTHROUGH

default:
qOraWarning( "QOCISpatialResult::gotoNext: ", d->err );
setLastError( qMakeError( QCoreApplication::translate( "QOCISpatialResult",
Expand Down
4 changes: 2 additions & 2 deletions src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -423,13 +423,13 @@ bool QgsOracleConn::exec( const QString &query, bool logError, QString *errorMes
if ( logError )
{
QgsMessageLog::logMessage( tr( "Connection error: %1 returned %2" )
.arg( query ).arg( error ),
.arg( query, error ),
tr( "Oracle" ) );
}
else
{
QgsDebugMsg( QStringLiteral( "Connection error: %1 returned %2" )
.arg( query ).arg( error ) );
.arg( query, error ) );
}
if ( errorMessage )
*errorMessage = error;
Expand Down
16 changes: 8 additions & 8 deletions src/providers/oracle/qgsoracleconn.h
Expand Up @@ -99,14 +99,14 @@ struct QgsOracleLayerProperty
}

return QString( "%1.%2.%3 type=%4 srid=%5 view=%6%7 sql=%8" )
.arg( ownerName )
.arg( tableName )
.arg( geometryColName )
.arg( typeString )
.arg( sridString )
.arg( isView ? "yes" : "no" )
.arg( isView ? QString( " pk=%1" ).arg( pkCols.join( "|" ) ) : "" )
.arg( sql );
.arg( ownerName,
tableName,
geometryColName,
typeString,
sridString,
isView ? "yes" : "no",
isView ? QString( " pk=%1" ).arg( pkCols.join( "|" ) ) : "",
sql );
}
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoracledataitems.h
Expand Up @@ -116,7 +116,7 @@ class QgsOracleLayerItem : public QgsLayerItem
QList<QAction *> actions( QWidget *parent ) override;

public slots:
bool deleteLayer();
bool deleteLayer() override;

private:
QgsOracleLayerProperty mLayerProperty;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/oracle/qgsoracleprovider.h
Expand Up @@ -382,7 +382,7 @@ class QgsOracleProviderMetadata: public QgsProviderMetadata
QString loadStyle( const QString &uri, QString &errCause ) override;
bool saveStyle( const QString &uri, const QString &qmlStyle, const QString &sldStyle, const QString &styleName,
const QString &styleDescription, const QString &uiFileContent, bool useAsDefault, QString &errCause ) override;
void cleanupProvider();
void cleanupProvider() override;
QgsVectorLayerExporter::ExportError createEmptyLayer( const QString &uri,
const QgsFields &fields, QgsWkbTypes::Type wkbType,
const QgsCoordinateReferenceSystem &srs, bool overwrite,
Expand Down

0 comments on commit 8713d96

Please sign in to comment.