Merge branch 'master' of git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG

Pull fix from Jef's upstream.

This fixes the end of dive garbage for newer Aqualung dive computers,
including the i770R.

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Remove extra padding from the end of the profile
This commit is contained in:
Linus Torvalds 2018-10-01 15:19:52 -07:00
commit c6c29f6e9a

View File

@ -496,9 +496,13 @@ oceanic_common_device_profile (dc_device_t *abstract, dc_event_progress_t *progr
// Remove padding from the profile.
if (layout->highmem) {
unsigned char *profile = profiles + offset + layout->rb_logbook_entry_size;
while (rb_entry_size >= PAGESIZE && array_isequal (profile + rb_entry_size - PAGESIZE, PAGESIZE, 0xFF)) {
rb_entry_size -= PAGESIZE;
// The logbook entry contains the total number of pages containing
// profile data, excluding the footer page. Limit the profile size
// to this size.
unsigned int npages = (array_uint16_le (profiles + offset + 12) & 0x0FFF) + 1;
unsigned int length = npages * PAGESIZE;
if (rb_entry_size > length) {
rb_entry_size = length;
}
}