You are not logged in.
Pages: 1
function HashString(str: AnsiString): cardinal;
begin
Result:=Hash32(pointer(str), Length(str))
end;
str:
'120546506@115871'
'141084032@115871'
all result=3273449680.
hash32 bug...
File: http://pan.baidu.com/s/1eQnbM98
unzip 001.7z
---------------------------
Debugger Exception Notification
---------------------------
Project Project2.exe raised exception class EAccessViolation with message 'Access violation at address 004C0C6C in module 'Project2.exe'. Write of address 7FEA0000'.
---------------------------
Break Continue Help
---------------------------
uses SynCommons;
....
var
i:DWORD;
begin
i:=GetTickCount;
FileSynLZ('.\001.jpg','.\s1.lz',Hash32('vbz007'));
ShowMessage(IntToStr(GetTickCount-i));
end;
Carefully read the SynZip code! Discover Link two obj.
My test exclusively using the SynZip;
my delphi path exists zlibEx.
Obj file is not compatible.
I tested again using the [mORMot Framework]'obj, Results are correct.
No Bug.... I'm sorry!
{{ in-memory ZLib DEFLATE compression }
function CompressMem(src, dst: pointer; srcLen, dstLen: integer;
CompressionLevel: integer=6; ZipFormat: Boolean=false) : integer;
/// in-memory ZLib INFLATE decompression
function UnCompressMem(src, dst: pointer; srcLen, dstLen: integer) : integer;
/// ZLib DEFLATE compression from memory into a stream
function CompressStream(src: pointer; srcLen: integer;
aStream: TStream; CompressionLevel:integer=6; ZipFormat: Boolean=false): cardinal;
/// ZLib INFLATE decompression from memory into a stream
// - return the number of bytes written into the stream
// - if checkCRC if not nil, it will contain thecrc32 (if aStream is nil, it will
// fast calculate the crc of the the uncompressed memory block)
function UnCompressStream(src: pointer; srcLen: integer; aStream: TStream; checkCRC: PCardinal): cardinal;
function Result is error!!
CODE:
var
fm:TFileStream;
s:AnsiString;
begin
fm:=TFileStream.Create(ExtractFilePath(ParamStr(0))+'4.zlib',fmCreate or fmOpenReadWrite);
try
s:='this is test!';
CompressStream(@s[1],Length(s),fm);
finally
FreeAndNil(fm);
end;
end;
Error:
fm.size=0;
function CompressString(const data: RawByteString; failIfGrow: boolean = false;
CompressionLevel: integer=6) : RawByteString;
Result is also Error!
Pages: 1