On Wed, Nov 5, 2014 at 2:48 PM, Willem Ferguson <
willemfergu...@zoology.up.ac.za> wrote:

> Miika,
>
> A problem arises when importing several dive logs. It appears some of the
> cylinder storage assignments are not reset between consecutive imports. I
> attach three images of the cylinder table for each of three consecutive
> imports.
> Import_1.png: First import, all assignments correct.
> Import_2.png: Two new cylinders are created and pressure info stored
> there. Gas composition info stored correctly.
> Import_3.png: Third import. Yet two more new cylinders created into which
> pressure info is stored. But gas composition info stored correctly.
>
> I cannot see anything obvious in file.c. Could it be that some sync with
> the Qt code is required?
>

I suppose we need to re-set the cylinder counter to zero when parsing a new
log file. Will this patch do the trick for you?

miika
From 9d1c426184b5bc08c757f600264716fbcd3345c6 Mon Sep 17 00:00:00 2001
From: Miika Turkia <miika.tur...@gmail.com>
Date: Wed, 5 Nov 2014 15:01:56 +0800
Subject: [PATCH 2/2] Reset cylinder index when importing new MK6 log

Signed-off-by: Miika Turkia <miika.tur...@gmail.com>
---
 file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/file.c b/file.c
index 60b79f2..de2c0db 100644
--- a/file.c
+++ b/file.c
@@ -430,7 +430,6 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
 	return ret;
 }
 
-static int cur_cylinder_index;
 int parse_txt_file(const char *filename, const char *csv)
 {
 	struct memblock memtxt, memcsv;
@@ -450,6 +449,7 @@ int parse_txt_file(const char *filename, const char *csv)
 		bool has_depth = false, has_setpoint = false;
 		char *lineptr;
 		static int diluent_pressure = 0, cylinder_pressure = 0;
+		int cur_cylinder_index = 0;
 
 		struct dive *dive;
 		struct divecomputer *dc;
-- 
2.1.0

_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to