Skip to content

Commit

Permalink
Merge pull request #36 from doubleyewdee/master
Browse files Browse the repository at this point in the history
Fixes for typo+int.MaxValue streams
  • Loading branch information
doubleyewdee committed Dec 14, 2016
2 parents d1b5880 + ef151ba commit d1ea6d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Microsoft.IO.RecyclableMemoryStream.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<package>
<metadata>
<id>Microsoft.IO.RecyclableMemoryStream</id>
<version>1.2.0</version>
<title>Micrisift.IO.RecyclableMemoryStream</title>
<version>1.2.1</version>
<title>Microsoft.IO.RecyclableMemoryStream</title>
<authors>Ben Watson; Chip Locke</authors>
<licenseUrl>https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream</projectUrl>
Expand Down
3 changes: 3 additions & 0 deletions UnitTests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,9 @@ public void GiantAllocationSucceeds()
var stream = mgr.GetStream(null, requestedSize);
Assert.IsTrue(stream.Capacity >= requestedSize);
}

var maxStream = mgr.GetStream(null, int.MaxValue);
Assert.IsTrue(maxStream.Capacity == int.MaxValue);
}
#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/RecyclableMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public override int Capacity
return this.largeBuffer.Length;
}

long size = this.blocks.Count * this.memoryManager.BlockSize;
long size = (long)this.blocks.Count * this.memoryManager.BlockSize;
return (int)Math.Min(int.MaxValue, size);
}
set
Expand Down

0 comments on commit d1ea6d1

Please sign in to comment.