Skip to content

Commit

Permalink
Fix errors with BlockDB files > 32 GB
Browse files Browse the repository at this point in the history
  • Loading branch information
UnknownShadow200 committed Feb 8, 2021
1 parent c6c19c6 commit 8247b19
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions MCGalaxy/Database/BlockDB/BlockDBFile.V1.cs
Expand Up @@ -82,8 +82,8 @@ public unsafe sealed class BlockDBFile_V1 : BlockDBFile {
}

public unsafe override int ReadForward(Stream s, byte[] bulk, BlockDBEntry* entriesPtr) {
int remaining = (int)((s.Length - s.Position) / EntrySize);
int count = Math.Min(remaining, BulkEntries);
long remaining = (s.Length - s.Position) / EntrySize;
int count = (int)Math.Min(remaining, BulkEntries);

if (count > 0) {
BlockDBFile.ReadFully(s, bulk, 0, count * EntrySize);
Expand All @@ -93,8 +93,8 @@ public unsafe sealed class BlockDBFile_V1 : BlockDBFile {

public unsafe override int ReadBackward(Stream s, byte[] bulk, BlockDBEntry* entriesPtr) {
long pos = s.Position;
int remaining = (int)(pos / EntrySize) - HeaderEntries;
int count = Math.Min(remaining, BulkEntries);
long remaining = (pos / EntrySize) - HeaderEntries;
int count = (int)Math.Min(remaining, BulkEntries);

if (count > 0) {
pos -= count * EntrySize;
Expand Down

0 comments on commit 8247b19

Please sign in to comment.