Skip to content

Commit d1ea6d1

Browse files
authored
Merge pull request #36 from doubleyewdee/master
Fixes for typo+int.MaxValue streams
2 parents d1b5880 + ef151ba commit d1ea6d1

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

Microsoft.IO.RecyclableMemoryStream.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<package>
33
<metadata>
44
<id>Microsoft.IO.RecyclableMemoryStream</id>
5-
<version>1.2.0</version>
6-
<title>Micrisift.IO.RecyclableMemoryStream</title>
5+
<version>1.2.1</version>
6+
<title>Microsoft.IO.RecyclableMemoryStream</title>
77
<authors>Ben Watson; Chip Locke</authors>
88
<licenseUrl>https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream/blob/master/LICENSE</licenseUrl>
99
<projectUrl>https://github.com/Microsoft/Microsoft.IO.RecyclableMemoryStream</projectUrl>

UnitTests/Tests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ public void GiantAllocationSucceeds()
444444
var stream = mgr.GetStream(null, requestedSize);
445445
Assert.IsTrue(stream.Capacity >= requestedSize);
446446
}
447+
448+
var maxStream = mgr.GetStream(null, int.MaxValue);
449+
Assert.IsTrue(maxStream.Capacity == int.MaxValue);
447450
}
448451
#endregion
449452

src/RecyclableMemoryStream.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public override int Capacity
314314
return this.largeBuffer.Length;
315315
}
316316

317-
long size = this.blocks.Count * this.memoryManager.BlockSize;
317+
long size = (long)this.blocks.Count * this.memoryManager.BlockSize;
318318
return (int)Math.Min(int.MaxValue, size);
319319
}
320320
set

0 commit comments

Comments
 (0)