fix synacode.pas in FPC big-endian systems
git-svn-id: https://svn.code.sf.net/p/synalist/code/trunk@180 7c85be65-684b-0410-a082-b2ed4fbef004
This commit is contained in:
parent
bd2dbb35a6
commit
e791fab639
29
synacode.pas
29
synacode.pas
@ -1,9 +1,9 @@
|
||||
{==============================================================================|
|
||||
| Project : Ararat Synapse | 002.002.002 |
|
||||
| Project : Ararat Synapse | 002.002.003 |
|
||||
|==============================================================================|
|
||||
| Content: Coding and decoding support |
|
||||
|==============================================================================|
|
||||
| Copyright (c)1999-2012, Lukas Gebauer |
|
||||
| Copyright (c)1999-2013, Lukas Gebauer |
|
||||
| All rights reserved. |
|
||||
| |
|
||||
| Redistribution and use in source and binary forms, with or without |
|
||||
@ -33,7 +33,7 @@
|
||||
| DAMAGE. |
|
||||
|==============================================================================|
|
||||
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2000-2012. |
|
||||
| Portions created by Lukas Gebauer are Copyright (c)2000-2013. |
|
||||
| All Rights Reserved. |
|
||||
|==============================================================================|
|
||||
| Contributor(s): |
|
||||
@ -51,6 +51,13 @@
|
||||
{$H+}
|
||||
{$TYPEDADDRESS OFF}
|
||||
|
||||
{$IFDEF CIL}
|
||||
{$DEFINE SYNACODE_NATIVE}
|
||||
{$ENDIF}
|
||||
{$IFDEF FPC_BIG_ENDIAN}
|
||||
{$DEFINE SYNACODE_NATIVE}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF UNICODE}
|
||||
{$WARN IMPLICIT_STRING_CAST OFF}
|
||||
{$WARN IMPLICIT_STRING_CAST_LOSS OFF}
|
||||
@ -328,14 +335,14 @@ const
|
||||
);
|
||||
|
||||
procedure ArrByteToLong(var ArByte: Array of byte; var ArLong: Array of Integer);
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
var
|
||||
n: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (High(ArByte) + 1) > ((High(ArLong) + 1) * 4) then
|
||||
Exit;
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
for n := 0 to ((high(ArByte) + 1) div 4) - 1 do
|
||||
ArLong[n] := ArByte[n * 4 + 0]
|
||||
+ (ArByte[n * 4 + 1] shl 8)
|
||||
@ -347,14 +354,14 @@ begin
|
||||
end;
|
||||
|
||||
procedure ArrLongToByte(var ArLong: Array of Integer; var ArByte: Array of byte);
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
var
|
||||
n: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
if (High(ArByte) + 1) < ((High(ArLong) + 1) * 4) then
|
||||
Exit;
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
for n := 0 to high(ArLong) do
|
||||
begin
|
||||
ArByte[n * 4 + 0] := ArLong[n] and $000000FF;
|
||||
@ -983,7 +990,7 @@ end;
|
||||
procedure MDUpdate(var MDContext: TMDCtx; const Data: AnsiString; transform: TMDTransform);
|
||||
var
|
||||
Index, partLen, InputLen, I: integer;
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
n: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
@ -999,7 +1006,7 @@ begin
|
||||
if InputLen >= partLen then
|
||||
begin
|
||||
ArrLongToByte(BufLong, BufAnsiChar);
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
for n := 1 to partLen do
|
||||
BufAnsiChar[index - 1 + n] := Ord(Data[n]);
|
||||
{$ELSE}
|
||||
@ -1011,7 +1018,7 @@ begin
|
||||
while I + 63 < InputLen do
|
||||
begin
|
||||
ArrLongToByte(BufLong, BufAnsiChar);
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
for n := 1 to 64 do
|
||||
BufAnsiChar[n - 1] := Ord(Data[i + n]);
|
||||
{$ELSE}
|
||||
@ -1026,7 +1033,7 @@ begin
|
||||
else
|
||||
I := 0;
|
||||
ArrLongToByte(BufLong, BufAnsiChar);
|
||||
{$IFDEF CIL}
|
||||
{$IFDEF SYNACODE_NATIVE}
|
||||
for n := 1 to InputLen-I do
|
||||
BufAnsiChar[Index + n - 1] := Ord(Data[i + n]);
|
||||
{$ELSE}
|
||||
|
Loading…
Reference in New Issue
Block a user