* 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 DoneHelpFilesTypes;
{$ifdef ENDIAN_BIG}
Procedure SwapLong(var x : longint);
Procedure SwapWord(var x : word);
{$endif ENDIAN_BIG}
implementation
uses
@ -212,32 +206,6 @@ const
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;
var P: PHelpFileType;
begin
@ -386,7 +354,7 @@ begin
P^.Links:=nil;
if P^.Param<>nil then DisposeStr(P^.Param); P^.Param:=nil;
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;
Dispose(P);
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
Borland OA .HLP reader objects and routines
@ -223,11 +223,9 @@ begin
OK:=ReadRecord(R,true);
OK:=OK and (R.SClass=oa_rtFileHeader) and (R.Size=SizeOf(Header));
if OK then Move(R.Data^,Header,SizeOf(Header));
{$ifdef ENDIAN_BIG}
SwapWord(Header.Options);
SwapWord(Header.MainIndexScreen);
SwapWord(Header.MaxScreenSize);
{$endif ENDIAN_BIG}
Header.Options :=LEToN(Header.Options);
Header.MainIndexScreen:=LEToN(Header.MainIndexScreen);
Header.MaxScreenSize :=LEToN(Header.MaxScreenSize );
DisposeRecord(R);
end;
end;
@ -240,9 +238,7 @@ var OK: boolean;
L,I: longint;
function GetCtxPos(C: THLPContextPos): longint;
begin
{$ifdef ENDIAN_BIG}
SwapWord(C.LoW);
{$endif ENDIAN_BIG}
c.LoW:=LEToN(Word(C.LoW));
GetCtxPos:=longint(C.HiB) shl 16 + C.LoW;
end;
begin
@ -250,9 +246,7 @@ begin
if OK then
with THLPContexts(R.Data^) do
begin
{$ifdef ENDIAN_BIG}
SwapWord(ContextCount);
{$endif ENDIAN_BIG}
ContextCount:=LEToN(ContextCount);
for I:=1 to longint(ContextCount)-1 do
begin
if Topics^.Count=MaxCollectionSize then Break;
@ -289,9 +283,7 @@ begin
if OK then
with THLPIndexTable(R.Data^) do
begin
{$ifdef ENDIAN_BIG}
SwapWord(IndexCount);
{$endif ENDIAN_BIG}
IndexCount:=LEToN(IndexCount);
for I:=0 to IndexCount-1 do
begin
LenCode:=PByteArray(@Entries)^[CurPtr];
@ -335,9 +327,7 @@ var OK: boolean;
begin
FillChar(R, SizeOf(R), 0);
F^.Read(H,SizeOf(H));
{$ifdef ENDIAN_BIG}
SwapWord(H.RecLength);
{$endif ENDIAN_BIG}
H.RecLength:=LEToN(H.RecLength);
OK:=F^.Status=stOK;
if OK then
begin
@ -447,7 +437,7 @@ begin
end;
ncRepChar : begin
Cnt:=2+GetNextNibble;
C:=GetNextChar{$ifdef FPC}(){$endif};
C:=GetNextChar();
for I:=1 to Cnt-1 do AddChar(C);
end;
end;
@ -516,19 +506,15 @@ begin
TP55FormatVersion :
with THLPKeywordRecord55(KeyWR.Data^) do
begin
{$ifdef ENDIAN_BIG}
SwapWord(UpContext);
SwapWord(DownContext);
{$endif ENDIAN_BIG}
UpContext:=LEToN(UpContext);
DownContext:=LEToN(DownContext);
T^.LinkCount:=KeywordCount;
GetMem(T^.Links,T^.LinkSize);
if T^.LinkCount>0 then
for I:=0 to T^.LinkCount-1 do
with Keywords[I] do
begin
{$ifdef ENDIAN_BIG}
SwapWord(KwContext);
{$endif ENDIAN_BIG}
KwContext:=LEToN(KwContext);
T^.Links^[I].Context:=KwContext;
T^.Links^[I].FileID:=ID;
Inc(LinkPosCount);
@ -542,19 +528,15 @@ begin
else
with THLPKeywordRecord(KeyWR.Data^) do
begin
{$ifdef ENDIAN_BIG}
SwapWord(KeywordCount);
SwapWord(UpContext);
SwapWord(DownContext);
{$endif ENDIAN_BIG}
KeywordCount:=LEToN(KeywordCount);
UpContext:=LEToN(UpContext);
DownContext:=LEToN(DownContext);
T^.LinkCount:=KeywordCount;
GetMem(T^.Links,T^.LinkSize);
if KeywordCount>0 then
for I:=0 to KeywordCount-1 do
begin
{$ifdef ENDIAN_BIG}
SwapWord(Keywords[I].KwContext);
{$endif ENDIAN_BIG}
Keywords[I].KwContext:=LEToN(Keywords[I].KwContext);
T^.Links^[I].Context:=Keywords[I].KwContext;
T^.Links^[I].FileID:=ID;
end;
@ -588,7 +570,7 @@ end;
procedure RegisterHelpType;
begin
RegisterHelpFileType({$ifdef FPC}@{$endif}CreateProc);
RegisterHelpFileType(@CreateProc);
end;
END.