#1 Re: mORMot 1 » TAlgoCompress.StreamCompress is buggy » 2022-07-09 03:27:36

my sample project is successful now.

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

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

#2 mORMot 1 » TAlgoCompress.StreamCompress is buggy » 2022-07-08 13:09:06

MyKore
Replies: 2

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.

Board footer

Powered by FluxBB