summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-17 01:39:26 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-08-17 01:39:26 (GMT)
commit0823d5a71d4c4591ae6e876539b9a248bdf00b8f (patch)
tree372674137fbba07d3b73f90ad3038d2e68127c1c
parent688f32eae1bf32f64de70e78406940dae4403574 (diff)
Use startsWith() instead of mid() and complete comparison
-rw-r--r--src/plugins/runner/routino/RoutinoRunner.cpp4
-rw-r--r--tools/constellations2kml/constellations2kml.cpp2
-rw-r--r--tools/stars/stars.cpp4
3 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/runner/routino/RoutinoRunner.cpp b/src/plugins/runner/routino/RoutinoRunner.cpp
index c3b286d..9daf919 100644
--- a/src/plugins/runner/routino/RoutinoRunner.cpp
+++ b/src/plugins/runner/routino/RoutinoRunner.cpp
@@ -129,8 +129,8 @@ GeoDataLineString* RoutinoRunnerPrivate::parseRoutinoOutput( const QByteArray &c
QStringList lines = QString::fromUtf8( content ).split( '\n' );
mDebug() << lines.count() << "lines";
foreach( const QString &line, lines ) {
- if ( line.left(1) == QString('#') ) {
- //skip comment
+ if (line.startsWith(QLatin1Char('#'))) {
+ //skip comment
continue;
}
QStringList fields = line.split('\t');
diff --git a/tools/constellations2kml/constellations2kml.cpp b/tools/constellations2kml/constellations2kml.cpp
index 56dad78..3a77e66 100644
--- a/tools/constellations2kml/constellations2kml.cpp
+++ b/tools/constellations2kml/constellations2kml.cpp
@@ -77,7 +77,7 @@ int main(int argc, char *argv[])
longitude = ( raHH + raMM / 60.0 + raSS / 3600.0 ) * 15.0 - 180.0;
QString decString = starsLine.mid( 83, 7 );
- double deSign = ( decString.mid( 0, 1 ) == "-" ) ? -1.0 : 1.0;
+ double deSign = decString.startsWith(QLatin1Char('-')) ? -1.0 : 1.0;
double deHH = decString.mid( 1, 2 ).toDouble();
double deMM = decString.mid( 3, 2 ).toDouble();
double deSS = decString.mid( 5, 2 ).toDouble();
diff --git a/tools/stars/stars.cpp b/tools/stars/stars.cpp
index 4d6ecf2..56054f2 100644
--- a/tools/stars/stars.cpp
+++ b/tools/stars/stars.cpp
@@ -57,7 +57,7 @@ void exportToDat()
QString decString = line.mid( 83, 7 );
- double deSign = ( decString.mid( 0, 1 ) == "-" ) ? -1.0 : 1.0;
+ double deSign = decString.startsWith(QLatin1Char('-')) ? -1.0 : 1.0;
double deHH = decString.mid( 1, 2 ).toDouble();
double deMM = decString.mid( 3, 2 ).toDouble();
double deSS = decString.mid( 5, 2 ).toDouble();
@@ -568,7 +568,7 @@ void exportToKml()
qreal longitude = ( raHH + raMM / 60.0 + raSS / 3600.0 ) * 15.0 - 180.0;
QString decString = line.mid( 83, 7 );
- double deSign = ( decString.mid( 0, 1 ) == "-" ) ? -1.0 : 1.0;
+ double deSign = decString.startsWith(QLatin1Char('-')) ? -1.0 : 1.0;
double deHH = decString.mid( 1, 2 ).toDouble();
double deMM = decString.mid( 3, 2 ).toDouble();
double deSS = decString.mid( 5, 2 ).toDouble();