[Bf-blender-cvs] [74e0f90] master: Fix a few compile errors with C++11 on macOS.

Brecht Van Lommel noreply at git.blender.org
Sat Oct 8 15:07:31 CEST 2016


Commit: 74e0f900c54ea57a48e0c84c51dd6859cc34d248
Author: Brecht Van Lommel
Date:   Wed Sep 14 11:41:20 2016 +0200
Branches: master
https://developer.blender.org/rB74e0f900c54ea57a48e0c84c51dd6859cc34d248

Fix a few compile errors with C++11 on macOS.

===================================================================

M	intern/ghost/intern/GHOST_NDOFManager.cpp
M	intern/ghost/intern/GHOST_NDOFManager.h
M	intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
M	intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
M	intern/ghost/intern/GHOST_SystemWin32.cpp
M	source/blender/render/intern/raytrace/rayobject_rtbuild.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_NDOFManager.cpp b/intern/ghost/intern/GHOST_NDOFManager.cpp
index c8e14ad..cab9bf4 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManager.cpp
@@ -324,14 +324,14 @@ bool GHOST_NDOFManager::setDevice(unsigned short vendor_id, unsigned short produ
 	return m_deviceType != NDOF_UnknownDevice;
 }
 
-void GHOST_NDOFManager::updateTranslation(const short t[3], GHOST_TUns64 time)
+void GHOST_NDOFManager::updateTranslation(const int t[3], GHOST_TUns64 time)
 {
 	memcpy(m_translation, t, sizeof(m_translation));
 	m_motionTime = time;
 	m_motionEventPending = true;
 }
 
-void GHOST_NDOFManager::updateRotation(const short r[3], GHOST_TUns64 time)
+void GHOST_NDOFManager::updateRotation(const int r[3], GHOST_TUns64 time)
 {
 	memcpy(m_rotation, r, sizeof(m_rotation));
 	m_motionTime = time;
diff --git a/intern/ghost/intern/GHOST_NDOFManager.h b/intern/ghost/intern/GHOST_NDOFManager.h
index 83d06ef..0c0b945 100644
--- a/intern/ghost/intern/GHOST_NDOFManager.h
+++ b/intern/ghost/intern/GHOST_NDOFManager.h
@@ -138,8 +138,8 @@ public:
 	//       rotations are + when CCW, - when CW
 	// each platform is responsible for getting axis data into this form
 	// these values should not be scaled (just shuffled or flipped)
-	void updateTranslation(const short t[3], GHOST_TUns64 time);
-	void updateRotation(const short r[3], GHOST_TUns64 time);
+	void updateTranslation(const int t[3], GHOST_TUns64 time);
+	void updateRotation(const int r[3], GHOST_TUns64 time);
 
 	// the latest raw button data from the device
 	// use HID button encoding (not NDOF_ButtonT)
@@ -163,8 +163,8 @@ private:
 	int m_buttonMask;
 	const NDOF_ButtonT *m_hidMap;
 
-	short m_translation[3];
-	short m_rotation[3];
+	int m_translation[3];
+	int m_rotation[3];
 	int m_buttons; // bit field
 
 	GHOST_TUns64 m_motionTime; // in milliseconds
diff --git a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
index 3cce6bf..e6fbc96 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
+++ b/intern/ghost/intern/GHOST_NDOFManagerCocoa.mm
@@ -200,8 +200,8 @@ static void DeviceEvent(uint32_t unused, uint32_t msg_type, void* msg_arg)
 				case kConnexionCmdHandleAxis:
 				{
 					// convert to blender view coordinates
-					const short t[3] = {s->axis[0], -(s->axis[2]), s->axis[1]};
-					const short r[3] = {-(s->axis[3]), s->axis[5], -(s->axis[4])};
+					const int t[3] = {s->axis[0], -(s->axis[2]), s->axis[1]};
+					const int r[3] = {-(s->axis[3]), s->axis[5], -(s->axis[4])};
 
 					ndof_manager->updateTranslation(t, now);
 					ndof_manager->updateRotation(r, now);
diff --git a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
index ded13b5..fff5aba 100644
--- a/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
+++ b/intern/ghost/intern/GHOST_NDOFManagerUnix.cpp
@@ -107,8 +107,8 @@ bool GHOST_NDOFManagerUnix::processEvents()
 				{
 					/* convert to blender view coords */
 					GHOST_TUns64 now = m_system.getMilliSeconds();
-					const short t[3] = {(short)e.motion.x, (short)e.motion.y, (short)-e.motion.z};
-					const short r[3] = {(short)-e.motion.rx, (short)-e.motion.ry, (short)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);
@@ -128,7 +128,7 @@ bool GHOST_NDOFManagerUnix::processEvents()
 #ifdef USE_FINISH_GLITCH_WORKAROUND
 		if (motion_test_prev == true && motion_test == false) {
 			GHOST_TUns64 now = m_system.getMilliSeconds();
-			const short v[3] = {0, 0, 0};
+			const int v[3] = {0, 0, 0};
 
 			updateTranslation(v, now);
 			updateRotation(v, now);
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index e436345..7d55a97 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -879,12 +879,12 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw)
 		{
 			const short *axis = (short *)(data + 1);
 			// massage into blender view coords (same goes for rotation)
-			const short t[3] = {axis[0], -axis[2], axis[1]};
+			const int t[3] = {axis[0], -axis[2], axis[1]};
 			m_ndofManager->updateTranslation(t, now);
 
 			if (raw.data.hid.dwSizeHid == 13) {
 				// this report also includes rotation
-				const short r[3] = {-axis[3], axis[5], -axis[4]};
+				const int r[3] = {-axis[3], axis[5], -axis[4]};
 				m_ndofManager->updateRotation(r, now);
 
 				// I've never gotten one of these, has anyone else?
@@ -895,7 +895,7 @@ bool GHOST_SystemWin32::processNDOF(RAWINPUT const &raw)
 		case 2: // rotation
 		{
 			const short *axis = (short *)(data + 1);
-			const short r[3] = {-axis[0], axis[2], -axis[1]};
+			const int r[3] = {-axis[0], axis[2], -axis[1]};
 			m_ndofManager->updateRotation(r, now);
 			break;
 		}
diff --git a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
index 724a809..81e41a2 100644
--- a/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
+++ b/source/blender/render/intern/raytrace/rayobject_rtbuild.cpp
@@ -31,10 +31,16 @@
 
 
 #include <assert.h>
-#include <math.h>
 #include <stdlib.h>
 #include <algorithm>
 
+#if __cplusplus >= 201103L
+#include <cmath>
+using std::isfinite;
+#else
+#include <math.h>
+#endif
+
 #include "rayobject_rtbuild.h"
 
 #include "MEM_guardedalloc.h"
@@ -42,10 +48,6 @@
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
-#if __cplusplus >= 201103L
-using std::isfinite;
-#endif
-
 static bool selected_node(RTBuilder::Object *node)
 {
 	return node->selected;




More information about the Bf-blender-cvs mailing list