diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcommon/llsdserialize.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/linden/indra/llcommon/llsdserialize.cpp b/linden/indra/llcommon/llsdserialize.cpp index a556d5d..d42842d 100644 --- a/linden/indra/llcommon/llsdserialize.cpp +++ b/linden/indra/llcommon/llsdserialize.cpp | |||
@@ -37,7 +37,7 @@ | |||
37 | #include "llstreamtools.h" // for fullread | 37 | #include "llstreamtools.h" // for fullread |
38 | 38 | ||
39 | #include <iostream> | 39 | #include <iostream> |
40 | #include "apr-1/apr_base64.h" | 40 | #include "apr_base64.h" |
41 | 41 | ||
42 | #if !LL_WINDOWS | 42 | #if !LL_WINDOWS |
43 | #include <netinet/in.h> // htonl & ntohl | 43 | #include <netinet/in.h> // htonl & ntohl |
@@ -146,12 +146,15 @@ bool LLSDSerialize::deserialize(LLSD& sd, std::istream& str, S32 max_bytes) | |||
146 | * Create the parser as appropriate | 146 | * Create the parser as appropriate |
147 | */ | 147 | */ |
148 | if (legacy_no_header) | 148 | if (legacy_no_header) |
149 | { | 149 | { // Create a LLSD XML parser, and parse the first chunk read above |
150 | LLSDXMLParser* x = new LLSDXMLParser; | 150 | LLSDXMLParser* x = new LLSDXMLParser(); |
151 | x->parsePart(hdr_buf, inbuf); | 151 | x->parsePart(hdr_buf, inbuf); // Parse the first part that was already read |
152 | p = x; | 152 | x->parseLines(str, sd); // Parse the rest of it |
153 | delete x; | ||
154 | return true; | ||
153 | } | 155 | } |
154 | else if (header == LLSD_BINARY_HEADER) | 156 | |
157 | if (header == LLSD_BINARY_HEADER) | ||
155 | { | 158 | { |
156 | p = new LLSDBinaryParser; | 159 | p = new LLSDBinaryParser; |
157 | } | 160 | } |
@@ -300,7 +303,8 @@ static const char BINARY_FALSE_SERIAL = '0'; | |||
300 | /** | 303 | /** |
301 | * LLSDParser | 304 | * LLSDParser |
302 | */ | 305 | */ |
303 | LLSDParser::LLSDParser() : mCheckLimits(true), mMaxBytesLeft(0) | 306 | LLSDParser::LLSDParser() |
307 | : mCheckLimits(true), mMaxBytesLeft(0), mParseLines(false) | ||
304 | { | 308 | { |
305 | } | 309 | } |
306 | 310 | ||
@@ -316,6 +320,15 @@ S32 LLSDParser::parse(std::istream& istr, LLSD& data, S32 max_bytes) | |||
316 | } | 320 | } |
317 | 321 | ||
318 | 322 | ||
323 | // Parse using routine to get() lines, faster than parse() | ||
324 | S32 LLSDParser::parseLines(std::istream& istr, LLSD& data) | ||
325 | { | ||
326 | mCheckLimits = false; | ||
327 | mParseLines = false; // was true, Emergency fix DEV-17785 parsing newline failure | ||
328 | return doParse(istr, data); | ||
329 | } | ||
330 | |||
331 | |||
319 | int LLSDParser::get(std::istream& istr) const | 332 | int LLSDParser::get(std::istream& istr) const |
320 | { | 333 | { |
321 | if(mCheckLimits) --mMaxBytesLeft; | 334 | if(mCheckLimits) --mMaxBytesLeft; |
@@ -1217,8 +1230,7 @@ void LLSDFormatter::realFormat(const std::string& format) | |||
1217 | 1230 | ||
1218 | void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const | 1231 | void LLSDFormatter::formatReal(LLSD::Real real, std::ostream& ostr) const |
1219 | { | 1232 | { |
1220 | char buffer[MAX_STRING]; /* Flawfinder: ignore */ | 1233 | std::string buffer = llformat(mRealFormat.c_str(), real); |
1221 | snprintf(buffer, MAX_STRING, mRealFormat.c_str(), real); /* Flawfinder: ignore */ | ||
1222 | ostr << buffer; | 1234 | ostr << buffer; |
1223 | } | 1235 | } |
1224 | 1236 | ||