Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8.
This commit is contained in:
parent
e746999aa9
commit
15f3cf7f8f
@ -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 {
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -971,8 +971,8 @@ struct Icon_Geom *BKE_icon_geom_from_memory(uchar *data, size_t data_len)
|
||||
p += 4;
|
||||
|
||||
struct Icon_Geom *geom = (struct Icon_Geom *)MEM_mallocN(sizeof(*geom), __func__);
|
||||
geom->coords_range[0] = (int)*p++;
|
||||
geom->coords_range[1] = (int)*p++;
|
||||
geom->coords_range[0] = int(*p++);
|
||||
geom->coords_range[1] = int(*p++);
|
||||
/* x, y ignored for now */
|
||||
p += 2;
|
||||
|
||||
|
@ -159,8 +159,8 @@ static void scene_init_data(ID *id)
|
||||
scene->unit.length_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_LENGTH));
|
||||
scene->unit.mass_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_MASS));
|
||||
scene->unit.time_unit = uchar(BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TIME));
|
||||
scene->unit.temperature_unit = (uchar)BKE_unit_base_of_type_get(USER_UNIT_METRIC,
|
||||
B_UNIT_TEMPERATURE);
|
||||
scene->unit.temperature_unit = uchar(
|
||||
BKE_unit_base_of_type_get(USER_UNIT_METRIC, B_UNIT_TEMPERATURE));
|
||||
|
||||
/* Anti-Aliasing threshold. */
|
||||
scene->grease_pencil_settings.smaa_threshold = 1.0f;
|
||||
|
@ -108,13 +108,13 @@ static void test_polyfill_topology(const float /*poly*/[][2],
|
||||
const uint v2 = (i + 1) % poly_num;
|
||||
void **p = BLI_edgehash_lookup_p(edgehash, v1, v2);
|
||||
EXPECT_NE((void *)p, nullptr);
|
||||
EXPECT_EQ((intptr_t)*p, 1);
|
||||
EXPECT_EQ(intptr_t(*p), 1);
|
||||
}
|
||||
|
||||
for (ehi = BLI_edgehashIterator_new(edgehash), i = 0; BLI_edgehashIterator_isDone(ehi) == false;
|
||||
BLI_edgehashIterator_step(ehi), i++) {
|
||||
void **p = BLI_edgehashIterator_getValue_p(ehi);
|
||||
EXPECT_TRUE(ELEM((intptr_t)*p, 1, 2));
|
||||
EXPECT_TRUE(ELEM(intptr_t(*p), 1, 2));
|
||||
}
|
||||
|
||||
BLI_edgehashIterator_free(ehi);
|
||||
|
@ -191,7 +191,7 @@ TEST(stack, OveralignedValues)
|
||||
Stack<AlignedBuffer<1, 512>, 2> stack;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
stack.push({});
|
||||
EXPECT_EQ((uintptr_t)&stack.peek() % 512, 0);
|
||||
EXPECT_EQ(uintptr_t(&stack.peek()) % 512, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ TEST(vector, OveralignedValues)
|
||||
Vector<AlignedBuffer<1, 512>, 2> vec;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
vec.append({});
|
||||
EXPECT_EQ((uintptr_t)&vec.last() % 512, 0);
|
||||
EXPECT_EQ(uintptr_t(&vec.last()) % 512, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ TEST(bmesh_core, BMVertCreate)
|
||||
EXPECT_EQ(bv1->co[1], 2.0f);
|
||||
EXPECT_EQ(bv1->co[2], 0.0f);
|
||||
EXPECT_TRUE(is_zero_v3(bv1->no));
|
||||
EXPECT_EQ(bv1->head.htype, (char)BM_VERT);
|
||||
EXPECT_EQ(bv1->head.htype, char(BM_VERT));
|
||||
EXPECT_EQ(bv1->head.hflag, 0);
|
||||
EXPECT_EQ(bv1->head.api_flag, 0);
|
||||
bv2 = BM_vert_create(bm, nullptr, nullptr, BM_CREATE_NOP);
|
||||
|
@ -2241,7 +2241,7 @@ static void draw_armature_edit(ArmatureDrawContext *ctx)
|
||||
eBone = eBone->next, index += 0x10000) {
|
||||
if (eBone->layer & arm->layer) {
|
||||
if ((eBone->flag & BONE_HIDDEN_A) == 0) {
|
||||
const int select_id = is_select ? index : (uint)-1;
|
||||
const int select_id = is_select ? index : uint(-1);
|
||||
const short constflag = 0;
|
||||
|
||||
/* catch exception for bone with hidden parent */
|
||||
@ -2378,7 +2378,7 @@ static void draw_armature_pose(ArmatureDrawContext *ctx)
|
||||
(arm->flag & ARM_POSEMODE) && (bone->flag & BONE_SELECTED) &&
|
||||
((ob->base_flag & BASE_FROM_DUPLI) == 0) &&
|
||||
(pchan->ikflag & (BONE_IK_XLIMIT | BONE_IK_ZLIMIT));
|
||||
const int select_id = is_pose_select ? index : (uint)-1;
|
||||
const int select_id = is_pose_select ? index : uint(-1);
|
||||
const short constflag = pchan->constflag;
|
||||
|
||||
pchan_draw_data_init(pchan);
|
||||
|
Loading…
Reference in New Issue
Block a user