From 15f3cf7f8f956a6372b6a99788b622946ba3d1e5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 26 Sep 2022 09:53:49 +1000 Subject: Cleanup: replace C-style casts with functional casts for numeric types Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8. --- intern/cycles/blender/python.cpp | 2 +- intern/ghost/intern/GHOST_SystemWin32.cpp | 10 +++++----- intern/ghost/intern/GHOST_SystemX11.cpp | 4 ++-- intern/ghost/intern/GHOST_WindowWin32.cpp | 2 +- intern/guardedalloc/tests/guardedalloc_alignment_test.cc | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'intern') diff --git a/intern/cycles/blender/python.cpp b/intern/cycles/blender/python.cpp index 1e33b0b7207..077875aecb2 100644 --- a/intern/cycles/blender/python.cpp +++ b/intern/cycles/blender/python.cpp @@ -534,7 +534,7 @@ static PyObject *osl_update_node_func(PyObject * /*self*/, PyObject *args) socket_type = "NodeSocketBool"; data_type = BL::NodeSocket::type_BOOLEAN; if (param->validdefault) { - default_boolean = (bool)param->idefault[0]; + default_boolean = bool(param->idefault[0]); } } else { diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 5c58f9a856c..5a840d869b3 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -562,7 +562,7 @@ GHOST_TKey GHOST_SystemWin32::processSpecialKey(short vKey, short scanCode) cons return key; } - char ch = (char)MapVirtualKeyA(vKey, MAPVK_VK_TO_CHAR); + char ch = char(MapVirtualKeyA(vKey, MAPVK_VK_TO_CHAR)); switch (ch) { case u'\"': case u'\'': @@ -1747,10 +1747,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } case WM_XBUTTONDOWN: { - if ((short)HIWORD(wParam) == XBUTTON1) { + if (short(HIWORD(wParam)) == XBUTTON1) { event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton4); } - else if ((short)HIWORD(wParam) == XBUTTON2) { + else if (short(HIWORD(wParam)) == XBUTTON2) { event = processButtonEvent(GHOST_kEventButtonDown, window, GHOST_kButtonMaskButton5); } break; @@ -1768,10 +1768,10 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } case WM_XBUTTONUP: { - if ((short)HIWORD(wParam) == XBUTTON1) { + if (short(HIWORD(wParam)) == XBUTTON1) { event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton4); } - else if ((short)HIWORD(wParam) == XBUTTON2) { + else if (short(HIWORD(wParam)) == XBUTTON2) { event = processButtonEvent(GHOST_kEventButtonUp, window, GHOST_kButtonMaskButton5); } break; diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 5c1ac157980..89b4b31468b 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1152,7 +1152,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) } if (ELEM(status, XLookupChars, XLookupBoth)) { - if ((unsigned char)utf8_buf[0] >= 32) { /* not an ascii control character */ + if (uchar(utf8_buf[0]) >= 32) { /* not an ascii control character */ /* do nothing for now, this is valid utf8 */ } else { @@ -1165,7 +1165,7 @@ void GHOST_SystemX11::processEvent(XEvent *xe) } else { printf("Bad keycode lookup. Keysym 0x%x Status: %s\n", - (unsigned int)key_sym, + uint(key_sym), (status == XLookupNone ? "XLookupNone" : status == XLookupKeySym ? "XLookupKeySym" : "Unknown status")); diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 50ee9385e39..e2d143ee5e6 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -89,7 +89,7 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system, */ } - RECT win_rect = {left, top, (long)(left + width), (long)(top + height)}; + RECT win_rect = {left, top, long(left + width), long(top + height)}; adjustWindowRectForClosestMonitor(&win_rect, style, extended_style); wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0); diff --git a/intern/guardedalloc/tests/guardedalloc_alignment_test.cc b/intern/guardedalloc/tests/guardedalloc_alignment_test.cc index ceda01c2fba..b1a2143c8dc 100644 --- a/intern/guardedalloc/tests/guardedalloc_alignment_test.cc +++ b/intern/guardedalloc/tests/guardedalloc_alignment_test.cc @@ -7,7 +7,7 @@ #include "MEM_guardedalloc.h" #include "guardedalloc_test_base.h" -#define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ((size_t)ptr % align, 0) +#define CHECK_ALIGNMENT(ptr, align) EXPECT_EQ(size_t(ptr) % align, 0) namespace { -- cgit v1.2.3