diff --git a/garmin_fit.cc b/garmin_fit.cc index b32a6c1fc..ede89adf9 100644 --- a/garmin_fit.cc +++ b/garmin_fit.cc @@ -217,13 +217,13 @@ GarminFitFormat::fit_getstring(int size) if (fit_data.len < size) { throw ReaderException("record truncated: expecting " + std::to_string(size) + " bytes, but only got " + std::to_string(fit_data.len) + "."); } - QByteArray buf(size + 1, 0); + QByteArray buf(size + 1, 0); // almost certainly an extra byte, QByteArray should guarnatee a terminator. gbsize_t count = gbfread(buf.data(), size, 1, fin); if (count != 1) { throw ReaderException("unexpected end of file with fit_data.len=" + std::to_string(fit_data.len) + "."); } fit_data.len -= size; - return QString(buf); + return QString(buf.constData()); } void diff --git a/reference/Lctns_Instinct.csv b/reference/Lctns_Instinct.csv new file mode 100644 index 000000000..a5b703af6 --- /dev/null +++ b/reference/Lctns_Instinct.csv @@ -0,0 +1,9 @@ +No,Latitude,Longitude,Name,Altitude +1,50.031985,14.310719,"X", +2,50.101786,14.391518," > 1",235.4 +3,50.102963,14.391518,"2",235.4 +4,50.104888,14.391045,"3",235.4 +5,50.206686,14.260687,"12 SEP 19:07",226.6 +6,50.213687,14.307941,"15 SEP 18:47",287.8 +7,50.184026,14.367012,"3 OCT 15:42",197.8 +8,50.172190,14.239638,"3 OCT 17:33",261.8 diff --git a/reference/Lctns_Instinct.fit b/reference/Lctns_Instinct.fit new file mode 100755 index 000000000..57168b8cf Binary files /dev/null and b/reference/Lctns_Instinct.fit differ diff --git a/testo.d/garmin_fit.test b/testo.d/garmin_fit.test index 876317ca1..a2a5a71da 100644 --- a/testo.d/garmin_fit.test +++ b/testo.d/garmin_fit.test @@ -29,6 +29,9 @@ compare ${REFERENCE}/track/garmin-oregon-700-output.gpx ${TMPDIR}/fit-sample-gar gpsbabel -i garmin_fit,recoverymode -f ${REFERENCE}/track/lezyne_super_gps-garmin_fit-sample-bad-endian.fit -o gpx -F ${TMPDIR}/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx 2>/dev/null compare ${REFERENCE}/track/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx ${TMPDIR}/lezyne_super_gps-garmin_fit-sample-bad-endian.gpx +gpsbabel -i garmin_fit -f ${REFERENCE}/Lctns_Instinct.fit -o unicsv,utc=0 -F ${TMPDIR}/Lctns_Instinct.csv +compare ${REFERENCE}/Lctns_Instinct.csv ${TMPDIR}/Lctns_Instinct.csv + # # Basic FIT tests (write) #