use System.IO.Compression.DeflateStream for mesh decompression in an attempt to reduce mesh asset decoding failures

master-beforevarregion
dahlia 2013-12-06 15:58:19 -08:00
parent 8ebad90800
commit 1496de7ce9
2 changed files with 5 additions and 10 deletions

View File

@ -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;
}
/// <summary>
/// decompresses a gzipped OSD object
/// </summary>
@ -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();

View File

@ -585,7 +585,6 @@
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="log4net" path="../../../../bin/"/>
<Reference name="zlib.net" path="../../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true"/>