From c609c87f1488abcaac578d60dc00c5d76e47c6d7 Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Thu, 17 Dec 2020 15:13:11 -0500
Subject: [PATCH] Revert "War in llformat and string temporaries in rlv code"

This reverts commit dd782497382f6d1b4b8d272cc9f383da1ad22027.
---
 indra/newview/rlvcommon.cpp      |  4 ----
 indra/newview/rlvenvironment.cpp |  8 +++-----
 indra/newview/rlvextensions.cpp  | 10 ++++------
 indra/newview/rlvhandler.cpp     | 19 ++++++++-----------
 indra/newview/rlvhelper.cpp      | 25 +++++++++++--------------
 indra/newview/rlvlocks.cpp       | 16 ++++++++--------
 6 files changed, 34 insertions(+), 48 deletions(-)

diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp
index 4fb8d3c7e36..3b54bbd3344 100644
--- a/indra/newview/rlvcommon.cpp
+++ b/indra/newview/rlvcommon.cpp
@@ -40,10 +40,6 @@
 #include "rlvhandler.h"
 #include "rlvlocks.h"
 
-#include <absl/strings/str_format.h>
-#include <absl/strings/str_replace.h>
-#include <absl/strings/str_split.h>
-
 #include <boost/algorithm/string.hpp>
 #include <boost/regex.hpp>
 
diff --git a/indra/newview/rlvenvironment.cpp b/indra/newview/rlvenvironment.cpp
index 639ac92c8c4..805390b3ce6 100644
--- a/indra/newview/rlvenvironment.cpp
+++ b/indra/newview/rlvenvironment.cpp
@@ -18,9 +18,7 @@
 
 #include "llinventoryfunctions.h"
 #include "llsettingsvo.h"
-
-#include "absl/strings/match.h"
-#include "absl/strings/str_format.h"
+#include <boost/algorithm/string.hpp>
 
 #include "rlvactions.h"
 #include "rlvenvironment.h"
