diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-07 19:44:59 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-07 19:44:59 +1000 |
commit | 1595b1fbedf5587bc7c60cc7a1156ac1bca69f59 (patch) | |
tree | 351e4826ae9f0f2996ac82d8c0c89c428bcb30b2 /win32 | |
parent | d97e0e4187f3130e2f06bc032040bc25485a2ece (diff) | |
download | scintilla-mirror-1595b1fbedf5587bc7c60cc7a1156ac1bca69f59.tar.gz |
Prefer C++ static cast over C-style casts.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/PlatWin.cxx | 4 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 10 |
2 files changed, 7 insertions, 7 deletions
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<float>(static_cast<int>(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<DWORD>(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<int>(rcFeed.length()) * sizeof(wchar_t); const int rcSize = sizeof(RECONVERTSTRING) + rcFeedLen + sizeof(wchar_t); - RECONVERTSTRING *rc = (RECONVERTSTRING *)lParam; + RECONVERTSTRING *rc = reinterpret_cast<RECONVERTSTRING *>(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<wchar_t*>(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<int>(rcFeed.length()); + rc->dwStrLen = static_cast<DWORD>(rcFeed.length()); rc->dwStrOffset = sizeof(RECONVERTSTRING); - rc->dwCompStrLen = (DWORD)static_cast<int>(rcCompWstring.length()); - rc->dwCompStrOffset = (DWORD)static_cast<int>(rcCompWstart.length()) * sizeof(wchar_t); + rc->dwCompStrLen = static_cast<DWORD>(rcCompWstring.length()); + rc->dwCompStrOffset = static_cast<DWORD>(rcCompWstart.length()) * sizeof(wchar_t); rc->dwTargetStrLen = rc->dwCompStrLen; rc->dwTargetStrOffset =rc->dwCompStrOffset; |