From fbc0bb8dc9d415facbaebf0cdf6bd7447e0e23a6 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 30 Apr 2018 09:54:15 +1000 Subject: Use Win32 types and avoid casting. Move code to avoid warnings. Use const where there is a benefit. --- win32/PlatWin.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'win32/PlatWin.cxx') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index a927372c2..c1d1f7cd1 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -353,9 +353,6 @@ FontCached::FontCached(const FontParameters &fp) : if (SUCCEEDED(hr)) { pTextFormat->SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP); - const int maxLines = 2; - DWRITE_LINE_METRICS lineMetrics[maxLines]; - UINT32 lineCount = 0; FLOAT yAscent = 1.0f; FLOAT yDescent = 1.0f; FLOAT yInternalLeading = 0.0f; @@ -363,6 +360,9 @@ FontCached::FontCached(const FontParameters &fp) : hr = pIDWriteFactory->CreateTextLayout(L"X", 1, pTextFormat, 100.0f, 100.0f, &pTextLayout); if (SUCCEEDED(hr)) { + const int maxLines = 2; + DWRITE_LINE_METRICS lineMetrics[maxLines]{}; + UINT32 lineCount = 0; hr = pTextLayout->GetLineMetrics(lineMetrics, maxLines, &lineCount); if (SUCCEEDED(hr)) { yAscent = lineMetrics[0].baseline; @@ -2040,7 +2040,7 @@ class ListBoxX : public ListBox { IListBoxDelegate *delegate; const char *widestItem; unsigned int maxCharWidth; - int resizeHit; + WPARAM resizeHit; PRectangle rcPreSize; Point dragOffset; Point location; // Caret location at which the list is opened @@ -2449,7 +2449,7 @@ POINT ListBoxX::MaxTrackSize() const { } void ListBoxX::SetRedraw(bool on) { - ::SendMessage(lb, WM_SETREDRAW, static_cast(on), 0); + ::SendMessage(lb, WM_SETREDRAW, on, 0); if (on) ::InvalidateRect(lb, NULL, TRUE); } @@ -2540,7 +2540,7 @@ void ListBoxX::StartResize(WPARAM hitCode) { } ::SetCapture(GetHWND()); - resizeHit = static_cast(hitCode); + resizeHit = hitCode; } LRESULT ListBoxX::NcHitTest(WPARAM wParam, LPARAM lParam) const { @@ -2753,7 +2753,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam case WM_MEASUREITEM: { MEASUREITEMSTRUCT *pMeasureItem = reinterpret_cast(lParam); - pMeasureItem->itemHeight = static_cast(ItemHeight()); + pMeasureItem->itemHeight = ItemHeight(); } break; -- cgit v1.2.3