From fecc9a5a8c80fdbf312b5d9af9af3e6dec15f3ae Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 27 Aug 2011 23:50:32 +0100 Subject: [PATCH] Fix FitRideFile for header change The header size in FitRideFile has increased from 12 to 14 bytes, but the new field is at the end of the header, not in the middle. Additionally, there is a new global record (79) which we now silently ignore. --- src/FitRideFile.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/FitRideFile.cpp b/src/FitRideFile.cpp index 9fae7f7fb..0f001f566 100644 --- a/src/FitRideFile.cpp +++ b/src/FitRideFile.cpp @@ -524,6 +524,7 @@ struct FitFileReaderState case 72: /* undocumented - new for garmin 800*/ case 34: /* activity */ case 49: /* file creator */ + case 79: /* unknown */ break; default: unknown_global_msg_nums.insert(def.global_msg_num); @@ -553,7 +554,6 @@ struct FitFileReaderState // if the header size is 14 we have profile minor then profile major // version. We still don't do anything with this information int profile_version = read_uint16(false); // always littleEndian - if (header_size == 14) profile_version = read_uint16(false); (void) profile_version; // not sure what to do with this int data_size = read_uint32(false); // always littleEndian @@ -569,6 +569,10 @@ struct FitFileReaderState delete rideFile; return NULL; } + + // read the rest of the header + if (header_size == 14) read_uint16(false); + int bytes_read = 0; bool stop = false; try {