Skip to content

Commit

Permalink
Better fix for issue #135
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed May 4, 2015
1 parent e957b1c commit 49d987a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions MimeKit/IO/Filters/MimeFilterBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ namespace MimeKit.IO.Filters {
/// </remarks>
public abstract class MimeFilterBase : IMimeFilter
{
byte[] output = new byte[4096];
byte[] preload = null;
byte[] inbuf = null;
int preloadLength;
byte[] preload;
byte[] output;
byte[] inbuf;

/// <summary>
/// Initializes a new instance of the <see cref="MimeKit.IO.Filters.MimeFilterBase"/> class.
Expand Down Expand Up @@ -221,15 +221,12 @@ protected void SaveRemainingInput (byte[] input, int startIndex, int length)
/// <param name="keep">If set to <c>true</c>, the current output should be preserved.</param>
protected void EnsureOutputSize (int size, bool keep)
{
if (size == 0)
return;

int outputSize = output != null ? output.Length : 0;
int outputSize = output != null ? output.Length : -1;

if (outputSize >= size)
return;

if (keep)
if (keep && output != null)
Array.Resize<byte> (ref output, GetIdealBufferSize (size));
else
output = new byte[GetIdealBufferSize (size)];
Expand Down

0 comments on commit 49d987a

Please sign in to comment.