* Fix failures introduced by rev 18975

git-svn-id: trunk@18976 -
This commit is contained in:
pierre 2011-09-05 07:51:22 +00:00
parent 68d27263e7
commit b526bb4dfa
3 changed files with 19 additions and 31 deletions

View File

@ -247,7 +247,6 @@ type
crc_test2 : pcrc_array; crc_test2 : pcrc_array;
private private
{$endif def Test_Double_checksum} {$endif def Test_Double_checksum}
change_endian : boolean;
buf : pchar; buf : pchar;
bufstart, bufstart,
bufsize, bufsize,
@ -263,6 +262,7 @@ type
entrytyp : byte; entrytyp : byte;
header : tppuheader; header : tppuheader;
size : integer; size : integer;
change_endian : boolean; { Used in ppudump util }
{ crc for the entire unit } { crc for the entire unit }
crc, crc,
{ crc for the interface definitions in this unit } { crc for the interface definitions in this unit }

View File

@ -250,25 +250,6 @@ implementation
symbase,symtable,symtype,symsym,symconst,symdef,defutil, symbase,symtable,symtype,symsym,symconst,symdef,defutil,
fmodule; fmodule;
const
{ Same valus as in ppu unit, but
their only goal here is to set change_endian constant }
uf_big_endian = $000004;
uf_little_endian = $001000;
{$ifdef FPC_BIG_ENDIAN}
target_flags = uf_little_endian;
{$else not FPC_BIG_ENDIAN}
target_flags = uf_big_endian;
{$endif not FPC_BIG_ENDIAN}
{$IFDEF ENDIAN_LITTLE}
source_flags = uf_little_endian;
{$ELSE}
source_flags = uf_big_endian;
{$ENDIF}
{ Change_endian must be use to store recordtokenbuf in
target endian order }
change_endian = (source_flags<>target_flags);
var var
{ dictionaries with the supported directives } { dictionaries with the supported directives }
turbo_scannerdirectives : TFPHashObjectList; { for other modes } turbo_scannerdirectives : TFPHashObjectList; { for other modes }
@ -284,7 +265,6 @@ implementation
preprocstring : array [preproctyp] of string[7] preprocstring : array [preproctyp] of string[7]
= ('$IFDEF','$IFNDEF','$IF','$IFOPT','$ELSE','$ELSEIF'); = ('$IFDEF','$IFNDEF','$IF','$IFOPT','$ELSE','$ELSEIF');
function is_keyword(const s:string):boolean; function is_keyword(const s:string):boolean;
var var
low,high,mid : longint; low,high,mid : longint;
@ -2103,7 +2083,7 @@ In case not, the value returned can be arbitrary.
procedure tscannerfile.writesizeint(val : sizeint); procedure tscannerfile.writesizeint(val : sizeint);
begin begin
if change_endian then if target_info.endian <> source_info.endian then
val:=swapendian(val); val:=swapendian(val);
recordtokenbuf.write(val,sizeof(sizeint)); recordtokenbuf.write(val,sizeof(sizeint));
end; end;
@ -2113,7 +2093,7 @@ In case not, the value returned can be arbitrary.
val : sizeint; val : sizeint;
begin begin
replaytokenbuf.read(val,sizeof(sizeint)); replaytokenbuf.read(val,sizeof(sizeint));
if change_endian then if target_info.endian <> source_info.endian then
val:=swapendian(val); val:=swapendian(val);
result:=val; result:=val;
end; end;
@ -2122,8 +2102,7 @@ In case not, the value returned can be arbitrary.
var var
t : ttoken; t : ttoken;
s : tspecialgenerictoken; s : tspecialgenerictoken;
len,val,msgnb : sizeint; len,val,msgnb,copy_size : sizeint;
copy_size : longint;
b : byte; b : byte;
pmsg : pmessagestaterecord; pmsg : pmessagestaterecord;
begin begin
@ -2138,7 +2117,7 @@ In case not, the value returned can be arbitrary.
writetoken(t); writetoken(t);
recordtokenbuf.write(s,1); recordtokenbuf.write(s,1);
copy_size:=sizeof(current_settings)-sizeof(pointer); copy_size:=sizeof(current_settings)-sizeof(pointer);
recordtokenbuf.write(copy_size,sizeof(longint)); writesizeint(copy_size);
recordtokenbuf.write(current_settings,copy_size); recordtokenbuf.write(current_settings,copy_size);
last_settings:=current_settings; last_settings:=current_settings;
end; end;
@ -2282,7 +2261,7 @@ In case not, the value returned can be arbitrary.
procedure tscannerfile.replaytoken; procedure tscannerfile.replaytoken;
var var
wlen,mesgnb : sizeint; wlen,mesgnb,copy_size : sizeint;
specialtoken : tspecialgenerictoken; specialtoken : tspecialgenerictoken;
i : byte; i : byte;
pmsg,prevmsg : pmessagestaterecord; pmsg,prevmsg : pmessagestaterecord;
@ -2361,8 +2340,12 @@ In case not, the value returned can be arbitrary.
else else
case specialtoken of case specialtoken of
ST_LOADSETTINGS: ST_LOADSETTINGS:
replaytokenbuf.read(current_settings, begin
sizeof(current_settings)-sizeof(pointer)); copy_size:=readsizeint;
if copy_size <> sizeof(current_settings)-sizeof(pointer) then
internalerror(2011090501);
replaytokenbuf.read(current_settings,copy_size);
end;
ST_LOADMESSAGES: ST_LOADMESSAGES:
begin begin
current_settings.pmessage:=nil; current_settings.pmessage:=nil;
@ -4546,5 +4529,4 @@ exit_label:
DoneWideString(patternw); DoneWideString(patternw);
end; end;
end. end.

View File

@ -936,19 +936,25 @@ var
begin begin
var64:=pint64(@tokenbuf[i])^; var64:=pint64(@tokenbuf[i])^;
inc(i,sizeof(int64)); inc(i,sizeof(int64));
if ppufile.change_endian then
var64:=swapendian(var64);
result:=var64; result:=var64;
end end
else if CpuAddrBitSize[cpu]=32 then else if CpuAddrBitSize[cpu]=32 then
begin begin
var32:=plongint(@tokenbuf[i])^; var32:=plongint(@tokenbuf[i])^;
inc(i,sizeof(longint)); inc(i,sizeof(longint));
if ppufile.change_endian then
var32:=swapendian(var32);
result:=var32; result:=var32;
end end
else if CpuAddrBitSize[cpu]=16 then else if CpuAddrBitSize[cpu]=16 then
begin begin
var16:=psmallint(@tokenbuf[i])^; var16:=psmallint(@tokenbuf[i])^;
inc(i,sizeof(smallint)); inc(i,sizeof(smallint));
result:=var32; if ppufile.change_endian then
var16:=swapendian(var16);
result:=var16;
end end
else else
begin begin