minor: move some compression related var setup inside compression if/then switch

xassetservice
Justin Clark-Casey (justincc) 2012-03-09 00:16:49 +00:00
parent 0cbdf9dad2
commit 3c5bd7c35a
1 changed files with 3 additions and 4 deletions

View File

@ -214,17 +214,16 @@ namespace OpenSim.Data.MySQL
m_log.Warn("[XASSET DB]: Description field truncated from " + asset.Description.Length + " to " + assetDescription.Length + " characters on add");
}
byte[] compressedData;
MemoryStream outputStream = new MemoryStream();
if (m_enableCompression)
{
MemoryStream outputStream = new MemoryStream();
using (GZipStream compressionStream = new GZipStream(outputStream, CompressionMode.Compress, false))
{
// Console.WriteLine(WebUtil.CopyTo(new MemoryStream(asset.Data), compressionStream, int.MaxValue));
// We have to close the compression stream in order to make sure it writes everything out to the underlying memory output stream.
compressionStream.Close();
compressedData = outputStream.ToArray();
byte[] compressedData = outputStream.ToArray();
asset.Data = compressedData;
}
}