From 3c5bd7c35ab24250f4f65e4ba90b3febaf5edd06 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 9 Mar 2012 00:16:49 +0000 Subject: minor: move some compression related var setup inside compression if/then switch --- OpenSim/Data/MySQL/MySQLXAssetData.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'OpenSim/Data') diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs index 501cf1a..95ef72a 100644 --- a/OpenSim/Data/MySQL/MySQLXAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs @@ -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; } } -- cgit v1.1