From 2c31cc45d4e41c42a8940bdefb79eae9d85d8fd7 Mon Sep 17 00:00:00 2001
From: Erik Kundiman <erik@megapahit.org>
Date: Wed, 19 Jul 2023 13:04:12 +0800
Subject: Pass texture entry pointer instead to copyTexture

Otherwise on GCC the -Waddress & -Wno-nonnull-compare warnings would be
treated as errors. It's a different term on Clang, which is undefined
bool conversion. On Clang it's just a warning, but on AppleClang it's
treated as an error.
Rather than suppressing these warnings, I think it's better to just
adjust the interface of copyTexture, since it isn't called that many
times.
---
 indra/llprimitive/llprimitive.cpp       | 4 ++--
 indra/llprimitive/llprimtexturelist.cpp | 6 +++---
 indra/llprimitive/llprimtexturelist.h   | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

(limited to 'indra/llprimitive')

diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index 67c225d25d..6ee438d181 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -263,7 +263,7 @@ void  LLPrimitive::setAllTETextures(const LLUUID &tex_id)
 //===============================================================
 void LLPrimitive::setTE(const U8 index, const LLTextureEntry& te)
 {
-	if(mTextureList.copyTexture(index, te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
+	if(mTextureList.copyTexture(index, &te) != TEM_CHANGE_NONE && te.getBumpmap() > 0)
 	{
 		mNumBumpmapTEs++;
 	}
@@ -742,7 +742,7 @@ void LLPrimitive::copyTEs(const LLPrimitive *primitivep)
 	}
 	for (i = 0; i < num_tes; i++)
 	{
-		mTextureList.copyTexture(i, *(primitivep->getTE(i)));
+		mTextureList.copyTexture(i, primitivep->getTE(i));
 	}
 }
 
diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp
index f4f08248b8..b50c541488 100644
--- a/indra/llprimitive/llprimtexturelist.cpp
+++ b/indra/llprimitive/llprimtexturelist.cpp
@@ -125,7 +125,7 @@ void LLPrimTextureList::take(LLPrimTextureList& other_list)
 // virtual 
 // copies LLTextureEntry 'te'
 // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
-S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
+S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry* te)
 {
 	if (S32(index) >= mEntryList.size())
 	{
@@ -137,9 +137,9 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
 		// we're changing an existing entry
 	llassert(mEntryList[index]);
 	delete (mEntryList[index]);
-	if  (&te)
+	if  (te)
 	{
-		mEntryList[index] = te.newCopy();
+		mEntryList[index] = te->newCopy();
 	}
 	else
 	{
diff --git a/indra/llprimitive/llprimtexturelist.h b/indra/llprimitive/llprimtexturelist.h
index 49c636e40f..a5f32bada6 100644
--- a/indra/llprimitive/llprimtexturelist.h
+++ b/indra/llprimitive/llprimtexturelist.h
@@ -71,7 +71,7 @@ public:
 
 	// copies LLTextureEntry 'te'
 	// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
-	S32 copyTexture(const U8 index, const LLTextureEntry& te);
+	S32 copyTexture(const U8 index, const LLTextureEntry* te);
 
 	// takes ownership of LLTextureEntry* 'te'
 	// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
-- 
cgit v1.2.3