Browse Source

compatibility fix.

Ugochukwu Mmaduekwe 7 years ago
parent
commit
cbefb1ac1d
1 changed files with 9 additions and 2 deletions
  1. 9 2
      CryptoLib/src/Asn1/ClpDerBmpString.pas

+ 9 - 2
CryptoLib/src/Asn1/ClpDerBmpString.pas

@@ -151,12 +151,19 @@ procedure TDerBmpString.Encode(const derOut: IDerOutputStream);
 var
 var
   c: TCryptoLibCharArray;
   c: TCryptoLibCharArray;
   b: TCryptoLibByteArray;
   b: TCryptoLibByteArray;
-  i: Int32;
+  i, LowPoint, HighPoint: Int32;
 begin
 begin
   System.SetLength(c, System.Length(Str));
   System.SetLength(c, System.Length(Str));
 
 
   // had to use this loop because somehow, StrPLCopy causes memory leak in FPC v3.0.5
   // had to use this loop because somehow, StrPLCopy causes memory leak in FPC v3.0.5
-  For i := System.Low(Str) to System.High(Str) do
+{$IFDEF DELPHIXE3_UP}
+  LowPoint := System.Low(Str);
+  HighPoint := System.High(Str);
+{$ELSE}
+  LowPoint := 1;
+  HighPoint := System.Length(Str);
+{$ENDIF DELPHIXE3_UP}
+  For i := LowPoint to HighPoint do
   begin
   begin
     c[i - 1] := Str[i];
     c[i - 1] := Str[i];
   end;
   end;