aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/PhysicsModules/Meshing
diff options
context:
space:
mode:
authorUbitUmarov2019-04-02 10:13:26 +0100
committerUbitUmarov2019-04-02 10:13:26 +0100
commitba66d2d3c125136171dc9fec34bb9d424a6a731d (patch)
treed5cd06c550f27d73af5cff6cd50036ea7e27ed39 /OpenSim/Region/PhysicsModules/Meshing
parentmantis 8509: replace mesh gzip decompress (diff)
downloadopensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.zip
opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.gz
opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.bz2
opensim-SC-ba66d2d3c125136171dc9fec34bb9d424a6a731d.tar.xz
minor cleanup on mesh decompress code
Diffstat (limited to 'OpenSim/Region/PhysicsModules/Meshing')
-rw-r--r--OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs16
1 files changed, 5 insertions, 11 deletions
diff --git a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
index 0d4b6b9..de39d0e 100644
--- a/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
+++ b/OpenSim/Region/PhysicsModules/Meshing/Meshmerizer/Meshmerizer.cs
@@ -597,28 +597,22 @@ namespace OpenSim.Region.PhysicsModule.Meshing
597 { 597 {
598 OSD decodedOsd = null; 598 OSD decodedOsd = null;
599 599
600 using (MemoryStream inMs = new MemoryStream(meshBytes)) 600 using (MemoryStream outMs = new MemoryStream())
601 { 601 {
602 using (MemoryStream outMs = new MemoryStream()) 602 using (MemoryStream inMs = new MemoryStream(meshBytes))
603 { 603 {
604 using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) 604 using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress))
605 { 605 {
606 byte[] readBuffer = new byte[2048]; 606 byte[] readBuffer = new byte[8192];
607 inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header 607 inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
608 int readLen = 0; 608 int readLen = 0;
609 609
610 while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0) 610 while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
611 outMs.Write(readBuffer, 0, readLen); 611 outMs.Write(readBuffer, 0, readLen);
612
613 outMs.Flush();
614
615 outMs.Seek(0, SeekOrigin.Begin);
616
617 byte[] decompressedBuf = outMs.GetBuffer();
618
619 decodedOsd = OSDParser.DeserializeLLSDBinary(decompressedBuf);
620 } 612 }
621 } 613 }
614 outMs.Seek(0, SeekOrigin.Begin);
615 decodedOsd = OSDParser.DeserializeLLSDBinary(outMs);
622 } 616 }
623 return decodedOsd; 617 return decodedOsd;
624 } 618 }