@@ -535,7 +533,7 @@ std::string RlvEnvironment::handleGetFn<LLVector2>(const std::function<LLVector2
 {
 	LLSettingsSky::ptr_t pSky = LLEnvironment::instance().getCurrentSky();
 	LLVector2 replyVec = fn(pSky);
-	return absl::StrFormat("%f/%f", replyVec.mV[VX], replyVec.mV[VY]);
+	return llformat("%f/%f", replyVec.mV[VX], replyVec.mV[VY]);
 }
 
 template<>
@@ -543,7 +541,7 @@ std::string RlvEnvironment::handleGetFn<LLColor3>(const std::function<LLColor3(L
 {
 	LLSettingsSky::ptr_t pSky = LLEnvironment::instance().getCurrentSky();
 	LLColor3 replyColor = fn(pSky);
-	return absl::StrFormat("%f/%f/%f", replyColor.mV[VX], replyColor.mV[VY], replyColor.mV[VZ]);
+	return llformat("%f/%f/%f", replyColor.mV[VX], replyColor.mV[VY], replyColor.mV[VZ]);
 }
 
 template<typename T>
diff --git a/indra/newview/rlvextensions.cpp b/indra/newview/rlvextensions.cpp
index 311c6097270..9a44df67785 100644
--- a/indra/newview/rlvextensions.cpp
+++ b/indra/newview/rlvextensions.cpp
@@ -23,8 +23,6 @@
 #include "rlvhandler.h"
 #include "rlvhelper.h"
 
-#include "absl/strings/str_format.h"
-
 // ============================================================================
 
 std::map<std::string, S16> RlvExtGetSet::m_DbgAllowed;
@@ -162,11 +160,11 @@ std::string RlvExtGetSet::onGetDebug(std::string strSetting)
 				switch (pSetting->type())
 				{
 					case TYPE_U32:
-						return absl::StrFormat("%u", gSavedSettings.getU32(strSetting));
+						return llformat("%u", gSavedSettings.getU32(strSetting));
 					case TYPE_S32:
-						return absl::StrFormat("%d", gSavedSettings.getS32(strSetting));
+						return llformat("%d", gSavedSettings.getS32(strSetting));
 					case TYPE_BOOLEAN:
-						return absl::StrFormat("%d", gSavedSettings.getBOOL(strSetting));
+						return llformat("%d", gSavedSettings.getBOOL(strSetting));
 					default:
 						RLV_ERRS << "Unexpected debug setting type" << LL_ENDL;
 						break;
@@ -195,7 +193,7 @@ std::string RlvExtGetSet::onGetPseudoDebug(const std::string& strSetting)
 		else
 		{
 			if (isAgentAvatarValid())
-				return absl::StrFormat("%d", (gAgentAvatarp->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()]
+				return llformat("%d", (gAgentAvatarp->getSex() == SEX_MALE)); // [See LLFloaterCustomize::LLFloaterCustomize()]
 		}
 	}
 	return std::string();
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index e2259e2ddf9..92f5c6154e2 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -70,9 +70,6 @@
 // Boost includes
 #include <boost/algorithm/string.hpp>
 
-// Abseil includes
-#include <absl/strings/str_format.h>
-
 // llappviewer.cpp
 extern BOOL gDoDisconnect;
 
@@ -3462,7 +3459,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETCAM_AVDIST>::onCommand(const RlvCommand&
 {
 	if (rlvCmd.hasOption())
 		return RLV_RET_FAILED_OPTION;
-	strReply = absl::StrFormat("%.3lf", (gAgentCamera.getCameraPositionGlobal() - gAgent.getPositionGlobal()).magVec());
+	strReply = llformat("%.3lf", (gAgentCamera.getCameraPositionGlobal() - gAgent.getPositionGlobal()).magVec());
 	return RLV_RET_SUCCESS;
 }
 
@@ -3474,7 +3471,7 @@ ERlvCmdRet RlvReplyCamMinMaxModifierHandler::onCommand(const RlvCommand& rlvCmd,
 		return RLV_RET_FAILED_OPTION;
 	ERlvBehaviour eBhvr = RlvBehaviourDictionary::instance().getBehaviourFromString("setcam_" + rlvCmd.getBehaviour().substr(7), RLV_TYPE_ADDREM);
 	if (RlvBehaviourModifier* pBhvrModifier = RlvBehaviourDictionary::instance().getModifierFromBehaviour(eBhvr))
-		strReply = (pBhvrModifier->hasValue()) ? absl::StrFormat("%.3f", pBhvrModifier->getValue<float>()) : LLStringUtil::null;
+		strReply = (pBhvrModifier->hasValue()) ? llformat("%.3f", pBhvrModifier->getValue<float>()) : LLStringUtil::null;
 	return RLV_RET_SUCCESS;
 }
 
@@ -3512,7 +3509,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETCAM_FOV>::onCommand(const RlvCommand& rlv
 {
 	if (rlvCmd.hasOption())
 		return RLV_RET_FAILED_OPTION;
-	strReply = absl::StrFormat("%.3f", LLViewerCamera::getInstance()->getDefaultFOV());
+	strReply = llformat("%.3f", LLViewerCamera::getInstance()->getDefaultFOV());
 	return RLV_RET_SUCCESS;
 }
 
@@ -3565,7 +3562,7 @@ ERlvCmdRet RlvReplyHandler<RLV_BHVR_GETHEIGHTOFFSET>::onCommand(const RlvCommand
 	else if (!isAgentAvatarValid())
 		return RLV_RET_FAILED_UNKNOWN;
 
-	strReply = absl::StrFormat("%.2f", gAgentAvatarp->getHoverOffset()[VZ] * 100.f);
+	strReply = llformat("%.2f", gAgentAvatarp->getHoverOffset()[VZ] * 100);
 	return RLV_RET_SUCCESS;
 }
 
@@ -3668,15 +3665,15 @@ ERlvCmdRet RlvHandler::onGetInvWorn(const RlvCommand& rlvCmd, std::string& strRe
 		wi.cntChildWorn += wiFolder.cntWorn + wiFolder.cntChildWorn;
 		wi.cntChildTotal += wiFolder.cntTotal + wiFolder.cntChildTotal;
 
-		absl::StrAppend(&strReply, absl::StrFormat(",%s|%d%d", gInventory.getCategory(itFolder->first)->getName(),
+		strReply += llformat(",%s|%d%d", gInventory.getCategory(itFolder->first)->getName().c_str(),
 		 (0 == wiFolder.cntTotal) ? 0 : (0 == wiFolder.cntWorn) ? 1 : (wiFolder.cntWorn != wiFolder.cntTotal) ? 2 : 3,
 		 (0 == wiFolder.cntChildTotal) ? 0 : (0 == wiFolder.cntChildWorn) ? 1 : (wiFolder.cntChildWorn != wiFolder.cntChildTotal) ? 2 : 3
-		));
+		);
 	}
 
 	// Now just prepend the root and done
-	strReply = absl::StrCat(absl::StrFormat("|%d%d", (0 == wi.cntTotal) ? 0 : (0 == wi.cntWorn) ? 1 : (wi.cntWorn != wi.cntTotal) ? 2 : 3,
-		(0 == wi.cntChildTotal) ? 0 : (0 == wi.cntChildWorn) ? 1 : (wi.cntChildWorn != wi.cntChildTotal) ? 2: 3), strReply);
+	strReply = llformat("|%d%d", (0 == wi.cntTotal) ? 0 : (0 == wi.cntWorn) ? 1 : (wi.cntWorn != wi.cntTotal) ? 2 : 3,
+		(0 == wi.cntChildTotal) ? 0 : (0 == wi.cntChildWorn) ? 1 : (wi.cntChildWorn != wi.cntChildTotal) ? 2: 3) + strReply;
 
 	return RLV_RET_SUCCESS;
 }
diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp
index 41b586bb82d..ef487898407 100644
--- a/indra/newview/rlvhelper.cpp
+++ b/indra/newview/rlvhelper.cpp
@@ -27,10 +27,6 @@
 #include "rlvinventory.h"
 #include "rlvmodifiers.h"
 
-#include "absl/strings/match.h"
-#include "absl/strings/str_format.h"
-#include "absl/strings/str_split.h"
-
 #include <boost/algorithm/string.hpp>
 
 // ============================================================================
@@ -858,7 +854,7 @@ bool RlvCommandOptionHelper::parseOption<RlvCommandOptionGeneric>(const std::str
 bool RlvCommandOptionHelper::parseStringList(const std::string& strOption, std::vector<std::string>& optionList, const std::string& strSeparator)
 {
 	if (!strOption.empty())
-		optionList = absl::StrSplit(strOption, strSeparator);
+		boost::split(optionList, strOption, boost::is_any_of(strSeparator));
 	return !optionList.empty();
 }
 
@@ -1001,11 +997,12 @@ bool RlvCommandOptionGetPath::getItemIDs(LLWearableType::EType wtType, uuid_vec_
 RlvCommandOptionAdjustHeight::RlvCommandOptionAdjustHeight(const RlvCommand& rlvCmd)
 	: m_nPelvisToFoot(0.0f), m_nPelvisToFootDeltaMult(0.0f), m_nPelvisToFootOffset(0.0f)
 {
-	std::vector<std::string> cmdTokens = absl::StrSplit(rlvCmd.getOption(), ';');
+	std::vector<std::string> cmdTokens;
+	boost::split(cmdTokens, rlvCmd.getOption(), boost::is_any_of(std::string(";")));
 	if (1 == cmdTokens.size())
 	{
 		m_fValid = (LLStringUtil::convertToF32(cmdTokens[0], m_nPelvisToFootOffset));
-		m_nPelvisToFootOffset /= 100.f;
+		m_nPelvisToFootOffset /= 100;
 	}
 	else if ( (2 <= cmdTokens.size()) && (cmdTokens.size() <= 3) )
 	{
@@ -1750,7 +1747,7 @@ void RlvBehaviourNotifyHandler::onCommand(const RlvCommand& rlvCmd, ERlvCmdRet e
 	{
 		case RLV_TYPE_ADD:
 		case RLV_TYPE_REMOVE:
-			sendNotification(rlvCmd.asString(), absl::StrCat("=", rlvCmd.getParam()));
+			sendNotification(rlvCmd.asString(), "=" + rlvCmd.getParam());
 			break;
 		case RLV_TYPE_CLEAR:
 			sendNotification(rlvCmd.asString());
@@ -1772,7 +1769,7 @@ void RlvBehaviourNotifyHandler::sendNotification(const std::string& strText, con
 				itNotify != pThis->m_Notifications.end(); ++itNotify)
 		{
 			if ( (itNotify->second.strFilter.empty()) || (boost::icontains(strText, itNotify->second.strFilter)) )
-				RlvUtil::sendChatReply(itNotify->second.nChannel, absl::StrCat("/", strText, strSuffix));
+				RlvUtil::sendChatReply(itNotify->second.nChannel, "/" + strText + strSuffix);
 		}
 	}
 }
@@ -1780,31 +1777,31 @@ void RlvBehaviourNotifyHandler::sendNotification(const std::string& strText, con
 // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
 void RlvBehaviourNotifyHandler::onWear(LLWearableType::EType eType, bool fAllowed)
 {
-	sendNotification(absl::StrFormat("worn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType)));
+	sendNotification(llformat("worn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str()));
 }
 
 // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
 void RlvBehaviourNotifyHandler::onTakeOff(LLWearableType::EType eType, bool fAllowed)
 {
-	sendNotification(absl::StrFormat("unworn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType)));
+	sendNotification(llformat("unworn %s %s", (fAllowed) ? "legally" : "illegally", LLWearableType::getTypeName(eType).c_str()));
 }
 
 // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
 void RlvBehaviourNotifyHandler::onAttach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
 {
-	sendNotification(absl::StrFormat("attached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName()));
+	sendNotification(llformat("attached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
 }
 
 // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
 void RlvBehaviourNotifyHandler::onDetach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
 {
-	sendNotification(absl::StrFormat("detached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName()));
+	sendNotification(llformat("detached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
 }
 
 // Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
 void RlvBehaviourNotifyHandler::onReattach(const LLViewerJointAttachment* pAttachPt, bool fAllowed)
 {
-	sendNotification(absl::StrFormat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName()));
+	sendNotification(llformat("reattached %s %s", (fAllowed) ? "legally" : "illegally", pAttachPt->getName().c_str()));
 }
 
 // =========================================================================
diff --git a/indra/newview/rlvlocks.cpp b/indra/newview/rlvlocks.cpp
index 4d62367e4a7..4b94e34fdf5 100644
--- a/indra/newview/rlvlocks.cpp
+++ b/indra/newview/rlvlocks.cpp
@@ -27,7 +27,6 @@
 #include "rlvhelper.h"
 #include "rlvinventory.h"
 
-#include "absl/strings/str_format.h"
 
 // ============================================================================
 // RlvAttachPtLookup member functions
@@ -453,9 +452,9 @@ void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const
 	const LLViewerInventoryItem* pItem = gInventory.getItem(idItem);
 	std::string strItemId = idItem.asString();
 
-	RLV_INFOS << absl::StreamFormat("Wear %s '%s' (%s)",
-		(RLV_WEAR_ADD == eWearAction) ? "add" : "replace", (pItem) ? pItem->getName() : "missing", strItemId)
-		<< RLV_ENDL;
+	std::string strTemp = llformat("Wear %s '%s' (%s)", 
+		(RLV_WEAR_ADD == eWearAction) ? "add" : "replace", (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str());
+	RLV_INFOS << strTemp.c_str() << RLV_ENDL;
 
 	if (!attachPts.empty())
 	{
@@ -469,10 +468,11 @@ void RlvAttachmentLockWatchdog::RlvWearInfo::dumpInstance() const
 				for (uuid_vec_t::const_iterator itAttach = itAttachPt->second.begin(); itAttach != itAttachPt->second.end(); ++itAttach)
 				{
 					pItem = gInventory.getItem(*itAttach);
-	
-					RLV_INFOS << absl::StreamFormat("  -> %s : %s (%s)",
-						pAttachPt->getName(), (pItem) ? pItem->getName() : "missing", (*itAttach).asString())
-						<< RLV_ENDL;
+					strItemId = (*itAttach).asString();
+
+					strTemp = llformat("  -> %s : %s (%s)",
+						pAttachPt->getName().c_str(), (pItem) ? pItem->getName().c_str() : "missing", strItemId.c_str());
+					RLV_INFOS << strTemp.c_str() << RLV_ENDL;
 				}
 			}
 			else
-- 
GitLab