From e8b8be637bf63f4ff530c2ec6d0abb89da50035f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 13 Feb 2012 15:53:41 -0800 Subject: Fix Linux compile issue : make templated type casting explicit --- indra/llmath/llcoord.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llmath/llcoord.h') diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h index 1f617e649e..533aa2978b 100644 --- a/indra/llmath/llcoord.h +++ b/indra/llmath/llcoord.h @@ -45,7 +45,7 @@ public: LLCoord(): mX(0), mY(0) {} - LLCoord(S32 x, S32 y): mX(x), mY(y) + LLCoord(S32 x, S32 y): mX((typename COORD_FRAME::value_t)(x)), mY((typename COORD_FRAME::value_t)(y)) {} LLCoord(const LLCoordCommon& other) -- cgit v1.2.3 From 5c8bcc4643e8f2e02c96847e3eeeced0d2b4157a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 13 Feb 2012 16:39:35 -0800 Subject: Fix Linux compile issue : make templated type casting explicit (2) --- indra/llmath/llcoord.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llmath/llcoord.h') diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h index 533aa2978b..756e23dbdf 100644 --- a/indra/llmath/llcoord.h +++ b/indra/llmath/llcoord.h @@ -45,7 +45,7 @@ public: LLCoord(): mX(0), mY(0) {} - LLCoord(S32 x, S32 y): mX((typename COORD_FRAME::value_t)(x)), mY((typename COORD_FRAME::value_t)(y)) + LLCoord(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y): mX(x), mY(y) {} LLCoord(const LLCoordCommon& other) @@ -58,7 +58,7 @@ public: return COORD_FRAME::convertToCommon(); } - void set(S32 x, S32 y) { mX = x; mY = y;} + void set(typename COORD_FRAME::value_t x, typename COORD_FRAME::value_t y) { mX = x; mY = y;} bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; } bool operator!=(const self_t& other) const { return !(*this == other); } -- cgit v1.2.3 From a5e4b15b7d29a64781eb32ef71e557a5bb8dc870 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Thu, 23 Feb 2012 21:02:46 +0200 Subject: Linux build fix. Moved type casts from protected base classes to derived LLCoord. --- indra/llmath/llcoord.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'indra/llmath/llcoord.h') diff --git a/indra/llmath/llcoord.h b/indra/llmath/llcoord.h index 756e23dbdf..9b76268afd 100644 --- a/indra/llmath/llcoord.h +++ b/indra/llmath/llcoord.h @@ -26,6 +26,15 @@ #ifndef LL_LLCOORD_H #define LL_LLCOORD_H +template class LLCoord; +struct LL_COORD_TYPE_GL; +struct LL_COORD_TYPE_WINDOW; +struct LL_COORD_TYPE_SCREEN; + +typedef LLCoord LLCoordGL; +typedef LLCoord LLCoordWindow; +typedef LLCoord LLCoordScreen; + struct LLCoordCommon { LLCoordCommon(S32 x, S32 y) : mX(x), mY(y) {} @@ -62,6 +71,8 @@ public: bool operator==(const self_t& other) const { return mX == other.mX && mY == other.mY; } bool operator!=(const self_t& other) const { return !(*this == other); } + static const self_t& getTypedCoords(const COORD_FRAME& self) { return static_cast(self); } + static self_t& getTypedCoords(COORD_FRAME& self) { return static_cast(self); } }; struct LL_COORD_TYPE_GL @@ -70,13 +81,13 @@ struct LL_COORD_TYPE_GL LLCoordCommon convertToCommon() const { - const LLCoord& self = static_cast&>(*this); + const LLCoordGL& self = LLCoordGL::getTypedCoords(*this); return LLCoordCommon(self.mX, self.mY); } void convertFromCommon(const LLCoordCommon& from) { - LLCoord& self = static_cast&>(*this); + LLCoordGL& self = LLCoordGL::getTypedCoords(*this); self.mX = from.mX; self.mY = from.mY; } @@ -98,8 +109,4 @@ struct LL_COORD_TYPE_SCREEN void convertFromCommon(const LLCoordCommon& from); }; -typedef LLCoord LLCoordGL; -typedef LLCoord LLCoordWindow; -typedef LLCoord LLCoordScreen; - #endif -- cgit v1.2.3