synacode.pas - POSIX fixes (ACBr)

git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@259 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
geby 2022-01-16 14:21:32 +00:00
parent 6bafc151a2
commit fb96504118

View File

@ -64,12 +64,19 @@
{$WARN SUSPICIOUS_TYPECAST OFF}
{$ENDIF}
{$IFDEF NEXTGEN}
{$ZEROBASEDSTRINGS OFF}
{$ENDIF}
unit synacode;
interface
uses
SysUtils;
SysUtils
{$IFDEF NEXTGEN}
,synafpc
{$ENDIF};
type
TSpecials = set of AnsiChar;
@ -194,10 +201,10 @@ function DecodeXX(const Value: AnsiString): AnsiString;
function DecodeYEnc(const Value: AnsiString): AnsiString;
{:Returns a new CRC32 value after adding a new byte of data.}
function UpdateCrc32(Value: Byte; Crc32: Integer): Integer;
function UpdateCrc32(Value: Byte; Crc32: Cardinal): Cardinal;
{:return CRC32 from a value string.}
function Crc32(const Value: AnsiString): Integer;
function Crc32(const Value: AnsiString): Cardinal;
{:Returns a new CRC16 value after adding a new byte of data.}
function UpdateCrc16(Value: Byte; Crc16: Word): Word;
@ -388,7 +395,7 @@ type
Hash: array[0..4] of Integer;
HashByte: array[0..19] of byte;
end;
// longint on 64bit POSIX is 8 byte
TMDTransform = procedure(var Buf: array of Integer; const Data: array of Integer);
{==============================================================================}
@ -820,7 +827,7 @@ end;
{==============================================================================}
function UpdateCrc32(Value: Byte; Crc32: Integer): Integer;
function UpdateCrc32(Value: Byte; Crc32: Cardinal): Cardinal;
begin
Result := (Crc32 shr 8)
xor crc32tab[Byte(Value xor (Crc32 and Integer($000000FF)))];
@ -828,11 +835,11 @@ end;
{==============================================================================}
function Crc32(const Value: AnsiString): Integer;
function Crc32(const Value: AnsiString): Cardinal;
var
n: Integer;
begin
Result := Integer($FFFFFFFF);
Result := $FFFFFFFF;
for n := 1 to Length(Value) do
Result := UpdateCrc32(Ord(Value[n]), Result);
Result := not Result;
@ -875,7 +882,7 @@ begin
MDContext.State[3] := Integer($10325476);
end;
procedure MD5Transform(var Buf: array of LongInt; const Data: array of LongInt);
procedure MD5Transform(var Buf: array of Integer; const Data: array of Integer);
var
A, B, C, D: LongInt;
@ -1013,7 +1020,7 @@ begin
Move(Data[1], BufAnsiChar[Index], partLen);
{$ENDIF}
ArrByteToLong(BufAnsiChar, BufLong);
Transform(State, Buflong); //Transform params are LongInt
Transform(State, Buflong);
I := partLen;
while I + 63 < InputLen do
begin
@ -1380,7 +1387,7 @@ end;
{==============================================================================}
procedure MD4Transform(var Buf: array of LongInt; const Data: array of LongInt);
procedure MD4Transform(var Buf: array of Integer; const Data: array of Integer);
var
A, B, C, D: LongInt;
function LRot32(a, b: longint): longint;