Base: Replace C cast
This commit is contained in:
committed by
Chris Hennes
parent
544d5a27b8
commit
1972dfe5a3
@@ -48,7 +48,7 @@ PyException::PyException(const Py::Object &obj) {
|
||||
// WARNING: we are assuming that python type object will never be
|
||||
// destroyed, so we don't keep reference here to save book-keeping in
|
||||
// our copy constructor and destructor
|
||||
_exceptionType = (PyObject*)obj.ptr()->ob_type;
|
||||
_exceptionType = reinterpret_cast<PyObject*>(obj.ptr()->ob_type);
|
||||
_errorType = obj.ptr()->ob_type->tp_name;
|
||||
}
|
||||
|
||||
|
||||
@@ -393,7 +393,7 @@ PyObject *PyObjectBase::_getattr(const char *attr)
|
||||
// Note: We must return the type object here,
|
||||
// so that our own types feel as really Python objects
|
||||
Py_INCREF(Py_TYPE(this));
|
||||
return (PyObject *)(Py_TYPE(this));
|
||||
return reinterpret_cast<PyObject *>(Py_TYPE(this));
|
||||
}
|
||||
else if (streq(attr, "__members__")) {
|
||||
// Use __dict__ instead as __members__ is deprecated
|
||||
|
||||
@@ -921,7 +921,7 @@ Rotation::EulerSequence Rotation::eulerSequenceFromName(const char *name)
|
||||
if (name) {
|
||||
for (unsigned i=0; i<sizeof(EulerSequenceNames)/sizeof(EulerSequenceNames[0]); ++i) {
|
||||
if (boost::iequals(name, EulerSequenceNames[i]))
|
||||
return (EulerSequence)(i+1);
|
||||
return static_cast<EulerSequence>(i+1);
|
||||
}
|
||||
}
|
||||
return Invalid;
|
||||
|
||||
@@ -247,14 +247,14 @@ _Precision Vector3<_Precision>::DistanceToPlane (const Vector3<_Precision> &rclB
|
||||
template <class _Precision>
|
||||
_Precision Vector3<_Precision>::Length () const
|
||||
{
|
||||
return (_Precision)sqrt ((x * x) + (y * y) + (z * z));
|
||||
return static_cast<_Precision>(sqrt ((x * x) + (y * y) + (z * z)));
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
_Precision Vector3<_Precision>::DistanceToLine (const Vector3<_Precision> &rclBase,
|
||||
const Vector3<_Precision> &rclDirect) const
|
||||
{
|
||||
return (_Precision) fabs((rclDirect % Vector3(*this - rclBase)).Length() / rclDirect.Length());
|
||||
return static_cast<_Precision>(fabs((rclDirect % Vector3(*this - rclBase)).Length() / rclDirect.Length()));
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
@@ -360,8 +360,8 @@ void Vector3<_Precision>::RotateX (_Precision f)
|
||||
Vector3 cPt (*this);
|
||||
_Precision fsin, fcos;
|
||||
|
||||
fsin = (_Precision)sin (f);
|
||||
fcos = (_Precision)cos (f);
|
||||
fsin = static_cast<_Precision>(sin(f));
|
||||
fcos = static_cast<_Precision>(cos(f));
|
||||
y = (cPt.y * fcos) - (cPt.z * fsin);
|
||||
z = (cPt.y * fsin) + (cPt.z * fcos);
|
||||
}
|
||||
@@ -372,8 +372,8 @@ void Vector3<_Precision>::RotateY (_Precision f)
|
||||
Vector3 cPt (*this);
|
||||
_Precision fsin, fcos;
|
||||
|
||||
fsin = (_Precision)sin (f);
|
||||
fcos = (_Precision)cos (f);
|
||||
fsin = static_cast<_Precision>(sin(f));
|
||||
fcos = static_cast<_Precision>(cos(f));
|
||||
x = (cPt.z * fsin) + (cPt.x * fcos);
|
||||
z = (cPt.z * fcos) - (cPt.x * fsin);
|
||||
}
|
||||
@@ -384,8 +384,8 @@ void Vector3<_Precision>::RotateZ (_Precision f)
|
||||
Vector3 cPt (*this);
|
||||
_Precision fsin, fcos;
|
||||
|
||||
fsin = (_Precision)sin (f);
|
||||
fcos = (_Precision)cos (f);
|
||||
fsin = static_cast<_Precision>(sin(f));
|
||||
fcos = static_cast<_Precision>(cos(f));
|
||||
x = (cPt.x * fcos) - (cPt.y * fsin);
|
||||
y = (cPt.x * fsin) + (cPt.y * fcos);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ template <class _Precision>
|
||||
Vector3<_Precision> & Vector3<_Precision>::Normalize ()
|
||||
{
|
||||
_Precision fLen = Length ();
|
||||
if (fLen != (_Precision)0.0 && fLen != (_Precision)1.0) {
|
||||
if (fLen != static_cast<_Precision>(0.0) && fLen != static_cast<_Precision>(1.0)) {
|
||||
x /= fLen;
|
||||
y /= fLen;
|
||||
z /= fLen;
|
||||
|
||||
Reference in New Issue
Block a user