Reduce LLSD::Binary temporaries
parent
f6d2536e4f
commit
1296afd96a
|
|
@ -51,7 +51,7 @@
|
|||
// U32
|
||||
LLSD ll_sd_from_U32(const U32 val)
|
||||
{
|
||||
std::vector<U8> v;
|
||||
LLSD::Binary v;
|
||||
U32 net_order = htonl(val);
|
||||
|
||||
v.resize(4);
|
||||
|
|
@ -63,7 +63,7 @@ LLSD ll_sd_from_U32(const U32 val)
|
|||
U32 ll_U32_from_sd(const LLSD& sd)
|
||||
{
|
||||
U32 ret;
|
||||
std::vector<U8> v = sd.asBinary();
|
||||
const LLSD::Binary& v = sd.asBinary();
|
||||
if (v.size() < 4)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -76,7 +76,7 @@ U32 ll_U32_from_sd(const LLSD& sd)
|
|||
//U64
|
||||
LLSD ll_sd_from_U64(const U64 val)
|
||||
{
|
||||
std::vector<U8> v;
|
||||
LLSD::Binary v;
|
||||
U32 high, low;
|
||||
|
||||
high = (U32)(val >> 32);
|
||||
|
|
@ -94,7 +94,7 @@ LLSD ll_sd_from_U64(const U64 val)
|
|||
U64 ll_U64_from_sd(const LLSD& sd)
|
||||
{
|
||||
U32 high, low;
|
||||
std::vector<U8> v = sd.asBinary();
|
||||
const LLSD::Binary& v = sd.asBinary();
|
||||
|
||||
if (v.size() < 8)
|
||||
{
|
||||
|
|
@ -112,7 +112,7 @@ U64 ll_U64_from_sd(const LLSD& sd)
|
|||
// IP Address (stored in net order in a U32, so don't need swizzling)
|
||||
LLSD ll_sd_from_ipaddr(const U32 val)
|
||||
{
|
||||
std::vector<U8> v;
|
||||
LLSD::Binary v;
|
||||
|
||||
v.resize(4);
|
||||
memcpy(&(v[0]), &val, 4); /* Flawfinder: ignore */
|
||||
|
|
@ -123,7 +123,7 @@ LLSD ll_sd_from_ipaddr(const U32 val)
|
|||
U32 ll_ipaddr_from_sd(const LLSD& sd)
|
||||
{
|
||||
U32 ret;
|
||||
std::vector<U8> v = sd.asBinary();
|
||||
const LLSD::Binary& v = sd.asBinary();
|
||||
if (v.size() < 4)
|
||||
{
|
||||
return 0;
|
||||
|
|
@ -135,17 +135,17 @@ U32 ll_ipaddr_from_sd(const LLSD& sd)
|
|||
// Converts an LLSD binary to an LLSD string
|
||||
LLSD ll_string_from_binary(const LLSD& sd)
|
||||
{
|
||||
std::vector<U8> value = sd.asBinary();
|
||||
const LLSD::Binary& value = sd.asBinary();
|
||||
std::string str;
|
||||
str.resize(value.size());
|
||||
memcpy(&str[0], &value[0], value.size());
|
||||
memcpy(&str[0], value.data(), value.size());
|
||||
return str;
|
||||
}
|
||||
|
||||
// Converts an LLSD string to an LLSD binary
|
||||
LLSD ll_binary_from_string(const LLSD& sd)
|
||||
{
|
||||
std::vector<U8> binary_value;
|
||||
LLSD::Binary binary_value;
|
||||
|
||||
std::string string_value = sd.asString();
|
||||
for (const U8 c : string_value)
|
||||
|
|
@ -990,8 +990,7 @@ LLSD llsd_clone(LLSD value, LLSD filter)
|
|||
|
||||
case LLSD::TypeBinary:
|
||||
{
|
||||
LLSD::Binary bin(value.asBinary().begin(), value.asBinary().end());
|
||||
clone = LLSD::Binary(bin);
|
||||
clone = LLSD::Binary(value.asBinary().begin(), value.asBinary().end());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -2345,11 +2345,11 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
|
|||
continue;
|
||||
}
|
||||
|
||||
LLSD::Binary pos = mdl[i]["Position"];
|
||||
LLSD::Binary norm = mdl[i]["Normal"];
|
||||
LLSD::Binary tangent = mdl[i]["Tangent"];
|
||||
LLSD::Binary tc = mdl[i]["TexCoord0"];
|
||||
LLSD::Binary idx = mdl[i]["TriangleList"];
|
||||
const LLSD::Binary& pos = mdl[i]["Position"].asBinary();
|
||||
const LLSD::Binary& norm = mdl[i]["Normal"].asBinary();
|
||||
const LLSD::Binary& tangent = mdl[i]["Tangent"].asBinary();
|
||||
const LLSD::Binary& tc = mdl[i]["TexCoord0"].asBinary();
|
||||
const LLSD::Binary& idx = mdl[i]["TriangleList"].asBinary();
|
||||
|
||||
//copy out indices
|
||||
auto num_indices = idx.size() / 2;
|
||||
|
|
@ -2538,7 +2538,7 @@ bool LLVolume::unpackVolumeFacesInternal(const LLSD& mdl)
|
|||
continue;
|
||||
}
|
||||
|
||||
LLSD::Binary weights = mdl[i]["Weights"];
|
||||
const LLSD::Binary& weights = mdl[i]["Weights"].asBinary();
|
||||
|
||||
U32 idx = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ LLSD HttpCoroRawHandler::handleSuccess(LLCore::HttpResponse * response, LLCore::
|
|||
bas >> std::noskipws;
|
||||
data.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>());
|
||||
|
||||
result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = data;
|
||||
result[HttpCoroutineAdapter::HTTP_RESULTS_RAW] = std::move(data);
|
||||
|
||||
#else
|
||||
// This is disabled because it's dangerous. See the other case for an
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,
|
|||
const LLSD& message,
|
||||
LLHTTPNode::ResponsePtr responsep)
|
||||
{
|
||||
std::vector<U8> data = message["body"]["binary-template-data"].asBinary();
|
||||
const LLSD::Binary& data = message["body"]["binary-template-data"].asBinary();
|
||||
auto size = data.size();
|
||||
if(size == 0)
|
||||
{
|
||||
|
|
@ -53,11 +53,11 @@ void LLTemplateMessageDispatcher::dispatch(const std::string& msg_name,
|
|||
LLHost host;
|
||||
host = gMessageSystem->getSender();
|
||||
|
||||
bool validate_message = mTemplateMessageReader.validateMessage(&(data[0]), static_cast<S32>(size), host, true);
|
||||
bool validate_message = mTemplateMessageReader.validateMessage(data.data(), static_cast<S32>(size), host, true);
|
||||
|
||||
if (validate_message)
|
||||
{
|
||||
mTemplateMessageReader.readMessage(&(data[0]),host);
|
||||
mTemplateMessageReader.readMessage(data.data(),host);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ LLSD LLMaterialID::asLLSD() const
|
|||
materialIDBinary.resize(MATERIAL_ID_SIZE * sizeof(U8));
|
||||
memcpy(materialIDBinary.data(), mID, MATERIAL_ID_SIZE * sizeof(U8));
|
||||
|
||||
LLSD materialID = materialIDBinary;
|
||||
LLSD materialID = std::move(materialIDBinary);
|
||||
return materialID;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue