From 524ab81a08980fe2f241090490cfa74b30bfb02f 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 448ff8d9a..5f116551e 100644 --- a/src/FitRideFile.cpp +++ b/src/FitRideFile.cpp @@ -526,6 +526,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); @@ -555,7 +556,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 @@ -571,6 +571,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 {