Skip to content

Commit d613d7b

Browse files
committed
Changed IFEND to ENDIF etc. to make it compile with Delphi again
The contribution of FPC compatibility made it no longer compile with Delphi so it had to be rolled back in parts. Not sure if it compiles with FPC any longer.
1 parent 04aa02e commit d613d7b

13 files changed

+72
-68
lines changed

Docs/VersionHistory.pdf

35.3 KB
Binary file not shown.

NOTICE.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jbg
2626
Gloegg
2727
pierangelodalben
2828
denovosoftware
29+
alexrayne
2930

3031
Parts of the work loosely based on the works of Wolfgang Erhardt, who is
3132
unfortunately dead already.

Source/DECBaseClass.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class function TDECObject.Identity: Int64;
243243
{$ELSE}
244244
Result := CRC32(IdentityBase, Signature[Low(Signature)],
245245
Length(Signature) * SizeOf(Signature[1]));
246-
{$IFEND}
246+
{$ENDIF}
247247
{$ELSE !DEC52_IDENTITY}
248248
Signature := RawByteString(StringOfChar(#$5A, 256 - Length(ClassName)) + UpperCase(ClassName));
249249
{$IFDEF HAVE_STR_LIKE_ARRAY}
@@ -252,7 +252,7 @@ class function TDECObject.Identity: Int64;
252252
{$ELSE}
253253
Result := CRC32(IdentityBase, Signature[1],
254254
Length(Signature) * SizeOf(Signature[1]));
255-
{$IFEND}
255+
{$ENDIF}
256256
{$ENDIF !DEC52_IDENTITY}
257257
end;
258258

Source/DECCipherBase.pas

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,19 +1003,19 @@ procedure TDECCipher.Init(const Key : RawByteString;
10031003
raise EDECCipherException.CreateRes(@sNoKeyMaterialGiven);
10041004

10051005
if Length(IVector) > 0 then
1006-
{$IFdef HAVE_STR_LIKE_ARRAY}
1006+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10071007
Init(Key[Low(Key)], Length(Key) * SizeOf(Key[Low(Key)]),
10081008
IVector[Low(IVector)], Length(IVector) * SizeOf(IVector[Low(IVector)]), IFiller)
10091009
{$ELSE}
10101010
Init(Key[1], Length(Key) * SizeOf(Key[1]),
10111011
IVector[1], Length(IVector) * SizeOf(IVector[1]), IFiller)
1012-
{$IFEND}
1012+
{$ENDIF}
10131013
else
1014-
{$IFdef HAVE_STR_LIKE_ARRAY}
1014+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10151015
Init(Key[Low(Key)], Length(Key) * SizeOf(Key[Low(Key)]), NullStr, 0, IFiller);
10161016
{$ELSE}
10171017
Init(Key[1], Length(Key) * SizeOf(Key[1]), NullStr, 0, IFiller);
1018-
{$IFEND}
1018+
{$ENDIF}
10191019
end;
10201020

10211021

@@ -1052,19 +1052,19 @@ procedure TDECCipher.Init(const Key, IVector: WideString; IFiller: Byte);
10521052
raise EDECCipherException.CreateRes(@sNoKeyMaterialGiven);
10531053

10541054
if Length(IVector) > 0 then
1055-
{$IFdef HAVE_STR_LIKE_ARRAY}
1055+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10561056
Init(Key[Low(Key)], Length(Key) * SizeOf(Key[Low(Key)]),
10571057
IVector[Low(IVector)], Length(IVector) * SizeOf(IVector[Low(IVector)]), IFiller)
10581058
{$ELSE}
10591059
Init(Key[1], Length(Key) * SizeOf(Key[1]),
10601060
IVector[1], Length(IVector) * SizeOf(IVector[1]), IFiller)
1061-
{$IFEND}
1061+
{$ENDIF}
10621062
else
1063-
{$IFdef HAVE_STR_LIKE_ARRAY}
1063+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10641064
Init(Key[Low(Key)], Length(Key) * SizeOf(Key[Low(Key)]), NullStr, 0, IFiller);
10651065
{$ELSE}
10661066
Init(Key[1], Length(Key) * SizeOf(Key[1]), NullStr, 0, IFiller);
1067-
{$IFEND}
1067+
{$ENDIF}
10681068
end;
10691069
{$ENDIF}
10701070

@@ -1098,13 +1098,13 @@ function TDECCipher.EncodeRawByteString(const Source: RawByteString; Format: TDE
10981098
SetLength(b, 0);
10991099
if Length(Source) > 0 then
11001100
begin
1101-
{$IFdef HAVE_STR_LIKE_ARRAY}
1101+
{$IFDEF HAVE_STR_LIKE_ARRAY}
11021102
SetLength(b, Length(Source) * SizeOf(Source[Low(Source)]));
11031103
DoEncode(@Source[low(Source)], @b[0], Length(Source) * SizeOf(Source[low(Source)]));
11041104
{$ELSE}
11051105
SetLength(b, Length(Source) * SizeOf(Source[1]));
11061106
DoEncode(@Source[1], @b[0], Length(Source) * SizeOf(Source[1]));
1107-
{$IFEND}
1107+
{$ENDIF}
11081108
Result := BytesToRawString(ValidFormat(Format).Encode(b));
11091109
end;
11101110
end;
@@ -1139,11 +1139,11 @@ function TDECCipher.DecodeRawByteString(const Source: RawByteString; Format: TDE
11391139
// This has been fixed in 10.3.0 Rio
11401140
b := ValidFormat(Format).Decode(BytesOf(Source));
11411141

1142-
{$IFdef HAVE_STR_LIKE_ARRAY}
1142+
{$IFDEF HAVE_STR_LIKE_ARRAY}
11431143
DoDecode(@b[0], @Result[Low(Result)], Length(Result) * SizeOf(Result[Low(Result)]));
11441144
{$ELSE}
11451145
DoDecode(@b[0], @Result[1], Length(Result) * SizeOf(Result[1]));
1146-
{$IFEND}
1146+
{$ENDIF}
11471147
end;
11481148
end;
11491149

Source/DECCipherFormats.pas

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -845,15 +845,15 @@ function TDECFormattedCipher.EncodeStringToBytes(const Source: string;
845845
begin
846846
if Length(Source) > 0 then
847847
begin
848-
{$IFdef HAVE_STR_LIKE_ARRAY}
848+
{$IFDEF HAVE_STR_LIKE_ARRAY}
849849
Len := Length(Source) * SizeOf(Source[low(Source)]);
850850
SetLength(Result, Len);
851851
Encode(Source[low(Source)], Result[0], Len);
852852
{$ELSE}
853853
Len := Length(Source) * SizeOf(Source[1]);
854854
SetLength(Result, Len);
855855
Encode(Source[1], Result[0], Len);
856-
{$IFEND}
856+
{$ENDIF}
857857

858858
Result := ValidFormat(Format).Encode(Result);
859859
end
@@ -867,15 +867,15 @@ function TDECFormattedCipher.EncodeStringToBytes(const Source: RawByteString; Fo
867867
begin
868868
if Length(Source) > 0 then
869869
begin
870-
{$IFdef HAVE_STR_LIKE_ARRAY}
870+
{$IFDEF HAVE_STR_LIKE_ARRAY}
871871
Len := Length(Source) * SizeOf(Source[low(Source)]);
872872
SetLength(Result, Len);
873873
Encode(Source[low(Source)], Result[0], Len);
874874
{$ELSE}
875875
Len := Length(Source) * SizeOf(Source[1]);
876876
SetLength(Result, Len);
877877
Encode(Source[1], Result[0], Len);
878-
{$IFEND}
878+
{$ENDIF}
879879

880880
Result := ValidFormat(Format).Encode(Result);
881881
end
@@ -1009,15 +1009,15 @@ function TDECFormattedCipher.EncodeStringToString(const Source: string;
10091009
begin
10101010
if Length(Source) > 0 then
10111011
begin
1012-
{$IFdef HAVE_STR_LIKE_ARRAY}
1012+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10131013
SourceSize := Length(Source) * SizeOf(Source[low(Source)]);
10141014
SetLength(EncryptedBuffer, SourceSize);
10151015
Encode(Source[low(Source)], EncryptedBuffer[0], SourceSize);
10161016
{$ELSE}
10171017
SourceSize := Length(Source) * SizeOf(Source[1]);
10181018
SetLength(EncryptedBuffer, SourceSize);
10191019
Encode(Source[1], EncryptedBuffer[0], SourceSize);
1020-
{$IFEND}
1020+
{$ENDIF}
10211021

10221022
Result := StringOf(ValidFormat(Format).Encode(EncryptedBuffer));
10231023
end
@@ -1034,23 +1034,23 @@ function TDECFormattedCipher.EncodeStringToString(const Source: RawByteString;
10341034
begin
10351035
if Length(Source) > 0 then
10361036
begin
1037-
{$IFdef HAVE_STR_LIKE_ARRAY}
1037+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10381038
SourceSize := Length(Source) * SizeOf(Source[low(Source)]);
10391039
SetLength(EncryptedBuffer, SourceSize);
10401040
Encode(Source[low(Source)], EncryptedBuffer[0], SourceSize);
10411041
{$ELSE}
10421042
SourceSize := Length(Source) * SizeOf(Source[1]);
10431043
SetLength(EncryptedBuffer, SourceSize);
10441044
Encode(Source[1], EncryptedBuffer[0], SourceSize);
1045-
{$IFEND}
1045+
{$ENDIF}
10461046

10471047
Temp := ValidFormat(Format).Encode(EncryptedBuffer);
10481048
SetLength(Result, length(Temp));
1049-
{$IFdef HAVE_STR_LIKE_ARRAY}
1049+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10501050
Move(Temp[0], Result[low(Result)], length(Temp))
10511051
{$ELSE}
10521052
Move(Temp[0], Result[1], length(Temp))
1053-
{$IFEND}
1053+
{$ENDIF}
10541054
end
10551055
else
10561056
Result := '';
@@ -1093,11 +1093,11 @@ function TDECFormattedCipher.DecodeStringToString(const Source: AnsiString;
10931093

10941094
SetLength(Result, length(Tmp));
10951095

1096-
{$IFdef HAVE_STR_LIKE_ARRAY}
1096+
{$IFDEF HAVE_STR_LIKE_ARRAY}
10971097
Move(Tmp[0], Result[low(Result)], length(Tmp))
10981098
{$ELSE}
10991099
Move(Tmp[0], Result[1], length(Tmp))
1100-
{$IFEND}
1100+
{$ENDIF}
11011101
end
11021102
else
11031103
SetLength(Result, 0);
@@ -1129,11 +1129,11 @@ function TDECFormattedCipher.DecodeStringToString(const Source: RawByteString;
11291129

11301130
SetLength(Result, length(Tmp));
11311131

1132-
{$IFdef HAVE_STR_LIKE_ARRAY}
1132+
{$IFDEF HAVE_STR_LIKE_ARRAY}
11331133
Move(Tmp[0], Result[low(Result)], length(Tmp))
11341134
{$ELSE}
11351135
Move(Tmp[0], Result[1], length(Tmp))
1136-
{$IFEND}
1136+
{$ENDIF}
11371137
end
11381138
else
11391139
SetLength(Result, 0);

Source/DECFormat.pas

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ class function TFormat_HEX.CharTableBinary: TBytes;
431431
// special and skipped chars
432432
// '0123456789ABCDEFX$ abcdefhHx()[]{},;:-_/\*+"'''+CHR(9)+CHR(10)+CHR(13);
433433

434-
{$IFdef HAVE_ASSIGN_ARRAY}
434+
{$IFDEF HAVE_ASSIGN_ARRAY}
435435
result := [$30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $41, $42, $43,
436436
$44, $45, $46, $58, $24, $20, $61, $62, $63, $64, $65, $66, $68,
437437
$48, $78, $28, $29, $5B, $5D, $7B, $7D, $2C, $3B, $3A, $2D, $5F,
@@ -487,7 +487,7 @@ class function TFormat_HEX.CharTableBinary: TBytes;
487487
result[45]:=$09;
488488
result[46]:=$0A;
489489
result[47]:=$0D;
490-
{$IFEND}
490+
{$ENDIF}
491491
end;
492492

493493
class procedure TFormat_HEX.DoEncode(const Source; var Dest: TBytes; Size: Integer);
@@ -597,7 +597,7 @@ class function TFormat_HEXL.CharTableBinary: TBytes;
597597
// special and skipped chars
598598
// '0123456789abcdefX$ ABCDEFhHx()[]{},;:-_/\*+"'''+CHR(9)+CHR(10)+CHR(13);
599599

600-
{$IFdef HAVE_ASSIGN_ARRAY}
600+
{$IFDEF HAVE_ASSIGN_ARRAY}
601601
result := [$30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $61, $62, $63,
602602
$64, $65, $66, $68, $58, $24, $20, $41, $42, $43, $44, $45, $46,
603603
$48, $78, $28, $29, $5B, $5D, $7B, $7D, $2C, $3B, $3A, $2D, $5F,
@@ -653,7 +653,7 @@ class function TFormat_HEXL.CharTableBinary: TBytes;
653653
result[45]:=$09;
654654
result[46]:=$0A;
655655
result[47]:=$0D;
656-
{$IFEND}
656+
{$ENDIF}
657657
end;
658658

659659
class function TFormat_DECMIME32.CharTableBinary: TBytes;
@@ -1113,7 +1113,7 @@ class function TFormat_UU.CharTableBinary: TBytes;
11131113
// ' '+CHR(9)+CHR(10)+CHR(13);
11141114

11151115
SetLength(result, 68);
1116-
{$IFdef HAVE_ASSIGN_ARRAY}
1116+
{$IFDEF HAVE_ASSIGN_ARRAY}
11171117
result := [$60, $21, $22, $23, $24, $25, $26, $27, $28, $29, $2A, $2B, $2C,
11181118
$2D, $2E, $2F, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39,
11191119
$3A, $3B, $3C, $3D, $3E, $3F, $40, $41, $42, $43, $44, $45, $46,
@@ -1196,7 +1196,7 @@ class function TFormat_UU.CharTableBinary: TBytes;
11961196
result[65]:=$09;
11971197
result[66]:=$0A;
11981198
result[67]:=$0D;
1199-
{$IFEND}
1199+
{$ENDIF}
12001200
end;
12011201

12021202
class procedure TFormat_UU.DoEncode(const Source; var Dest: TBytes; Size: Integer);
@@ -1350,7 +1350,7 @@ class function TFormat_XX.CharTableBinary: TBytes;
13501350
// '+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' +
13511351
// ' "()[]'''+CHR(9)+CHR(10)+CHR(13);
13521352
SetLength(result, 74);
1353-
{$IFdef HAVE_ASSIGN_ARRAY}
1353+
{$IFDEF HAVE_ASSIGN_ARRAY}
13541354
result := [$2B, $2D, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $41,
13551355
$42, $43, $44, $45, $46, $47, $48, $49, $4A, $4B, $4C, $4D, $4E,
13561356
$4F, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $5A, $61,
@@ -1439,7 +1439,7 @@ class function TFormat_XX.CharTableBinary: TBytes;
14391439
result[71]:=$09;
14401440
result[72]:=$0A;
14411441
result[73]:=$0D;
1442-
{$IFEND}
1442+
{$ENDIF}
14431443
end;
14441444

14451445
var

Source/DECFormatBase.pas

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ class function TDECFormat.Encode(const Data: RawByteString): RawByteString;
454454
DoEncode(Data[Low(Data)], b, Length(Data) * SizeOf(Data[Low(Data)]));
455455
{$ELSE}
456456
DoEncode(Data[1], b, Length(Data) * SizeOf(Data[1]));
457-
{$IFEND}
457+
{$ENDIF}
458458
Result := BytesToRawString(b);
459459
end
460460
else
@@ -503,11 +503,11 @@ class function TDECFormat.Decode(const Data: RawByteString): RawByteString;
503503
begin
504504
if Length(Data) > 0 then
505505
begin
506-
{$IFdef HAVE_STR_LIKE_ARRAY}
506+
{$IFDEF HAVE_STR_LIKE_ARRAY}
507507
DoDecode(Data[Low(Data)], b, Length(Data) * SizeOf(Data[Low(Data)]));
508508
{$ELSE}
509509
DoDecode(Data[1], b, Length(Data) * SizeOf(Data[1]));
510-
{$IFEND}
510+
{$ENDIF}
511511
Result := BytesToRawString(b);
512512
end
513513
else
@@ -552,13 +552,13 @@ class function TDECFormat.IsValid(const Data: TBytes): Boolean;
552552

553553
class function TDECFormat.IsValid(const Text: RawByteString): Boolean;
554554
begin
555-
{$IFdef HAVE_STR_LIKE_ARRAY}
555+
{$IFDEF HAVE_STR_LIKE_ARRAY}
556556
Result := (Length(Text) = 0) or
557557
(DoIsValid(Text[Low(Text)], Length(Text) * SizeOf(Text[Low(Text)])));
558558
{$ELSE}
559559
Result := (Length(Text) = 0) or
560560
(DoIsValid(Text[1], Length(Text) * SizeOf(Text[1])));
561-
{$IFEND}
561+
{$ENDIF}
562562
end;
563563

564564
class function TDECFormat.UpCaseBinary(b: Byte): Byte;

Source/DECHash.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ THash_Square = class;
7979
THash_Snefru128 = class; // derived from the Xerox Secure Hash Function
8080
THash_Snefru256 = class; // " - "
8181
THash_Sapphire = class;
82+
THash_BCrypt = class;
8283

8384
/// <summary>
8485
/// Implementation of the MD2 hash algorithm. Considered to be broken,

Source/DECHashAuthentication.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ TDECPasswordHash = class(TDECHashAuthentication, IDECHashPassword)
913913
write SetSalt;
914914
end;
915915

916-
{$IFndef HAVE_ASSIGN_ARRAY}
916+
{$IFNDEF HAVE_ASSIGN_ARRAY}
917917
/// <summary>
918918
/// Class helper for implementing array concatenation which is not available
919919
/// in Delphi XE6 or lower.
@@ -924,7 +924,7 @@ TDECPasswordHash = class(TDECHashAuthentication, IDECHashPassword)
924924
TArrHelper = class
925925
class procedure AppendArrays<T>(var A: TArray<T>; const B: TArray<T>);
926926
end;
927-
{$IFEND}
927+
{$ENDIF}
928928

929929
/// <summary>
930930
/// Meta class for the class containing the authentication methods
@@ -1520,7 +1520,7 @@ class procedure TArrHelper.AppendArrays<T>(var A: TArray<T>; const B: TArray<T>)
15201520
for i := 0 to High(B) do
15211521
A[L + i] := B[i];
15221522
end;
1523-
{$IFEND}
1523+
{$ENDIF}
15241524

15251525
{ TDECPasswordHash }
15261526

Source/DECHashBase.pas

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,13 @@ function TDECHash.CalcString(const Value: string; Format: TDECFormatClass): stri
702702
Result := '';
703703
if Length(Value) > 0 then
704704
begin
705-
{$IFdef HAVE_STR_LIKE_ARRAY}
705+
{$IFDEF HAVE_STR_LIKE_ARRAY}
706706
Size := Length(Value) * SizeOf(Value[low(Value)]);
707707
Data := CalcBuffer(Value[low(Value)], Size);
708708
{$ELSE}
709709
Size := Length(Value) * SizeOf(Value[1]);
710710
Data := CalcBuffer(Value[1], Size);
711-
{$IFEND}
711+
{$ENDIF}
712712
Result := StringOf(ValidFormat(Format).Encode(Data));
713713
end
714714
else
@@ -724,7 +724,7 @@ function TDECHash.CalcString(const Value: RawByteString; Format: TDECFormatClass
724724
begin
725725
Result := '';
726726
if Length(Value) > 0 then
727-
{$IFdef HAVE_STR_LIKE_ARRAY}
727+
{$IFDEF HAVE_STR_LIKE_ARRAY}
728728
result := BytesToRawString(
729729
ValidFormat(Format).Encode(
730730
CalcBuffer(Value[low(Value)],
@@ -734,7 +734,7 @@ function TDECHash.CalcString(const Value: RawByteString; Format: TDECFormatClass
734734
ValidFormat(Format).Encode(
735735
CalcBuffer(Value[1],
736736
Length(Value) * SizeOf(Value[1]))))
737-
{$IFEND}
737+
{$ENDIF}
738738
else
739739
begin
740740
SetLength(Buf, 0);

0 commit comments

Comments
 (0)