Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle FileBlockSize values > 4096 when reading #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,12 @@ public enum LoadingRule
/// </summary>
public static uint FirstIdentity { get { return 1; } }

const int BlockHeaderSize = 16; //length + CRC
const int BlockHeaderSize = 17; //Header Size + Length + CRC + Block Count + Block Id
private const int OffsetOfHeaderSize = 0;
private const int OffsetOfLength = 0;
private const int OffsetOfCrc32 = 4;
private const int OffsetOfBlockCount = 8;
private const int OffsetOfBlockId = 12;
private const int OffsetOfLength = 1;
private const int OffsetOfCrc32 = 5;
private const int OffsetOfBlockCount = 9;
private const int OffsetOfBlockId = 13;

readonly Options _options;
readonly int BlockSize;
Expand Down Expand Up @@ -895,7 +895,7 @@ public Stream Read(ref BlockRef block, bool headerOnly, FGet fget)
throw new InvalidDataException();

headerSize = bytes[OffsetOfHeaderSize];
length = (int) GetUInt32(bytes, OffsetOfLength) & 0x00FFFFFF;
length = (int) GetUInt32(bytes, OffsetOfLength);

block.ActualBlocks = (int) GetUInt32(bytes, OffsetOfBlockCount);
uint blockId = GetUInt32(bytes, OffsetOfBlockId);
Expand Down