summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@qt.io>2016-11-15 09:57:39 +0100
committerMaurice Kalinowski <maurice.kalinowski@qt.io>2016-11-16 13:48:29 +0000
commitf46977ae785632e52fc7212265f2e1e0d38565db (patch)
treedecfa2169f3c04e1838457fdf0c8f21338d4b0cb
parent8c3c657f0e8130274618cbe63cb2effcbac27df5 (diff)
msvc: Fix build with less permissive compiler options
Later versions added the /permissive- option, which checks for more strict language conformance. Hence, do required cleanups to compile systeminfo successfully. According to MSDN you are supposed to use SysAlloc/FreeString instead of manually constructed wchar_t*, otherwise native calls might fail. Task-number: QTBUG-56880 Change-Id: Ia5d17b3c2e2d6d86adb167075a4e6085aace7b2a Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--src/systeminfo/windows/qnetworkinfo_win.cpp4
-rw-r--r--src/systeminfo/windows/qwmihelper_win.cpp11
2 files changed, 11 insertions, 4 deletions
diff --git a/src/systeminfo/windows/qnetworkinfo_win.cpp b/src/systeminfo/windows/qnetworkinfo_win.cpp
index 5f25b50b..4768ff58 100644
--- a/src/systeminfo/windows/qnetworkinfo_win.cpp
+++ b/src/systeminfo/windows/qnetworkinfo_win.cpp
@@ -1078,8 +1078,8 @@ QString QNetworkInfoPrivate::networkName(QNetworkInfo::NetworkMode mode, int net
if (connAtts != NULL) {
DOT11_SSID ssid;
ssid = connAtts->wlanAssociationAttributes.dot11Ssid;
- for (uint i = 0; i < ssid.uSSIDLength;i++) {
- QString temp = ssid.ucSSID[i];
+ for (uint i = 0; i < ssid.uSSIDLength; i++) {
+ QLatin1Char temp(ssid.ucSSID[i]);
netname += temp;
}
}
diff --git a/src/systeminfo/windows/qwmihelper_win.cpp b/src/systeminfo/windows/qwmihelper_win.cpp
index 7ef6d42a..6c593bef 100644
--- a/src/systeminfo/windows/qwmihelper_win.cpp
+++ b/src/systeminfo/windows/qwmihelper_win.cpp
@@ -135,9 +135,12 @@ QVariant WMIHelper::getWMIData(const QString &wmiNamespace, const QString &class
bstrQuery = ::SysAllocString(oleStr);
- hres = wbemServices->ExecQuery(L"WQL", bstrQuery,
+ BSTR wql = SysAllocString(L"WQL");
+ hres = wbemServices->ExecQuery(wql, bstrQuery,
WBEM_FLAG_BIDIRECTIONAL | WBEM_FLAG_RETURN_IMMEDIATELY,0,&wbemEnumerator);
+ SysFreeString(wql);
+
if (hres != WBEM_S_NO_ERROR){
qWarning() << "WMI Query failed.";
wbemLocator->Release();
@@ -289,13 +292,17 @@ void WMIHelper::setupNotfication(const QString &wmiNamespace,const QString &clas
bstrQuery = ::SysAllocString(oleStr);
+ BSTR wql = SysAllocString(L"WQL");
+
hres = wbemServices->ExecNotificationQueryAsync(
- L"WQL",
+ wql,
bstrQuery,
WBEM_FLAG_SEND_STATUS,
NULL,
pStubSink);
+ SysFreeString(wql);
+
if (FAILED(hres)) {
printf("ExecNotificationQueryAsync failed "
"with = 0x%X\n", hres);