tormoder / fit

A Go package for decoding and encoding Garmin FIT files
MIT License
243 stars 42 forks source link

reader: tolerate strings without NULL terminator #84

Closed jcolp closed 1 year ago

jcolp commented 1 year ago

At least one major manufacturer is producing strings in their FIT file without a NULL terminator.

This change makes it so that the entirety of the contents of the data field can be used as the string, instead of assuming the last part will be a NULL terminator.

tormoder commented 1 year ago

Would it be possible to add an example FIT file as testdata to show this behaviour? For example in testdata/misc. And it may be as minimal as possible.

jcolp commented 1 year ago

Sure! I've added a FIT file which demonstrates this. Is there anything else you'd like?

tormoder commented 1 year ago

Thanks.

Could you also add entry for the file here: https://github.com/tormoder/fit/blob/master/reader_files_test.go with just a 0 fingerprint, and the run go test -update.

jcolp commented 1 year ago

I can, though "go test -update" doesn't update things, is there another command I'm missing to do so?

jcolp commented 1 year ago

Ah, is it because I don't have Golden Cheetah data?

tormoder commented 1 year ago

Sorry, please use a fingerprint != 0 for the bootstrap entry, e.g. 1, and then run go test -update.

jcolp commented 1 year ago

That was successful, thanks!

tormoder commented 1 year ago

Thanks!