mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-08 04:39:41 +01:00
* use proper value for Fnv64 initialization
* PPU version increased
This commit is contained in:
parent
84da5e619c
commit
190b27ad45
@ -33,6 +33,7 @@ function TrimStrCRC32(const s: ansistring; maxlen: longint): ansistring;
|
|||||||
{ calculate string hash using FNV Hash:
|
{ calculate string hash using FNV Hash:
|
||||||
http://www.isthe.com/chongo/tech/comp/fnv/
|
http://www.isthe.com/chongo/tech/comp/fnv/
|
||||||
}
|
}
|
||||||
|
function InitFnv64: uint64;
|
||||||
function UpdateFnv64(const InitFnv: uint64; const InBuf; InLen: Integer): uint64;
|
function UpdateFnv64(const InitFnv: uint64; const InBuf; InLen: Integer): uint64;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -102,6 +103,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function InitFnv64: uint64;
|
||||||
|
begin
|
||||||
|
result:=uint64(14695981039346656037);
|
||||||
|
end;
|
||||||
|
|
||||||
{ calculate string hash using FNV Hash:
|
{ calculate string hash using FNV Hash:
|
||||||
http://www.isthe.com/chongo/tech/comp/fnv/
|
http://www.isthe.com/chongo/tech/comp/fnv/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -744,7 +744,7 @@ implementation
|
|||||||
tmpstr:=_class.objname^+'_$_'+make_mangledname('',realintfdef.owner,'')+'_$$_'+realintfdef.objname^+'_$_'+tostr(i)+'_$_'+pd.mangledname;
|
tmpstr:=_class.objname^+'_$_'+make_mangledname('',realintfdef.owner,'')+'_$$_'+realintfdef.objname^+'_$_'+tostr(i)+'_$_'+pd.mangledname;
|
||||||
if length(tmpstr)>50 then
|
if length(tmpstr)>50 then
|
||||||
begin
|
begin
|
||||||
hash:=0;
|
hash:=InitFnv64;
|
||||||
hash:=UpdateFnv64(hash,tmpstr[51],length(tmpstr)-50);
|
hash:=UpdateFnv64(hash,tmpstr[51],length(tmpstr)-50);
|
||||||
hs:=copy(tmpstr,1,50)+'$H'+Base64Mangle(hash);
|
hs:=copy(tmpstr,1,50)+'$H'+Base64Mangle(hash);
|
||||||
end
|
end
|
||||||
|
|||||||
@ -48,7 +48,7 @@ const
|
|||||||
CurrentPPUVersion = 208;
|
CurrentPPUVersion = 208;
|
||||||
{ for any other changes to the ppu format, increase this version number
|
{ for any other changes to the ppu format, increase this version number
|
||||||
(it's a cardinal) }
|
(it's a cardinal) }
|
||||||
CurrentPPULongVersion = 24;
|
CurrentPPULongVersion = 25;
|
||||||
|
|
||||||
{ unit flags }
|
{ unit flags }
|
||||||
uf_big_endian = $000004;
|
uf_big_endian = $000004;
|
||||||
|
|||||||
@ -1669,7 +1669,7 @@ implementation
|
|||||||
begin
|
begin
|
||||||
if length(prefix)>(maxidlen-length(s)-1) then
|
if length(prefix)>(maxidlen-length(s)-1) then
|
||||||
begin
|
begin
|
||||||
hash:=0;
|
hash:=InitFnv64;
|
||||||
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
|
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
|
||||||
prefix:='$H'+Base64Mangle(hash);
|
prefix:='$H'+Base64Mangle(hash);
|
||||||
end;
|
end;
|
||||||
@ -1686,7 +1686,7 @@ implementation
|
|||||||
internalerror(200204174);
|
internalerror(200204174);
|
||||||
if length(prefix)>(maxidlen-length(tabstractrecorddef(st.defowner).objname^)-3) then
|
if length(prefix)>(maxidlen-length(tabstractrecorddef(st.defowner).objname^)-3) then
|
||||||
begin
|
begin
|
||||||
hash:=0;
|
hash:=InitFnv64;
|
||||||
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
|
hash:=UpdateFnv64(hash,prefix[1],length(prefix));
|
||||||
prefix:='$H'+Base64Mangle(hash);
|
prefix:='$H'+Base64Mangle(hash);
|
||||||
end;
|
end;
|
||||||
@ -1731,7 +1731,7 @@ implementation
|
|||||||
result:=result+'_$$_'+suffix;
|
result:=result+'_$$_'+suffix;
|
||||||
if length(result)>(maxidlen-1) then
|
if length(result)>(maxidlen-1) then
|
||||||
begin
|
begin
|
||||||
hash:=0;
|
hash:=InitFnv64;
|
||||||
hash:=UpdateFnv64(hash,result[1],length(result));
|
hash:=UpdateFnv64(hash,result[1],length(result));
|
||||||
result:=copy(result,1,maxidlen-(high(Base64OfUint64String)-low(Base64OfUint64String)+1)-2)+'$H'+Base64Mangle(hash);
|
result:=copy(result,1,maxidlen-(high(Base64OfUint64String)-low(Base64OfUint64String)+1)-2)+'$H'+Base64Mangle(hash);
|
||||||
end;
|
end;
|
||||||
@ -5785,7 +5785,7 @@ implementation
|
|||||||
if (newlen-oldlen>12) and
|
if (newlen-oldlen>12) and
|
||||||
((newlen>100) or (newlen-oldlen>64)) then
|
((newlen>100) or (newlen-oldlen>64)) then
|
||||||
begin
|
begin
|
||||||
hash:=0;
|
hash:=InitFnv64;
|
||||||
for i:=0 to paras.count-1 do
|
for i:=0 to paras.count-1 do
|
||||||
begin
|
begin
|
||||||
hp:=tparavarsym(paras[i]);
|
hp:=tparavarsym(paras[i]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user