Now that fmt plays nice with gcc let's actually use it: replace std::to_string, boost lexical_cast and a couple miscellaneous llformats with fmt. (Alchemy sync-ish)

This commit is contained in:
Router Gray
2020-05-20 14:38:30 -05:00
parent 34a7ebf53f
commit 3e78b74474
31 changed files with 92 additions and 113 deletions

View File

@@ -3,6 +3,7 @@
include(APR)
include(Boost)
include(EXPAT)
include(Linking)
include(ZLIB)
if (DARWIN)
@@ -18,7 +19,9 @@ set(LLCOMMON_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
)
set(LLCOMMON_LIBRARIES llcommon)
set(LLCOMMON_LIBRARIES llcommon
fmt::fmt
)
set(LLCOMMON_LINK_SHARED OFF CACHE BOOL "Build the llcommon target as a shared library.")
if(LLCOMMON_LINK_SHARED)

View File

@@ -230,7 +230,7 @@ void LLAvatarAppearance::initInstance()
for (U32 lod = 0; lod < mesh_dict->mLOD; lod++)
{
LLAvatarJointMesh* mesh = createAvatarJointMesh();
std::string mesh_name = "m" + mesh_dict->mName + std::to_string(lod);
std::string mesh_name = fmt::format(FMT_STRING("m{:s}{:d}"), mesh_dict->mName, lod);
// We pre-pended an m - need to capitalize first character for camelCase
mesh_name[1] = toupper(mesh_name[1]);
mesh->setName(mesh_name);

View File

@@ -299,6 +299,7 @@ target_link_libraries(
${Boost_SYSTEM_LIBRARY}
${CORESERVICES_LIBRARY}
${URIPARSER_LIBRARY}
fmt::fmt
nlohmann_json::nlohmann_json
absl::strings
${RT_LIBRARY}

View File

@@ -34,6 +34,16 @@
#ifndef LL_LLFORMAT_H
#define LL_LLFORMAT_H
#if defined(LL_CLANG)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated"
#endif
#include <fmt/format.h>
#include <fmt/printf.h>
#if defined(LL_CLANG)
#pragma clang diagnostic pop
#endif
// Use as follows:
// LL_INFOS() << llformat("Test:%d (%.2f %.2f)", idx, x, y) << LL_ENDL;
//

View File

@@ -1354,8 +1354,7 @@ void LLStringUtil::formatNumber(std::string& numStr, std::string decimals)
if (convertToS32(numStr, intStr))
{
strStream << intStr;
numStr = strStream.str();
numStr = fmt::to_string(intStr);
}
}
else
@@ -1435,14 +1434,14 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
{
struct tm * gmt = gmtime (&loc_seconds);
LLStringUtil::format_map_t args;
args["[MDAY]"] = llformat ("%d", gmt->tm_mday);
args["[MDAY]"] = fmt::to_string(gmt->tm_mday);
replacement = LLStringOps::sDayFormat;
LLStringUtil::format(replacement, args);
}
else if (code == "%-d")
{
struct tm * gmt = gmtime (&loc_seconds);
replacement = llformat ("%d", gmt->tm_mday); // day of the month without leading zero
replacement = fmt::to_string(gmt->tm_mday); // day of the month without leading zero
}
else if( !LLStringOps::sAM.empty() && !LLStringOps::sPM.empty() && code == "%p" )
{

View File

@@ -31,7 +31,6 @@
#include "llnamevalue.h"
#include "u64.h"
#include "llstring.h"
#include "llstringtable.h"
@@ -149,7 +148,7 @@ void LLNameValue::init(const char *name, const char *data, const char *type, con
else if (!strcmp(mStringType, "U64"))
{
mType = NVT_U64;
mNameValueReference.u64 = new U64(str_to_U64(ll_safe_string(data)));
mNameValueReference.u64 = new U64(std::stoull(data));
}
else if (!strcmp(mStringType, "VEC3"))
{
@@ -919,9 +918,7 @@ std::string LLNameValue::printData() const
break;
case NVT_U64:
{
char u64_string[U64_BUFFER_LEN]; /* Flawfinder: ignore */
U64_to_str(*mNameValueReference.u64, u64_string, sizeof(u64_string));
buffer = u64_string;
buffer = fmt::to_string(*mNameValueReference.u64);
}
break;
case NVT_VEC3:
@@ -952,11 +949,7 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a)
s << *(a.mNameValueReference.u32);
break;
case NVT_U64:
{
char u64_string[U64_BUFFER_LEN]; /* Flawfinder: ignore */
U64_to_str(*a.mNameValueReference.u64, u64_string, sizeof(u64_string));
s << u64_string;
}
s << (*a.mNameValueReference.u64);
break;
case NVT_VEC3:
s << *(a.mNameValueReference.vec3);

View File

@@ -30,7 +30,6 @@
#include "lluuid.h"
#include "llerror.h"
#include "llmath.h"
#include "u64.h"
//number of bytes sent in each message
const U32 LL_XFER_CHUNK_SIZE = 1000;
@@ -347,12 +346,12 @@ void LLXfer::abort (S32 result_code)
if (result_code != LL_ERR_CIRCUIT_GONE)
{
gMessageSystem->newMessageFast(_PREHASH_AbortXfer);
gMessageSystem->nextBlockFast(_PREHASH_XferID);
gMessageSystem->addU64Fast(_PREHASH_ID, mID);
gMessageSystem->addS32Fast(_PREHASH_Result, result_code);
gMessageSystem->sendMessage(mRemoteHost);
gMessageSystem->newMessageFast(_PREHASH_AbortXfer);
gMessageSystem->nextBlockFast(_PREHASH_XferID);
gMessageSystem->addU64Fast(_PREHASH_ID, mID);
gMessageSystem->addS32Fast(_PREHASH_Result, result_code);
gMessageSystem->sendMessage(mRemoteHost);
}
mStatus = e_LL_XFER_ABORTED;
@@ -363,7 +362,7 @@ void LLXfer::abort (S32 result_code)
std::string LLXfer::getFileName()
{
return U64_to_str(mID);
return fmt::to_string(mID);
}
///////////////////////////////////////////////////////////

View File

@@ -35,7 +35,6 @@
#include "llerror.h"
#include "lluuid.h"
#include "u64.h"
const F32 LL_XFER_REGISTRATION_TIMEOUT = 60.0f; // timeout if a registered transfer hasn't been requested in 60 seconds
const F32 LL_PACKET_TIMEOUT = 3.0f; // packet timeout at 3 s
@@ -543,11 +542,10 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
if (fdata_size < 0 ||
fdata_size > BUF_SIZE)
{
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
LL_WARNS("Xfer") << "Received invalid xfer data size of " << fdata_size
<< " in packet number " << packetnum
<< " from " << mesgsys->getSender()
<< " for xfer id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF))
<< " for xfer id: " << fmt::to_string(id)
<< LL_ENDL;
return;
}
@@ -556,10 +554,9 @@ void LLXferManager::processReceiveData (LLMessageSystem *mesgsys, void ** /*user
xferp = findXferByID(id, mReceiveList);
if (!xferp)
{
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
LL_WARNS("Xfer") << "received xfer data from " << mesgsys->getSender()
<< " for non-existent xfer id: "
<< U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << LL_ENDL;
<< fmt::to_string(id) << LL_ENDL;
return;
}
@@ -765,8 +762,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
mesgsys->getBOOL("XferID", "UseBigPackets", b_use_big_packets);
mesgsys->getU64Fast(_PREHASH_XferID, _PREHASH_ID, id);
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
LL_INFOS("Xfer") << "xfer request id: " << U64_to_str(id, U64_BUF, sizeof(U64_BUF))
LL_INFOS("Xfer") << "xfer request id: " << fmt::to_string(id)
<< " to " << mesgsys->getSender() << LL_ENDL;
mesgsys->getStringFast(_PREHASH_XferID, _PREHASH_Filename, local_filename);
@@ -890,9 +886,8 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{ // no uuid or filename - use the ID sent
char U64_BUF[MAX_STRING]; /* Flawfinder : ignore */
LL_INFOS("Xfer") << "starting memory transfer: "
<< U64_to_str(id, U64_BUF, sizeof(U64_BUF)) << " to "
<< fmt::to_string(id) << " to "
<< mesgsys->getSender() << LL_ENDL;
xferp = findXferByID(id, mSendList);
@@ -903,7 +898,7 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{
LL_INFOS("Xfer") << "Warning: xfer ID " << U64_BUF << " not found." << LL_ENDL;
LL_INFOS("Xfer") << "Warning: xfer ID " << fmt::to_string(id) << " not found." << LL_ENDL;
result = LL_ERR_FILE_NOT_FOUND;
}
}
@@ -937,12 +932,12 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
{ // Not many transfers in progress already, so start immediately
xferp->sendNextPacket();
changeNumActiveXfers(xferp->mRemoteHost,1);
LL_DEBUGS("Xfer") << "Starting xfer ID " << U64_to_str(id) << " immediately" << LL_ENDL;
LL_DEBUGS("Xfer") << "Starting xfer ID " << fmt::to_string(id) << " immediately" << LL_ENDL;
}
else if (mHardLimitOutgoingXfersPerCircuit == 0 ||
(host_statusp->mNumActive + host_statusp->mNumPending) < mHardLimitOutgoingXfersPerCircuit)
{ // Must close the file handle and wait for earlier ones to complete
LL_INFOS("Xfer") << " queueing xfer request id " << U64_to_str(id) << ", "
LL_INFOS("Xfer") << " queueing xfer request id " << fmt::to_string(id) << ", "
<< host_statusp->mNumActive << " active and "
<< host_statusp->mNumPending << " pending ahead of this one"
<< LL_ENDL;
@@ -983,13 +978,13 @@ void LLXferManager::processFileRequest (LLMessageSystem *mesgsys, void ** /*user
}
else
{
LL_WARNS("Xfer") << "LLXferManager::processFileRequest() - no LLHostStatus found for id " << U64_to_str(id)
LL_WARNS("Xfer") << "LLXferManager::processFileRequest() - no LLHostStatus found for id " << fmt::to_string(id)
<< " host " << xferp->mRemoteHost << LL_ENDL;
}
}
else
{
LL_WARNS("Xfer") << "LLXferManager::processFileRequest() - no xfer found for id " << U64_to_str(id) << LL_ENDL;
LL_WARNS("Xfer") << "LLXferManager::processFileRequest() - no xfer found for id " << fmt::to_string(id) << LL_ENDL;
}
}
@@ -1113,7 +1108,7 @@ void LLXferManager::retransmitUnackedPackets()
{
if (xferp->reopenFileHandle())
{
LL_WARNS("Xfer") << "Error re-opening file handle for xfer ID " << U64_to_str(xferp->mID)
LL_WARNS("Xfer") << "Error re-opening file handle for xfer ID " << fmt::to_string(xferp->mID)
<< " to host " << xferp->mRemoteHost << LL_ENDL;
xferp->abort(LL_ERR_CANNOT_OPEN_FILE);
iter = mSendList.erase(iter);
@@ -1122,7 +1117,7 @@ void LLXferManager::retransmitUnackedPackets()
}
else
{ // No error re-opening the file, send the first packet
LL_DEBUGS("Xfer") << "Moving pending xfer ID " << U64_to_str(xferp->mID) << " to active" << LL_ENDL;
LL_DEBUGS("Xfer") << "Moving pending xfer ID " << fmt::to_string(xferp->mID) << " to active" << LL_ENDL;
xferp->sendNextPacket();
changeNumActiveXfers(xferp->mRemoteHost,1);
}
@@ -1136,7 +1131,7 @@ void LLXferManager::retransmitUnackedPackets()
// so we don't blow through bandwidth.
//
while (mXferAckQueue.size())
while (!mXferAckQueue.empty())
{
if (mAckThrottle.checkOverflow(1000.0f*8.0f))
{

View File

@@ -73,7 +73,6 @@
#include "llxfermanager.h"
#include "timing.h"
#include "llquaternion.h"
#include "u64.h"
#include "v3dmath.h"
#include "v3math.h"
#include "v4math.h"
@@ -2600,54 +2599,54 @@ void LLMessageSystem::summarizeLogs(std::ostream& str)
// Incoming
str << buffer << std::endl << "Incoming:" << std::endl;
tmp_str = U64_to_str(mTotalBytesIn);
tmp_str = fmt::to_string(mTotalBytesIn);
buffer = llformat( "Total bytes received: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesIn * 0.008f) / run_time);
str << buffer << std::endl;
tmp_str = U64_to_str(mPacketsIn);
tmp_str = fmt::to_string(mPacketsIn);
buffer = llformat( "Total packets received: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32) mPacketsIn / run_time));
str << buffer << std::endl;
buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesIn / (F32)mPacketsIn);
str << buffer << std::endl;
tmp_str = U64_to_str(mReliablePacketsIn);
tmp_str = fmt::to_string(mReliablePacketsIn);
buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsIn)/((F32) mPacketsIn + 1));
str << buffer << std::endl;
tmp_str = U64_to_str(mCompressedPacketsIn);
tmp_str = fmt::to_string(mCompressedPacketsIn);
buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsIn)/((F32) mPacketsIn + 1));
str << buffer << std::endl;
S64 savings = mUncompressedBytesIn - mCompressedBytesIn;
tmp_str = U64_to_str(savings);
tmp_str = fmt::to_string(savings);
buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mCompressedPacketsIn +1));
tmp_str = fmt::to_string(savings/(mCompressedPacketsIn +1));
buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesIn)/((F32) mCompressedBytesIn+1));
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mPacketsIn+1));
tmp_str = fmt::to_string(savings/(mPacketsIn+1));
buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesIn + (F32) savings)/((F32) mTotalBytesIn + 1.f));
// Outgoing
str << buffer << std::endl << std::endl << "Outgoing:" << std::endl;
tmp_str = U64_to_str(mTotalBytesOut);
tmp_str = fmt::to_string(mTotalBytesOut);
buffer = llformat( "Total bytes sent: %20s (%5.2f kbits per second)", tmp_str.c_str(), ((F32)mTotalBytesOut * 0.008f) / run_time );
str << buffer << std::endl;
tmp_str = U64_to_str(mPacketsOut);
tmp_str = fmt::to_string(mPacketsOut);
buffer = llformat( "Total packets sent: %20s (%5.2f packets per second)", tmp_str.c_str(), ((F32)mPacketsOut / run_time));
str << buffer << std::endl;
buffer = llformat( "Average packet size: %20.0f bytes", (F32)mTotalBytesOut / (F32)mPacketsOut);
str << buffer << std::endl;
tmp_str = U64_to_str(mReliablePacketsOut);
tmp_str = fmt::to_string(mReliablePacketsOut);
buffer = llformat( "Total reliable packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mReliablePacketsOut)/((F32) mPacketsOut + 1));
str << buffer << std::endl;
tmp_str = U64_to_str(mCompressedPacketsOut);
tmp_str = fmt::to_string(mCompressedPacketsOut);
buffer = llformat( "Total compressed packets: %20s (%5.2f%%)", tmp_str.c_str(), 100.f * ((F32) mCompressedPacketsOut)/((F32) mPacketsOut + 1));
str << buffer << std::endl;
savings = mUncompressedBytesOut - mCompressedBytesOut;
tmp_str = U64_to_str(savings);
tmp_str = fmt::to_string(savings);
buffer = llformat( "Total compression savings: %20s bytes", tmp_str.c_str());
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mCompressedPacketsOut +1));
tmp_str = fmt::to_string(savings/(mCompressedPacketsOut +1));
buffer = llformat( "Avg comp packet savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mUncompressedBytesOut)/((F32) mCompressedBytesOut+1));
str << buffer << std::endl;
tmp_str = U64_to_str(savings/(mPacketsOut+1));
tmp_str = fmt::to_string(savings/(mPacketsOut+1));
buffer = llformat( "Avg overall comp savings: %20s (%5.2f : 1)", tmp_str.c_str(), ((F32) mTotalBytesOut + (F32) savings)/((F32) mTotalBytesOut + 1.f));
str << buffer << std::endl << std::endl;
buffer = llformat( "SendPacket failures: %20d", mSendPacketFailureCount);

View File

@@ -53,7 +53,6 @@
#pragma warning (default : 4264)
#endif
#include <boost/lexical_cast.hpp>
#include "lldaeloader.h"
#include "llsdserialize.h"
@@ -2380,7 +2379,7 @@ std::string LLDAELoader::getElementLabel(daeElement *element)
if (ind > 0)
{
index_string = "_" + boost::lexical_cast<std::string>(ind);
index_string = "_" + fmt::to_string(ind);
}
// if parent has a name or ID, use it

View File

@@ -2475,7 +2475,7 @@ BOOL LLLineEditor::evaluateFloat()
else
{
// Replace the expression with the result
std::string result_str = llformat("%f", result);
std::string result_str = fmt::to_string(result);
setText(result_str);
selectAll();
}

View File

@@ -414,7 +414,7 @@ void LLResMgr::getIntegerString( std::string& output, S32 input ) const
{
if (fraction == remaining_count)
{
fraction_string = llformat("%d", fraction);
fraction_string = fmt::to_string(fraction);
}
else
{

View File

@@ -3201,7 +3201,7 @@ LLScrollListItem* LLScrollListCtrl::addRow(LLScrollListItem *new_item, const LLS
// empty columns strings index by ordinal
if (column.empty())
{
column = llformat("%d", col_index);
column = fmt::to_string(col_index);
}
LLScrollListColumn* columnp = getColumn(column);

View File

@@ -26,7 +26,6 @@
#include "llviewerprecompiledheaders.h"
#include <boost/lexical_cast.hpp>
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
@@ -3994,7 +3993,7 @@ LLSD LLAppearanceMgr::dumpCOF() const
LLUUID linked_asset_id(linked_item->getAssetUUID());
md5.update((unsigned char*)linked_asset_id.mData, 16);
U32 flags = linked_item->getFlags();
md5.update(boost::lexical_cast<std::string>(flags));
md5.update(fmt::to_string(flags));
}
else if (LLAssetType::AT_LINK_FOLDER != inv_item->getActualType())
{

View File

@@ -1348,8 +1348,8 @@ bool LLAppViewer::mainLoop()
#ifdef USE_CRASHPAD
// Not event based. Update per frame
SET_CRASHPAD_ANNOTATION_VALUE(session_duration, std::to_string(LLFrameTimer::getElapsedSeconds()));
SET_CRASHPAD_ANNOTATION_VALUE(memory_alloc, std::to_string((LLMemory::getCurrentRSS() >> 10)/1000.f));
SET_CRASHPAD_ANNOTATION_VALUE(session_duration, fmt::to_string(LLFrameTimer::getElapsedSeconds()));
SET_CRASHPAD_ANNOTATION_VALUE(memory_alloc, fmt::to_string((LLMemory::getCurrentRSS() >> 10)/1000.f));
#endif
//check memory availability information
@@ -2809,9 +2809,9 @@ void LLAppViewer::writeDebugInfo(bool isStatic)
SET_CRASHPAD_ANNOTATION_VALUE(cpu_string, gDebugInfo["CPUInfo"]["CPUString"].asString());
SET_CRASHPAD_ANNOTATION_VALUE(gpu_string, gDebugInfo["GraphicsCard"].asString());
SET_CRASHPAD_ANNOTATION_VALUE(gl_version, gDebugInfo["GLInfo"]["GLVersion"].asString());
SET_CRASHPAD_ANNOTATION_VALUE(session_duration, std::to_string(LLFrameTimer::getElapsedSeconds()));
SET_CRASHPAD_ANNOTATION_VALUE(memory_alloc, std::to_string((LLMemory::getCurrentRSS() >> 10) / 1000.f));
SET_CRASHPAD_ANNOTATION_VALUE(memory_sys, std::to_string(gDebugInfo["RAMInfo"]["Physical"].asInteger() * 0.001f));
SET_CRASHPAD_ANNOTATION_VALUE(session_duration, fmt::to_string(LLFrameTimer::getElapsedSeconds()));
SET_CRASHPAD_ANNOTATION_VALUE(memory_alloc, fmt::to_string((LLMemory::getCurrentRSS() >> 10) / 1000.f));
SET_CRASHPAD_ANNOTATION_VALUE(memory_sys, fmt::to_string(gDebugInfo["RAMInfo"]["Physical"].asInteger() * 0.001f));
#endif
}

View File

@@ -52,7 +52,6 @@
#include "llworld.h"
#include <boost/date_time.hpp>
#include <boost/lexical_cast.hpp>
// [RLVa:KB]
#include "rlvhandler.h"
@@ -1006,7 +1005,7 @@ void LLFloaterAvatarList::refreshAvatarList()
color = sRadarTextYoung;
}
}
agep.value = age_set ? boost::lexical_cast<std::string>(entry->mAge) : "?";
agep.value = age_set ? fmt::to_string(entry->mAge) : "?";
agep.color = color;
element.columns.add(agep);
}
@@ -1069,7 +1068,7 @@ void LLFloaterAvatarList::refreshAvatarList()
else
{
LLStringUtil::format_map_t args;
args["[COUNT]"] = boost::lexical_cast<std::string>(mAvatars.size());
args["[COUNT]"] = fmt::to_string(mAvatars.size());
setTitle(getString("TitleWithCount", args));
}

View File

@@ -277,19 +277,19 @@ void LLFloaterBuyCurrencyUI::updateUI()
S32 balance = gStatusBar->getBalance();
childShow("balance_label");
childShow("balance_amount");
childSetTextArg("balance_amount", "[AMT]", llformat("%d", balance));
childSetTextArg("balance_amount", "[AMT]", fmt::to_string(balance));
childSetTextArg("balance_amount", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
S32 buying = mManager.getAmount();
childShow("buying_label");
childShow("buying_amount");
childSetTextArg("buying_amount", "[AMT]", llformat("%d", buying));
childSetTextArg("buying_amount", "[AMT]", fmt::to_string(buying));
childSetTextArg("buying_amount", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
S32 total = balance + buying;
childShow("total_label");
childShow("total_amount");
childSetTextArg("total_amount", "[AMT]", llformat("%d", total));
childSetTextArg("total_amount", "[AMT]", fmt::to_string(total));
childSetTextArg("total_amount", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
childSetVisible("purchase_warning_repurchase", false);

View File

@@ -1454,7 +1454,7 @@ void LLPanelLandObjects::onClickReturnOwnerList()
LLSD args;
args["NAME"] = mSelectedName;
args["N"] = std::to_string(mSelectedCount);
args["N"] = fmt::to_string(mSelectedCount);
if (mSelectedIsGroup)
{
LLNotificationsUtil::add("ReturnObjectsDeededToGroup", args, LLSD(), boost::bind(&LLPanelLandObjects::callbackReturnOwnerList, this, _1, _2));
@@ -1665,7 +1665,7 @@ void LLPanelLandObjects::onClickReturnOwnerObjects()
LLUUID owner_id = parcel->getOwnerID();
LLSD args;
args["N"] = std::to_string(owned);
args["N"] = fmt::to_string(owned);
if (owner_id == gAgent.getID())
{

View File

@@ -43,11 +43,6 @@
#include "llcombobox.h"
#include "lllineeditor.h"
#include "llviewerwindow.h"
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
#include <boost/lexical_cast.hpp>
LLFloaterPostProcess* LLFloaterPostProcess::sPostProcess = NULL;
@@ -190,7 +185,7 @@ void LLFloaterPostProcess::syncMenu()
//llsd["uniform"][1]=>"uniform[1]"
for(S32 i=0;i<it->second.size();++i)
{
childSetValue(it->first+'['+boost::lexical_cast<std::string>(i)+']',it->second[i]);
childSetValue(it->first+'['+fmt::to_string(i)+']',it->second[i]);
}
}
else

View File

@@ -54,7 +54,6 @@
#include "hippogridmanager.h"
#include <boost/lexical_cast.hpp>
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
@@ -97,7 +96,7 @@ LLFloaterPay::LLFloaterPay(const std::string& name,
for(U32 i = 0; i < MAX_PAY_BUTTONS; ++i)
{
mQuickPayButton[i] = getChild<LLButton>("fastpay " + boost::lexical_cast<std::string>(mQuickPayInfo[i]));
mQuickPayButton[i] = getChild<LLButton>("fastpay " + fmt::to_string(mQuickPayInfo[i]));
mQuickPayButton[i]->setClickedCallback(boost::bind(&LLFloaterPay::onGive,this,boost::ref(mQuickPayInfo[i])));
mQuickPayButton[i]->setVisible(FALSE);
mQuickPayButton[i]->setLabelArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());

View File

@@ -3152,7 +3152,7 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
else if ("marketplace_copy_id" == action)
{
auto id = LLMarketplaceData::instance().getListingID(mUUID);
gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(std::to_string(id)));
gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(fmt::to_string(id)));
}
// <singu> Move displaced inventory to lost and found
else if ("move_to_lost_and_found" == action)

View File

@@ -66,7 +66,6 @@
#include "aicurl.h"
#include <mutex>
#include "boost/lexical_cast.hpp"
#ifndef LL_WINDOWS
#include "netdb.h"
@@ -110,7 +109,7 @@ const U32 MAX_TEXTURE_UPLOAD_RETRIES = 5;
static S32 dump_num = 0;
std::string make_dump_name(std::string prefix, S32 num)
{
return prefix + boost::lexical_cast<std::string>(num) + std::string(".xml");
return prefix + fmt::to_string(num) + std::string(".xml");
}
void dump_llsd_to_file(const LLSD& content, std::string filename);

View File

@@ -199,8 +199,8 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType
{
date birthday(year, month, day), today(day_clock::local_day());
std::ostringstream born_on;
const std::locale fmt(std::locale::classic(), new date_facet(gSavedSettings.getString("ShortDateFormat").data()));
born_on.imbue(fmt);
const std::locale date_fmt(std::locale::classic(), new date_facet(gSavedSettings.getString("ShortDateFormat").data()));
born_on.imbue(date_fmt);
born_on << birthday << " (" << today - birthday << ')';
childSetValue("born", born_on.str());
}

View File

@@ -67,12 +67,7 @@
#include "hippogridmanager.h"
#include "lfsimfeaturehandler.h"
#if LL_MSVC
// disable boost::lexical_cast warning
#pragma warning (disable:4702)
#endif
#include <boost/tokenizer.hpp>
#include <boost/lexical_cast.hpp>
//---------------------------------------------------------------------------
// LLPanelDirFindAll - Google search appliance based search
@@ -468,7 +463,7 @@ const std::string LLPanelDirFind::getSearchURLSuffix(bool inc_pg, bool inc_matur
(inc_pg ? SEARCH_PG : SEARCH_NONE) |
(inc_mature ? SEARCH_MATURE : SEARCH_NONE) |
(inc_adult ? SEARCH_ADULT : SEARCH_NONE);
url.replace(url.find(substring), substring.length(), boost::lexical_cast<std::string>(maturityFlag));
url.replace(url.find(substring), substring.length(), fmt::to_string(maturityFlag));
// Include region and x/y position, not for the GSA, but
// just to get logs on the web server for search_proxy.php

View File

@@ -60,7 +60,6 @@
#include "llviewerwindow.h"
#include "hippogridmanager.h"
#include <boost/lexical_cast.hpp>
// consts
const S32 MATURE_CONTENT = 1;
@@ -268,7 +267,7 @@ BOOL LLPanelGroupGeneral::postBuild()
std::string member_count(LLTrans::getString("LoadingData"));
if (LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID))
member_count = boost::lexical_cast<std::string>(gdatap->mMembers.size());
member_count = fmt::to_string(gdatap->mMembers.size());
getChild<LLUICtrl>("text_owners_and_visible_members")->setTextArg("[COUNT]", member_count);
return LLPanelGroupTab::postBuild();
@@ -836,7 +835,7 @@ void LLPanelGroupGeneral::updateMembers()
}
}
getChild<LLUICtrl>("text_owners_and_visible_members")->setTextArg("[COUNT]", boost::lexical_cast<std::string>(gdatap->mMembers.size()));
getChild<LLUICtrl>("text_owners_and_visible_members")->setTextArg("[COUNT]", fmt::to_string(gdatap->mMembers.size()));
if (mMemberProgress == gdatap->mMembers.end())
{

View File

@@ -354,7 +354,7 @@ S32 LLPanelGroupLandMoney::impl::getStoredContribution()
// Fills in the text field with the contribution, contrib
void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
{
std::string buffer = llformat("%d", contrib);
std::string buffer = fmt::to_string(contrib);
if ( mYourContributionEditorp )
{
@@ -364,7 +364,7 @@ void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max)
{
mPanel.getChild<LLUICtrl>("your_contribution_max_value")->setTextArg("[AMOUNT]", llformat("%d", max));
mPanel.getChild<LLUICtrl>("your_contribution_max_value")->setTextArg("[AMOUNT]", fmt::to_string(max));
}
//static

View File

@@ -151,7 +151,6 @@
#include "llviewerobjectbackup.h"
#include "llagentui.h"
#include "llpathfindingmanager.h"
#include <boost/lexical_cast.hpp>
#include "lltexturecache.h"
#include "llvovolume.h"
@@ -684,9 +683,9 @@ void init_menus()
std::string symbol = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
auto& benefits = LLAgentBenefitsMgr::current();
const std::string texture_upload_cost_str = symbol + std::to_string(benefits.getTextureUploadCost());
const std::string sound_upload_cost_str = symbol + std::to_string(benefits.getSoundUploadCost());
const std::string animation_upload_cost_str = symbol + std::to_string(benefits.getAnimationUploadCost());
const std::string texture_upload_cost_str = symbol + fmt::to_string(benefits.getTextureUploadCost());
const std::string sound_upload_cost_str = symbol + fmt::to_string(benefits.getSoundUploadCost());
const std::string animation_upload_cost_str = symbol + fmt::to_string(benefits.getAnimationUploadCost());
gMenuHolder->childSetLabelArg("Upload Image", "[UPLOADFEE]", texture_upload_cost_str);
gMenuHolder->childSetLabelArg("Upload Sound", "[UPLOADFEE]", sound_upload_cost_str);
gMenuHolder->childSetLabelArg("Upload Animation", "[UPLOADFEE]", animation_upload_cost_str);
@@ -2836,7 +2835,7 @@ class LLObjectMeasure final : public view_listener_t
LLFloaterChat::addChat(chat);
LLStringUtil::format_map_t args;
args["[DIST]"] = boost::lexical_cast<std::string>(dist_vec(startMeasurePoint, position));
args["[DIST]"] = fmt::to_string(dist_vec(startMeasurePoint, position));
chat.mText = LLTrans::getString("MeasuredDistance", args);
startpoint_set = false;

View File

@@ -1268,7 +1268,7 @@ bool upload_new_resource(
LLStringUtil::format_map_t args;
args["[NAME]"] = name;
args["[CURRENCY]"] = gHippoGridManager->getConnectedGrid()->getCurrencySymbol();
args["[AMOUNT]"] = llformat("%d", expected_upload_cost);
args["[AMOUNT]"] = fmt::to_string(expected_upload_cost);
LLFloaterBuyCurrency::buyCurrency( LLTrans::getString("UploadingCosts", args), expected_upload_cost );
return false;
}

View File

@@ -32,7 +32,6 @@
#include "llviewerprecompiledheaders.h"
#include "llviewermessage.h"
#include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp>
#include "llanimationstates.h"
#include "llaudioengine.h"
@@ -1938,7 +1937,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
{
LLSD args;
args["SOURCE"] = from_id;
args["AMOUNT"] = boost::lexical_cast<std::string>(SpamNewlines);
args["AMOUNT"] = fmt::to_string(SpamNewlines);
LLNotificationsUtil::add("AntiSpamNewlineFlood", args);
}
return;

View File

@@ -33,7 +33,6 @@
#include "llviewerprecompiledheaders.h"
#include <boost/lexical_cast.hpp>
#include "llfeaturemanager.h"
#include "llviewershadermgr.h"
@@ -591,7 +590,7 @@ BOOL LLViewerShaderMgr::loadBasicShaders()
std::map<std::string, std::string> attribs;
attribs["MAX_JOINTS_PER_MESH_OBJECT"] =
boost::lexical_cast<std::string>(LLSkinningUtil::getMaxJointCount());
fmt::to_string(LLSkinningUtil::getMaxJointCount());
// We no longer have to bind the shaders to global glhandles, they are automatically added to a map now.
for (U32 i = 0; i < shaders.size(); i++)
@@ -1687,7 +1686,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoTCV.glsl", GL_VERTEX_SHADER_ARB));
gFXAAProgram.mShaderFiles.push_back(make_pair("deferred/fxaaF.glsl", GL_FRAGMENT_SHADER_ARB));
static LLCachedControl<uint32_t> fxaaQuality("FXAAQuality", 12);
gFXAAProgram.addPermutation("FXAA_QUALITY_M_PRESET", std::to_string(fxaaQuality.get()));
gFXAAProgram.addPermutation("FXAA_QUALITY_M_PRESET", fmt::to_string(fxaaQuality.get()));
gFXAAProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED];
success = gFXAAProgram.createShader(NULL, NULL);
}

View File

@@ -259,8 +259,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
{
parcel_id = parcel->getLocalID();
}
substitution["PARCEL_ID"] = llformat("%d", parcel_id);
substitution["PARCEL_ID"] = fmt::to_string(parcel_id);
// expand all of the substitution strings and escape the url
std::string expanded_url = url;
LLStringUtil::format(expanded_url, substitution);