Browse Source

fixed compiler warnings and hints in Delphi.

Ugochukwu Mmaduekwe 7 years ago
parent
commit
a7c0fc10c6

+ 3 - 0
CryptoLib/src/Asn1/ClpAsn1InputStream.pas

@@ -25,6 +25,9 @@ uses
   Classes,
   Generics.Collections,
   ClpCryptoLibTypes,
+{$IFDEF DELPHI}
+  ClpIDerNull,
+{$ENDIF DELPHI}
   ClpAsn1Tags,
   ClpDefiniteLengthInputStream,
   ClpDerOctetString,

+ 3 - 0
CryptoLib/src/Asn1/ClpAsn1Sequence.pas

@@ -27,6 +27,9 @@ uses
   ClpCryptoLibTypes,
   ClpCollectionUtilities,
   ClpDerNull,
+{$IFDEF DELPHI}
+  ClpIDerNull,
+{$ENDIF DELPHI}
   ClpIBerTaggedObject,
   ClpAsn1TaggedObject,
   ClpIAsn1TaggedObject,

+ 3 - 0
CryptoLib/src/Asn1/ClpAsn1Set.pas

@@ -28,6 +28,9 @@ uses
   ClpCryptoLibTypes,
   ClpCollectionUtilities,
   ClpDerNull,
+{$IFDEF DELPHI}
+  ClpIDerNull,
+{$ENDIF DELPHI}
   ClpIAsn1TaggedObject,
   ClpIAsn1EncodableVector,
   ClpAsn1EncodableVector,

+ 0 - 1
CryptoLib/src/Asn1/ClpBerOctetString.pas

@@ -156,7 +156,6 @@ function TBerOctetString.GenerateOcts: TList<IDerOctetString>;
 var
   i, endPoint: Int32;
   nStr: TCryptoLibByteArray;
-  temp: IDerOctetString;
 begin
   result := TList<IDerOctetString>.Create();
   i := 0;

+ 4 - 0
CryptoLib/src/Asn1/ClpBerTaggedObject.pas

@@ -25,6 +25,10 @@ uses
   SysUtils,
   Generics.Collections,
   ClpCryptoLibTypes,
+{$IFDEF DELPHI}
+  ClpAsn1TaggedObject,
+  ClpIBerSequence,
+{$ENDIF DELPHI}
   ClpAsn1Tags,
   ClpBerSequence,
   ClpIAsn1OctetString,

+ 4 - 4
CryptoLib/src/Asn1/ClpDerApplicationSpecific.pas

@@ -329,7 +329,7 @@ begin
   //
   if (tagNo = $1F) then
   begin
-    tagNo := 0;
+    // tagNo := 0;
 
     b := input[index] and $FF;
     System.Inc(index);
@@ -343,13 +343,13 @@ begin
 
     while ((b >= 0) and ((b and $80) <> 0)) do
     begin
-      tagNo := tagNo or ((b and $7F));
-      tagNo := tagNo shl 7;
+      // tagNo := tagNo or ((b and $7F));
+      // tagNo := tagNo shl 7;
       b := input[index] and $FF;
       System.Inc(index);
     end;
 
-    tagNo := tagNo or (b and $7F);
+    // tagNo := tagNo or (b and $7F);
   end;
 
   System.SetLength(tmp, System.Length(input) - index + 1);

+ 15 - 15
CryptoLib/src/Asn1/X9/ClpECNamedCurveTable.pas

@@ -41,8 +41,8 @@ type
   strict private
 
     class function GetNames: TCryptoLibStringArray; static;
-    class function FromDomainParameters(const dp: IECDomainParameters)
-      : IX9ECParameters; static; inline;
+    // class function FromDomainParameters(const dp: IECDomainParameters)
+    // : IX9ECParameters; static; inline;
 
   public
     // /**
@@ -87,19 +87,19 @@ implementation
 
 { TECNamedCurveTable }
 
