Robert martin asked: 

> On the FTP server I have
> 
> procedure TForm1.IdFTPServerCRCFile(ASender: TIdFTPServerContext;
>   const AFileName: String; var VStream: TStream); var
>     CRC     : TIdHashCRC32;
>     fs      : TFileStream;
>     Hash    : String;
> begin
>     CRC := TIdHashCRC32.Create;
>     try
>         fs := TFileStream.Create(AFilename, fmOpenRead);
>         try
>             Hash    := IntToStr(CRC.HashValue(fs));
> 
>             VStream := TMemoryStream.Create;
>             VStream.Write(Hash, SizeOf(Hash));

I think the preceeding line should read:
             VStream.Write(Hash, Length(Hash));

As SizeOf will return you 4 bytes being the native size of the string type,
ie. a pointer.

>         finally
>             fs.Free;
>         end;
>     finally
>         CRC.Free;
>     end;

Cheers, Max.


_______________________________________________
Delphi mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to