mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix parsing of Windows new lines on Mk6 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
744e14b450
commit
70939a1d84
1 changed files with 6 additions and 1 deletions
7
file.c
7
file.c
|
|
@ -423,9 +423,14 @@ char *parse_mkvi_value(const char *haystack, const char *needle)
|
||||||
valueptr += 2;
|
valueptr += 2;
|
||||||
}
|
}
|
||||||
if ((endptr = strstr(lineptr, "\n")) != NULL) {
|
if ((endptr = strstr(lineptr, "\n")) != NULL) {
|
||||||
|
char terminator = '\n';
|
||||||
|
if (*(endptr - 1) == '\r') {
|
||||||
|
--endptr;
|
||||||
|
terminator = '\r';
|
||||||
|
}
|
||||||
*endptr = 0;
|
*endptr = 0;
|
||||||
ret = strdup(valueptr);
|
ret = strdup(valueptr);
|
||||||
*endptr = '\n';
|
*endptr = terminator;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue