From 76db1e6f44774432c92761a97ac080643ed3638f Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 26 Apr 2010 08:09:22 +0000 Subject: [PATCH] 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. --- src/reefnet_sensusultra.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/reefnet_sensusultra.c b/src/reefnet_sensusultra.c index 63bb13f..bd3360d 100644 --- a/src/reefnet_sensusultra.c +++ b/src/reefnet_sensusultra.c @@ -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.