From 5efd3d1e339668221b224622542bf4902c070ba9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Mon, 10 May 2021 08:26:19 +0200 Subject: [PATCH] Propper entry text trim --- src/data/ov2parser.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/data/ov2parser.cpp b/src/data/ov2parser.cpp index 5a30e739..0ad57ff7 100644 --- a/src/data/ov2parser.cpp +++ b/src/data/ov2parser.cpp @@ -22,11 +22,11 @@ bool OV2Parser::parse(QFile *file, QList &tracks, switch (type) { case 0: stream >> len; - if (stream.status() != QDataStream::Ok || len < 5) { + if (stream.status() != QDataStream::Ok || len < 5 + || stream.skipRawData(len - 5) < (int)len - 5) { _errorString = "Corrupted deleted record"; return false; } - stream.skipRawData(len - 5); break; case 1: if (stream.skipRawData(20) < 20) { @@ -52,12 +52,8 @@ bool OV2Parser::parse(QFile *file, QList &tracks, return false; } Waypoint wp(Coordinates(lon/1e5, lat/1e5)); - if (type == 2) - wp.setName(codec.toString(ba)); - else { - QList parts(ba.split('\0')); - wp.setName(codec.toString(parts.at(0))); - } + QList parts(ba.split('\0')); + wp.setName(codec.toString(parts.first())); waypoints.append(wp);} break; default: