On Tue, Nov 11, 2014 at 5:30 PM, Willem Ferguson <
[email protected]> wrote:

> Looks excellent Miika,
>
> Small bug. At the end of each item in the second column of the Extra data
> tab there is a small unprintable character showing up as a square. I
> suspect that should not be?
>

I am shooting in the dark but would this patch fix the issue?

miika
From a5e6d6966ae6ee654a5ceaa6fbc1842d9c60b23d Mon Sep 17 00:00:00 2001
From: Miika Turkia <[email protected]>
Date: Tue, 11 Nov 2014 17:51:14 +0800
Subject: [PATCH] Fix parsing of Windows new lines on Mk6 import

Signed-off-by: Miika Turkia <[email protected]>
---
 file.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/file.c b/file.c
index 29bbea5..5e8ab38 100644
--- a/file.c
+++ b/file.c
@@ -423,9 +423,14 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
 			valueptr += 2;
 		}
 		if ((endptr = strstr(lineptr, "\n")) != NULL) {
+			char terminator = '\n';
+			if (*(endptr - 1) == '\r') {
+				--endptr;
+				terminator = '\r';
+			}
 			*endptr = 0;
 			ret = strdup(valueptr);
-			*endptr = '\n';
+			*endptr = terminator;
 
 		}
 	}
-- 
2.1.0

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to