-class function TECNamedCurveTable.FromDomainParameters
-  (const dp: IECDomainParameters): IX9ECParameters;
-begin
-  if dp = Nil then
-  begin
-    result := Nil;
-  end
-  else
-  begin
-    result := TX9ECParameters.Create(dp.Curve, dp.G, dp.N, dp.H, dp.GetSeed())
-  end;
-
-end;
+// class function TECNamedCurveTable.FromDomainParameters
+// (const dp: IECDomainParameters): IX9ECParameters;
+// begin
+// if dp = Nil then
+// begin
+// result := Nil;
+// end
+// else
+// begin
+// result := TX9ECParameters.Create(dp.Curve, dp.G, dp.N, dp.H, dp.GetSeed())
+// end;
+//
+// end;
 
 class function TECNamedCurveTable.GetByName(const name: String)
   : IX9ECParameters;

+ 1 - 1
CryptoLib/src/Crypto/Signers/ClpECSchnorrSigner.pas

@@ -423,7 +423,7 @@ var
   xQ, yQ, tempV, tempH, rb: TCryptoLibByteArray;
   R_and_S: TCryptoLibGenericArray<TBigInteger>;
 begin
-  Result := False;
+
   if (pu_key.parameters.curve = Nil) then
   begin
     raise EArgumentNilCryptoLibException.CreateRes(@SCurveNil)

+ 0 - 3
CryptoLib/src/Include/CryptoLib.inc

@@ -65,9 +65,6 @@
 // It does not affect the binary size or generated code
 {$DEFINITIONINFO ON}
 
-// Disable Hints.
-{$HINTS OFF}
-
 // Disable Overflow and RangeChecks.
 {$OVERFLOWCHECKS OFF}
 {$RANGECHECKS OFF}

+ 6 - 6
CryptoLib/src/Math/EC/Abc/ClpSimpleBigDecimal.pas

@@ -57,7 +57,7 @@ type
     function GetInt64Value: Int64; inline;
     function GetScale: Int32; inline;
 
-    constructor Create(const limBigDec: TSimpleBigDecimal); overload;
+    // constructor Create(const limBigDec: TSimpleBigDecimal); overload;
 
     procedure CheckScale(const b: TSimpleBigDecimal); inline;
 
@@ -178,11 +178,11 @@ begin
   Result := FbigInt.CompareTo(val.FbigInt);
 end;
 
-constructor TSimpleBigDecimal.Create(const limBigDec: TSimpleBigDecimal);
-begin
-  FbigInt := limBigDec.FbigInt;
-  Fscale := limBigDec.Fscale;
-end;
+// constructor TSimpleBigDecimal.Create(const limBigDec: TSimpleBigDecimal);
+// begin
+// FbigInt := limBigDec.FbigInt;
+// Fscale := limBigDec.Fscale;
+// end;
 
 constructor TSimpleBigDecimal.Create(const bigInt: TBigInteger; scale: Int32);
 begin

+ 3 - 0
CryptoLib/src/Math/Raw/ClpMod.pas

@@ -23,6 +23,9 @@ interface
 
 uses
   ClpCryptoLibTypes,
+{$IFDEF DELPHI}
+  ClpBitConverter,
+{$ENDIF DELPHI}
   ClpNat,
   ClpConverters,
   ClpSecureRandom,

+ 2 - 2
CryptoLib/src/Utils/ClpStreamSorter.pas

@@ -33,8 +33,8 @@ type
   public
 
     class function Read(input: TStream; var buffer: TCryptoLibByteArray;
-      offset, count: Int32): Int32; static; inline;
-    class function ReadByte(input: TStream): Int32; static; inline;
+      offset, count: Int32): Int32; static;
+    class function ReadByte(input: TStream): Int32; static;
   end;
 
 implementation

+ 3 - 0
CryptoLib/src/Utils/Encoders/ClpBase64.pas

@@ -23,6 +23,9 @@ interface
 
 uses
   SbpBase64,
+{$IFDEF DELPHI}
+  SbpIBase64,
+{$ENDIF DELPHI}
   ClpCryptoLibTypes;
 
 type