Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mterwoord_cp authored and mterwoord_cp committed Sep 20, 2014
1 parent 43f26fe commit 387ee63
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion Users/Kudzu/Breakpoints/BreakpointsOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ protected void TestATA()
var xData = new byte[xRootFile.Size];
var size = (int) xRootFile.Size;
Console.WriteLine("Size: " + size);
xStream.Read(xData, 0, (int) xRootFile.Size);
var sizeInt = (int)xRootFile.Size;
xStream.Read(xData, 0, sizeInt);
var xText = Encoding.ASCII.GetString(xData);
Console.WriteLine(xText);
}
Expand Down
24 changes: 12 additions & 12 deletions source2/Kernel/System/Cosmos.System/Filesystem/FAT/FatStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ public int Read(byte[] aBuffer, Int64 aOffset, Int64 aCount) {
UInt64 xClusterIdx = mPosition / xClusterSize;
UInt64 xPosInCluster = mPosition % xClusterSize;
mFS.ReadCluster((ulong)mFatTable[(int)xClusterIdx], xCluster);
// long xReadSize;
// if (xPosInCluster + xCount > xClusterSize) {
// xReadSize = (long)(xClusterSize - xPosInCluster - 1);
// } else {
// xReadSize = (long)xCount;
// }
// // no need for a long version, because internal Array.Copy() does a cast down to int, and a range check,
// // or we do a semantic change here
// Array.Copy(xCluster, (long)xPosInCluster, aBuffer, aOffset, xReadSize);

// aOffset += xReadSize;
//xCount -= (ulong)xReadSize;
long xReadSize;
if (xPosInCluster + xCount > xClusterSize) {
xReadSize = (long)(xClusterSize - xPosInCluster - 1);
} else {
xReadSize = (long)xCount;
}
// no need for a long version, because internal Array.Copy() does a cast down to int, and a range check,
// or we do a semantic change here
Array.Copy(xCluster, (long)xPosInCluster, aBuffer, aOffset, xReadSize);

aOffset += xReadSize;
xCount -= (ulong)xReadSize;
xCount = 0;
}

Expand Down

0 comments on commit 387ee63

Please sign in to comment.