Locate the header marker correctly in a longer sequence of zero bytes.

If the first few bytes of the timestamp are equal to zero, they were
incorrectly identified as part of the header marker. The correct header
marker is located a the start of this zero byte sequence, not the end.
This commit is contained in:
Jef Driesen 2010-04-26 08:09:22 +00:00
parent 5dcfe111de
commit 76db1e6f44

View File

@ -655,6 +655,11 @@ reefnet_sensusultra_parse (reefnet_sensusultra_device_t *device,
// Move the pointer to the begin of the header.
current -= sizeof (header);
// If there is a sequence of more than 4 zero bytes present, the header
// marker is located at the start of this sequence, not the end.
while (current > data && current[-1] == 0x00)
current--;
// Once a header marker is found, start searching
// for the corresponding footer marker. The search is
// now limited to the start of the previous dive.