mantis 8509: replace mesh gzip decompress

0.9.1.0-post-fixes
UbitUmarov 2019-04-01 18:12:17 +01:00
parent 7f55db72d2
commit 2739b2f5cc
1 changed files with 15 additions and 15 deletions

View File

@ -40,7 +40,7 @@ using OpenSim.Region.Framework;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Framework.Capabilities; using OpenSim.Framework.Capabilities;
using ComponentAce.Compression.Libs.zlib; using System.IO.Compression;
using OSDArray = OpenMetaverse.StructuredData.OSDArray; using OSDArray = OpenMetaverse.StructuredData.OSDArray;
using OSDMap = OpenMetaverse.StructuredData.OSDMap; using OSDMap = OpenMetaverse.StructuredData.OSDMap;
@ -571,15 +571,15 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
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[4096]; byte[] readBuffer = new byte[2048];
inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
int readLen = 0; int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{ while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
zOut.Write(readBuffer, 0, readLen); outMs.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin); outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer(); byte[] decompressedBuf = outMs.GetBuffer();
@ -638,15 +638,15 @@ namespace OpenSim.Region.ClientStack.Linden
{ {
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[4096]; byte[] readBuffer = new byte[2048];
inMs.Read(readBuffer, 0, 2); // skip first 2 bytes in header
int readLen = 0; int readLen = 0;
while ((readLen = inMs.Read(readBuffer, 0, readBuffer.Length)) > 0)
{ while ((readLen = decompressionStream.Read(readBuffer, 0, readBuffer.Length)) > 0)
zOut.Write(readBuffer, 0, readLen); outMs.Write(readBuffer, 0, readLen);
}
zOut.Flush();
outMs.Seek(0, SeekOrigin.Begin); outMs.Seek(0, SeekOrigin.Begin);
byte[] decompressedBuf = outMs.GetBuffer(); byte[] decompressedBuf = outMs.GetBuffer();