From 1595b1fbedf5587bc7c60cc7a1156ac1bca69f59 Mon Sep 17 00:00:00 2001 From: Neil Date: Fri, 7 Apr 2017 19:44:59 +1000 Subject: Prefer C++ static cast over C-style casts. --- win32/PlatWin.cxx | 4 ++-- win32/ScintillaWin.cxx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 1b0f65518..ec89479ab 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1292,7 +1292,7 @@ static int Delta(int difference) { } static float RoundFloat(float f) { - return float(int(f+0.5f)); + return static_cast(static_cast(f+0.5f)); } void SurfaceD2D::LineTo(int x_, int y_) { @@ -1899,7 +1899,7 @@ static HCURSOR GetReverseArrowCursor() { FlipBitmap(info.hbmMask, bmp.bmWidth, bmp.bmHeight); if (info.hbmColor != NULL) FlipBitmap(info.hbmColor, bmp.bmWidth, bmp.bmHeight); - info.xHotspot = (DWORD)bmp.bmWidth - 1 - info.xHotspot; + info.xHotspot = static_cast(bmp.bmWidth) - 1 - info.xHotspot; reverseArrowCursor = ::CreateIconIndirect(&info); if (reverseArrowCursor != NULL) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 5d159ca31..fdcfbda53 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -2689,11 +2689,11 @@ LRESULT ScintillaWin::ImeOnReconvert(LPARAM lParam) { const int rcFeedLen = static_cast(rcFeed.length()) * sizeof(wchar_t); const int rcSize = sizeof(RECONVERTSTRING) + rcFeedLen + sizeof(wchar_t); - RECONVERTSTRING *rc = (RECONVERTSTRING *)lParam; + RECONVERTSTRING *rc = reinterpret_cast(lParam); if (!rc) return rcSize; // Immediately be back with rcSize of memory block. - wchar_t *rcFeedStart = (wchar_t*)(rc + 1); + wchar_t *rcFeedStart = reinterpret_cast(rc + 1); memcpy(rcFeedStart, &rcFeed[0], rcFeedLen); std::string rcCompString = RangeText(mainStart, mainEnd); @@ -2704,10 +2704,10 @@ LRESULT ScintillaWin::ImeOnReconvert(LPARAM lParam) { // Map selection to dwCompStr. // No selection assumes current caret as rcCompString without length. rc->dwVersion = 0; // It should be absolutely 0. - rc->dwStrLen = (DWORD)static_cast(rcFeed.length()); + rc->dwStrLen = static_cast(rcFeed.length()); rc->dwStrOffset = sizeof(RECONVERTSTRING); - rc->dwCompStrLen = (DWORD)static_cast(rcCompWstring.length()); - rc->dwCompStrOffset = (DWORD)static_cast(rcCompWstart.length()) * sizeof(wchar_t); + rc->dwCompStrLen = static_cast(rcCompWstring.length()); + rc->dwCompStrOffset = static_cast(rcCompWstart.length()) * sizeof(wchar_t); rc->dwTargetStrLen = rc->dwCompStrLen; rc->dwTargetStrOffset =rc->dwCompStrOffset; -- cgit v1.2.3