Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More efficient use of strings
  • Loading branch information
nyalldawson committed Feb 28, 2017
1 parent 92f0327 commit e7f2f78
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -758,8 +758,8 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
int myLength1 = 0;
int myStart2 = 0;
int myLength2 = 0;
QString lat1Str = QLatin1String( "" );
QString lat2Str = QLatin1String( "" );
QString lat1Str;
QString lat2Str;
myStart1 = myLat1RegExp.indexIn( myProj4String, myStart1 );
myStart2 = myLat2RegExp.indexIn( myProj4String, myStart2 );
if ( myStart1 != -1 && myStart2 != -1 )
Expand All @@ -770,7 +770,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
lat2Str = myProj4String.mid( myStart2 + LAT_PREFIX_LEN, myLength2 - LAT_PREFIX_LEN );
}
// If we found the lat_1 and lat_2 we need to swap and check to see if we can find it...
if ( lat1Str != QLatin1String( "" ) && lat2Str != QLatin1String( "" ) )
if ( !lat1Str.isEmpty() && !lat2Str.isEmpty() )
{
// Make our new string to check...
QString proj4StringModified = myProj4String;
Expand All @@ -793,7 +793,7 @@ bool QgsCoordinateReferenceSystem::createFromProj4( const QString &proj4String )
// - retry without datum, if no match is found (looks like +datum<>WGS84 was dropped in GDAL)

QString sql = QStringLiteral( "SELECT * FROM tbl_srs WHERE " );
QString delim = QLatin1String( "" );
QString delim;
QString datum;

// split on spaces followed by a plus sign (+) to deal
Expand Down Expand Up @@ -1022,7 +1022,7 @@ QString QgsCoordinateReferenceSystem::description() const
{
if ( d->mDescription.isNull() )
{
return QLatin1String( "" );
return QString();
}
else
{
Expand All @@ -1034,7 +1034,7 @@ QString QgsCoordinateReferenceSystem::projectionAcronym() const
{
if ( d->mProjectionAcronym.isNull() )
{
return QLatin1String( "" );
return QString();
}
else
{
Expand All @@ -1046,7 +1046,7 @@ QString QgsCoordinateReferenceSystem::ellipsoidAcronym() const
{
if ( d->mEllipsoidAcronym.isNull() )
{
return QLatin1String( "" );
return QString();
}
else
{
Expand All @@ -1057,7 +1057,7 @@ QString QgsCoordinateReferenceSystem::ellipsoidAcronym() const
QString QgsCoordinateReferenceSystem::toProj4() const
{
if ( !d->mIsValid )
return QLatin1String( "" );
return QString();

if ( d->mProj4.isEmpty() )
{
Expand Down Expand Up @@ -2363,7 +2363,7 @@ QString QgsCoordinateReferenceSystem::geographicCrsAuthId() const
}
else
{
return QLatin1String( "" );
return QString();
}
}

Expand Down

0 comments on commit e7f2f78

Please sign in to comment.