summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/btdeviceselectiondialog.cpp8
-rw-r--r--qt-ui/btdeviceselectiondialog.h1
2 files changed, 5 insertions, 4 deletions
diff --git a/qt-ui/btdeviceselectiondialog.cpp b/qt-ui/btdeviceselectiondialog.cpp
index 74afda616..40d57314f 100644
--- a/qt-ui/btdeviceselectiondialog.cpp
+++ b/qt-ui/btdeviceselectiondialog.cpp
@@ -609,14 +609,14 @@ void WinBluetoothDeviceDiscoveryAgent::run()
break;
}
- // Save the name of the discovered device and truncate the address
- QString deviceName = QString(pResults->lpszServiceInstanceName);
- deviceAddress.truncate(addressSize / sizeof(wchar_t));
-
// Remove the round parentheses
deviceAddress.remove(')');
deviceAddress.remove('(');
+ // Save the name of the discovered device and truncate the address
+ QString deviceName = QString(pResults->lpszServiceInstanceName);
+ deviceAddress.truncate(BTH_ADDR_PRETTY_STRING_LEN);
+
// Create an object with information about the discovered device
QBluetoothDeviceInfo deviceInfo = QBluetoothDeviceInfo(QBluetoothAddress(deviceAddress), deviceName, 0);
diff --git a/qt-ui/btdeviceselectiondialog.h b/qt-ui/btdeviceselectiondialog.h
index 3d72db418..d947d3449 100644
--- a/qt-ui/btdeviceselectiondialog.h
+++ b/qt-ui/btdeviceselectiondialog.h
@@ -15,6 +15,7 @@
#define SUCCESS 0
#define BTH_ADDR_STR_LEN 40
+ #define BTH_ADDR_PRETTY_STRING_LEN 17 // there are 6 two-digit hex values and 5 colons
#undef ERROR // this is already declared in our headers
#undef IGNORE // this is already declared in our headers