Skip to content

Commit

Permalink
tidy fixes (#1179)
Browse files Browse the repository at this point in the history
* tidy readability-convert-member-functions-to-static

* tidy readability-make-member-function-const

* kill trailing space
  • Loading branch information
tsteven4 authored Sep 15, 2023
1 parent 2ff93fa commit dfc770a
Show file tree
Hide file tree
Showing 16 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion duplicate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void DuplicateFilter::process()
.arg(degrees2ddmm(waypointp->latitude), 11, 'f', 3)
.arg(degrees2ddmm(waypointp->longitude), 11, 'f', 3);
}

if (snopt) {
key.append(waypointp->shortname);
}
Expand Down
4 changes: 2 additions & 2 deletions exif.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ ExifFormat::exif_read_str(ExifTag* tag)
// Panasonic DMC-TZ10 stores datum with trailing spaces.
// Kodak stores zero count ASCII tags.
QByteArray buf = (tag->count == 0) ? QByteArray("") : tag->data.at(0).toByteArray();
// If the bytearray contains internal NULL(s), get rid of the first and
// If the bytearray contains internal NULL(s), get rid of the first and
// anything after it.
if (auto idx = buf.indexOf('\0'); idx >= 0) {
buf = buf.left(idx);
Expand Down Expand Up @@ -1574,7 +1574,7 @@ ExifFormat::write()
exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 0, dt.time().hour());
exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 1, dt.time().minute());
exif_put_double(GPS_IFD, GPS_IFD_TAG_TIMESTAMP, 2,
static_cast<double>(dt.time().second()) +
static_cast<double>(dt.time().second()) +
static_cast<double>(dt.time().msec())/1000.0);

