[PATCH] Divinglog import: ignore unsupported cylinders

Miika Turkia miika.turkia at gmail.com
Sun Aug 2 08:36:38 PDT 2015


Subsurface supports currently 8 cylinders, thus we should not attempt to
add more.

Signed-off-by: Miika Turkia <miika.turkia at gmail.com>
---
 parse-xml.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/parse-xml.c b/parse-xml.c
index e63ed4f..7c8d6bd 100644
--- a/parse-xml.c
+++ b/parse-xml.c
@@ -2851,6 +2851,14 @@ extern int divinglog_cylinder(void *handle, int columns, char **data, char **col
 	short dbl = 1;
 	//char get_cylinder_template[] = "select TankID,TankSize,PresS,PresE,PresW,O2,He,DblTank from Tank where LogID = %d";
 
+	/*
+	 * Divinglog might have more cylinders than what we support. So
+	 * better to ignore those.
+	 */
+
+	if (cur_cylinder_index >= MAX_CYLINDERS)
+		return 0;
+
 	if (data[7] && atoi(data[7]) > 0)
 		dbl = 2;
 
-- 
2.1.4



More information about the subsurface mailing list