summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-18 13:13:49 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2016-02-19 11:11:08 +0000
commitb20548f9999d8c111268f3f2287c0801c6c5cbb0 (patch)
treee3e2aafabf3e1df13ee825dacd62712b437e51f8 /src/plugins/platforms
parent342c909b340cb1bfbb95480fc79dcea21a470c83 (diff)
Windows QPA: Fix warnings as shown by Qt Creator's Clang based code model.
Code except font, accessibility and file qwindowswindow.cpp. Task-number: QTBUG-50804 Change-Id: I40848264f9fa16eea00cf70d7be009c484c49e92 Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowsclipboard.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp46
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsdrag.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsinputcontext.cpp25
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp4
-rw-r--r--src/plugins/platforms/windows/qwindowskeymapper.cpp66
-rw-r--r--src/plugins/platforms/windows/qwindowsmime.cpp152
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp20
-rw-r--r--src/plugins/platforms/windows/qwindowsnativeimage.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowsole.cpp12
-rw-r--r--src/plugins/platforms/windows/qwindowsole.h2
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.cpp15
-rw-r--r--src/plugins/platforms/windows/qwindowsopengltester.h8
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp6
-rw-r--r--src/plugins/platforms/windows/qwindowsservices.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowstabletsupport.h2
-rw-r--r--src/plugins/platforms/windows/qwindowstheme.cpp11
22 files changed, 214 insertions, 211 deletions
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index af9d2a5969..a518c0bb83 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -93,7 +93,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
SIZE size = {r.width(), r.height()};
POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0};
- BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA};
+ BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA};
if (QWindowsContext::user32dll.updateLayeredWindowIndirect) {
RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
@@ -119,7 +119,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
m_image->hdc(), br.x() + offset.x(), br.y() + offset.y(), SRCCOPY)) {
const DWORD lastError = GetLastError(); // QTBUG-35926, QTBUG-29716: may fail after lock screen.
if (lastError != ERROR_SUCCESS && lastError != ERROR_INVALID_HANDLE)
- qErrnoWarning(lastError, "%s: BitBlt failed", __FUNCTION__);
+ qErrnoWarning(int(lastError), "%s: BitBlt failed", __FUNCTION__);
}
rw->releaseDC();
#ifndef Q_OS_WINCE
diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp
index 8b0be5d916..930f901523 100644
--- a/src/plugins/platforms/windows/qwindowsclipboard.cpp
+++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp
@@ -259,9 +259,9 @@ bool QWindowsClipboard::clipboardViewerWndProc(HWND hwnd, UINT message, WPARAM w
switch (message) {
case WM_CHANGECBCHAIN: {
- const HWND toBeRemoved = (HWND)wParam;
+ const HWND toBeRemoved = reinterpret_cast<HWND>(wParam);
if (toBeRemoved == m_nextClipboardViewer) {
- m_nextClipboardViewer = (HWND)lParam;
+ m_nextClipboardViewer = reinterpret_cast<HWND>(lParam);
} else {
propagateClipboardMessage(message, wParam, lParam);
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index 6ff6875c49..09c2f7df2e 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -101,10 +101,10 @@ static inline bool useRTL_Extensions(QSysInfo::WinVersion ver)
if ((ver & QSysInfo::WV_NT_based) && (ver >= QSysInfo::WV_VISTA)) {
// Since the IsValidLanguageGroup/IsValidLocale functions always return true on
// Vista, check the Keyboard Layouts for enabling RTL.
- if (const UINT nLayouts = GetKeyboardLayoutList(0, 0)) {
+ if (const int nLayouts = GetKeyboardLayoutList(0, 0)) {
QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]);
GetKeyboardLayoutList(nLayouts, lpList.data());
- for (UINT i = 0; i < nLayouts; ++i) {
+ for (int i = 0; i < nLayouts; ++i) {
switch (PRIMARYLANGID((quintptr)lpList[i])) {
case LANG_ARABIC:
case LANG_HEBREW:
@@ -540,15 +540,15 @@ QString QWindowsContext::registerWindowClass(QString cname,
// add an instance-specific ID, the address of the window proc.
static int classExists = -1;
- const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0);
+ const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(0));
if (classExists == -1) {
WNDCLASS wcinfo;
- classExists = GetClassInfo(appInstance, (wchar_t*)cname.utf16(), &wcinfo);
+ classExists = GetClassInfo(appInstance, reinterpret_cast<LPCWSTR>(cname.utf16()), &wcinfo);
classExists = classExists && wcinfo.lpfnWndProc != proc;
}
if (classExists)
- cname += QString::number((quintptr)proc);
+ cname += QString::number(reinterpret_cast<quintptr>(proc));
if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list
return cname;
@@ -568,13 +568,13 @@ QString QWindowsContext::registerWindowClass(QString cname,
#ifndef Q_OS_WINCE
wc.hbrBackground = brush;
if (icon) {
- wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE);
+ wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
if (wc.hIcon) {
int sw = GetSystemMetrics(SM_CXSMICON);
int sh = GetSystemMetrics(SM_CYSMICON);
- wc.hIconSm = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0);
+ wc.hIconSm = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, sw, sh, 0));
} else {
- wc.hIcon = (HICON)LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
+ wc.hIcon = static_cast<HICON>(LoadImage(0, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
wc.hIconSm = 0;
}
} else {
@@ -590,7 +590,7 @@ QString QWindowsContext::registerWindowClass(QString cname,
#endif
wc.lpszMenuName = 0;
- wc.lpszClassName = (wchar_t*)cname.utf16();
+ wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16());
#ifndef Q_OS_WINCE
ATOM atom = RegisterClassEx(&wc);
#else
@@ -610,10 +610,10 @@ QString QWindowsContext::registerWindowClass(QString cname,
void QWindowsContext::unregisterWindowClasses()
{
- const HINSTANCE appInstance = (HINSTANCE)GetModuleHandle(0);
+ const HINSTANCE appInstance = static_cast<HINSTANCE>(GetModuleHandle(0));
foreach (const QString &name, d->m_registeredWindowClassNames) {
- if (!UnregisterClass((wchar_t*)name.utf16(), appInstance) && QWindowsContext::verbose)
+ if (!UnregisterClass(reinterpret_cast<LPCWSTR>(name.utf16()), appInstance) && QWindowsContext::verbose)
qErrnoWarning("UnregisterClass failed for '%s'", qPrintable(name));
}
d->m_registeredWindowClassNames.clear();
@@ -629,11 +629,11 @@ QString QWindowsContext::windowsErrorMessage(unsigned long errorCode)
QString rc = QString::fromLatin1("#%1: ").arg(errorCode);
ushort *lpMsgBuf;
- const int len = FormatMessage(
+ const DWORD len = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL, errorCode, 0, (LPTSTR)&lpMsgBuf, 0, NULL);
+ NULL, errorCode, 0, reinterpret_cast<LPTSTR>(&lpMsgBuf), 0, NULL);
if (len) {
- rc = QString::fromUtf16(lpMsgBuf, len);
+ rc = QString::fromUtf16(lpMsgBuf, int(len));
LocalFree(lpMsgBuf);
} else {
rc += QString::fromLatin1("<unknown error>");
@@ -797,11 +797,11 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn,
if (!wndProc)
wndProc = DefWindowProc;
QString className = registerWindowClass(classNameIn, wndProc);
- return CreateWindowEx(0, (wchar_t*)className.utf16(),
+ return CreateWindowEx(0, reinterpret_cast<LPCWSTR>(className.utf16()),
windowName, style,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
- HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
+ HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL);
}
#ifndef Q_OS_WINCE
@@ -812,11 +812,11 @@ static inline QString errorMessageFromComError(const _com_error &comError)
{
TCHAR *message = Q_NULLPTR;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
- NULL, comError.Error(), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
+ NULL, DWORD(comError.Error()), MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
message, 0, NULL);
if (message) {
const QString result = QString::fromWCharArray(message).trimmed();
- LocalFree((HLOCAL)message);
+ LocalFree(static_cast<HLOCAL>(message));
return result;
}
if (const WORD wCode = comError.WCode())
@@ -1064,7 +1064,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
platformWindow->handleMoved();
return true;
case QtWindows::ResizeEvent:
- platformWindow->handleResized((int)wParam);
+ platformWindow->handleResized(static_cast<int>(wParam));
return true;
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
case QtWindows::QuerySizeHints:
@@ -1203,7 +1203,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
sessionManager->setActive(false);
sessionManager->allowsInteraction();
- bool endsession = (bool) wParam;
+ const bool endsession = wParam != 0;
// we receive the message for each toplevel window included internal hidden ones,
// but the aboutToQuit signal should be emitted only once.
@@ -1270,7 +1270,7 @@ bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
bool mouseTriggered = false;
QPoint globalPos;
QPoint pos;
- if (msg.lParam != (int)0xffffffff) {
+ if (msg.lParam != int(0xffffffff)) {
mouseTriggered = true;
globalPos.setX(msg.pt.x);
globalPos.setY(msg.pt.y);
@@ -1278,8 +1278,8 @@ bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
RECT clientRect;
if (GetClientRect(msg.hwnd, &clientRect)) {
- if (pos.x() < (int)clientRect.left || pos.x() >= (int)clientRect.right ||
- pos.y() < (int)clientRect.top || pos.y() >= (int)clientRect.bottom)
+ if (pos.x() < clientRect.left || pos.x() >= clientRect.right ||
+ pos.y() < clientRect.top || pos.y() >= clientRect.bottom)
{
// This is the case that user has right clicked in the window's caption,
// We should call DefWindowProc() to display a default shortcut menu
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 9f65f73a81..cda741c226 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -113,8 +113,8 @@ HCURSOR QWindowsCursor::createPixmapCursor(QPixmap pixmap, const QPoint &hotSpot
ICONINFO ii;
ii.fIcon = 0;
- ii.xHotspot = hotSpot.x();
- ii.yHotspot = hotSpot.y();
+ ii.xHotspot = DWORD(hotSpot.x());
+ ii.yHotspot = DWORD(hotSpot.y());
ii.hbmMask = im;
ii.hbmColor = ic;
@@ -571,7 +571,7 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const
for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) {
if (s->shape == cursorShape) {
#ifndef Q_OS_WINCE
- return (HCURSOR)LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED);
+ return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED));
#else
return LoadCursor(0, s->resource);
#endif
diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp
index 18e67ff1a3..150e135604 100644
--- a/src/plugins/platforms/windows/qwindowsdrag.cpp
+++ b/src/plugins/platforms/windows/qwindowsdrag.cpp
@@ -641,7 +641,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
m_chosenEffect = DROPEFFECT_COPY;
HGLOBAL hData = GlobalAlloc(0, sizeof(DWORD));
if (hData) {
- DWORD *moveEffect = (DWORD *)GlobalLock(hData);;
+ DWORD *moveEffect = reinterpret_cast<DWORD *>(GlobalLock(hData));
*moveEffect = DROPEFFECT_MOVE;
GlobalUnlock(hData);
STGMEDIUM medium;
@@ -649,7 +649,7 @@ QWindowsOleDropTarget::Drop(LPDATAOBJECT pDataObj, DWORD grfKeyState,
medium.tymed = TYMED_HGLOBAL;
medium.hGlobal = hData;
FORMATETC format;
- format.cfFormat = RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT);
+ format.cfFormat = CLIPFORMAT(RegisterClipboardFormat(CFSTR_PERFORMEDDROPEFFECT));
format.tymed = TYMED_HGLOBAL;
format.ptd = 0;
format.dwAspect = 1;
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 5983741711..787a072a7a 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -187,9 +187,9 @@ bool QWindowsLibGLESv2::init()
qCDebug(lcQpaGl) << "Qt: Using OpenGL ES 2.0 from" << dllName;
#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
- m_lib = ::LoadLibraryW((const wchar_t *) QString::fromLatin1(dllName).utf16());
+ m_lib = ::LoadLibraryW(reinterpret_cast<LPCWSTR>(QString::fromLatin1(dllName).utf16()));
if (!m_lib) {
- qErrnoWarning(::GetLastError(), "Failed to load %s", dllName);
+ qErrnoWarning(int(GetLastError()), "Failed to load %s", dllName);
return false;
}
#endif // !QT_STATIC
@@ -395,7 +395,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester:
Q_UNUSED(preferredType)
#endif
if (display == EGL_NO_DISPLAY)
- display = libEGL.eglGetDisplay((EGLNativeDisplayType)dc);
+ display = libEGL.eglGetDisplay(dc);
if (!display) {
qWarning("%s: Could not obtain EGL display", __FUNCTION__);
return 0;
@@ -427,8 +427,8 @@ QWindowsOpenGLContext *QWindowsEGLStaticContext::createContext(QOpenGLContext *c
void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *nativeConfig, int *err)
{
*err = 0;
- EGLSurface surface = libEGL.eglCreateWindowSurface(m_display, (EGLConfig) nativeConfig,
- (EGLNativeWindowType) nativeWindow, 0);
+ EGLSurface surface = libEGL.eglCreateWindowSurface(m_display, nativeConfig,
+ static_cast<EGLNativeWindowType>(nativeWindow), 0);
if (surface == EGL_NO_SURFACE) {
*err = libEGL.eglGetError();
qWarning("%s: Could not create the EGL window surface: 0x%x", __FUNCTION__, *err);
@@ -439,7 +439,7 @@ void *QWindowsEGLStaticContext::createWindowSurface(void *nativeWindow, void *na
void QWindowsEGLStaticContext::destroyWindowSurface(void *nativeSurface)
{
- libEGL.eglDestroySurface(m_display, (EGLSurface) nativeSurface);
+ libEGL.eglDestroySurface(m_display, nativeSurface);
}
QSurfaceFormat QWindowsEGLStaticContext::formatFromConfig(EGLDisplay display, EGLConfig config,
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 8d33e2f0db..2eaae6b726 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -1011,7 +1011,7 @@ QOpenGLStaticContext::QOpenGLStaticContext() :
QByteArray QOpenGLStaticContext::getGlString(unsigned int which)
{
if (const GLubyte *s = opengl32.glGetString(which))
- return QByteArray((const char*)s);
+ return QByteArray(reinterpret_cast<const char*>(s));
return QByteArray();
}
@@ -1238,7 +1238,7 @@ bool QWindowsGLContext::updateObtainedParams(HDC hdc, int *obtainedSwapInterval)
bool hasRobustness = false;
if (m_obtainedFormat.majorVersion() < 3) {
- const char *exts = (const char *) QOpenGLStaticContext::opengl32.glGetString(GL_EXTENSIONS);
+ const char *exts = reinterpret_cast<const char *>(QOpenGLStaticContext::opengl32.glGetString(GL_EXTENSIONS));
hasRobustness = exts && strstr(exts, "GL_ARB_robustness");
} else {
typedef const GLubyte * (APIENTRY *glGetStringi_t)(GLenum, GLuint);
@@ -1247,7 +1247,7 @@ bool QWindowsGLContext::updateObtainedParams(HDC hdc, int *obtainedSwapInterval)
GLint n = 0;
QOpenGLStaticContext::opengl32.glGetIntegerv(GL_NUM_EXTENSIONS, &n);
for (GLint i = 0; i < n; ++i) {
- const char *p = (const char *) glGetStringi(GL_EXTENSIONS, i);
+ const char *p = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
if (p && !strcmp(p, "GL_ARB_robustness")) {
hasRobustness = true;
break;
diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
index 56b5561756..d3299db460 100644
--- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp
@@ -319,7 +319,9 @@ void QWindowsInputContext::invokeAction(QInputMethod::Action action, int cursorP
// position.
const HIMC himc = ImmGetContext(m_compositionContext.hwnd);
const HWND imeWindow = ImmGetDefaultIMEWnd(m_compositionContext.hwnd);
- SendMessage(imeWindow, m_WM_MSIME_MOUSE, MAKELONG(MAKEWORD(MK_LBUTTON, cursorPosition == 0 ? 2 : 1), cursorPosition), (LPARAM)himc);
+ const WPARAM mouseOperationCode =
+ MAKELONG(MAKEWORD(MK_LBUTTON, cursorPosition == 0 ? 2 : 1), cursorPosition);
+ SendMessage(imeWindow, m_WM_MSIME_MOUSE, mouseOperationCode, LPARAM(himc));
ImmReleaseContext(m_compositionContext.hwnd, himc);
}
@@ -328,7 +330,7 @@ static inline QString getCompositionString(HIMC himc, DWORD dwIndex)
enum { bufferSize = 256 };
wchar_t buffer[bufferSize];
const int length = ImmGetCompositionString(himc, dwIndex, buffer, bufferSize * sizeof(wchar_t));
- return QString::fromWCharArray(buffer, length / sizeof(wchar_t));
+ return QString::fromWCharArray(buffer, size_t(length) / sizeof(wchar_t));
}
// Determine the converted string range as pair of start/length to be selected.
@@ -559,9 +561,8 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
if (size < 0)
return false;
*result = size;
- return true;
}
- break;
+ return true;
case IMR_CONFIRMRECONVERTSTRING:
return true;
default:
@@ -572,7 +573,7 @@ bool QWindowsInputContext::handleIME_Request(WPARAM wParam,
void QWindowsInputContext::handleInputLanguageChanged(WPARAM wparam, LPARAM lparam)
{
- const LCID newLanguageId = languageIdFromLocaleId(lparam);
+ const LCID newLanguageId = languageIdFromLocaleId(WORD(lparam));
if (newLanguageId == m_languageId)
return;
const LCID oldLanguageId = m_languageId;
@@ -606,13 +607,13 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
if (!surroundingTextV.isValid())
return -1;
const QString surroundingText = surroundingTextV.toString();
- const DWORD memSize = sizeof(RECONVERTSTRING)
- + (surroundingText.length() + 1) * sizeof(ushort);
+ const int memSize = int(sizeof(RECONVERTSTRING))
+ + (surroundingText.length() + 1) * int(sizeof(ushort));
qCDebug(lcQpaInputMethods) << __FUNCTION__ << " reconv=" << reconv
<< " surroundingText=" << surroundingText << " size=" << memSize;
// If memory is not allocated, return the required size.
if (!reconv)
- return surroundingText.isEmpty() ? -1 : int(memSize);
+ return surroundingText.isEmpty() ? -1 : memSize;
const QVariant posV = QInputMethod::queryFocusObject(Qt::ImCursorPosition, QVariant());
const int pos = posV.isValid() ? posV.toInt() : 0;
@@ -631,13 +632,13 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv)
QInputMethodEvent selectEvent(QString(), attributes);
QCoreApplication::sendEvent(fo, &selectEvent);
- reconv->dwSize = memSize;
+ reconv->dwSize = DWORD(memSize);
reconv->dwVersion = 0;
- reconv->dwStrLen = surroundingText.size();
+ reconv->dwStrLen = DWORD(surroundingText.size());
reconv->dwStrOffset = sizeof(RECONVERTSTRING);
- reconv->dwCompStrLen = endPos - startPos; // TCHAR count.
- reconv->dwCompStrOffset = startPos * sizeof(ushort); // byte count.
+ reconv->dwCompStrLen = DWORD(endPos - startPos); // TCHAR count.
+ reconv->dwCompStrOffset = DWORD(startPos) * sizeof(ushort); // byte count.
reconv->dwTargetStrLen = reconv->dwCompStrLen;
reconv->dwTargetStrOffset = reconv->dwCompStrOffset;
ushort *pastReconv = reinterpret_cast<ushort *>(reconv + 1);
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index bd2014b8f2..27ec258f37 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -514,8 +514,8 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co
case QPlatformIntegration::FontSmoothingGamma:
return QVariant(QWindowsFontDatabase::fontSmoothingGamma());
case QPlatformIntegration::MouseDoubleClickInterval:
- if (const int ms = GetDoubleClickTime())
- return QVariant(ms);
+ if (const UINT ms = GetDoubleClickTime())
+ return QVariant(int(ms));
break;
case QPlatformIntegration::UseRtlExtensions:
return QVariant(d->m_context.useRTLExtensions());
diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp
index b7e7867404..5790341dbf 100644
--- a/src/plugins/platforms/windows/qwindowskeymapper.cpp
+++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp
@@ -541,7 +541,7 @@ Q_STATIC_ASSERT((NumMods == KeyboardLayoutItem::NumQtKeys));
/**
Remap return or action key to select key for windows mobile.
*/
-inline int winceKeyBend(int keyCode)
+inline quint32 winceKeyBend(quint32 keyCode)
{
return KeyTbl[keyCode];
}
@@ -575,10 +575,10 @@ QT_END_INCLUDE_NAMESPACE
#endif // Q_OS_WINCE
// Translate a VK into a Qt key code, or unicode character
-static inline int toKeyOrUnicode(int vk, int scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0)
+static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0)
{
Q_ASSERT(vk > 0 && vk < 256);
- int code = 0;
+ quint32 code = 0;
QChar unicodeBuffer[5];
int res = ToUnicode(vk, scancode, kbdBuffer, reinterpret_cast<LPWSTR>(unicodeBuffer), 5, 0);
// When Ctrl modifier is used ToUnicode does not return correct values. In order to assign the
@@ -632,13 +632,13 @@ void QWindowsKeyMapper::changeKeyboard()
/* MAKELCID()'s first argument is a WORD, and GetKeyboardLayout()
* returns a DWORD. */
- LCID newLCID = MAKELCID((quintptr)GetKeyboardLayout(0), SORT_DEFAULT);
+ LCID newLCID = MAKELCID(quintptr(GetKeyboardLayout(0)), SORT_DEFAULT);
// keyboardInputLocale = qt_localeFromLCID(newLCID);
bool bidi = false;
wchar_t LCIDFontSig[16];
if (GetLocaleInfo(newLCID, LOCALE_FONTSIGNATURE, LCIDFontSig, sizeof(LCIDFontSig) / sizeof(wchar_t))
- && (LCIDFontSig[7] & (wchar_t)0x0800))
+ && (LCIDFontSig[7] & wchar_t(0x0800)))
bidi = true;
keyboardInputDirection = bidi ? Qt::RightToLeft : Qt::LeftToRight;
@@ -662,7 +662,7 @@ void QWindowsKeyMapper::updateKeyMap(const MSG &msg)
unsigned char kbdBuffer[256]; // Will hold the complete keyboard state
GetKeyboardState(kbdBuffer);
const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask;
- updatePossibleKeyCodes(kbdBuffer, scancode, msg.wParam);
+ updatePossibleKeyCodes(kbdBuffer, scancode, quint32(msg.wParam));
}
// Fills keyLayout for that vk_key. Values are all characters one can type using that key
@@ -721,7 +721,7 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
keyLayout[vk_key].qtKey[7] = toKeyOrUnicode(vk_key, scancode, buffer, &isDeadKey);
keyLayout[vk_key].deadkeys |= isDeadKey ? 0x80 : 0;
// Add a fall back key for layouts which don't do composition and show non-latin1 characters
- int fallbackKey = winceKeyBend(vk_key);
+ quint32 fallbackKey = winceKeyBend(vk_key);
if (!fallbackKey || fallbackKey == Qt::Key_unknown) {
fallbackKey = 0;
if (vk_key != keyLayout[vk_key].qtKey[0] && vk_key < 0x5B && vk_key > 0x2F)
@@ -762,7 +762,7 @@ void QWindowsKeyMapper::updatePossibleKeyCodes(unsigned char *kbdBuffer, quint32
static inline QString messageKeyText(const MSG &msg)
{
- const QChar ch = QChar((ushort)msg.wParam);
+ const QChar ch = QChar(ushort(msg.wParam));
return ch.isNull() ? QString() : QString(ch);
}
@@ -807,7 +807,7 @@ static void showSystemMenu(QWindow* w)
topLevelHwnd,
0);
if (ret)
- qWindowsWndProc(topLevelHwnd, WM_SYSCOMMAND, ret, 0);
+ qWindowsWndProc(topLevelHwnd, WM_SYSCOMMAND, WPARAM(ret), 0);
}
static inline void sendExtendedPressRelease(QWindow *w, int k,
@@ -871,7 +871,7 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
if (cmd < 0 || cmd > 52)
return false;
- const int qtKey = CmdTbl[cmd];
+ const int qtKey = int(CmdTbl[cmd]);
sendExtendedPressRelease(receiver, qtKey, Qt::KeyboardModifier(state), 0, 0, 0);
// QTBUG-43343: Make sure to return false if Qt does not handle the key, otherwise,
// the keys are not passed to the active media player.
@@ -885,10 +885,10 @@ bool QWindowsKeyMapper::translateMultimediaKeyEventInternal(QWindow *window, con
bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &msg, bool /* grab */)
{
- const int msgType = msg.message;
+ const UINT msgType = msg.message;
const quint32 scancode = (msg.lParam >> 16) & scancodeBitmask;
- quint32 vk_key = msg.wParam;
+ quint32 vk_key = quint32(msg.wParam);
quint32 nModifiers = 0;
QWindow *receiver = m_keyGrabber ? m_keyGrabber : window;
@@ -949,13 +949,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (dirStatus == VK_LSHIFT
&& ((msg.wParam == VK_SHIFT && GetKeyState(VK_LCONTROL))
|| (msg.wParam == VK_CONTROL && GetKeyState(VK_LSHIFT)))) {
- sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, msg.wParam, nModifiers, QString(), false);
+ sendExtendedPressRelease(receiver, Qt::Key_Direction_L, 0, scancode, vk_key, nModifiers, QString(), false);
result = true;
dirStatus = 0;
} else if (dirStatus == VK_RSHIFT
&& ( (msg.wParam == VK_SHIFT && GetKeyState(VK_RCONTROL))
|| (msg.wParam == VK_CONTROL && GetKeyState(VK_RSHIFT)))) {
- sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, msg.wParam, nModifiers, QString(), false);
+ sendExtendedPressRelease(receiver, Qt::Key_Direction_R, 0, scancode, vk_key, nModifiers, QString(), false);
result = true;
dirStatus = 0;
} else {
@@ -1030,7 +1030,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
|| (msg.wParam >= VK_OEM_PLUS && msg.wParam <= VK_OEM_3))
? 0 : int(Qt::KeypadModifier);
default:
- if ((uint)msg.lParam == 0x004c0001 || (uint)msg.lParam == 0xc04c0001)
+ if (uint(msg.lParam) == 0x004c0001 || uint(msg.lParam) == 0xc04c0001)
state |= Qt::KeypadModifier;
break;
}
@@ -1042,6 +1042,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
case Qt::Key_Slash:
case Qt::Key_NumLock:
state |= Qt::KeypadModifier;
+ break;
default:
break;
}
@@ -1051,13 +1052,13 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (msgType == WM_KEYDOWN || msgType == WM_IME_KEYDOWN || msgType == WM_SYSKEYDOWN) {
// Get the last record of this key press, so we can validate the current state
// The record is not removed from the list
- KeyRecord *rec = key_recorder.findKey(msg.wParam, false);
+ KeyRecord *rec = key_recorder.findKey(int(msg.wParam), false);
// If rec's state doesn't match the current state, something has changed behind our back
// (Consumed by modal widget is one possibility) So, remove the record from the list
// This will stop the auto-repeat of the key, should a modifier change, for example
if (rec && rec->state != state) {
- key_recorder.findKey(msg.wParam, true);
+ key_recorder.findKey(int(msg.wParam), true);
rec = 0;
}
@@ -1070,11 +1071,11 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
QChar uch;
if (PeekMessage(&wm_char, 0, charType, charType, PM_REMOVE)) {
// Found a ?_CHAR
- uch = QChar((ushort)wm_char.wParam);
+ uch = QChar(ushort(wm_char.wParam));
if (msgType == WM_SYSKEYDOWN && uch.isLetter() && (msg.lParam & KF_ALTDOWN))
uch = uch.toLower(); // (See doc of WM_SYSCHAR) Alt-letter
if (!code && !uch.row())
- code = asciiToKeycode(uch.cell(), state);
+ code = asciiToKeycode(char(uch.cell()), state);
}
// Special handling for the WM_IME_KEYDOWN message. Microsoft IME (Korean) will not
@@ -1085,7 +1086,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
const QWindowsInputContext *windowsInputContext =
qobject_cast<const QWindowsInputContext *>(QWindowsIntegration::instance()->inputContext());
if (!(windowsInputContext && windowsInputContext->isComposing()))
- vk_key = ImmGetVirtualKey((HWND)window->winId());
+ vk_key = ImmGetVirtualKey(reinterpret_cast<HWND>(window->winId()));
BYTE keyState[256];
wchar_t newKey[3] = {0};
GetKeyboardState(keyState);
@@ -1105,14 +1106,14 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
uch = QChar(QLatin1Char(0x7f)); // Windows doesn't know this one.
} else {
if (msgType != WM_SYSKEYDOWN || !code) {
- UINT map = MapVirtualKey(msg.wParam, 2);
+ UINT map = MapVirtualKey(UINT(msg.wParam), 2);
// If the high bit of the return value is set, it's a deadkey
if (!(map & 0x80000000))
- uch = QChar((ushort)map);
+ uch = QChar(ushort(map));
}
}
if (!code && !uch.row())
- code = asciiToKeycode(uch.cell(), state);
+ code = asciiToKeycode(char(uch.cell()), state);
}
// Special handling of global Windows hotkeys
@@ -1141,9 +1142,9 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
if (rec) {
if (code < Qt::Key_Shift || code > Qt::Key_ScrollLock) {
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code,
- Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true);
+ Qt::KeyboardModifier(state), scancode, quint32(msg.wParam), nModifiers, rec->text, true);
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
- Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers, rec->text, true);
+ Qt::KeyboardModifier(state), scancode, quint32(msg.wParam), nModifiers, rec->text, true);
result = true;
}
}
@@ -1151,7 +1152,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
// and store the key data into our records.
else {
const QString text = uch.isNull() ? QString() : QString(uch);
- const char a = uch.row() ? 0 : uch.cell();
+ const char a = uch.row() ? char(0) : char(uch.cell());
const Qt::KeyboardModifiers modifiers(state);
#ifndef QT_NO_SHORTCUT
// Is Qt interested in the context menu key?
@@ -1160,9 +1161,9 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
return false;
}
#endif // !QT_NO_SHORTCUT
- key_recorder.storeKey(msg.wParam, a, state, text);
+ key_recorder.storeKey(int(msg.wParam), a, state, text);
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyPress, code,
- modifiers, scancode, msg.wParam, nModifiers, text, false);
+ modifiers, scancode, quint32(msg.wParam), nModifiers, text, false);
result =true;
bool store = true;
#ifndef Q_OS_WINCE
@@ -1181,7 +1182,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
}
#endif // !Q_OS_WINCE
if (!store)
- key_recorder.findKey(msg.wParam, true);
+ key_recorder.findKey(int(msg.wParam), true);
}
}
@@ -1191,7 +1192,7 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
// The key may not be in our records if, for example, the down event was handled by
// win32 natively, or our window gets focus while a key is already press, but now gets
// the key release event.
- KeyRecord* rec = key_recorder.findKey(msg.wParam, true);
+ const KeyRecord *rec = key_recorder.findKey(int(msg.wParam), true);
if (!rec && !(code == Qt::Key_Shift
|| code == Qt::Key_Control
|| code == Qt::Key_Meta
@@ -1199,13 +1200,14 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms
// Someone ate the key down event
} else {
if (!code)
- code = asciiToKeycode(rec->ascii ? rec->ascii : msg.wParam, state);
+ code = asciiToKeycode(rec->ascii ? char(rec->ascii) : char(msg.wParam), state);
// Map SHIFT + Tab to SHIFT + BackTab, QShortcutMap knows about this translation
if (code == Qt::Key_Tab && (state & Qt::ShiftModifier) == Qt::ShiftModifier)
code = Qt::Key_Backtab;
QWindowSystemInterface::handleExtendedKeyEvent(receiver, QEvent::KeyRelease, code,
- Qt::KeyboardModifier(state), scancode, msg.wParam, nModifiers,
+ Qt::KeyboardModifier(state), scancode, quint32(msg.wParam),
+ nModifiers,
(rec ? rec->text : QString()), false);
result = true;
#ifndef Q_OS_WINCE
diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp
index a8264b55c0..de18426484 100644
--- a/src/plugins/platforms/windows/qwindowsmime.cpp
+++ b/src/plugins/platforms/windows/qwindowsmime.cpp
@@ -150,7 +150,7 @@ static bool qt_write_dibv5(QDataStream &s, QImage image)
bi.bV5Planes = 1;
bi.bV5BitCount = 32;
bi.bV5Compression = BI_BITFIELDS;
- bi.bV5SizeImage = bpl_bmp*image.height();
+ bi.bV5SizeImage = DWORD(bpl_bmp * image.height());
bi.bV5XPelsPerMeter = 0;
bi.bV5YPelsPerMeter = 0;
bi.bV5ClrUsed = 0;
@@ -170,30 +170,29 @@ static bool qt_write_dibv5(QDataStream &s, QImage image)
image = image.convertToFormat(QImage::Format_ARGB32);
uchar *buf = new uchar[bpl_bmp];
- uchar *b;
- memset(buf, 0, bpl_bmp);
+ memset(buf, 0, size_t(bpl_bmp));
for (int y=image.height()-1; y>=0; y--) {
// write the image bits
const QRgb *p = reinterpret_cast<const QRgb *>(image.constScanLine(y));
const QRgb *end = p + image.width();
- b = buf;
+ uchar *b = buf;
while (p < end) {
int alpha = qAlpha(*p);
if (alpha) {
- *b++ = qBlue(*p);
- *b++ = qGreen(*p);
- *b++ = qRed(*p);
+ *b++ = uchar(qBlue(*p));
+ *b++ = uchar(qGreen(*p));
+ *b++ = uchar(qRed(*p));
} else {
//white for fully transparent pixels.
*b++ = 0xff;
*b++ = 0xff;
*b++ = 0xff;
}
- *b++ = alpha;
+ *b++ = uchar(alpha);
p++;
}
- d->write((char*)buf, bpl_bmp);
+ d->write(reinterpret_cast<const char *>(buf), bpl_bmp);
if (s.status() != QDataStream::Ok) {
delete[] buf;
return false;
@@ -221,25 +220,22 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image)
if (d->atEnd())
return false;
- d->read((char *)&bi, sizeof(bi)); // read BITMAPV5HEADER header
+ d->read(reinterpret_cast<char *>(&bi), sizeof(bi)); // read BITMAPV5HEADER header
if (s.status() != QDataStream::Ok)
return false;
- int nbits = bi.bV5BitCount;
- int comp = bi.bV5Compression;
- if (nbits != 32 || bi.bV5Planes != 1 || comp != BMP_BITFIELDS)
+ const int nbits = bi.bV5BitCount;
+ if (nbits != 32 || bi.bV5Planes != 1 || bi.bV5Compression != BMP_BITFIELDS)
return false; //Unsupported DIBV5 format
- int w = bi.bV5Width, h = bi.bV5Height;
- int red_mask = bi.bV5RedMask;
- int green_mask = bi.bV5GreenMask;
- int blue_mask = bi.bV5BlueMask;
- int alpha_mask = bi.bV5AlphaMask;
- int red_shift = 0;
- int green_shift = 0;
- int blue_shift = 0;
- int alpha_shift = 0;
- QImage::Format format = QImage::Format_ARGB32;
+ const int w = bi.bV5Width;
+ int h = bi.bV5Height;
+ const int red_mask = int(bi.bV5RedMask);
+ const int green_mask = int(bi.bV5GreenMask);
+ const int blue_mask = int(bi.bV5BlueMask);
+ const int alpha_mask = int(bi.bV5AlphaMask);
+
+ const QImage::Format format = QImage::Format_ARGB32;
if (bi.bV5Height < 0)
h = -h; // support images with negative height
@@ -251,30 +247,25 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image)
image.setDotsPerMeterX(bi.bV5XPelsPerMeter);
image.setDotsPerMeterY(bi.bV5YPelsPerMeter);
- red_shift = calc_shift(red_mask);
- green_shift = calc_shift(green_mask);
- blue_shift = calc_shift(blue_mask);
- if (alpha_mask) {
- alpha_shift = calc_shift(alpha_mask);
- }
+ const int red_shift = calc_shift(red_mask);
+ const int green_shift = calc_shift(green_mask);
+ const int blue_shift = calc_shift(blue_mask);
+ const int alpha_shift = alpha_mask ? calc_shift(alpha_mask) : 0u;
- int bpl = image.bytesPerLine();
+ const int bpl = image.bytesPerLine();
uchar *data = image.bits();
- QRgb *p;
- QRgb *end;
+
uchar *buf24 = new uchar[bpl];
- int bpl24 = ((w*nbits+31)/32)*4;
- uchar *b;
- unsigned int c;
+ const int bpl24 = ((w * nbits + 31) / 32) * 4;
while (--h >= 0) {
- p = (QRgb *)(data + h*bpl);
- end = p + w;
- if (d->read((char *)buf24,bpl24) != bpl24)
+ QRgb *p = reinterpret_cast<QRgb *>(data + h * bpl);
+ QRgb *end = p + w;
+ if (d->read(reinterpret_cast<char *>(buf24), bpl24) != bpl24)
break;
- b = buf24;
+ const uchar *b = buf24;
while (p < end) {
- c = *b | (*(b+1))<<8 | (*(b+2))<<16 | (*(b+3))<<24;
+ const int c = *b | (*(b + 1)) << 8 | (*(b + 2)) << 16 | (*(b + 3)) << 24;
*p++ = qRgba(((c & red_mask) >> red_shift) ,
((c & green_mask) >> green_shift),
((c & blue_mask) >> blue_shift),
@@ -289,9 +280,9 @@ static bool qt_read_dibv5(QDataStream &s, QImage &image)
uchar *buf = new uchar[bpl];
h = -bi.bV5Height;
for (int y = 0; y < h/2; ++y) {
- memcpy(buf, data + y*bpl, bpl);
- memcpy(data + y*bpl, data + (h-y-1)*bpl, bpl);
- memcpy(data + (h-y-1)*bpl, buf, bpl);
+ memcpy(buf, data + y * bpl, size_t(bpl));
+ memcpy(data + y*bpl, data + (h - y -1) * bpl, size_t(bpl));
+ memcpy(data + (h - y -1 ) * bpl, buf, size_t(bpl));
}
delete [] buf;
}
@@ -309,7 +300,7 @@ static int getCf(const FORMATETC &formatetc)
static FORMATETC setCf(int cf)
{
FORMATETC formatetc;
- formatetc.cfFormat = cf;
+ formatetc.cfFormat = CLIPFORMAT(cf);
formatetc.dwAspect = DVASPECT_CONTENT;
formatetc.lindex = -1;
formatetc.ptd = NULL;
@@ -319,12 +310,12 @@ static FORMATETC setCf(int cf)
static bool setData(const QByteArray &data, STGMEDIUM *pmedium)
{
- HGLOBAL hData = GlobalAlloc(0, data.size());
+ HGLOBAL hData = GlobalAlloc(0, SIZE_T(data.size()));
if (!hData)
return false;
void *out = GlobalLock(hData);
- memcpy(out, data.data(), data.size());
+ memcpy(out, data.data(), size_t(data.size()));
GlobalUnlock(hData);
pmedium->tymed = TYMED_HGLOBAL;
pmedium->hGlobal = hData;
@@ -339,8 +330,8 @@ static QByteArray getData(int cf, IDataObject *pDataObj, int lindex = -1)
formatetc.lindex = lindex;
STGMEDIUM s;
if (pDataObj->GetData(&formatetc, &s) == S_OK) {
- DWORD * val = (DWORD*)GlobalLock(s.hGlobal);
- data = QByteArray::fromRawData((char*)val, GlobalSize(s.hGlobal));
+ const void *val = GlobalLock(s.hGlobal);
+ data = QByteArray::fromRawData(reinterpret_cast<const char *>(val), int(GlobalSize(s.hGlobal)));
data.detach();
GlobalUnlock(s.hGlobal);
ReleaseStgMedium(&s);
@@ -356,7 +347,7 @@ static QByteArray getData(int cf, IDataObject *pDataObj, int lindex = -1)
while(SUCCEEDED(hr)){
hr = s.pstm->Read(szBuffer, sizeof(szBuffer), &actualRead);
if (SUCCEEDED(hr) && actualRead > 0) {
- data += QByteArray::fromRawData(szBuffer, actualRead);
+ data += QByteArray::fromRawData(szBuffer, int(actualRead));
}
if (actualRead != sizeof(szBuffer))
break;
@@ -508,11 +499,11 @@ QWindowsMime::~QWindowsMime()
*/
int QWindowsMime::registerMimeType(const QString &mime)
{
- int f = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (mime.utf16()));
+ const UINT f = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (mime.utf16()));
if (!f)
qErrnoWarning("QWindowsMime::registerMimeType: Failed to register clipboard format");
- return f;
+ return int(f);
}
/*!
@@ -655,9 +646,9 @@ bool QWindowsMimeText::convertFromMime(const FORMATETC &formatetc, const QMimeDa
++u;
}
res.truncate(ri);
- const int byteLength = res.length() * sizeof(ushort);
+ const int byteLength = res.length() * int(sizeof(ushort));
QByteArray r(byteLength + 2, '\0');
- memcpy(r.data(), res.unicode(), byteLength);
+ memcpy(r.data(), res.unicode(), size_t(byteLength));
r[byteLength] = 0;
r[byteLength+1] = 0;
return setData(r, pmedium);
@@ -700,17 +691,17 @@ QVariant QWindowsMimeText::convertToMime(const QString &mime, LPDATAOBJECT pData
QString str;
QByteArray data = getData(CF_UNICODETEXT, pDataObj);
if (!data.isEmpty()) {
- str = QString::fromWCharArray((const wchar_t *)data.data());
+ str = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData()));
str.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
} else {
data = getData(CF_TEXT, pDataObj);
if (!data.isEmpty()) {
const char* d = data.data();
- const int s = qstrlen(d);
+ const unsigned s = qstrlen(d);
QByteArray r(data.size()+1, '\0');
char* o = r.data();
int j=0;
- for (int i=0; i<s; i++) {
+ for (unsigned i = 0; i < s; ++i) {
char c = d[i];
if (c!='\r')
o[j++]=c;
@@ -771,22 +762,22 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
for (int i=0; i<urls.size(); i++) {
QString fn = QDir::toNativeSeparators(urls.at(i).toLocalFile());
if (!fn.isEmpty()) {
- size += sizeof(ushort) * (fn.length() + 1);
+ size += sizeof(ushort) * size_t(fn.length() + 1);
fileNames.append(fn);
}
}
QByteArray result(size, '\0');
- DROPFILES* d = (DROPFILES*)result.data();
+ DROPFILES* d = reinterpret_cast<DROPFILES *>(result.data());
d->pFiles = sizeof(DROPFILES);
GetCursorPos(&d->pt); // try
d->fNC = true;
- char* files = ((char*)d) + d->pFiles;
+ char *files = (reinterpret_cast<char*>(d)) + d->pFiles;
d->fWide = true;
- wchar_t* f = (wchar_t*)files;
+ wchar_t *f = reinterpret_cast<wchar_t *>(files);
for (int i=0; i<fileNames.size(); i++) {
- int l = fileNames.at(i).length();
+ const size_t l = size_t(fileNames.at(i).length());
memcpy(f, fileNames.at(i).utf16(), l * sizeof(ushort));
f += l;
*f++ = 0;
@@ -799,7 +790,8 @@ bool QWindowsMimeURI::convertFromMime(const FORMATETC &formatetc, const QMimeDat
QByteArray result;
if (!urls.isEmpty()) {
QString url = urls.at(0).toString();
- result = QByteArray((const char *)url.utf16(), url.length() * sizeof(ushort));
+ result = QByteArray(reinterpret_cast<const char *>(url.utf16()),
+ url.length() * int(sizeof(ushort)));
}
result.append('\0');
result.append('\0');
@@ -854,9 +846,9 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
if (data.isEmpty())
return QVariant();
- LPDROPFILES hdrop = (LPDROPFILES)data.data();
+ const DROPFILES *hdrop = reinterpret_cast<const DROPFILES *>(data.constData());
if (hdrop->fWide) {
- const wchar_t* filesw = (const wchar_t *)(data.data() + hdrop->pFiles);
+ const wchar_t *filesw = reinterpret_cast<const wchar_t *>(data.constData() + hdrop->pFiles);
int i = 0;
while (filesw[i]) {
QString fileurl = QString::fromWCharArray(filesw + i);
@@ -864,7 +856,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
i += fileurl.length()+1;
}
} else {
- const char* files = (const char *)data.data() + hdrop->pFiles;
+ const char* files = reinterpret_cast<const char *>(data.constData() + hdrop->pFiles);
int i=0;
while (files[i]) {
urls += QUrl::fromLocalFile(QString::fromLocal8Bit(files+i));
@@ -880,7 +872,7 @@ QVariant QWindowsMimeURI::convertToMime(const QString &mimeType, LPDATAOBJECT pD
QByteArray data = getData(CF_INETURL_W, pDataObj);
if (data.isEmpty())
return QVariant();
- return QUrl(QString::fromWCharArray((const wchar_t *)data.constData()));
+ return QUrl(QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData())));
} else if (canGetData(CF_INETURL, pDataObj)) {
QByteArray data = getData(CF_INETURL, pDataObj);
if (data.isEmpty())
@@ -1008,14 +1000,14 @@ bool QWindowsMimeHtml::convertFromMime(const FORMATETC &formatetc, const QMimeDa
result += "<!--EndFragment-->";
// set the correct number for EndHTML
- QByteArray pos = QString::number(result.size()).toLatin1();
- memcpy((char *)(result.data() + 53 - pos.length()), pos.constData(), pos.length());
+ QByteArray pos = QByteArray::number(result.size());
+ memcpy(reinterpret_cast<char *>(result.data() + 53 - pos.length()), pos.constData(), size_t(pos.length()));
// set correct numbers for StartFragment and EndFragment
- pos = QString::number(result.indexOf("<!--StartFragment-->") + 20).toLatin1();
- memcpy((char *)(result.data() + 79 - pos.length()), pos.constData(), pos.length());
- pos = QString::number(result.indexOf("<!--EndFragment-->")).toLatin1();
- memcpy((char *)(result.data() + 103 - pos.length()), pos.constData(), pos.length());
+ pos = QByteArray::number(result.indexOf("<!--StartFragment-->") + 20);
+ memcpy(reinterpret_cast<char *>(result.data() + 79 - pos.length()), pos.constData(), size_t(pos.length()));
+ pos = QByteArray::number(result.indexOf("<!--EndFragment-->"));
+ memcpy(reinterpret_cast<char *>(result.data() + 103 - pos.length()), pos.constData(), size_t(pos.length()));
return setData(result, pmedium);
}
@@ -1243,9 +1235,9 @@ bool QBuiltInMimes::convertFromMime(const FORMATETC &formatetc, const QMimeData
++u;
}
res.truncate(ri);
- const int byteLength = res.length() * sizeof(ushort);
+ const int byteLength = res.length() * int(sizeof(ushort));
QByteArray r(byteLength + 2, '\0');
- memcpy(r.data(), res.unicode(), byteLength);
+ memcpy(r.data(), res.unicode(), size_t(byteLength));
r[byteLength] = 0;
r[byteLength+1] = 0;
data = r;
@@ -1282,7 +1274,7 @@ QVariant QBuiltInMimes::convertToMime(const QString &mimeType, IDataObject *pDat
qCDebug(lcQpaMime) << __FUNCTION__;
if (mimeType == QLatin1String("text/html") && preferredType == QVariant::String) {
// text/html is in wide chars on windows (compatible with Mozilla)
- val = QString::fromWCharArray((const wchar_t *)data.data());
+ val = QString::fromWCharArray(reinterpret_cast<const wchar_t *>(data.constData()));
} else {
val = data; // it should be enough to return the data and let QMimeData do the rest.
}
@@ -1422,8 +1414,8 @@ bool QLastResortMimes::canConvertToMime(const QString &mimeType, IDataObject *pD
if (isCustomMimeType(mimeType)) {
// MSDN documentation for QueryGetData says only -1 is supported, so ignore lindex here.
QString clipFormat = customMimeType(mimeType);
- int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
- return canGetData(cf, pDataObj);
+ const UINT cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
+ return canGetData(int(cf), pDataObj);
} else if (formats.keys(mimeType).isEmpty()) {
// if it is not in there then register it and see if we can get it
int cf = QWindowsMime::registerMimeType(mimeType);
@@ -1443,8 +1435,8 @@ QVariant QLastResortMimes::convertToMime(const QString &mimeType, IDataObject *p
if (isCustomMimeType(mimeType)) {
int lindex;
QString clipFormat = customMimeType(mimeType, &lindex);
- int cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
- data = getData(cf, pDataObj, lindex);
+ const UINT cf = RegisterClipboardFormat(reinterpret_cast<const wchar_t *> (clipFormat.utf16()));
+ data = getData(int(cf), pDataObj, lindex);
} else if (formats.keys(mimeType).isEmpty()) {
int cf = QWindowsMime::registerMimeType(mimeType);
data = getData(cf, pDataObj);
@@ -1593,7 +1585,7 @@ void QWindowsMimeConverter::ensureInitialized() const
QString QWindowsMimeConverter::clipboardFormatName(int cf)
{
wchar_t buf[256] = {0};
- return GetClipboardFormatName(cf, buf, 255)
+ return GetClipboardFormatName(UINT(cf), buf, 255)
? QString::fromWCharArray(buf) : QString();
}
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index e26010b5c4..32f8285954 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -203,7 +203,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// Check for events synthesized from touch. Lower 7 bits are touch/pen index, bit 8 indicates touch.
// However, when tablet support is active, extraInfo is a packet serial number. This is not a problem
// since we do not want to ignore mouse events coming from a tablet.
- const quint64 extraInfo = GetMessageExtraInfo();
+ const quint64 extraInfo = quint64(GetMessageExtraInfo());
if ((extraInfo & signatureMask) == miWpSignature) {
if (extraInfo & 0x80) { // Bit 7 indicates touch event, else tablet pen.
source = Qt::MouseEventSynthesizedBySystem;
@@ -243,7 +243,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
}
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
- const Qt::MouseButtons buttons = keyStateToMouseButtons((int)msg.wParam);
+ const Qt::MouseButtons buttons = keyStateToMouseButtons(int(msg.wParam));
// If the window was recently resized via mouse doubleclick on the frame or title bar,
// we don't get WM_LBUTTONDOWN or WM_LBUTTONDBLCLK for the second click,
@@ -418,13 +418,13 @@ static void redirectWheelEvent(QWindow *window, const QPoint &globalPos, int del
bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
MSG msg, LRESULT *)
{
- const Qt::KeyboardModifiers mods = keyStateToModifiers((int)msg.wParam);
+ const Qt::KeyboardModifiers mods = keyStateToModifiers(int(msg.wParam));
int delta;
if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
- delta = (short) HIWORD (msg.wParam);
+ delta = HIWORD (msg.wParam);
else
- delta = (int) msg.wParam;
+ delta = int(msg.wParam);
Qt::Orientation orientation = (msg.message == WM_MOUSEHWHEEL
|| (mods & Qt::AltModifier)) ?
@@ -495,15 +495,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
return true;
const QRect screenGeometry = screen->geometry();
- const int winTouchPointCount = msg.wParam;
+ const int winTouchPointCount = int(msg.wParam);
QScopedArrayPointer<TOUCHINPUT> winTouchInputs(new TOUCHINPUT[winTouchPointCount]);
- memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * winTouchPointCount);
+ memset(winTouchInputs.data(), 0, sizeof(TOUCHINPUT) * size_t(winTouchPointCount));
QTouchPointList touchPoints;
touchPoints.reserve(winTouchPointCount);
Qt::TouchPointStates allStates = 0;
- QWindowsContext::user32dll.getTouchInputInfo((HANDLE) msg.lParam, msg.wParam, winTouchInputs.data(), sizeof(TOUCHINPUT));
+ QWindowsContext::user32dll.getTouchInputInfo(reinterpret_cast<HANDLE>(msg.lParam),
+ UINT(msg.wParam),
+ winTouchInputs.data(), sizeof(TOUCHINPUT));
for (int i = 0; i < winTouchPointCount; ++i) {
const TOUCHINPUT &winTouchInput = winTouchInputs[i];
int id = m_touchInputIDToTouchPointID.value(winTouchInput.dwID, -1);
@@ -544,7 +546,7 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
touchPoints.append(touchPoint);
}
- QWindowsContext::user32dll.closeTouchInputHandle((HANDLE) msg.lParam);
+ QWindowsContext::user32dll.closeTouchInputHandle(reinterpret_cast<HANDLE>(msg.lParam));
// all touch points released, forget the ids we've seen, they may not be reused
if (allStates == Qt::TouchPointReleased)
diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
index 66e64e64b4..3cdfc9f56e 100644
--- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp
+++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp
@@ -93,13 +93,13 @@ static inline HBITMAP createDIB(HDC hdc, int width, int height,
bmi.blueMask = 0;
}
- void *bits = 0;
+ uchar *bits = Q_NULLPTR;
HBITMAP bitmap = CreateDIBSection(hdc, reinterpret_cast<BITMAPINFO *>(&bmi),
- DIB_RGB_COLORS, &bits, 0, 0);
+ DIB_RGB_COLORS, reinterpret_cast<void **>(&bits), 0, 0);
if (!bitmap || !bits)
qFatal("%s: CreateDIBSection failed.", __FUNCTION__);
- *bitsIn = (uchar*)bits;
+ *bitsIn = bits;
return bitmap;
}
@@ -112,7 +112,7 @@ QWindowsNativeImage::QWindowsNativeImage(int width, int height,
if (width != 0 && height != 0) {
uchar *bits;
m_bitmap = createDIB(m_hdc, width, height, format, &bits);
- m_null_bitmap = (HBITMAP)SelectObject(m_hdc, m_bitmap);
+ m_null_bitmap = static_cast<HBITMAP>(SelectObject(m_hdc, m_bitmap));
m_image = QImage(bits, width, height, format);
Q_ASSERT(m_image.paintEngine()->type() == QPaintEngine::Raster);
static_cast<QRasterPaintEngine *>(m_image.paintEngine())->setDC(m_hdc);
diff --git a/src/plugins/platforms/windows/qwindowsole.cpp b/src/plugins/platforms/windows/qwindowsole.cpp
index e480c1ebcf..4521f66edd 100644
--- a/src/plugins/platforms/windows/qwindowsole.cpp
+++ b/src/plugins/platforms/windows/qwindowsole.cpp
@@ -215,7 +215,7 @@ QWindowsOleDataObject::EnumFormatEtc(DWORD dwDirection, LPENUMFORMATETC FAR* ppe
fmtetcs = mc.allFormatsForMime(data);
} else {
FORMATETC formatetc;
- formatetc.cfFormat = CF_PERFORMEDDROPEFFECT;
+ formatetc.cfFormat = CLIPFORMAT(CF_PERFORMEDDROPEFFECT);
formatetc.dwAspect = DVASPECT_CONTENT;
formatetc.lindex = -1;
formatetc.ptd = NULL;
@@ -269,7 +269,7 @@ QWindowsOleEnumFmtEtc::QWindowsOleEnumFmtEtc(const QVector<FORMATETC> &fmtetcs)
m_lpfmtetcs.reserve(fmtetcs.count());
for (int idx = 0; idx < fmtetcs.count(); ++idx) {
LPFORMATETC destetc = new FORMATETC();
- if (copyFormatEtc(destetc, (LPFORMATETC)&(fmtetcs.at(idx)))) {
+ if (copyFormatEtc(destetc, &(fmtetcs.at(idx)))) {
m_lpfmtetcs.append(destetc);
} else {
m_isNull = true;
@@ -363,14 +363,14 @@ QWindowsOleEnumFmtEtc::Next(ULONG celt, LPFORMATETC rgelt, ULONG FAR* pceltFetch
nOffset = m_nIndex + i;
if (nOffset < ULONG(m_lpfmtetcs.count())) {
- copyFormatEtc((LPFORMATETC)&(rgelt[i]), m_lpfmtetcs.at(nOffset));
+ copyFormatEtc(rgelt + i, m_lpfmtetcs.at(int(nOffset)));
i++;
} else {
break;
}
}
- m_nIndex += (WORD)i;
+ m_nIndex += i;
if (pceltFetched != NULL)
*pceltFetched = i;
@@ -397,7 +397,7 @@ QWindowsOleEnumFmtEtc::Skip(ULONG celt)
}
}
- m_nIndex += (WORD)i;
+ m_nIndex += i;
if (i != celt)
return ResultFromScode(S_FALSE);
@@ -431,7 +431,7 @@ QWindowsOleEnumFmtEtc::Clone(LPENUMFORMATETC FAR* newEnum)
return NOERROR;
}
-bool QWindowsOleEnumFmtEtc::copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const
+bool QWindowsOleEnumFmtEtc::copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const
{
if (dest == NULL || src == NULL)
return false;
diff --git a/src/plugins/platforms/windows/qwindowsole.h b/src/plugins/platforms/windows/qwindowsole.h
index 09f6114e2d..bbafa98a0b 100644
--- a/src/plugins/platforms/windows/qwindowsole.h
+++ b/src/plugins/platforms/windows/qwindowsole.h
@@ -103,7 +103,7 @@ public:
STDMETHOD(Clone)(LPENUMFORMATETC FAR* newEnum);
private:
- bool copyFormatEtc(LPFORMATETC dest, LPFORMATETC src) const;
+ bool copyFormatEtc(LPFORMATETC dest, const FORMATETC *src) const;
ULONG m_dwRefs;
ULONG m_nIndex;
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp
index fcbe488f93..438aa8752a 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.cpp
+++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp
@@ -75,10 +75,10 @@ GpuDescription GpuDescription::detect()
const HRESULT hr = direct3D9->GetAdapterIdentifier(0, 0, &adapterIdentifier);
direct3D9->Release();
if (SUCCEEDED(hr)) {
- result.vendorId = int(adapterIdentifier.VendorId);
- result.deviceId = int(adapterIdentifier.DeviceId);
- result.revision = int(adapterIdentifier.Revision);
- result.subSysId = int(adapterIdentifier.SubSysId);
+ result.vendorId = adapterIdentifier.VendorId;
+ result.deviceId = adapterIdentifier.DeviceId;
+ result.revision = adapterIdentifier.Revision;
+ result.subSysId = adapterIdentifier.SubSysId;
QVector<int> version(4, 0);
version[0] = HIWORD(adapterIdentifier.DriverVersion.HighPart); // Product
version[1] = LOWORD(adapterIdentifier.DriverVersion.HighPart); // Version
@@ -329,10 +329,10 @@ bool QWindowsOpenGLTester::testDesktopGL()
WNDCLASS wclass;
wclass.cbClsExtra = 0;
wclass.cbWndExtra = 0;
- wclass.hInstance = (HINSTANCE) GetModuleHandle(0);
+ wclass.hInstance = static_cast<HINSTANCE>(GetModuleHandle(0));
wclass.hIcon = 0;
wclass.hCursor = 0;
- wclass.hbrBackground = (HBRUSH) (COLOR_BACKGROUND);
+ wclass.hbrBackground = HBRUSH(COLOR_BACKGROUND);
wclass.lpszMenuName = 0;
wclass.lpfnWndProc = DefWindowProc;
wclass.lpszClassName = className;
@@ -371,8 +371,7 @@ bool QWindowsOpenGLTester::testDesktopGL()
typedef const GLubyte * (APIENTRY * GetString_t)(GLenum name);
GetString_t GetString = reinterpret_cast<GetString_t>(::GetProcAddress(lib, "glGetString"));
if (GetString) {
- const char *versionStr = (const char *) GetString(GL_VERSION);
- if (versionStr) {
+ if (const char *versionStr = reinterpret_cast<const char *>(GetString(GL_VERSION))) {
const QByteArray version(versionStr);
const int majorDot = version.indexOf('.');
if (majorDot != -1) {
diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h
index 0fad3d960e..0f1a78daaa 100644
--- a/src/plugins/platforms/windows/qwindowsopengltester.h
+++ b/src/plugins/platforms/windows/qwindowsopengltester.h
@@ -51,10 +51,10 @@ struct GpuDescription
QString toString() const;
QVariant toVariant() const;
- int vendorId;
- int deviceId;
- int revision;
- int subSysId;
+ uint vendorId;
+ uint deviceId;
+ uint revision;
+ uint subSysId;
QVersionNumber driverVersion;
QByteArray driverName;
QByteArray description;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index bfcf96ebe7..5accbe87e1 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -152,7 +152,7 @@ BOOL QT_WIN_CALLBACK monitorEnumCallback(HMONITOR hMonitor, HDC, LPRECT, LPARAM
static inline WindowsScreenDataList monitorData()
{
WindowsScreenDataList result;
- EnumDisplayMonitors(0, 0, monitorEnumCallback, (LPARAM)&result);
+ EnumDisplayMonitors(0, 0, monitorEnumCallback, reinterpret_cast<LPARAM>(&result));
return result;
}
@@ -200,7 +200,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHBITMAP(HBITMAP bitmap, int hbitmapFormat =
QPixmap QWindowsScreen::grabWindow(WId window, int x, int y, int width, int height) const
{
RECT r;
- HWND hwnd = window ? (HWND)window : GetDesktopWindow();
+ HWND hwnd = window ? reinterpret_cast<HWND>(window) : GetDesktopWindow();
GetClientRect(hwnd, &r);
if (width < 0) width = r.right - r.left;
@@ -434,7 +434,7 @@ QWindowsScreenManager::QWindowsScreenManager() :
bool QWindowsScreenManager::handleDisplayChange(WPARAM wParam, LPARAM lParam)
{
- const int newDepth = (int)wParam;
+ const int newDepth = int(wParam);
const WORD newHorizontalResolution = LOWORD(lParam);
const WORD newVerticalResolution = HIWORD(lParam);
if (newDepth != m_lastDepth || newHorizontalResolution != m_lastHorizontalResolution
diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp
index cc697ba7e4..ae63ac46ae 100644
--- a/src/plugins/platforms/windows/qwindowsservices.cpp
+++ b/src/plugins/platforms/windows/qwindowsservices.cpp
@@ -53,7 +53,10 @@ static inline bool shellExecute(const QUrl &url)
#ifndef Q_OS_WINCE
const QString nativeFilePath =
url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded);
- const quintptr result = (quintptr)ShellExecute(0, 0, (wchar_t*)nativeFilePath.utf16(), 0, 0, SW_SHOWNORMAL);
+ const quintptr result =
+ reinterpret_cast<quintptr>(ShellExecute(0, 0,
+ reinterpret_cast<const wchar_t *>(nativeFilePath.utf16()),
+ 0, 0, SW_SHOWNORMAL));
// ShellExecute returns a value greater than 32 if successful
if (result <= 32) {
qWarning("ShellExecute '%s' failed (error %s).", qPrintable(url.toString()), qPrintable(QString::number(result)));
@@ -91,7 +94,7 @@ static inline QString mailCommand()
if (debug)
qDebug() << __FUNCTION__ << "keyName=" << keyName;
command[0] = 0;
- if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, (const wchar_t*)keyName.utf16(), 0, KEY_READ, &handle)) {
+ if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, reinterpret_cast<const wchar_t*>(keyName.utf16()), 0, KEY_READ, &handle)) {
DWORD bufferSize = BufferSize;
RegQueryValueEx(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(command), &bufferSize);
RegCloseKey(handle);
@@ -134,7 +137,8 @@ static inline bool launchMail(const QUrl &url)
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
- if (!CreateProcess(NULL, (wchar_t*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ if (!CreateProcess(NULL, reinterpret_cast<wchar_t *>(const_cast<ushort *>(command.utf16())),
+ NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
qErrnoWarning("Unable to launch '%s'", qPrintable(command));
return false;
}
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
index b27811df9e..222551a86f 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp
@@ -316,7 +316,7 @@ QDebug operator<<(QDebug d, const QWindowsTabletDeviceData &t)
}
#endif // !QT_NO_DEBUG_STREAM
-QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(const quint64 uniqueId, const UINT cursorType) const
+QWindowsTabletDeviceData QWindowsTabletSupport::tabletInit(qint64 uniqueId, UINT cursorType) const
{
QWindowsTabletDeviceData result;
result.uniqueId = uniqueId;
diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h
index a6d2771206..6e0d92df53 100644
--- a/src/plugins/platforms/windows/qwindowstabletsupport.h
+++ b/src/plugins/platforms/windows/qwindowstabletsupport.h
@@ -123,7 +123,7 @@ public:
private:
unsigned options() const;
- QWindowsTabletDeviceData tabletInit(const quint64 uniqueId, const UINT cursorType) const;
+ QWindowsTabletDeviceData tabletInit(qint64 uniqueId, UINT cursorType) const;
static QWindowsWinTab32DLL m_winTab32DLL;
const HWND m_window;
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 5bbe923fe7..887a217b06 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -456,7 +456,9 @@ static QPixmap loadIconFromShell32(int resourceId, QSizeF size)
HMODULE hmod = QSystemLibrary::load(L"shell32");
#endif
if (hmod) {
- HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size.width(), size.height(), 0);
+ HICON iconHandle =
+ static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId),
+ IMAGE_ICON, int(size.width()), int(size.height()), 0));
if (iconHandle) {
QPixmap iconpixmap = qt_pixmapFromWinHICON(iconHandle);
DestroyIcon(iconHandle);
@@ -557,7 +559,7 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) con
if (sp == FileLinkIcon || sp == DirLinkIcon || sp == DirLinkOpenIcon) {
QPainter painter(&pixmap);
QPixmap link = loadIconFromShell32(30, pixmapSize);
- painter.drawPixmap(0, 0, pixmapSize.width(), pixmapSize.height(), link);
+ painter.drawPixmap(0, 0, int(pixmapSize.width()), int(pixmapSize.height()), link);
}
pixmap.setDevicePixelRatio(scaleFactor);
return pixmap;
@@ -632,7 +634,8 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info)
return result;
IImageList *imageList = 0;
- HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList, (void **)&imageList);
+ HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList,
+ reinterpret_cast<void **>(&imageList));
if (hr != S_OK)
return result;
HICON hIcon;
@@ -664,7 +667,7 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s
QPixmap pixmap;
const QString filePath = QDir::toNativeSeparators(fileInfo.filePath());
- const int width = size.width();
+ const int width = int(size.width());
const int iconSize = width > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON;
const int requestedImageListSize =
#ifdef USE_IIMAGELIST