[PATCH] missing braces around if statement

Miika Turkia miika.turkia at gmail.com
Mon Mar 23 11:30:20 PDT 2015


On Mon, Mar 23, 2015 at 2:42 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
> On Mon, Mar 23, 2015 at 12:33:03AM -0300, Marcos Cardinot wrote:
>> Hi,
>>
>> It's a simple issue, it seems that someone forgot the braces... please see
>> attached patch.
>
> Excellent find!

Indeed!

> So Miika, without this patch it seems we only ever matched the first
> cylinder...

Which means that we should create additional cylinders when we
encounter a gas change event. The 2 crafted samples I have, do not
trigger this bug, thus I did not notice anything amiss. And I still
haven't been able to ensure this works properly, as the samples don't
have switches back and forth.

>> diff --git a/parse-xml.c b/parse-xml.c
>> index a42f8c8..34c1b4c 100644
>> --- a/parse-xml.c
>> +++ b/parse-xml.c
>> @@ -2940,9 +2940,10 @@ int parse_dlf_buffer(unsigned char *buffer, size_t size)
>>
>>                               found = false;
>>                               for (i = 0; i < cur_cylinder_index; ++i) {
>> -                                     if (cur_dive->cylinder[i].gasmix.o2.permille == ptr[6] * 10 && cur_dive->cylinder[i].gasmix.he.permille == ptr[7] * 10)
>> +                                     if (cur_dive->cylinder[i].gasmix.o2.permille == ptr[6] * 10 && cur_dive->cylinder[i].gasmix.he.permille == ptr[7] * 10) {
>>                                               found = true;
>>                                               break;
>> +                                     }
>>                               }
>>                               if (!found) {
>>                                       cylinder_start();
>
> Can you verify and figure out why that didn't cause issues in your
> testing?

See above. Not able to properly test this without dive with gas
switches back and forth, but the patch should be correct.

miika


More information about the subsurface mailing list