Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-25 13:27:46 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 15:31:31 +0300
commit21d77a417e17ac92bfc10dbd742c867d4019ce69 (patch)
treeec664b5c6ca7882bcc5a1e1ce09cad67b842af9d /intern/ghost
parentd35a10134cfdbd3e24a56218ef3f05aac2a2fc7e (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8.
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_DropTargetWin32.cpp2
-rw-r--r--intern/ghost/intern/GHOST_EventPrinter.cpp2
-rw-r--r--intern/ghost/intern/GHOST_NDOFManagerUnix.cpp4
-rw-r--r--intern/ghost/intern/GHOST_PathUtils.cpp4
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp2
-rw-r--r--intern/ghost/intern/GHOST_WindowSDL.cpp2
-rw-r--r--intern/ghost/intern/GHOST_Wintab.cpp8
-rw-r--r--intern/ghost/intern/GHOST_XrControllerModel.cpp26
-rw-r--r--intern/ghost/intern/GHOST_XrSession.cpp2
-rw-r--r--intern/ghost/test/gears/GHOST_Test.cpp2
10 files changed, 27 insertions, 27 deletions
diff --git a/intern/ghost/intern/GHOST_DropTargetWin32.cpp b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
index 2831f2ee8ad..a38af619662 100644
--- a/intern/ghost/intern/GHOST_DropTargetWin32.cpp
+++ b/intern/ghost/intern/GHOST_DropTargetWin32.cpp
@@ -341,7 +341,7 @@ void printLastError(void)
(LPTSTR)&s,
0,
NULL)) {
- printf("\nLastError: (%d) %s\n", (int)err, s);
+ printf("\nLastError: (%d) %s\n", int(err), s);
LocalFree(s);
}
}
diff --git a/intern/ghost/intern/GHOST_EventPrinter.cpp b/intern/ghost/intern/GHOST_EventPrinter.cpp
index 7c20cd701b0..0d7f05009ff 100644
--- a/intern/ghost/intern/GHOST_EventPrinter.cpp
+++ b/intern/ghost/intern/GHOST_EventPrinter.cpp
@@ -161,7 +161,7 @@ bool GHOST_EventPrinter::processEvent(GHOST_IEvent *event)
void GHOST_EventPrinter::getKeyString(GHOST_TKey key, char str[32]) const
{
if ((key >= GHOST_kKeyComma) && (key <= GHOST_kKeyRightBracket)) {
- sprintf(str, "%c", (char)key);
+ sprintf(str, "%c", char(key));
}
else if ((key >= GHOST_kKeyNumpad0) && (key <= GHOST_kKeyNumpad9)) {
sprintf(str, "Numpad %d", (key - GHOST_kKeyNumpad0));
diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
index 7770f5f39ce..6cf9aa1ed04 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
@@ -86,8 +86,8 @@ bool GHOST_NDOFManagerUnix::processEvents()
case SPNAV_EVENT_MOTION: {
/* convert to blender view coords */
uint64_t now = m_system.getMilliSeconds();
- const int t[3] = {(int)e.motion.x, (int)e.motion.y, (int)-e.motion.z};
- const int r[3] = {(int)-e.motion.rx, (int)-e.motion.ry, (int)e.motion.rz};
+ const int t[3] = {int(e.motion.x), int(e.motion.y), int(-e.motion.z)};
+ const int r[3] = {int(-e.motion.rx), int(-e.motion.ry), int(e.motion.rz)};
updateTranslation(t, now);
updateRotation(r, now);
diff --git a/intern/ghost/intern/GHOST_PathUtils.cpp b/intern/ghost/intern/GHOST_PathUtils.cpp
index 3b57480039a..bcccd369460 100644
--- a/intern/ghost/intern/GHOST_PathUtils.cpp
+++ b/intern/ghost/intern/GHOST_PathUtils.cpp
@@ -37,7 +37,7 @@ void GHOST_URL_decode(char *buf_dst, int buf_dst_size, const char *buf_src)
case STATE_SEARCH: {
if (buf_src[i] != '%') {
strncat(buf_dst, &buf_src[i], 1);
- assert((int)strlen(buf_dst) < buf_dst_size);
+ assert(int(strlen(buf_dst)) < buf_dst_size);
break;
}
@@ -71,7 +71,7 @@ void GHOST_URL_decode(char *buf_dst, int buf_dst_size, const char *buf_src)
sscanf(temp_num_buf, "%x", &ascii_character);
/* Ensure we aren't going to overflow. */
- assert((int)strlen(buf_dst) < buf_dst_size);
+ assert(int(strlen(buf_dst)) < buf_dst_size);
/* Concatenate this character onto the output. */
strncat(buf_dst, (char *)&ascii_character, 1);
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index a383710256a..5c1ac157980 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -2470,7 +2470,7 @@ GHOST_TSuccess GHOST_SystemX11::showMessageBox(const char *title,
dialog_data.padding_x,
dialog_data.padding_x + (i + 1) * dialog_data.line_height,
text_splitted[i],
- (int)strlen(text_splitted[i]));
+ int(strlen(text_splitted[i])));
}
dialog_data.drawButton(m_display, window, buttonBorderGC, buttonGC, 1, continue_label);
if (strlen(link)) {
diff --git a/intern/ghost/intern/GHOST_WindowSDL.cpp b/intern/ghost/intern/GHOST_WindowSDL.cpp
index 64642abc2af..6866f01736f 100644
--- a/intern/ghost/intern/GHOST_WindowSDL.cpp
+++ b/intern/ghost/intern/GHOST_WindowSDL.cpp
@@ -551,7 +551,7 @@ static SDL_Cursor *getStandardCursorShape(GHOST_TStandardCursor shape)
sdl_std_cursor_HEIGHT_##name, \
(sdl_std_cursor_WIDTH_##name + (sdl_std_cursor_HOT_X_##name)) - 1, \
(sdl_std_cursor_HEIGHT_##name + (sdl_std_cursor_HOT_Y_##name)) - 1); \
- assert(sdl_std_cursor_array[(int)ind] != nullptr); \
+ assert(sdl_std_cursor_array[int(ind)] != nullptr); \
} \
(void)0
diff --git a/intern/ghost/intern/GHOST_Wintab.cpp b/intern/ghost/intern/GHOST_Wintab.cpp
index c75a39bb34b..edc5f18af4d 100644
--- a/intern/ghost/intern/GHOST_Wintab.cpp
+++ b/intern/ghost/intern/GHOST_Wintab.cpp
@@ -331,7 +331,7 @@ void GHOST_Wintab::getInput(std::vector<GHOST_WintabInfoWin32> &outWintabInfo)
out.y = pkt.pkY;
if (m_maxPressure > 0) {
- out.tabletData.Pressure = (float)pkt.pkNormalPressure / (float)m_maxPressure;
+ out.tabletData.Pressure = float(pkt.pkNormalPressure) / float(m_maxPressure);
}
if ((m_maxAzimuth > 0) && (m_maxAltitude > 0)) {
@@ -351,15 +351,15 @@ void GHOST_Wintab::getInput(std::vector<GHOST_WintabInfoWin32> &outWintabInfo)
ORIENTATION ort = pkt.pkOrientation;
/* Convert raw fixed point data to radians. */
- float altRad = (float)((fabs((float)ort.orAltitude) / (float)m_maxAltitude) * M_PI_2);
- float azmRad = (float)(((float)ort.orAzimuth / (float)m_maxAzimuth) * M_PI * 2.0);
+ float altRad = float((fabs(float(ort.orAltitude)) / float(m_maxAltitude)) * M_PI_2);
+ float azmRad = float((float(ort.orAzimuth) / float(m_maxAzimuth)) * M_PI * 2.0);
/* Find length of the stylus' projected vector on the XY plane. */
float vecLen = cos(altRad);
/* From there calculate X and Y components based on azimuth. */
out.tabletData.Xtilt = sin(azmRad) * vecLen;
- out.tabletData.Ytilt = (float)(sin(M_PI_2 - azmRad) * vecLen);
+ out.tabletData.Ytilt = float(sin(M_PI_2 - azmRad) * vecLen);
}
out.time = pkt.pkTime;
diff --git a/intern/ghost/intern/GHOST_XrControllerModel.cpp b/intern/ghost/intern/GHOST_XrControllerModel.cpp
index 5be3a8e70ad..dc77f6e8976 100644
--- a/intern/ghost/intern/GHOST_XrControllerModel.cpp
+++ b/intern/ghost/intern/GHOST_XrControllerModel.cpp
@@ -230,10 +230,10 @@ static void calc_node_transforms(const tinygltf::Node &gltf_node,
* both. */
if (gltf_node.matrix.size() == 16) {
const std::vector<double> &dm = gltf_node.matrix;
- float m[4][4] = {{(float)dm[0], (float)dm[1], (float)dm[2], (float)dm[3]},
- {(float)dm[4], (float)dm[5], (float)dm[6], (float)dm[7]},
- {(float)dm[8], (float)dm[9], (float)dm[10], (float)dm[11]},
- {(float)dm[12], (float)dm[13], (float)dm[14], (float)dm[15]}};
+ float m[4][4] = {{float(dm[0]), float(dm[1]), float(dm[2]), float(dm[3])},
+ {float(dm[4]), float(dm[5]), float(dm[6]), float(dm[7])},
+ {float(dm[8]), float(dm[9]), float(dm[10]), float(dm[11])},
+ {float(dm[12]), float(dm[13]), float(dm[14]), float(dm[15])}};
memcpy(r_local_transform, m, sizeof(float[4][4]));
}
else {
@@ -259,21 +259,21 @@ static void calc_node_transforms(const tinygltf::Node &gltf_node,
scale[0] = scale[1] = scale[2] = 1.0;
}
- q.w() = (float)rotation[3];
- q.x() = (float)rotation[0];
- q.y() = (float)rotation[1];
- q.z() = (float)rotation[2];
+ q.w() = float(rotation[3]);
+ q.x() = float(rotation[0]);
+ q.y() = float(rotation[1]);
+ q.z() = float(rotation[2]);
q.normalize();
scalemat.setIdentity();
- scalemat(0, 0) = (float)scale[0];
- scalemat(1, 1) = (float)scale[1];
- scalemat(2, 2) = (float)scale[2];
+ scalemat(0, 0) = float(scale[0]);
+ scalemat(1, 1) = float(scale[1]);
+ scalemat(2, 2) = float(scale[2]);
m.setIdentity();
m.block<3, 3>(0, 0) = q.toRotationMatrix() * scalemat;
m.block<3, 1>(0, 3) = Eigen::Vector3f(
- (float)translation[0], (float)translation[1], (float)translation[2]);
+ float(translation[0]), float(translation[1]), float(translation[2]));
}
*(Eigen::Matrix4f *)r_world_transform = *(Eigen::Matrix4f *)parent_transform *
@@ -450,7 +450,7 @@ void GHOST_XrControllerModel::loadControllerModel(XrSession session)
CHECK_XR(g_xrLoadControllerModelMSFT(session, m_model_key, 0, &buf_size, nullptr),
"Failed to get controller model buffer size.");
- std::vector<uint8_t> buf((size_t)buf_size);
+ std::vector<uint8_t> buf((size_t(buf_size)));
CHECK_XR(g_xrLoadControllerModelMSFT(session, m_model_key, buf_size, &buf_size, buf.data()),
"Failed to load controller model binary buffers.");
diff --git a/intern/ghost/intern/GHOST_XrSession.cpp b/intern/ghost/intern/GHOST_XrSession.cpp
index 1966a4e77da..0031c1f1278 100644
--- a/intern/ghost/intern/GHOST_XrSession.cpp
+++ b/intern/ghost/intern/GHOST_XrSession.cpp
@@ -484,7 +484,7 @@ void GHOST_XrSession::drawView(GHOST_XrSwapchain &swapchain,
swapchain.updateCompositionLayerProjectViewSubImage(r_proj_layer_view.subImage);
assert(view_idx < 256);
- draw_view_info.view_idx = (char)view_idx;
+ draw_view_info.view_idx = char(view_idx);
draw_view_info.swapchain_format = swapchain.getFormat();
draw_view_info.expects_srgb_buffer = swapchain.isBufferSRGB();
draw_view_info.ofsx = r_proj_layer_view.subImage.imageRect.offset.x;
diff --git a/intern/ghost/test/gears/GHOST_Test.cpp b/intern/ghost/test/gears/GHOST_Test.cpp
index f5ef2527d75..1891f1eca77 100644
--- a/intern/ghost/test/gears/GHOST_Test.cpp
+++ b/intern/ghost/test/gears/GHOST_Test.cpp
@@ -57,7 +57,7 @@ void StereoProjection(float left,
static void testTimerProc(GHOST_ITimerTask * /*task*/, uint64_t time)
{
- std::cout << "timer1, time=" << (int)time << "\n";
+ std::cout << "timer1, time=" << int(time) << "\n";
}
static void gearGL(