exif_put_str(GPS_IFD, GPS_IFD_TAG_DATESTAMP, CSTR(dt.toString(u"yyyy:MM:dd")));
Expand Down
2 changes: 1 addition & 1 deletion filter_vecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FilterVecs
class fltinfo_t {
public:

bool isDynamic() {
bool isDynamic() const {
return factory != nullptr;
}
explicit operator bool() const {
Expand Down
2 changes: 1 addition & 1 deletion gdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class GdbFormat : public Format
* it’s in <qhashfunctions.h>, a public header.
*/
QtPrivate::QHashCombine hash;

seed = hash(seed, c.shortname.toUpper());
seed = hash(seed, c.lat);
seed = hash(seed, c.lon);
Expand Down
2 changes: 1 addition & 1 deletion geo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#define MYNAME "geo"

void GeoFormat::GeoReadLoc(QXmlStreamReader& reader) const
void GeoFormat::GeoReadLoc(QXmlStreamReader& reader)
{
Waypoint* wpt = nullptr;
QString current_tag;
Expand Down
2 changes: 1 addition & 1 deletion geo.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class GeoFormat : public Format

/* Member Functions */

void GeoReadLoc(QXmlStreamReader& reader) const;
static void GeoReadLoc(QXmlStreamReader& reader);
void geo_waypt_pr(const Waypoint*, QXmlStreamWriter& writer);
static Geocache::container_t wpt_container(const QString&);

Expand Down
4 changes: 2 additions & 2 deletions googletakeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class GoogleTakeoutFormat : public Format

ff_type get_type() const override
{
return ff_type_file;
return ff_type_file;
}

QVector<ff_cap> get_cap() const override
Expand All @@ -86,7 +86,7 @@ class GoogleTakeoutFormat : public Format
void rd_init(const QString& fname) override
{}
void read() override;

private:
/* Constants */

Expand Down
2 changes: 1 addition & 1 deletion gpx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ GpxFormat::qualifiedName() const
* file. So we map from the namespaceUris to the prefixes used in our
* hash table.
*/
static const QHash<QString, QString> tag_ns_prefixes = {
static const QHash<QString, QString> tag_ns_prefixes = {
{"http://www.garmin.com/xmlschemas/GpxExtensions/v3", "gpxx"},
{"http://www.garmin.com/xmlschemas/TrackPointExtension/v1", "gpxtpx"},
{"http://www.groundspeak.com/cache/1/0", "groundspeak"},
Expand Down
2 changes: 1 addition & 1 deletion gtm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <QString> // for QString
#include <QVector> // for QVector

#include "defs.h"
#include "defs.h"
#include "gbfile.h" // for gbfseek, gbfputc, gbfputint32, gbfputflt
#include "jeeps/gpsmath.h" // for GPS_Math_Known_Datum_To_WGS84_M
#include "src/core/datetime.h" // for DateTime
Expand Down
6 changes: 3 additions & 3 deletions igc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ QByteArray IgcFormat::latlon2str(const Waypoint* wpt)
return str;
}

QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt) const
QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt)
{
QByteArray str = dt.toUTC().toString("ddMMyy").toUtf8();
if (str.size() != 6) {
Expand All @@ -645,7 +645,7 @@ QByteArray IgcFormat::date2str(const gpsbabel::DateTime& dt) const
return str;
}

QByteArray IgcFormat::tod2str(const gpsbabel::DateTime& tod) const
QByteArray IgcFormat::tod2str(const gpsbabel::DateTime& tod)
{
QByteArray str = tod.toUTC().toString("hhmmss").toUtf8();
if (str.size() != 6) {
Expand Down Expand Up @@ -826,7 +826,7 @@ void IgcFormat::wr_fix_record(const Waypoint* wpt, int pres_alt, int gnss_alt)
* @return The number of seconds to add to the GNSS track in order to align
* it with the pressure track.
*/
int IgcFormat::correlate_tracks(const route_head* pres_track, const route_head* gnss_track) const
int IgcFormat::correlate_tracks(const route_head* pres_track, const route_head* gnss_track)
{
double alt_diff;
double speed;
Expand Down
10 changes: 5 additions & 5 deletions igc.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class IgcFormat : public Format
* A factor can never be zero, so this looks good to me.
* Be careful.
*/
int get_ext_factor(igc_ext_type_t type) const
static int get_ext_factor(igc_ext_type_t type)
{
int ret = 0;
switch (type) {
Expand Down Expand Up @@ -242,17 +242,17 @@ class IgcFormat : public Format
void detect_gnss_track(const route_head*);
void detect_other_track(const route_head*, int& max_waypt_ct);
void get_tracks(const route_head**, const route_head**);
QByteArray latlon2str(const Waypoint*);
QByteArray date2str(const gpsbabel::DateTime&) const;
QByteArray tod2str(const gpsbabel::DateTime&) const;
static QByteArray latlon2str(const Waypoint*);
static QByteArray date2str(const gpsbabel::DateTime&);
static QByteArray tod2str(const gpsbabel::DateTime&);
void wr_header();
void wr_task_wpt_name(const Waypoint*, const char*);
void wr_task_hdr(const route_head*, unsigned int task_num);
void wr_task_wpt(const Waypoint*);
void wr_task_tlr(const route_head*);
void wr_tasks();
void wr_fix_record(const Waypoint*, int, int);
int correlate_tracks(const route_head*, const route_head*) const;
static int correlate_tracks(const route_head*, const route_head*);
void wr_track();

/* Data Members */
Expand Down
2 changes: 1 addition & 1 deletion kml.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ QString KmlFormat::kml_gc_mkstar(int rating)

}

QString KmlFormat::kml_geocache_get_logs(const Waypoint* wpt) const
QString KmlFormat::kml_geocache_get_logs(const Waypoint* wpt)
{
QString r;

Expand Down
2 changes: 1 addition & 1 deletion kml.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class KmlFormat : public Format
static QString kml_lookup_gc_icon(const Waypoint* waypointp);
static const char* kml_lookup_gc_container(const Waypoint* waypointp);
static QString kml_gc_mkstar(int rating);
QString kml_geocache_get_logs(const Waypoint* wpt) const;
static QString kml_geocache_get_logs(const Waypoint* wpt);
void kml_write_data_element(const QString& name, const QString& value) const;
void kml_write_data_element(const QString& name, int value) const;
void kml_write_data_element(const QString& name, double value) const;
Expand Down
12 changes: 6 additions & 6 deletions position.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,31 @@ void PositionFilter::position_runqueue(const WaypointList& waypt_list, int qtype
{
if (!waypt_list.empty()) {
QList<WptRecord> qlist;

for (auto* const waypointp : waypt_list) {
qlist.append(WptRecord(waypointp));
}
int nelems = qlist.size();

for (int i = 0 ; i < nelems ; ++i) {
if (!qlist.at(i).deleted) {
bool something_deleted = false;

for (int j = i + 1 ; j < nelems ; ++j) {
if (!qlist.at(j).deleted) {
double dist = gc_distance(qlist.at(j).wpt->latitude,
qlist.at(j).wpt->longitude,
qlist.at(i).wpt->latitude,
qlist.at(i).wpt->longitude);

if (dist <= pos_dist) {
if (check_time) {
qint64 diff_time = std::abs(qlist.at(j).wpt->creation_time.msecsTo(qlist.at(i).wpt->creation_time));
if (diff_time >= max_diff_time) {
continue;
}
}

qlist[j].deleted = true;
qlist.at(j).wpt->wpt_flags.marked_for_deletion = 1;
something_deleted = true;
Expand All @@ -75,7 +75,7 @@ void PositionFilter::position_runqueue(const WaypointList& waypt_list, int qtype
}
}
}

if (something_deleted && (purge_duplicates != nullptr)) {
qlist.at(i).wpt->wpt_flags.marked_for_deletion = 1;
}
Expand Down
4 changes: 2 additions & 2 deletions util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ make_datetime(QDate date, QTime time, bool is_localtime, bool force_utc, int utc
result = date.startOfDay(timespec, offset);
#endif
}

return result;
}

Expand Down Expand Up @@ -1066,7 +1066,7 @@ QString grapheme_truncate(const QString& input, unsigned int count)

int xstrtoi(const char* str, char** str_end, int base)
{

long value = strtol(str, str_end, base);
if (value > INT_MAX) {
errno = ERANGE;
Expand Down
2 changes: 1 addition & 1 deletion vecs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Vecs
class fmtinfo_t {
public:

bool isDynamic() {
bool isDynamic() const {
return factory != nullptr;
}
explicit operator bool() const {
Expand Down

0 comments on commit dfc770a

Please sign in to comment.