* cleaning out use of old endianess routines (these are centralized in system since 2.0.x days)

git-svn-id: trunk@16621 -
This commit is contained in:
marco 2010-12-23 20:38:56 +00:00
parent 067536f8da
commit 9c4675def5
2 changed files with 18 additions and 68 deletions

View File

@ -176,12 +176,6 @@ function GetHelpFileTypeCount: integer;
procedure GetHelpFileType(Index: sw_integer; var HT: THelpFileType); procedure GetHelpFileType(Index: sw_integer; var HT: THelpFileType);
procedure DoneHelpFilesTypes; procedure DoneHelpFilesTypes;
{$ifdef ENDIAN_BIG}
Procedure SwapLong(var x : longint);
Procedure SwapWord(var x : word);
{$endif ENDIAN_BIG}
implementation implementation
uses uses
@ -212,32 +206,6 @@ const
HelpFileTypes : PHelpFileTypeCollection = nil; HelpFileTypes : PHelpFileTypeCollection = nil;
{$ifdef ENDIAN_BIG}
Procedure SwapLong(var x : longint);
var
y : word;
z : word;
Begin
y := (x shr 16) and $FFFF;
y := ((y shl 8) and $FFFF) or ((y shr 8) and $ff);
z := x and $FFFF;
z := ((z shl 8) and $FFFF) or ((z shr 8) and $ff);
x := (longint(z) shl 16) or longint(y);
End;
Procedure SwapWord(var x : word);
var
z : byte;
Begin
z := (x shr 8) and $ff;
x := x and $ff;
x := (x shl 8);
x := x or z;
End;
{$endif ENDIAN_BIG}
function NewHelpFileType(AOpenProc: THelpFileOpenProc): PHelpFileType; function NewHelpFileType(AOpenProc: THelpFileOpenProc): PHelpFileType;
var P: PHelpFileType; var P: PHelpFileType;
begin begin
@ -386,7 +354,7 @@ begin
P^.Links:=nil; P^.Links:=nil;
if P^.Param<>nil then DisposeStr(P^.Param); P^.Param:=nil; if P^.Param<>nil then DisposeStr(P^.Param); P^.Param:=nil;
if Assigned(P^.ExtData) then if Assigned(P^.ExtData) then
FreeMem(P^.ExtData{$ifndef FPC},P^.ExtDataSize{$endif}); FreeMem(P^.ExtData);
if Assigned(P^.NamedMarks) then Dispose(P^.NamedMarks, Done); P^.NamedMarks:=nil; if Assigned(P^.NamedMarks) then Dispose(P^.NamedMarks, Done); P^.NamedMarks:=nil;
Dispose(P); Dispose(P);
end; end;

View File

