NativeXml
NativeXml copied to clipboard
Range-Error in sdStreams.pas when Element.text is greater than 32k
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;
Changed all :integer declarations in the unit to :longint and the problem is gone so far.
Changed all :integer declarations in the unit to :longint and the problem is gone so far.
But LongInt
is equal to Integer
under Windows, are you sure that fixed the problem?