From 6cb829a3d123090583082bc4e93af41fdb4bc5e9 Mon Sep 17 00:00:00 2001
From: Oliver Wolff <oliver.wolff@qt.io>
Date: Thu, 26 Jan 2017 15:10:52 +0100
Subject: [PATCH] winrt: Fixed reading of string attributes in sequences

Change-Id: I063668f9b95b95aa15a736b80e11d81c15cd1730
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
---
 src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
index 1d98874f..29ccb290 100644
--- a/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
+++ b/src/bluetooth/qbluetoothservicediscoveryagent_winrt.cpp
@@ -427,6 +427,9 @@ QBluetoothServiceInfo::Sequence QWinRTBluetoothServiceDiscoveryWorker::readSeque
             BYTE length;
             hr = dataReader->ReadByte(&length);
             Q_ASSERT_SUCCEEDED(hr);
+            remainingLength -= 1;
+            if (bytesRead)
+                *bytesRead += 1;
             HString value;
             hr = dataReader->ReadString(length, value.GetAddressOf());
             Q_ASSERT_SUCCEEDED(hr);
@@ -435,7 +438,7 @@ QBluetoothServiceInfo::Sequence QWinRTBluetoothServiceDiscoveryWorker::readSeque
             result.append(QVariant::fromValue(str));
             remainingLength -= length;
             if (bytesRead)
-                *bytesRead += 2;
+                *bytesRead += length;
             break;
         }
         case TYPE_SEQUENCE: {
-- 
GitLab