Skip to content

Commit

Permalink
FitFile : Some devices (eg Coros Pace 2) declare uint32 with size 1
Browse files Browse the repository at this point in the history
Fix #3645
  • Loading branch information
grauser committed Jul 11, 2021
1 parent 566d562 commit c29a776
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/FileIO/FitRideFile.cpp
Expand Up @@ -2942,6 +2942,14 @@ struct FitFileReaderState
case 6: size = 4;
if (field.size==size) {
value.type = SingleValue; value.v = read_uint32(def.is_big_endian, &count);
} else if (field.size<size) {
// Some device (eg Coros Pace 2) seems to declare uint32 with size 1
value.type = SingleValue;
if (field.size == 1)
value.v = read_uint8(&count);
if (field.size == 2)
value.v = read_uint16(def.is_big_endian, &count);
size = field.size;
} else { // Multi-values
value.type = ListValue;
value.list.clear();
Expand All @@ -2968,7 +2976,7 @@ struct FitFileReaderState
value.type = ListValue;
value.list.clear();
for (int i=0;i<field.size/size;i++) {
value.list.append(read_float32(&count));
value.list.append(read_float32(def.is_big_endian, &count));
}
size = field.size;
}
Expand Down

0 comments on commit c29a776

Please sign in to comment.