From bcf2e31a516190df2bac351f767205105bb111b9 Mon Sep 17 00:00:00 2001 From: alcexhim Date: Fri, 24 Jul 2015 12:04:39 -0400 Subject: [PATCH] Calculate block count using floating point math and Ceiling() for accuracy --- .../UniversalEditor.Essential/ObjectModels/FileSystem/File.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs b/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs index cb4a29c0..20617a28 100644 --- a/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs +++ b/CSharp/Plugins/UniversalEditor.Essential/ObjectModels/FileSystem/File.cs @@ -259,7 +259,8 @@ namespace UniversalEditor.ObjectModels.FileSystem long blockSize = (System.Environment.WorkingSet / BLOCK_FRACTION); long offset = 0; - long blockCount = mvarSource.GetLength() / blockSize; + double dbl = ((double)mvarSource.GetLength() / (double)blockSize); + long blockCount = (long)Math.Ceiling(dbl); if (transformations != null) {