From c150ece20fd339eef0d149461dd04e37bdc2c9f9 Mon Sep 17 00:00:00 2001 From: catalinr Date: Mon, 14 Oct 2019 07:49:28 +0300 Subject: [PATCH] Cast int to double to avoid arithmetic overflow warning --- include/wx/geometry.h | 4 ++-- include/wx/math.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/wx/geometry.h b/include/wx/geometry.h index a3b3f1b8c7..513ff1385e 100644 --- a/include/wx/geometry.h +++ b/include/wx/geometry.h @@ -133,7 +133,7 @@ inline void wxPoint2DInt::GetRounded( wxInt32 *x , wxInt32 *y ) const inline wxDouble wxPoint2DInt::GetVectorLength() const { // cast needed MIPSpro compiler under SGI - return sqrt( (double)(m_x)*(m_x) + (m_y)*(m_y) ); + return sqrt( (wxDouble)(m_x)*(m_x) + (wxDouble)(m_y)*(m_y) ); } inline void wxPoint2DInt::SetVectorLength( wxDouble length ) @@ -155,7 +155,7 @@ inline wxDouble wxPoint2DInt::GetDistance( const wxPoint2DInt &pt ) const inline wxDouble wxPoint2DInt::GetDistanceSquare( const wxPoint2DInt &pt ) const { - return ( (pt.m_x-m_x)*(pt.m_x-m_x) + (pt.m_y-m_y)*(pt.m_y-m_y) ); + return ( (wxDouble)(pt.m_x-m_x)*(pt.m_x-m_x) + (wxDouble)(pt.m_y-m_y)*(pt.m_y-m_y) ); } inline wxInt32 wxPoint2DInt::GetDotProduct( const wxPoint2DInt &vec ) const diff --git a/include/wx/math.h b/include/wx/math.h index 261969d364..89d0bc719f 100644 --- a/include/wx/math.h +++ b/include/wx/math.h @@ -136,7 +136,7 @@ inline bool wxIsNullDouble(double x) { return wxIsSameDouble(x, 0.); } inline int wxRound(double x) { - wxASSERT_MSG( x > INT_MIN - 0.5 && x < INT_MAX + 0.5, + wxASSERT_MSG( x > (double)INT_MIN - 0.5 && x < (double)INT_MAX + 0.5, wxT("argument out of supported range") ); #if defined(HAVE_ROUND)