diff --git a/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas b/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas index 369ee58..419e04a 100644 --- a/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas +++ b/HashLib/src/Crypto/Blake2BParams/HlpBlake2BParams.pas @@ -97,7 +97,7 @@ TBlake2BTreeConfig = class sealed(TInterfacedObject, IBlake2BTreeConfig) procedure ValidateInnerHashSize(AInnerHashSize: Byte); inline; procedure ValidateMaxDepth(AMaxDepth: Byte); inline; procedure ValidateNodeDepth(ANodeDepth: Byte); inline; - procedure ValidateNodeOffset(ANodeOffset: UInt64); inline; + procedure ValidateNodeOffset(ANodeOffset: UInt64); function GetFanOut: Byte; inline; procedure SetFanOut(AValue: Byte); inline; @@ -342,9 +342,10 @@ procedure TBlake2BTreeConfig.ValidateNodeDepth(ANodeDepth: Byte); end; procedure TBlake2BTreeConfig.ValidateNodeOffset(ANodeOffset: UInt64); +const + MaxNodeOffset: UInt64 = $FFFFFFFFFFFFFFFF; // (2^64) - 1 begin - // ANodeOffset > ((2^64) - 1) - if ANodeOffset > System.High(UInt64) then + if ANodeOffset > MaxNodeOffset then begin raise EArgumentInvalidHashLibException.CreateRes (@SInvalidNodeOffsetParameter); diff --git a/HashLib/src/Include/HashLib.inc b/HashLib/src/Include/HashLib.inc index 6c47f0b..d0a32d1 100644 --- a/HashLib/src/Include/HashLib.inc +++ b/HashLib/src/Include/HashLib.inc @@ -21,6 +21,13 @@ {$MESSAGE ERROR 'This Library requires Delphi 2010 or higher.'} {$IFEND} + // Silence H2586 (legacy $IFEND) on XE4+ where $ENDIF can also close $IF. + // The $LEGACYIFEND directive itself was introduced in XE4 (25.0), so the + // guard is necessary to keep Delphi 2010 / XE / XE2 / XE3 compiling. + {$IF CompilerVersion >= 25.0} + {$LEGACYIFEND ON} + {$IFEND} + {$DEFINE DELPHI} {$DEFINITIONINFO ON} // Enable code browsing (Ctrl+Click) diff --git a/HashLib/src/Utils/HlpArmHwCapProvider.pas b/HashLib/src/Utils/HlpArmHwCapProvider.pas index f4e73c7..3d269d0 100644 --- a/HashLib/src/Utils/HlpArmHwCapProvider.pas +++ b/HashLib/src/Utils/HlpArmHwCapProvider.pas @@ -139,12 +139,17 @@ implementation class procedure TArmHwCapProvider.ResolveDynamicImports(); var - LHandle: Pointer; + LHandle: NativeUInt; begin FGetAuxVal := nil; +{$IFDEF FPC} + LHandle := NativeUInt(dlopen(nil, RTLD_NOW)); +{$ELSE} LHandle := dlopen(nil, RTLD_NOW); - if LHandle = nil then +{$ENDIF} + + if LHandle = 0 then Exit; try @@ -179,12 +184,17 @@ class function TArmHwCapProvider.GetHwCap2(): UInt64; class procedure TArmHwCapProvider.ResolveDynamicImports(); var - LHandle: Pointer; + LHandle: NativeUInt; begin FElfAuxInfo := nil; +{$IFDEF FPC} + LHandle := NativeUInt(dlopen(nil, RTLD_NOW)); +{$ELSE} LHandle := dlopen(nil, RTLD_NOW); - if LHandle = nil then +{$ENDIF} + + if LHandle = 0 then Exit; try