use System.IO.Compression.DeflateStream for mesh decompression in an attempt to reduce mesh asset decoding failures
parent
8ebad90800
commit
1496de7ce9
|
@ -40,7 +40,6 @@ using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using ComponentAce.Compression.Libs.zlib;
|
|
||||||
|
|
||||||
namespace OpenSim.Region.Physics.Meshing
|
namespace OpenSim.Region.Physics.Meshing
|
||||||
{
|
{
|
||||||
|
@ -549,7 +548,6 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// decompresses a gzipped OSD object
|
/// decompresses a gzipped OSD object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -564,15 +562,13 @@ namespace OpenSim.Region.Physics.Meshing
|
||||||
{
|
{
|
||||||
using (MemoryStream outMs = new MemoryStream())
|
using (MemoryStream outMs = new MemoryStream())
|
||||||
{
|
{
|
||||||
using (ZOutputStream zOut = new ZOutputStream(outMs))
|
using (DeflateStream decompressionStream = new DeflateStream(inMs, CompressionMode.Decompress))
|
||||||
{
|
{
|
||||||
byte[] readBuffer = new byte[2048];
|
byte[] readBuffer = new byte[2048];
|
||||||
int readLen = 0;
|
inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
|
||||||
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
|
|
||||||
{
|
decompressionStream.CopyTo(outMs);
|
||||||
zOut.Write(readBuffer, 0, readLen);
|
|
||||||
}
|
|
||||||
zOut.Flush();
|
|
||||||
outMs.Seek(0, SeekOrigin.Begin);
|
outMs.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
byte[] decompressedBuf = outMs.GetBuffer();
|
byte[] decompressedBuf = outMs.GetBuffer();
|
||||||
|
|
|
@ -585,7 +585,6 @@
|
||||||
<Reference name="OpenSim.Framework.Console"/>
|
<Reference name="OpenSim.Framework.Console"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="log4net" path="../../../../bin/"/>
|
<Reference name="log4net" path="../../../../bin/"/>
|
||||||
<Reference name="zlib.net" path="../../../../bin/"/>
|
|
||||||
|
|
||||||
<Files>
|
<Files>
|
||||||
<Match pattern="*.cs" recurse="true"/>
|
<Match pattern="*.cs" recurse="true"/>
|
||||||
|
|
Loading…
Reference in New Issue