[PATCH] missing braces around if statement

Dirk Hohndel dirk at hohndel.org
Mon Mar 23 05:42:58 PDT 2015


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!

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

> 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?

/D


More information about the subsurface mailing list