From 1496de7ce99079d3d7bf046db088c3d6e2a97bcb Mon Sep 17 00:00:00 2001 From: dahlia Date: Fri, 6 Dec 2013 15:58:19 -0800 Subject: use System.IO.Compression.DeflateStream for mesh decompression in an attempt to reduce mesh asset decoding failures --- OpenSim/Region/Physics/Meshing/Meshmerizer.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Physics/Meshing/Meshmerizer.cs') diff --git a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs index 1f08b03..e313a30 100644 --- a/OpenSim/Region/Physics/Meshing/Meshmerizer.cs +++ b/OpenSim/Region/Physics/Meshing/Meshmerizer.cs @@ -40,7 +40,6 @@ using log4net; using Nini.Config; using System.Reflection; using System.IO; -using ComponentAce.Compression.Libs.zlib; namespace OpenSim.Region.Physics.Meshing { @@ -549,7 +548,6 @@ namespace OpenSim.Region.Physics.Meshing return true; } - /// /// decompresses a gzipped OSD object /// @@ -564,15 +562,13 @@ namespace OpenSim.Region.Physics.Meshing { using (MemoryStream outMs = new MemoryStream()) { - using (ZOutputStream zOut = new ZOutputStream(outMs)) + using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress)) { byte[] readBuffer = new byte[2048]; - int readLen = 0; - while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0) - { - zOut.Write(readBuffer, 0, readLen); - } - zOut.Flush(); + inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header + + decompressionStream.CopyTo(outMs); + outMs.Seek(0, SeekOrigin.Begin); byte[] decompressedBuf = outMs.GetBuffer(); -- cgit v1.1