diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2022-11-22 16:21:44 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2022-11-22 16:21:44 -0500 |
commit | abe62c23d74d5319691a49881719b03cc9b5b090 (patch) | |
tree | d63f782540580ab5ad6f28d144c4909a420dec11 /indra/llcommon/lllivefile.cpp | |
parent | 15b5dedb2dc139c85461e7c867164b65cc6fc628 (diff) |
SL-18330: Make LLSDSerialize::deserialize() default to notation.
LLSDSerialize::serialize() emits a header string, e.g. "<? llsd/notation ?>"
for notation format. Until now, LLSDSerialize::deserialize() has required that
header to properly decode the input stream.
But none of LLSDBinaryFormatter, LLSDXMLFormatter or LLSDNotationFormatter
emit that header themselves. Nor do any of the Python llsd.format_binary(),
format_xml() or format_notation() functions. Until now, you could not use
LLSD::deserialize() to parse an arbitrary-format LLSD stream serialized by
anything but LLSDSerialize::serialize().
Change LLSDSerialize::deserialize() so that if no header is recognized,
instead of failing, it attempts to parse as notation. Add tests to exercise
this case.
The tricky part about this processing is that deserialize() necessarily reads
some number of bytes from the input stream first, to try to recognize the
header. If it fails to do so, it must prepend the bytes it has already read to
the rest of the input stream since they're probably the beginning of the
serialized data.
To support this use case, introduce cat_streambuf, a std::streambuf subclass
that (virtually) concatenates other std::streambuf instances. When read by a
std::istream, the sequence of underlying std::streambufs appears to the
consumer as a single continuous stream.
Diffstat (limited to 'indra/llcommon/lllivefile.cpp')
0 files changed, 0 insertions, 0 deletions