#1 2022-07-08 13:09:06

MyKore
Member
Registered: 2022-07-08
Posts: 2

TAlgoCompress.StreamCompress is buggy

when the Source is a TMemoryStream,  TAlgoCompress.StreamCompress will always read the first 4M bytes,   you never advance S to next chunk.

A.TXT with 'A' and 'B',
run the sample project, then check the B.TXT, you will find only 'A' is appear. 


program Project1;

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils,
  Classes,
  mormot.core.buffers;

const
  ChunkComp_Magic:Cardinal = $4E50435A;
  ChunkComp_ChunkSize = 4096;
var
  ms:TMemoryStream;
begin
  ms:=TMemoryStream.Create;
  ms.LoadFromFile('A.TXT');
  AlgoSynLZ.StreamCompress(ms,'A.SLZ',ChunkComp_Magic,False,False,ChunkComp_ChunkSize);
  ms.Free;

  ms := AlgoSynLZ.StreamUnCompress('A.SLZ',ChunkComp_Magic,False);
  ms.SaveToFile('B.TXT');
  ms.Free;
end.

Last edited by MyKore (2022-07-08 13:13:27)

Offline

#2 2022-07-08 21:30:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: TAlgoCompress.StreamCompress is buggy

Please follow the forum rules and do not post huge code or text in the forum.

Didn't https://github.com/synopse/mORMot2/commit/585a9758913 fix it?

Offline

#3 2022-07-09 03:27:36

MyKore
Member
Registered: 2022-07-08
Posts: 2

Re: TAlgoCompress.StreamCompress is buggy

my sample project is successful now.

by the way, what's the mean of {%H-},

e.g.:   D = pointer({%H-}tmpd)

Last edited by MyKore (2022-07-09 12:19:26)

Offline

Board footer

Powered by FluxBB