Skip to content

Range-Error in sdStreams.pas when Element.text is greater than 32k #9

Description

@MicrotronX

Hi, there is a problem within the function tsdBufferWriter.write:

A tByteArray is used for the WriteChunk call but the tByteArray has a limit of 32k. In my case, I have disabled the ChunkWrites:

function TsdBufferWriter.Write(const Buffer; Count: Integer): Longint;
var
Idx, Siz: integer;
begin
// index in the source buffer
Idx := 0;
// remaining size
Siz := Count;

fSource.WriteBuffer(Buffer, Count); // write everything at once

{ // code starting from here makes problems with big content!
// surplus
while FRawPosition + Siz >= FChunkSize do
begin
Move(TByteArray(Buffer)[Idx], FRawBuffer[FRawPosition], FChunkSize - FRawPosition);
WriteChunk(FChunkSize);
dec(Siz, FChunkSize - FRawPosition);
inc(Idx, FChunkSize - FRawPosition);
FRawPosition := 0;
end;

// copy the raw buffer
Move(TByteArray(Buffer)[Idx], FRawBuffer[FRawPosition], Siz);
}

inc(FRawPosition, Siz);

Result := Count;
end;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions