From cadc932c23189cb0143149d2284d2ae6e908b6dc Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Thu, 29 Dec 2022 12:47:11 -0700 Subject: [PATCH] odds and ends (#964) * odds and ends support subseconds in exif GPSTimeStamp. While rare, some devices provide subsecond information. add missing include guards. use cmake for mkicondoc, retiring the last qmake build. provide default initializers for a couple of data members. kill some empty statements. * Dont' use case_ignore_strcmp for two QStrings. --- CMakeLists.txt | 5 +++++ discard.h | 2 +- exif.cc | 2 +- garmin_device_xml.h | 3 +++ garmin_txt.cc | 2 +- gbser_private.h | 3 +++ gui/latlng.h | 4 ++-- mkicondoc.cc | 1 - mkicondoc/mkicondoc.pro | 9 --------- nmea.h | 7 ++++--- src/core/codecdevice.h | 3 +++ src/core/logging.h | 6 +++--- 12 files changed, 26 insertions(+), 21 deletions(-) delete mode 100644 mkicondoc/mkicondoc.pro diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a985892d..00536ca5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,6 +367,11 @@ message(STATUS "Libs are: \"${LnkLibs}\"") get_target_property(IncDirs gpsbabel INCLUDE_DIRECTORIES) message(STATUS "Include Directores are: \"${IncDirs}\"") +# In case we ever update the garmin_icons mkicondoc helps +# update the related document table. +add_executable(mkicondoc EXCLUDE_FROM_ALL mkicondoc.cc) +target_link_libraries(mkicondoc PRIVATE ${QT_LIBRARIES}) + set(TESTS arc-project arc diff --git a/discard.h b/discard.h index 8e8881198..ad5c4cfbf 100644 --- a/discard.h +++ b/discard.h @@ -66,7 +66,7 @@ class DiscardFilter:public Filter int satpf{}; int eleminpf{}; int elemaxpf{}; - gpsdata_type what; + gpsdata_type what{}; route_head* head{}; QVector args = { diff --git a/exif.cc b/exif.cc index 8c41c45fa..956d34ba5 100644 --- a/exif.cc +++ b/exif.cc @@ -254,7 +254,7 @@ ExifFormat::exif_read_timestamp(const ExifTag* tag) double min = exif_read_double(tag, 1); double sec = exif_read_double(tag, 2); - return QTime(int(hour), int(min), int(sec)); + return QTime(0, 0).addMSecs(lround((((hour * 60.0) + min) * 60.0 + sec) * 1000.0)); } QDate diff --git a/garmin_device_xml.h b/garmin_device_xml.h index 43495ebb9..6796b1be3 100644 --- a/garmin_device_xml.h +++ b/garmin_device_xml.h @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef GARMIN_DEVICE_XML_H_ +#define GARMIN_DEVICE_XML_H_ /* * Describes a file on the unit. @@ -54,3 +56,4 @@ const gdx_info* gdx_find_file(char** dirlist); #include extern jmp_buf gdx_jmp_buf; +#endif // GARMIN_DEVICE_XML_H_ diff --git a/garmin_txt.cc b/garmin_txt.cc index dd24e4197..1f102763c 100644 --- a/garmin_txt.cc +++ b/garmin_txt.cc @@ -229,7 +229,7 @@ enum_waypt_cb(const Waypoint* wpt) } for (int i = 0; i < wpt_a_ct; i++) { /* check for duplicates */ const Waypoint* tmp = wpt_a[i]; - if (case_ignore_strcmp(tmp->shortname, wpt->shortname) == 0) { + if (tmp->shortname.compare(wpt->shortname, Qt::CaseInsensitive) == 0) { wpt_a[i] = wpt; waypoints--; return; diff --git a/gbser_private.h b/gbser_private.h index 37c889eec..568d6314b 100644 --- a/gbser_private.h +++ b/gbser_private.h @@ -18,6 +18,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef GBSER_PRIVATE_H_ +#define GBSER_PRIVATE_H_ #define MYMAGIC 0x91827364 #define BUFSIZE 512 @@ -25,3 +27,4 @@ void gbser_db(int l, const char* msg, ...); int gbser_fill_buffer(void* h, unsigned want, unsigned* ms); unsigned gbser_read_buffer(void* handle, void** buf, unsigned* len); +#endif // GBSER_PRIVATE_H_ diff --git a/gui/latlng.h b/gui/latlng.h index 10c9d603a..44c390108 100644 --- a/gui/latlng.h +++ b/gui/latlng.h @@ -28,8 +28,8 @@ class LatLng { public: - LatLng(): _lat(0), _lng(0) {}; - LatLng(double lat, double lng): _lat(lat), _lng(lng) {}; + LatLng(): _lat(0), _lng(0) {} + LatLng(double lat, double lng): _lat(lat), _lng(lng) {} double lat() const { return _lat; diff --git a/mkicondoc.cc b/mkicondoc.cc index afeb6f73a..94a7a21bc 100644 --- a/mkicondoc.cc +++ b/mkicondoc.cc @@ -1,6 +1,5 @@ // Display all the Garmin icons that we know about so we can copy/paste // into our doc, xmldoc/chapters/garmin_icons.xml. -// cd mkicondoc && qmake && make #include // for sort #include // for printf diff --git a/mkicondoc/mkicondoc.pro b/mkicondoc/mkicondoc.pro deleted file mode 100644 index 24a31236d..000000000 --- a/mkicondoc/mkicondoc.pro +++ /dev/null @@ -1,9 +0,0 @@ -QT -= gui - -CONFIG += console -CONFIG -= app_bundle -CONFIG += c++17 - -TEMPLATE = app - -SOURCES += ../mkicondoc.cc diff --git a/nmea.h b/nmea.h index 61f5c0b38..e0f3a679d 100644 --- a/nmea.h +++ b/nmea.h @@ -94,11 +94,11 @@ class NmeaFormat : public Format gprmc }; - enum { + enum read_mode_type { rm_unknown = 0, rm_serial, rm_file - } read_mode; + }; /* Member Functions */ @@ -132,7 +132,8 @@ class NmeaFormat : public Format gbfile* file_in{}, *file_out{}; route_head* trk_head{}; short_handle mkshort_handle{}; - preferred_posn_type posn_type; + preferred_posn_type posn_type{}; + read_mode_type read_mode{}; QDateTime prev_datetime; Waypoint* curr_waypt{}; Waypoint* last_waypt{}; diff --git a/src/core/codecdevice.h b/src/core/codecdevice.h index 6ccb7e8ac..596bc2dcb 100644 --- a/src/core/codecdevice.h +++ b/src/core/codecdevice.h @@ -16,6 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef SRC_CORE_CODECDEVICE_H_ +#define SRC_CORE_CODECDEVICE_H_ #include // for QIODevice #include // for QIODeviceBase::OpenMode @@ -61,3 +63,4 @@ class CodecDevice : public QIODevice }; } // namespace +#endif // SRC_CORE_CODECDEVICE_H_ diff --git a/src/core/logging.h b/src/core/logging.h index c0356d201..c3932d992 100644 --- a/src/core/logging.h +++ b/src/core/logging.h @@ -16,8 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef gpsbabel_logging_h_included -#define gpsbabel_logging_h_included +#ifndef SRC_CORE_LOGGING_H_ +#define SRC_CORE_LOGGING_H_ // A wrapper for QDebug that provides a sensible Warning() and FatalMsg() // with convenient functions, stream operators and manipulators. @@ -79,4 +79,4 @@ namespace Qt inline QTextStream& uppercasedigits(QTextStream &s) { return ::uppercasedigits(s); } } #endif -#endif // gpsbabel_logging_h_included +#endif // SRC_CORE_LOGGING_H_