From 49247ea39a9dac1f9aebf39ff1d1e8b246d4357c Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Mon, 24 Aug 2020 06:56:50 -0400 Subject: [PATCH] I hate reinterpret_cast. Especially when its not needed. --- indra/llrender/llfontgl.cpp | 2 +- indra/llui/llxuiparser.cpp | 2 +- indra/newview/llcallbacklist.cpp | 4 ++-- indra/newview/llfloaterpay.cpp | 4 ++-- indra/newview/lltoolbrush.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 88114cae873..176d35dea87 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -101,7 +101,7 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp S32 LLFontGL::getNumFaces(const std::string& filename) { - if (mFontFreetype == reinterpret_cast<LLFontFreetype*>(NULL)) + if (!mFontFreetype) { mFontFreetype = new LLFontFreetype; } diff --git a/indra/llui/llxuiparser.cpp b/indra/llui/llxuiparser.cpp index 138ba8bf023..e7e824f0d72 100644 --- a/indra/llui/llxuiparser.cpp +++ b/indra/llui/llxuiparser.cpp @@ -962,7 +962,7 @@ bool LLXUIParser::writeStringValue(Parser& parser, const void* val_ptr, name_sta LLXMLNodePtr node = self.getNode(stack); if (node.notNull()) { - const std::string* string_val = reinterpret_cast<const std::string*>(val_ptr); + const std::string* string_val = static_cast<const std::string*>(val_ptr); if (string_val->find('\n') != std::string::npos || string_val->size() > MAX_STRING_ATTRIBUTE_SIZE) { diff --git a/indra/newview/llcallbacklist.cpp b/indra/newview/llcallbacklist.cpp index 59ecbdd0eaf..ffa9a5fef0b 100644 --- a/indra/newview/llcallbacklist.cpp +++ b/indra/newview/llcallbacklist.cpp @@ -128,7 +128,7 @@ class OnIdleCallbackOneTime static void onIdle(void *data) { gIdleCallbacks.deleteFunction(onIdle, data); - OnIdleCallbackOneTime* self = reinterpret_cast<OnIdleCallbackOneTime*>(data); + OnIdleCallbackOneTime* self = static_cast<OnIdleCallbackOneTime*>(data); self->call(); delete self; } @@ -159,7 +159,7 @@ class OnIdleCallbackRepeating // Will keep getting called until the callable returns true. static void onIdle(void *data) { - OnIdleCallbackRepeating* self = reinterpret_cast<OnIdleCallbackRepeating*>(data); + OnIdleCallbackRepeating* self = static_cast<OnIdleCallbackRepeating*>(data); bool done = self->call(); if (done) { diff --git a/indra/newview/llfloaterpay.cpp b/indra/newview/llfloaterpay.cpp index 477ae8ab6f8..4352cd8ac82 100644 --- a/indra/newview/llfloaterpay.cpp +++ b/indra/newview/llfloaterpay.cpp @@ -463,7 +463,7 @@ void LLFloaterPay::finishPayUI(const LLUUID& target_id, BOOL is_group) // static void LLFloaterPay::onCancel(void* data) { - LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data); + LLFloaterPay* self = static_cast<LLFloaterPay*>(data); if(self) { self->closeFloater(); @@ -473,7 +473,7 @@ void LLFloaterPay::onCancel(void* data) // static void LLFloaterPay::onKeystroke(LLLineEditor*, void* data) { - LLFloaterPay* self = reinterpret_cast<LLFloaterPay*>(data); + LLFloaterPay* self = static_cast<LLFloaterPay*>(data); if(self) { // enable the Pay button when amount is non-empty and positive, disable otherwise diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index 0a0bfaf58bb..2d2c069f91b 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -618,7 +618,7 @@ void LLToolBrushLand::determineAffectedRegions(region_list_t& regions, // static void LLToolBrushLand::onIdle( void* brush_tool ) { - LLToolBrushLand* self = reinterpret_cast<LLToolBrushLand*>(brush_tool); + LLToolBrushLand* self = static_cast<LLToolBrushLand*>(brush_tool); if( LLToolMgr::getInstance()->getCurrentTool() == self ) { -- GitLab