Unit DIFFMAKE

**************************************************} { } { Difference Maker } { Copyright (c) 1997,1998 S.Kurinny & S.Kostinsky } { } {

Classes

TDiffMaker - Suppose that you must send to smb.

Functions

CalculateCRC32 - Calculates CRC value for a given buffer.
CRC32Calc - Calculates CRC for a given memory buffer.
CRC32Finish - ----------------------------------------------------------------------} { Finishes calculation of CRC.
CRC32Start - Returns initialized CRC variable (Assigns value $FFFFFFFF to it).
DiffMakerRegister - -------------------------------------------------
DiffStreamCompress - Low level difference making routine.
DiffStreamExtract - Low level routine for applying delta (previously created with DiffStreamCompress procedure) to the old data

-------------------------------------------------@param InStream stream with delta @param UseStream stream that will be used (old version of a file) @param OutStream output stream (new version of a file) @see DiffStreamCompress
RegisterFileNamePropEdits - -------------------------------------------------} { Call this procedure to register filename property editor for properties InFile,OutFile and UseFile of TDiffMake component.

Types

Constants

SErrCRC
SErrSmallBuffer

Variables


Functions


Function CalculateCRC32(VAR Buf;Count:Integer):Integer;

Calculates CRC value for a given buffer. This function calls CRC32Start, CRC32Calc,CRC32finish internally and returns calculated CRC value.

----------------------------------------------------------------------


function CRC32Calc(Var Buf;CRC:integer;BufSize:Integer):Integer;

ParameterDescription
Bufmemory buffer
CRCinitial CRC value (result of previuos call to CRC32Calc or $FFFFFFFF). @BufSize buffer size. @result new CRC value

Calculates CRC for a given memory buffer.

----------------------------------------------------------------------


function CRC32Finish(CRC:Integer):Integer;

----------------------------------------------------------------------} { Finishes calculation of CRC. If you don't need compartability with PKZIP's CRC algorythm you may not call this function.

----------------------------------------------------------------------} { Tests CRC algorythm. Returns true if Ok. This function is for testing purposes only and you don't need to call it.} {Function TestCRC:Boolean; Var CRC:Integer; begin CRC:=not CRC32Calc(TestString[1],$ffffffff,Length(TestString)); Result:=CRC=PKZIP_CRC; end;} {----------------------------------------------------------------------


function CRC32Start:Integer;

Returns initialized CRC variable (Assigns value $FFFFFFFF to it). CRC variable must be initialized before calculating CRC.

----------------------------------------------------------------------


procedure DiffMakerRegister;

-------------------------------------------------

procedure DiffStreamCompress(InStream,UseStream,OutStream:TStream;MaxLev:Integer);

ParameterDescription
InStreamstream that need to be compressed (for example new version of a file)
UseStreamstream that will be used (for example old version of a file)
OutStreamoutput stream (delta file)
MaxLevcompression level (10..1000, 10 - maximal speed, minimal compression ratio, 1000 - minimal speed, maximal compression ratio) @see DiffStreamExtract

Low level difference making routine.

-------------------------------------------------


procedure DiffStreamExtract(InStream,UseStream,OutStream:TStream);

ParameterDescription
InStreamstream with delta
UseStreamstream that will be used (old version of a file)
OutStreamoutput stream (new version of a file) @see DiffStreamCompress

Low level routine for applying delta (previously created with DiffStreamCompress procedure) to the old data

-------------------------------------------------


procedure RegisterFileNamePropEdits;

-------------------------------------------------} { Call this procedure to register filename property editor for properties InFile,OutFile and UseFile of TDiffMake component. This procedure is used by \DEMO\DIFFGUI\diffgui.dpr demo project.

-------------------------------------------------


Types


Constants

SErrCRC = 'CRC Error'

SErrSmallBuffer = 'Buffer size should be at least 4 bytes'


Variables