lintondf [Sun, 7 Jun 2020 22:19:10 +0000 (18:19 -0400)]
Extract expected travel durations from Garmin BaseCamp GDB output (#585)
* extract track segment expected travel durations from Garmin BaseCamp autorouted GDB exports and report as <rtept/src> elements in gpx output
* revised to use Garmin Format-Specific Data object to store durations
* generate at frozen test time
* include code review suggestions
* store Garmin BaseCamp autoroute waypoint travel durations in the <desc> elements of <rtept> waypoints; modify gpx ouptut to exclude autoroute generated rtept waypoints from initial waypoint list
* remove waypoint class lookup and replace tabs with spaces
GPSBabel [Thu, 4 Jun 2020 07:46:11 +0000 (02:46 -0500)]
Remove Mapsource .mps format (#588)
* Fix numerous instances of shadowing confusion.
Inspired by a cppcon talk and our recent conversations about warnings, I
took a closer look at shadowing variables in our code and I wasn't proud
of my findings.
We had a lot of code that was writing to local variables or function
arguments when it thought it was operating on globals or (soon)
method-member variables. I made a rather half-hearted pass at changing
this by splitting up huge functions, renaming arguments, renaming globals
to reflect their future status as method variables (foo_), and generally
cleaning things up. The amound of effort I spent on each format was
approximately equal to its expected lifespan - I'm not spending an hour
on cleanups on formats I should instead be deleting.
In a future submit, I'll try to find some combination of -W flags on
our targets that allows us to not regress easily.
* Fix merge conflict I just created in gdb.cc
* Delete workspace.xml
* Delete the same link in garmin_icons.xml that I deleted twice yesterday.
Fix more esoteric warnings.
* Reapply MORE of yesterday's commits.
Seriously, I know this has been committed and is in HEAD...
* Attempt to fix list detachment within route.cc
* Remove Mapsource
The Mapsource format has been deprecated by Garmin for something
like 15 years. Later versions of Mapsource used GDB and Basecamp,
Garmin's first replacement for the Mapsource lineage, was used
exclusively in later versions.
I've reviewed list traffic and floated a discussion on the list.
The code style was never really very flexible and it it bears
a high maintenance cost that we can no longer afford. This
format is dead.
* Remove more pieces of Mapsource.
* Change Netstumbler test to not use Mapsource for staging.
More cleanups.
tsteven4 [Mon, 1 Jun 2020 18:55:10 +0000 (12:55 -0600)]
clean up mkstyle.sh (#578)
as suggested by shellcheck used $() instead of backticks,
and double quote to prevent globbing and word splitting.
mkstyle.sh now works if the directory path contains a space.
drop the failed attempt to exclude custom.style. This resolves #577
drop the exclusion of README.style, which hasn't existed for a long time.
use basename to drop the suffix instead of piping to sed.
GPSBabel [Wed, 27 May 2020 03:31:16 +0000 (22:31 -0500)]
Fix numerous instances of shadowing confusion. (#570)
Fix numerous instances of shadowing confusion.
Inspired by a cppcon talk and our recent conversations about warnings, I
took a closer look at shadowing variables in our code and I wasn't proud
of my findings.
We had a lot of code that was writing to local variables or function
arguments when it thought it was operating on globals or (soon)
method-member variables. I made a rather half-hearted pass at changing
this by splitting up huge functions, renaming arguments, renaming globals
to reflect their future status as method variables (foo_), and generally
cleaning things up. The amound of effort I spent on each format was
approximately equal to its expected lifespan - I'm not spending an hour
on cleanups on formats I should instead be deleting.
In a future submit, I'll try to find some combination of -W flags on
our targets that allows us to not regress easily.
tsteven4 [Sat, 23 May 2020 21:36:29 +0000 (15:36 -0600)]
fix a few -Wstringop-truncation warnings (#565)
* fix -Wstringop-truncation warning in bushnell.
* fix -Wstringop-truncation in alantrl.
* fix -Wstringop-truncation warning in garmin, and a real error.
The real error:
In garmin.cc route_hdr_pr would fail to terminate the
GPS_SWay rte_ident member if latin1 encoded route name was longer
than 255 characters. Subsequently garmin.cc route_write passes the
GPS_SWay structure to GPS_Command_Send_Route. GPS_Command_Send_Route
may call GPS_A20[01]_Send which may call GPS_D202_Send. GPS_D202_Send
assumes that rte_ident is null terminated.
The other change only silences the warning, the character array was
subsequently terminated anyway.
* fix -Wstringop-truncation warning in enigma.
These are nonstrings. They are not required to be null terminated.
A real reference file caputred from MGL Central 2.0 is added. In it
you can see that don't care values are not all filled with a particular
value. We fill them with NULLs are a result of zeroing the structure before
we write it. You can also see the 1000m offset in altitudes is correct.
* correct reference file mode.
* fix two strncpy warnings that gcc 9.3.0 doesn't issue.
Perhaps it is a gcc bug that these didn't cause warnings. It seems
to be related to the fact they were the last member in the structure.
In any event, we can copy 1 byte less, we explicitly add a terminator
subsequently.
tsteven4 [Wed, 20 May 2020 16:17:55 +0000 (10:17 -0600)]
let clang-tidy provide default member initializers (#562)
* let clang-tidy provide default memeber intializers
This is the check cppcoreguidelines-pro-type-member-init, but
it was only applied to the class declarations for our filters,
formats and vectors.
This is currently irrelevant as all these are constructed globally,
but if one constructs dynamic instances errors can be seen in gpx, kml, nmea
and lowranceusr formats.
* revert filter_vecs change which MSVC 2015 choked on.
tsteven4 [Wed, 13 May 2020 15:01:50 +0000 (09:01 -0600)]
use qdatetime for dg100 format (#556)
* use QDateTime for dg-100 format.
* fix undefined behavior bug in dg100.
When sending the getconfig command memcpy would be invoked with
src == nullptr. The behavior of memcpy is undefined under these conditions,
even if the count is zero as it is in this case.
tsteven4 [Wed, 13 May 2020 13:22:58 +0000 (07:22 -0600)]
Add regression test capability for DG100/DG200 format. (#554)
* add regression test cabability for dg100 format.
The test compares any written data with the subsequent bytes in the
reference file. The test supplies any read data from the subsequent
bytes in the reference file.
A reference file can be created from the debug output at level 5
when reading an actual globalsat device:
egrep 'Receiving|Sent' "$log" | sed 's/^Sent: //' | sed 's/^Receiving //' \
| sed 's/RX:.*//' | xxd -r -p > "$log".bin
This creates a binary file from all the bytes transferred to or
from the device.
* update serialization reference files.
Even though the dg100 regression formats are internal, they still
get serialized. The GUI ignores them.
* Fix memory leak exposed by new dg100 regression test.
By using QList instead of homegrown dynarray16 class.
tsteven4 [Thu, 7 May 2020 12:31:39 +0000 (06:31 -0600)]
fix nmea writer date bug. (#553)
* fix nmea writer date bug.
dates before 2000 were written with a month off by one.
This also changes the behavior when the creation time is invalid.
Previously you would get data related to the unix epoch for the date
and time fields.
Now you get empty fields, i.e. ",,"
* fix magellan writer date bug.
This had the same bug as nmea. It had an additional bug
when it attempted to round the fractional part of a second. Rounding
can ripple all the way from the fractional part of a second to the year,
as is now demonstrated in the testcase.
Like nmea, magellan will now print empty fields if the creation time
is invalid.
tsteven4 [Mon, 4 May 2020 19:20:22 +0000 (13:20 -0600)]
convert unicsv to Format class (#552)
* convert unicsv to Format class.
Two bugs are fixed as well:
1. { "datum", fld_date, STR_ANY } is removed from the fields_def.
Note that the type is fld_date. I don't think this was ever used.
We do have the datum option to set the datum from the command line.
2. unicsv_fondle_header changed the fields_def type to fld_iso_time
if it was fld_time or fld_date and the value contained "iso".
However, fields_def isn't used outside unicsv_fondle_header, so
this had no effect.
tsteven4 [Fri, 1 May 2020 22:12:29 +0000 (16:12 -0600)]
fix windows issues with kml.h including windows.h (#551)
windows.h defines macros for max and min, which lead to compiler
warnings:
random.h(125): warning C4003: not enough arguments for function-like macro invocation 'max' (compiling source file
tsteven4 [Fri, 1 May 2020 12:32:18 +0000 (06:32 -0600)]
add recoverymode and CRC checking to FIT reader. (#549)
* add recoverymode and CRC checking to FIT reader.
If present, the header CRC is checked.
The file CRC and length is checked.
A recoverymode option is added.
In the default mode we will fatal with:
a bad CRC,
a bad endian field,
an attempt to read when the data section doesn't have sufficient data,
an unexepected EOF.
In recovery mode when we encounter one of these errors we will abort
read processing and continue. This allows a more immediate cleaner
exit from the reader while still allowing any writer to use data that
was recovered previous to the read abort.
* add further explanation of recoverymode for document.
* make sure garmin fit messages are defined before being used.
This includes a workaround for a bug in the Qt intaller
that causes segmentation faults in the Qt installer when
the minimal platform is used on macos 10.14, 10.15.
assume energympro and globalsatsport use LocalTime. (#447)
* assume energympro and globalsatsport use LocalTime.
add an option to set the timezone for these formats, as the
timezone used to create the data may not match the timezone of the
computer reading the data.
* modify energympro/globalsatsport tests to use
UTC offsets. Europe/Stockholm wasn't available on our Docker
bionic test image.
* fix an actual bug found by Wimplicit-fallthrough=
* add comments for gcc wrt Wimplicit-fallthrough=
The real fix is the to add the attribute [[fallthrough]];
which was added in c++17.
gcc accepts this, but until c++17 there wasn't
a requirement to ignore unrecognized attributes, so we can
imagine a pre c++17 compiler might choke on it.
Fix access to QByteArray/QString outside the valid range. (#537)
With Qt 5.15, and likely 5.14, the following warnings were generated during
testo:
Using QByteRef with an index pointing outside the valid range of a QByteArray. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
Note this requires Qt to be compiled for debug.
These warnings can be debugged by running testo with
"export QT_FATAL_WARNINGS=1" to generate core dumps.
I suspect the appending of null terminators in ggv_bin is unecessary,
i.e. I beleive QByteArray::resize() in ggv_bin_read_bytes will take
care of this. Never the less I slavishly kept adding them just to make
certain.