From b20548f9999d8c111268f3f2287c0801c6c5cbb0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 18 Feb 2016 13:13:49 +0100 Subject: 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 --- .../platforms/windows/qwindowsinputcontext.cpp | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowsinputcontext.cpp') 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(reconv + 1); -- cgit v1.2.3