From c897edc13e4965877ae3a233b5390f4363990fd3 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 20 Aug 2022 14:31:39 +0200 Subject: [PATCH] parser: fix DLF import In bc3b56a9690, the import of the dive mode was simplified, by replacing an if-else-if chain by bit manipulations. However, the bitmask was wrong: 0b00111000 is 0x38 not 0x30, which means that "odd" dive modes were not recognized as such. Bug found by coverity. Signed-off-by: Berthold Stoeger --- core/parse-xml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/parse-xml.c b/core/parse-xml.c index 94e059862..91578f8d3 100644 --- a/core/parse-xml.c +++ b/core/parse-xml.c @@ -1854,7 +1854,7 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size, struct dive_table *tabl // ptr[14] >> 1 is scrubber used in % // 3 bit dive type - switch((ptr[15] & 0x30) >> 3) { + switch((ptr[15] & 0x38) >> 3) { case 0: // unknown case 1: state.cur_dc->divemode = OC;