Fix the detection of the last valid dive.

Normally, the last valid dive is followed by an empty entry with all
0xFF bytes. However, we received data from a device where a few of those
bytes are not equal to 0xFF. This causes the entry to be processed
incorrectly as a valid dive.

As a workaround, we now check the internal dive number for 0xFFFF.
This commit is contained in:
Jef Driesen 2014-04-07 11:05:14 +02:00
parent eb12a0aa20
commit 6b912f4f7b

View File

@ -314,6 +314,10 @@ cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[]
// Get the internal dive number.
unsigned int current = array_uint16_le (data + offset);
if (current == 0xFFFF) {
WARNING (context, "Unexpected internal dive number found.");
break;
}
if (current > maximum) {
maximum = current;
latest = i;