Skip to content

Commit

Permalink
Fix some inefficient QString replace calls
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 26, 2017
1 parent 148380a commit 718e498
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -1154,7 +1154,7 @@ QString QgsGdalProvider::generateBandName( int bandNumber ) const
val = values.at( 1 );
if ( values.at( 0 ) == QLatin1String( "NETCDF_DIM_EXTRA" ) )
{
dimExtraValues = val.replace( QStringLiteral( "{" ), QString() ).replace( QStringLiteral( "}" ), QString() ).split( ',' );
dimExtraValues = val.replace( '{', QString() ).replace( '}', QString() ).split( ',' );
//http://qt-project.org/doc/qt-4.8/qregexp.html#capturedTexts
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/server/qgsserverrequest.cpp
Expand Up @@ -81,7 +81,7 @@ QMap<QString, QString> QgsServerRequest::parameters() const
{
// prepare the value
QString value = pair.second;
value.replace( "+", " " );
value.replace( '+', ' ' );

mParams.insert( pair.first.toUpper(), value );
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/services/wfs/qgswfsgetfeature.cpp
Expand Up @@ -1298,7 +1298,7 @@ namespace QgsWfs
continue;
}

QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( QStringLiteral( " " ), QStringLiteral( "_" ) ) );
QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( ' ', '_' ) );
QDomText fieldText = doc.createTextNode( featureAttributes[idx].toString() );
fieldElem.appendChild( fieldText );
typeNameElement.appendChild( fieldElem );
Expand Down Expand Up @@ -1399,7 +1399,7 @@ namespace QgsWfs
continue;
}

QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( QStringLiteral( " " ), QStringLiteral( "_" ) ) );
QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( ' ', '_' ) );
QDomText fieldText = doc.createTextNode( featureAttributes[idx].toString() );
fieldElem.appendChild( fieldText );
typeNameElement.appendChild( fieldElem );
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wfs/qgswfsparameters.cpp
Expand Up @@ -383,7 +383,7 @@ namespace QgsWfs

if ( !bbox.isEmpty() )
{
const QStringList corners = bbox.split( ',' );
QStringList corners = bbox.split( ',' );

if ( corners.size() == 4 )
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wfs/qgswfstransaction.cpp
Expand Up @@ -933,7 +933,7 @@ namespace QgsWfs
}

// get bbox corners
const QStringList corners = bbox.split( ',' );
QStringList corners = bbox.split( ',' );
if ( corners.size() != 4 )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "BBOX has to be composed of 4 elements: '%1'" ).arg( bbox ) );
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wfs/qgswfstransaction_1_0_0.cpp
Expand Up @@ -916,7 +916,7 @@ namespace QgsWfs
}

// get bbox corners
const QStringList corners = bbox.split( ',' );
QStringList corners = bbox.split( ',' );
if ( corners.size() != 4 )
{
throw QgsRequestNotWellFormedException( QStringLiteral( "BBOX has to be composed of 4 elements: '%1'" ).arg( bbox ) );
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/wms/qgswmsrenderer.cpp
Expand Up @@ -2224,7 +2224,7 @@ namespace QgsWms
continue;
}

QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( QStringLiteral( " " ), QStringLiteral( "_" ) ) );
QDomElement fieldElem = doc.createElement( "qgs:" + attributeName.replace( ' ', '_' ) );
QString fieldTextString = featureAttributes.at( i ).toString();
if ( layer )
{
Expand Down

0 comments on commit 718e498

Please sign in to comment.