1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Added workaround for broken FIT files exported by Strava

Fixes #410
This commit is contained in:
Martin Tůma 2021-11-27 10:41:39 +01:00
parent 6cf3c9ef96
commit a4d91ef17a

View File

@ -223,6 +223,22 @@ bool FITParser::readField(CTX &ctx, Field *field, QVariant &val, bool &valid)
case 0: // enum
VAL(quint8, 0xffU);
break;
case 3:
case 0x83: // sint16
VAL(qint16, 0x7fffU);
break;
case 4:
case 0x84: // uint16
VAL(quint16, 0xffffU);
break;
case 5:
case 0x85: // sint32
VAL(qint32, 0x7fffffffU);
break;
case 6:
case 0x86: // uint32
VAL(quint32, 0xffffffffU);
break;
case 7: // UTF8 nul terminated string
{QByteArray ba(ctx.file->read(field->size));
ctx.len -= field->size;
@ -230,18 +246,6 @@ bool FITParser::readField(CTX &ctx, Field *field, QVariant &val, bool &valid)
val = ret ? ba : QString();
valid = !ba.isEmpty();}
break;
case 0x83: // sint16
VAL(qint16, 0x7fffU);
break;
case 0x84: // uint16
VAL(quint16, 0xffffU);
break;
case 0x85: // sint32
VAL(qint32, 0x7fffffffU);
break;
case 0x86: // uint32
VAL(quint32, 0xffffffffU);
break;
default:
ret = skipValue(ctx, field->size);
valid = false;