diff options
author | belabalazs <balazsbela@gmail.com> | 2013-03-26 15:12:00 +0200 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2013-03-26 15:11:36 +0100 |
commit | 14573e5f6e5e1dc1eeb9e661ba423b85355d045a (patch) | |
tree | adee553733e19ca85e8c5d98a25bd1e13d1c0ea1 | |
parent | c4bdffbdc8498fcda9c8551e085a22c66bbe6d10 (diff) | |
download | qtlocation-14573e5f6e5e1dc1eeb9e661ba423b85355d045a.tar.gz |
Fixed NMEA case sensitive checksum comparison bug
Task-number: QTBUG-30383
Change-Id: I55aa8bcd9a9622b5c18e7cbb5e6e1a7a8f298e4c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
-rw-r--r-- | src/location/qlocationutils.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/location/qlocationutils.cpp b/src/location/qlocationutils.cpp index 04801d80..d4766058 100644 --- a/src/location/qlocationutils.cpp +++ b/src/location/qlocationutils.cpp @@ -294,9 +294,10 @@ bool QLocationUtils::hasValidNmeaChecksum(const char *data, int size) return ::strncmp(calc, &data[asteriskIndex+1], 2) == 0; */ - QString s; - s.sprintf("%02x", result); - return (s.toLatin1() == QByteArray(&data[asteriskIndex + 1], 2)); + QByteArray checkSumBytes(&data[asteriskIndex + 1], 2); + bool ok = false; + int checksum = checkSumBytes.toInt(&ok,16); + return ok && checksum == result; } bool QLocationUtils::getNmeaTime(const QByteArray &bytes, QTime *time) |