summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLubomir I. Ivanov (VMware) <neolit123@gmail.com>2018-02-27 21:24:33 +0200
committerLubomir I. Ivanov <neolit123@gmail.com>2018-02-28 11:44:05 +0000
commit6b3cfe2f836556c2d92b6c7915232fa00fd040f6 (patch)
tree0118c7c737615e4253d042a6ebf8d57e2e02e8ca /src
parente63f53aefdecc7ae54986fedb459cb7b40859abd (diff)
qlecontroller_win: fix GetLastError() bug in getServiceSystemPath()
Fix strange bug in getServiceSystemPath() where after the first call to SetupDiGetDeviceInterfaceDetail(), GetLastError() returns 0 instead of ERROR_INSUFFICIENT_BUFFER (122). A fix is to use a `const DWORD` for the error immediately after the SetupDiGetDeviceInterfaceDetail() call. Possibly a compiler issue. Target toolchain is: gcc version 5.3.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project) Change-Id: Id197201e9e161f7240c339231990196f58cb87eb Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/bluetooth/qlowenergycontroller_win.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bluetooth/qlowenergycontroller_win.cpp b/src/bluetooth/qlowenergycontroller_win.cpp
index 9f10a167..56382e69 100644
--- a/src/bluetooth/qlowenergycontroller_win.cpp
+++ b/src/bluetooth/qlowenergycontroller_win.cpp
@@ -143,8 +143,9 @@ static QString getServiceSystemPath(const QBluetoothAddress &deviceAddress,
deviceInterfaceDetailDataSize,
&deviceInterfaceDetailDataSize,
NULL)) {
- if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
- *systemErrorCode = ::GetLastError();
+ const DWORD error = ::GetLastError();
+ if (error != ERROR_INSUFFICIENT_BUFFER) {
+ *systemErrorCode = error;
break;
}
}