@ -1,5 +1,5 @@
{ {
This file is part of the Free Pascal Integrated Development Environment wThis file is part of the Free Pascal Integrated Development Environment
Copyright (c) 2000 by Berczi Gabor Copyright (c) 2000 by Berczi Gabor
Borland OA .HLP reader objects and routines Borland OA .HLP reader objects and routines
@ -223,11 +223,9 @@ begin
OK:=ReadRecord(R,true); OK:=ReadRecord(R,true);
OK:=OK and (R.SClass=oa_rtFileHeader) and (R.Size=SizeOf(Header)); OK:=OK and (R.SClass=oa_rtFileHeader) and (R.Size=SizeOf(Header));
if OK then Move(R.Data^,Header,SizeOf(Header)); if OK then Move(R.Data^,Header,SizeOf(Header));
{$ifdef ENDIAN_BIG} Header.Options :=LEToN(Header.Options);
SwapWord(Header.Options); Header.MainIndexScreen:=LEToN(Header.MainIndexScreen);
SwapWord(Header.MainIndexScreen); Header.MaxScreenSize :=LEToN(Header.MaxScreenSize );
SwapWord(Header.MaxScreenSize);
{$endif ENDIAN_BIG}
DisposeRecord(R); DisposeRecord(R);
end; end;
end; end;
@ -240,9 +238,7 @@ var OK: boolean;
L,I: longint; L,I: longint;
function GetCtxPos(C: THLPContextPos): longint; function GetCtxPos(C: THLPContextPos): longint;
begin begin
{$ifdef ENDIAN_BIG} c.LoW:=LEToN(Word(C.LoW));
SwapWord(C.LoW);
{$endif ENDIAN_BIG}
GetCtxPos:=longint(C.HiB) shl 16 + C.LoW; GetCtxPos:=longint(C.HiB) shl 16 + C.LoW;
end; end;
begin begin
@ -250,9 +246,7 @@ begin
if OK then if OK then
with THLPContexts(R.Data^) do with THLPContexts(R.Data^) do
begin begin
{$ifdef ENDIAN_BIG} ContextCount:=LEToN(ContextCount);
SwapWord(ContextCount);
{$endif ENDIAN_BIG}
for I:=1 to longint(ContextCount)-1 do for I:=1 to longint(ContextCount)-1 do
begin begin
if Topics^.Count=MaxCollectionSize then Break; if Topics^.Count=MaxCollectionSize then Break;
@ -289,9 +283,7 @@ begin
if OK then if OK then
with THLPIndexTable(R.Data^) do with THLPIndexTable(R.Data^) do
begin begin
{$ifdef ENDIAN_BIG} IndexCount:=LEToN(IndexCount);
SwapWord(IndexCount);
{$endif ENDIAN_BIG}
for I:=0 to IndexCount-1 do for I:=0 to IndexCount-1 do
begin begin
LenCode:=PByteArray(@Entries)^[CurPtr]; LenCode:=PByteArray(@Entries)^[CurPtr];
@ -335,9 +327,7 @@ var OK: boolean;
begin begin
FillChar(R, SizeOf(R), 0); FillChar(R, SizeOf(R), 0);
F^.Read(H,SizeOf(H)); F^.Read(H,SizeOf(H));
{$ifdef ENDIAN_BIG} H.RecLength:=LEToN(H.RecLength);
SwapWord(H.RecLength);
{$endif ENDIAN_BIG}
OK:=F^.Status=stOK; OK:=F^.Status=stOK;
if OK then if OK then
begin begin
@ -447,7 +437,7 @@ begin
end; end;
ncRepChar : begin ncRepChar : begin
Cnt:=2+GetNextNibble; Cnt:=2+GetNextNibble;
C:=GetNextChar{$ifdef FPC}(){$endif}; C:=GetNextChar();
for I:=1 to Cnt-1 do AddChar(C); for I:=1 to Cnt-1 do AddChar(C);
end; end;
end; end;
@ -516,19 +506,15 @@ begin
TP55FormatVersion : TP55FormatVersion :
with THLPKeywordRecord55(KeyWR.Data^) do with THLPKeywordRecord55(KeyWR.Data^) do
begin begin
{$ifdef ENDIAN_BIG} UpContext:=LEToN(UpContext);
SwapWord(UpContext); DownContext:=LEToN(DownContext);
SwapWord(DownContext);
{$endif ENDIAN_BIG}
T^.LinkCount:=KeywordCount; T^.LinkCount:=KeywordCount;
GetMem(T^.Links,T^.LinkSize); GetMem(T^.Links,T^.LinkSize);
if T^.LinkCount>0 then if T^.LinkCount>0 then
for I:=0 to T^.LinkCount-1 do for I:=0 to T^.LinkCount-1 do
with Keywords[I] do with Keywords[I] do
begin begin
{$ifdef ENDIAN_BIG} KwContext:=LEToN(KwContext);
SwapWord(KwContext);
{$endif ENDIAN_BIG}
T^.Links^[I].Context:=KwContext; T^.Links^[I].Context:=KwContext;
T^.Links^[I].FileID:=ID; T^.Links^[I].FileID:=ID;
Inc(LinkPosCount); Inc(LinkPosCount);
@ -542,19 +528,15 @@ begin
else else
with THLPKeywordRecord(KeyWR.Data^) do with THLPKeywordRecord(KeyWR.Data^) do
begin begin
{$ifdef ENDIAN_BIG} KeywordCount:=LEToN(KeywordCount);
SwapWord(KeywordCount); UpContext:=LEToN(UpContext);
SwapWord(UpContext); DownContext:=LEToN(DownContext);
SwapWord(DownContext);
{$endif ENDIAN_BIG}
T^.LinkCount:=KeywordCount; T^.LinkCount:=KeywordCount;
GetMem(T^.Links,T^.LinkSize); GetMem(T^.Links,T^.LinkSize);
if KeywordCount>0 then if KeywordCount>0 then
for I:=0 to KeywordCount-1 do for I:=0 to KeywordCount-1 do
begin begin
{$ifdef ENDIAN_BIG} Keywords[I].KwContext:=LEToN(Keywords[I].KwContext);
SwapWord(Keywords[I].KwContext);
{$endif ENDIAN_BIG}
T^.Links^[I].Context:=Keywords[I].KwContext; T^.Links^[I].Context:=Keywords[I].KwContext;
T^.Links^[I].FileID:=ID; T^.Links^[I].FileID:=ID;
end; end;
@ -588,7 +570,7 @@ end;
procedure RegisterHelpType; procedure RegisterHelpType;
begin begin
RegisterHelpFileType({$ifdef FPC}@{$endif}CreateProc); RegisterHelpFileType(@CreateProc);
end; end;
END. END.