Merge PR #2823: GlobalShortcut_win.cpp: Fix MinGW compilation warnings

This commit is contained in:
Mikkel Krautz 2017-02-06 17:25:38 +01:00 committed by GitHub
commit 4400a807d0

View File

@ -45,6 +45,7 @@ GlobalShortcutWin::GlobalShortcutWin()
: pDI(NULL)
, hhMouse(NULL)
, hhKeyboard(NULL)
, uiHardwareDevices(0)
#ifdef USE_GKEY
, gkey(NULL)
#endif
@ -52,8 +53,7 @@ GlobalShortcutWin::GlobalShortcutWin()
, xboxinput(NULL)
, nxboxinput(0)
#endif
, uiHardwareDevices(0) {
{
// Hidden setting to disable hooking
bHook = g.qs->value(QLatin1String("winhooks"), true).toBool();
@ -82,14 +82,14 @@ void GlobalShortcutWin::run() {
DWORD type = 0;
DWORD value = 0;
DWORD len = sizeof(DWORD);
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Control Panel\\Desktop", NULL, KEY_READ, &key) == ERROR_SUCCESS) {
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Control Panel\\Desktop", 0, KEY_READ, &key) == ERROR_SUCCESS) {
LONG err = RegQueryValueExA(key, "LowLevelHooksTimeout", NULL, &type, reinterpret_cast<LPBYTE>(&value), &len);
if (err == ERROR_SUCCESS && type == REG_DWORD) {
qWarning("GlobalShortcutWin: Found LowLevelHooksTimeout with value = 0x%x", value);
qWarning("GlobalShortcutWin: Found LowLevelHooksTimeout with value = 0x%lx", static_cast<unsigned long>(value));
} else if (err == ERROR_FILE_NOT_FOUND) {
qWarning("GlobalShortcutWin: No LowLevelHooksTimeout registry key found.");
} else {
qWarning("GlobalShortcutWin: Error looking up LowLevelHooksTimeout. (Error: 0x%x, Type: 0x%x, Value: 0x%x)", err, type, value);
qWarning("GlobalShortcutWin: Error looking up LowLevelHooksTimeout. (Error: 0x%lx, Type: 0x%lx, Value: 0x%lx)", static_cast<unsigned long>(err), static_cast<unsigned long>(type), static_cast<unsigned long>(value));
}
}
@ -371,10 +371,10 @@ BOOL CALLBACK GlobalShortcutWin::EnumDeviceObjectsCallback(LPCDIDEVICEOBJECTINST
id->qhNames[lpddoi->dwType] = name;
if (g.s.bDirectInputVerboseLogging) {
qWarning("GlobalShortcutWin: EnumObjects: device %s %s object 0x%.8x %s",
qWarning("GlobalShortcutWin: EnumObjects: device %s %s object 0x%.8lx %s",
qPrintable(QUuid(id->guid).toString()),
qPrintable(id->name),
lpddoi->dwType,
static_cast<unsigned long>(lpddoi->dwType),
qPrintable(name));
}
@ -454,13 +454,13 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
// blacklist, we need a more structured aproach.
{
if (id->vendor_id == 0x262A) {
qWarning("GlobalShortcutWin: rejected blacklisted device %s (GUID: %s, PGUID: %s, VID: 0x%.4x, PID: 0x%.4x, TYPE: 0x%.8x)",
qWarning("GlobalShortcutWin: rejected blacklisted device %s (GUID: %s, PGUID: %s, VID: 0x%.4x, PID: 0x%.4x, TYPE: 0x%.8lx)",
qPrintable(id->name),
qPrintable(id->vguid.toString()),
qPrintable(id->vguidproduct.toString()),
id->vendor_id,
id->product_id,
pdidi->dwDevType);
static_cast<unsigned long>(pdidi->dwDevType));
delete id;
return DIENUM_CONTINUE;
}
@ -520,12 +520,12 @@ BOOL GlobalShortcutWin::EnumDevicesCB(LPCDIDEVICEINSTANCE pdidi, LPVOID pContext
if (FAILED(hr = id->pDID->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)))
qFatal("GlobalShortcutWin: SetProperty: %lx", hr);
qWarning("Adding device %s %s %s:%d type 0x%.8x guid product %s",
qWarning("Adding device %s %s %s:%d type 0x%.8lx guid product %s",
qPrintable(QUuid(id->guid).toString()),
qPrintable(name),
qPrintable(sname),
id->qhNames.count(),
pdidi->dwDevType,
static_cast<unsigned long>(pdidi->dwDevType),
qPrintable(id->vguidproduct.toString()));
cbgsw->qhInputDevices[id->guid] = id;