Skip to content
Snippets Groups Projects
Commit c805d879 authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

More needless stream allocations

parent 127f1e3a
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
#include "lltimer.h" #include "lltimer.h"
#include "lldir.h" #include "lldir.h"
#include <boost/iostreams/stream.hpp>
#if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG #if LL_RELEASE_WITH_DEBUG_INFO || LL_DEBUG
#define CONTROL_ERRS LL_ERRS("ControlErrors") #define CONTROL_ERRS LL_ERRS("ControlErrors")
#else #else
...@@ -203,7 +205,8 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value) ...@@ -203,7 +205,8 @@ LLSD LLControlVariable::getComparableValue(const LLSD& value)
{ {
LLPointer<LLSDNotationParser> parser = new LLSDNotationParser; LLPointer<LLSDNotationParser> parser = new LLSDNotationParser;
LLSD result; LLSD result;
std::stringstream value_stream(value.asString()); const auto& llsd_str = value.asStringRef();
boost::iostreams::stream<boost::iostreams::array_source> value_stream(llsd_str.data(), llsd_str.size());
if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE) if (parser->parse(value_stream, result, LLSDSerialize::SIZE_UNLIMITED) != LLSDParser::PARSE_FAILURE)
{ {
storable_value = result; storable_value = result;
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
#include "llsd.h" #include "llsd.h"
#include "llsdserialize.h" #include "llsdserialize.h"
#include <boost/iostreams/device/array.hpp>
#include <boost/iostreams/stream.hpp>
LLLocationHistory::LLLocationHistory() : LLLocationHistory::LLLocationHistory() :
mFilename("typed_locations.txt") mFilename("typed_locations.txt")
{ {
...@@ -163,7 +166,7 @@ void LLLocationHistory::load() ...@@ -163,7 +166,7 @@ void LLLocationHistory::load()
LLPointer<LLSDParser> parser = new LLSDNotationParser(); LLPointer<LLSDParser> parser = new LLSDNotationParser();
while (std::getline(file, line)) { while (std::getline(file, line)) {
LLSD s_item; LLSD s_item;
std::istringstream iss(line); boost::iostreams::stream<boost::iostreams::array_source> iss(line.data(), line.size());
if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE) if (parser->parse(iss, s_item, line.length()) == LLSDParser::PARSE_FAILURE)
{ {
LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL; LL_INFOS()<< "Parsing saved teleport history failed" << LL_ENDL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment