summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-09-29 18:10:27 -0500
committerDave Parks <davep@lindenlab.com>2010-09-29 18:10:27 -0500
commit23b4dc61893f90abd49957a9b377312012fa0161 (patch)
tree0d961db90558b15a6ef98b6db6fc7e1998cdc42c
parent0c93da0501ab1debd6fa11af29a215be81f7b803 (diff)
Fix for serialization deprecation problems.
-rw-r--r--indra/llcommon/llsdserialize.cpp21
-rw-r--r--indra/llprimitive/llmodel.cpp2
-rw-r--r--indra/newview/llmeshrepository.cpp13
3 files changed, 28 insertions, 8 deletions
diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp
index cce3e5d16e..fe7072d01a 100644
--- a/indra/llcommon/llsdserialize.cpp
+++ b/indra/llcommon/llsdserialize.cpp
@@ -1999,7 +1999,7 @@ std::string zip_llsd(LLSD& data)
{
std::stringstream llsd_strm;
- LLSDSerialize::serialize(data, llsd_strm, LLSDSerialize::LLSD_BINARY);
+ LLSDSerialize::toBinary(data, llsd_strm);
const U32 CHUNK = 65536;
@@ -2052,7 +2052,7 @@ std::string zip_llsd(LLSD& data)
return std::string();
}
}
- while (strm.avail_out == 0);
+ while (ret == Z_OK);
std::string::size_type size = cur_size;
@@ -2060,12 +2060,14 @@ std::string zip_llsd(LLSD& data)
deflateEnd(&strm);
free(output);
+#if 0 //verify results work with unzip_llsd
std::istringstream test(result);
LLSD test_sd;
if (!unzip_llsd(test_sd, test, result.size()))
{
llerrs << "Invalid compression result!" << llendl;
}
+#endif
return result;
}
@@ -2131,7 +2133,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
memcpy(result+cur_size, out, have);
cur_size += have;
- } while (strm.avail_out == 0);
+ } while (ret == Z_OK);
inflateEnd(&strm);
delete [] in;
@@ -2145,9 +2147,18 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size)
//result now points to the decompressed LLSD block
{
std::string res_str((char*) result, cur_size);
- std::istringstream istr(res_str);
- if (!LLSDSerialize::deserialize(data, istr, cur_size))
+ std::string deprecated_header("<? LLSD/Binary ?>");
+
+ if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
+ {
+ res_str = res_str.substr(deprecated_header.size()+1, cur_size);
+ }
+ cur_size = res_str.size();
+
+ std::istringstream istr(res_str);
+
+ if (!LLSDSerialize::fromBinary(data, istr, cur_size))
{
llwarns << "Failed to unzip LLSD block" << llendl;
free(result);
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index b2f80de12a..9e3d9704ae 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1660,7 +1660,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite)
if (!nowrite)
{
- LLSDSerialize::serialize(header, ostr, LLSDSerialize::LLSD_BINARY);
+ LLSDSerialize::toBinary(header, ostr);
if (!skin.empty())
{ //write skin block
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 5347b7313e..17b101e410 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -897,15 +897,24 @@ bool LLMeshRepoThread::headerReceived(const LLVolumeParams& mesh_params, U8* dat
{
std::string res_str((char*) data, data_size);
+ std::string deprecated_header("<? LLSD/Binary ?>");
+
+ if (res_str.substr(0, deprecated_header.size()) == deprecated_header)
+ {
+ res_str = res_str.substr(deprecated_header.size()+1, data_size);
+ header_size = deprecated_header.size()+1;
+ }
+ data_size = res_str.size();
+
std::istringstream stream(res_str);
- if (!LLSDSerialize::deserialize(header, stream, data_size))
+ if (!LLSDSerialize::fromBinary(header, stream, data_size))
{
llwarns << "Mesh header parse error. Not a valid mesh asset!" << llendl;
return false;
}
- header_size = stream.tellg();
+ header_size += stream.tellg();
}
else
{