* ordinal-pointer conversions fixed

This commit is contained in:
peter 2004-04-28 20:48:20 +00:00
parent b80e1cfcdb
commit 8c60c6f93e
14 changed files with 114 additions and 72 deletions

View File

@ -434,7 +434,7 @@ begin
if (_self=nil) or (_vmt=nil) then
exit;
{ vmt=-1 when memory was allocated }
if longint(_vmt)=-1 then
if ptrint(_vmt)=-1 then
begin
if (_self=nil) or (ppointer(_self+vmt_pos)^=nil) then
HandleError(210)
@ -1139,7 +1139,10 @@ end;
{
$Log$
Revision 1.70 2004-04-26 15:55:01 peter
Revision 1.71 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.70 2004/04/26 15:55:01 peter
* FPC_MOVE alias
Revision 1.69 2004/02/02 20:39:27 florian

View File

@ -744,7 +744,7 @@ begin
i:=0;
{$ifdef go32v2}
if cardinal(p)<$1000 then
if ptruint(p)<$1000 then
runerror(216);
asm
movl %ebp,get_ebp
@ -753,27 +753,27 @@ begin
end;
stack_top:=__stkbottom+__stklen;
{ allow all between start of code and end of data }
if cardinal(p)<=data_end then
if ptruint(p)<=data_end then
goto _exit;
{ .bss section }
if cardinal(p)<=cardinal(heap_at_init) then
if ptruint(p)<=ptruint(heap_at_init) then
goto _exit;
{ stack can be above heap !! }
if (cardinal(p)>=get_ebp) and (cardinal(p)<=stack_top) then
if (ptruint(p)>=get_ebp) and (ptruint(p)<=stack_top) then
goto _exit;
{$endif go32v2}
{ I don't know where the stack is in other OS !! }
{$ifdef win32}
if (cardinal(p)>=$40000) and (p<=HeapOrg) then
if (ptruint(p)>=$40000) and (p<=HeapOrg) then
goto _exit;
{ inside stack ? }
asm
movl %ebp,get_ebp
end;
if (cardinal(p)>get_ebp) and
(cardinal(p)<Win32StackTop) then
if (ptruint(p)>get_ebp) and
(ptruint(p)<Win32StackTop) then
goto _exit;
{$endif win32}
@ -785,8 +785,8 @@ begin
begin
{ inside this valid block ! }
{ we can be changing the extrainfo !! }
if (cardinal(p)>=cardinal(pp)+sizeof(theap_mem_info){+extra_info_size}) and
(cardinal(p)<=cardinal(pp)+sizeof(theap_mem_info)+extra_info_size+pp^.size) then
if (ptruint(p)>=ptruint(pp)+sizeof(theap_mem_info){+extra_info_size}) and
(ptruint(p)<=ptruint(pp)+sizeof(theap_mem_info)+extra_info_size+pp^.size) then
begin
{ check allocated block }
if ((pp^.sig=$DEADBEEF) and not usecrc) or
@ -817,8 +817,8 @@ begin
while pp<>nil do
begin
{ inside this block ! }
if (cardinal(p)>=cardinal(pp)+sizeof(theap_mem_info)+cardinal(extra_info_size)) and
(cardinal(p)<=cardinal(pp)+sizeof(theap_mem_info)+cardinal(extra_info_size)+cardinal(pp^.size)) then
if (ptruint(p)>=ptruint(pp)+sizeof(theap_mem_info)+ptruint(extra_info_size)) and
(ptruint(p)<=ptruint(pp)+sizeof(theap_mem_info)+ptruint(extra_info_size)+ptruint(pp^.size)) then
{ allocated block }
if ((pp^.sig=$DEADBEEF) and not usecrc) or
((pp^.sig=calculate_sig(pp)) and usecrc) then
@ -1156,7 +1156,10 @@ finalization
end.
{
$Log$
Revision 1.27 2004-03-15 21:48:26 peter
Revision 1.28 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.27 2004/03/15 21:48:26 peter
* cmem moved to rtl
* longint replaced with ptrint in heapmanagers

View File

@ -22,7 +22,7 @@ interface
{$S-}
procedure GetLineInfo(addr:dword;var func,source:string;var line:longint);
procedure GetLineInfo(addr:ptruint;var func,source:string;var line:longint);
implementation
@ -721,7 +721,7 @@ end;
{$Q-}
{ this avoids problems with some targets PM }
procedure GetLineInfo(addr:dword;var func,source:string;var line:longint);
procedure GetLineInfo(addr:ptruint;var func,source:string;var line:longint);
var
res : {$ifdef tp}integer{$else}longint{$endif};
stabsleft,
@ -852,7 +852,7 @@ begin
{ reset to prevent infinite recursion if problems inside the code PM }
Store:=BackTraceStrFunc;
BackTraceStrFunc:=@SysBackTraceStr;
GetLineInfo(dword(addr),func,source,line);
GetLineInfo(ptruint(addr),func,source,line);
{ create string }
StabBackTraceStr:=' $'+HexStr(ptrint(addr),sizeof(ptrint)*2);
if func<>'' then
@ -883,7 +883,10 @@ finalization
end.
{
$Log$
Revision 1.22 2004-04-22 21:10:35 peter
Revision 1.23 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.22 2004/04/22 21:10:35 peter
* elf64 support
Revision 1.21 2004/04/22 19:43:43 peter

View File

@ -1937,7 +1937,7 @@ VAR I: LongInt;
BEGIN
For I := Count DownTo 1 Do
Begin { Down from last item }
IF Boolean(Byte(Longint(CallPointerLocal(Test,PreviousFramePointer,Items^[I-1])))) THEN
IF Boolean(Byte(ptrint(CallPointerLocal(Test,PreviousFramePointer,Items^[I-1])))) THEN
Begin { Test each item }
LastThat := Items^[I-1]; { Return item }
Exit; { Now exit }
@ -1953,7 +1953,7 @@ FUNCTION TCollection.FirstThat (Test: Pointer): Pointer;
VAR I: LongInt;
BEGIN
For I := 1 To Count Do Begin { Up from first item }
IF Boolean(Byte(Longint(CallPointerLocal(Test,PreviousFramePointer,Items^[I-1])))) THEN
IF Boolean(Byte(ptrint(CallPointerLocal(Test,PreviousFramePointer,Items^[I-1])))) THEN
Begin { Test each item }
FirstThat := Items^[I-1]; { Return item }
Exit; { Now exit }
@ -2950,7 +2950,10 @@ BEGIN
END.
{
$Log$
Revision 1.30 2004-04-22 20:59:23 peter
Revision 1.31 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.30 2004/04/22 20:59:23 peter
* longint to ptrint
Revision 1.29 2004/03/31 21:49:19 florian

View File

@ -601,12 +601,12 @@
begin
IEntry:=getinterfaceentry(iid);
if Assigned(IEntry) then begin
PDWORD(@obj)^:=DWORD(PDWORD(Self))+IEntry^.IOffset;
PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset;
intf_incr_ref(pointer(obj)); { it must be an com interface }
getinterface:=True;
end
else begin
PDWORD(@Obj)^:=0;
PPointer(@Obj)^:=nil;
getinterface:=False;
end;
end;
@ -617,13 +617,13 @@
begin
IEntry:=getinterfaceentrybystr(iidstr);
if Assigned(IEntry) then begin
PDWORD(@obj)^:=DWORD(PDWORD(Self))+IEntry^.IOffset;
PPointer(@obj)^:=Pointer(Self)+IEntry^.IOffset;
if Assigned(IEntry^.iid) then { for Com interfaces }
intf_incr_ref(pointer(obj));
getinterfacebystr:=True;
end
else begin
PDWORD(@Obj)^:=0;
PPointer(@Obj)^:=nil;
getinterfacebystr:=False;
end;
end;
@ -747,7 +747,10 @@
{
$Log$
Revision 1.36 2004-03-22 22:19:36 florian
Revision 1.37 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.36 2004/03/22 22:19:36 florian
* more alignment fixes
Revision 1.35 2004/03/21 22:41:29 florian

View File

@ -61,7 +61,7 @@ Function fpSigProcMask(how:cint;nset : pSigSet; oset : pSigSet):cint; [public, a
}
begin
fpsigprocmask:=do_syscall(syscall_nr_rt_sigprocmask,longint(how),longint(nset),longint(oset));
fpsigprocmask:=do_syscall(syscall_nr_rt_sigprocmask,TSysParam(how),TSysParam(nset),TSysParam(oset));
end;
@ -71,7 +71,7 @@ Function fpSigPending(var nset: TSigSet):cint;
signals is set in SSet
}
begin
fpsigpending:=do_syscall(syscall_nr_rt_sigpending,longint(@nset));
fpsigpending:=do_syscall(syscall_nr_rt_sigpending,TSysParam(@nset));
end;
function fpsigsuspend(const sigmask:TSigSet):cint;
@ -81,7 +81,7 @@ function fpsigsuspend(const sigmask:TSigSet):cint;
}
begin
fpsigsuspend:= do_syscall(syscall_nr_rt_sigsuspend,longint(@sigmask));
fpsigsuspend:= do_syscall(syscall_nr_rt_sigsuspend,TSysParam(@sigmask));
end;
Type
@ -97,13 +97,13 @@ Const ITimer_Real =0;
Function SetITimer(Which : Longint;Const value : ItimerVal; var VarOValue:ItimerVal):Longint;
Begin
SetItimer:=Do_Syscall(syscall_nr_setitimer,Which,Longint(@Value),longint(@varovalue));
SetItimer:=Do_Syscall(syscall_nr_setitimer,Which,TSysParam(@Value),TSysParam(@varovalue));
End;
Function GetITimer(Which : Longint;Var value : ItimerVal):Longint;
Begin
GetItimer:=Do_Syscall(syscall_nr_getItimer,Which,Longint(@value));
GetItimer:=Do_Syscall(syscall_nr_getItimer,Which,TSysParam(@value));
End;
Function fpalarm(Seconds: cuint):cuint;
@ -256,7 +256,7 @@ function fpwait(var stat_loc:cint): pid_t;
}
begin // actually a wait4() call with 4th arg 0.
fpWait:=do_syscall(syscall_nr_Wait4,WAIT_ANY,longint(@Stat_loc),0,0);
fpWait:=do_syscall(syscall_nr_Wait4,WAIT_ANY,TSysParam(@Stat_loc),0,0);
end;
//function fpgetpid : pid_t;
@ -312,7 +312,7 @@ end;
function fpgetgroups(gidsetsize : cint; var grouplist:tgrparr): cint;
begin
fpgetgroups:=do_syscall(syscall_nr_getgroups,gidsetsize,longint(@grouplist));
fpgetgroups:=do_syscall(syscall_nr_getgroups,gidsetsize,TSysParam(@grouplist));
end;
function fpgetpgrp : pid_t;
@ -342,7 +342,7 @@ Function fplink(existing:pchar;newone:pchar):cint;
In effect, new will be the same file as old.
}
begin
fpLink:=Do_Syscall(syscall_nr_link,longint(existing),longint(newone));
fpLink:=Do_Syscall(syscall_nr_link,TSysParam(existing),TSysParam(newone));
end;
Function fpmkfifo(path:pchar;mode:mode_t):cint;
@ -355,13 +355,13 @@ end;
Function fpchmod(path:pchar;mode:mode_t):cint;
begin
fpchmod:=do_syscall(syscall_nr_chmod,longint(path),longint(mode));
fpchmod:=do_syscall(syscall_nr_chmod,TSysParam(path),TSysParam(mode));
end;
Function fpchown(path:pchar;owner:uid_t;group:gid_t):cint;
begin
fpChOwn:=do_syscall(syscall_nr_chown,longint(path),longint(owner),longint(group));
fpChOwn:=do_syscall(syscall_nr_chown,TSysParam(path),TSysParam(owner),TSysParam(group));
end;
Function fpUtime(path:pchar;times:putimbuf):cint;
@ -373,7 +373,7 @@ end;
Function fppipe(var fildes : tfildes):cint;
begin
fppipe:=do_syscall(syscall_nr_pipe,longint(@fildes));
fppipe:=do_syscall(syscall_nr_pipe,TSysParam(@fildes));
end;
function fpfcntl(fildes:cint;Cmd:cint;Arg:cint):cint;
@ -385,7 +385,7 @@ end;
function fpfcntl(fildes:cint;Cmd:cint;var Arg:flock):cint;
begin
fpfcntl:=do_syscall(syscall_nr_fcntl,fildes,cmd,longint(@arg));
fpfcntl:=do_syscall(syscall_nr_fcntl,fildes,cmd,TSysParam(@arg));
end;
function fpfcntl(fildes:cint;Cmd:cint):cint;
@ -397,13 +397,13 @@ end;
function fpexecve(path:pchar;argv:ppchar;envp:ppchar):cint;
Begin
fpexecve:=do_syscall(syscall_nr_Execve,longint(path),longint(argv),longint(envp));
fpexecve:=do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(argv),TSysParam(envp));
End;
function fpexecv(path:pchar;argv:ppchar):cint;
Begin
fpexecv:=do_syscall(syscall_nr_Execve,longint(path),longint(argv),longint(envp));
fpexecv:=do_syscall(syscall_nr_Execve,TSysParam(path),TSysParam(argv),TSysParam(envp));
End;
function fptimes(var buffer : tms):clock_t;
@ -425,17 +425,17 @@ Function fpSelect(N:cint;readfds,writefds,exceptfds:pfdSet;TimeOut:PTimeVal):cin
{$ifdef cpui386}
Var
SelectArray : Array[1..5] of longint;
SelectArray : Array[1..5] of TSysParam;
{$endif}
begin
{$ifdef cpui386}
SelectArray[1]:=n;
SelectArray[2]:=longint(Readfds);
Selectarray[3]:=longint(Writefds);
selectarray[4]:=longint(exceptfds);
Selectarray[5]:=longint(TimeOut);
fpSelect:=do_syscall(syscall_nr_select,longint(@selectarray));
SelectArray[2]:=TSysParam(Readfds);
Selectarray[3]:=TSysParam(Writefds);
selectarray[4]:=TSysParam(exceptfds);
Selectarray[5]:=TSysParam(TimeOut);
fpSelect:=do_syscall(syscall_nr_select,TSysParam(@selectarray));
{$endif}
{$ifdef cpupowerpc}
fpSelect:=do_syscall(syscall_nr__newselect,n,tsysparam(readfds),tsysparam(writefds),tsysparam(exceptfds),tsysparam(timeout));
@ -446,7 +446,10 @@ end;
{
$Log$
Revision 1.9 2004-04-22 17:17:23 peter
Revision 1.10 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.9 2004/04/22 17:17:23 peter
* x86-64 fixes
Revision 1.8 2004/02/21 23:18:50 marco

View File

@ -34,7 +34,7 @@ end;
function shmat (shmid:cint; shmaddr:pointer; shmflg:cint): pointer;
Var raddr : pointer;
error : cint;
error : ptrint;
begin
error:=do_syscall(syscall_nr_SHMAT,TSysParam(shmid),TSysParam(shmflg),TSysParam(@raddr),TSysParam(shmaddr));
If Error<0 then
@ -99,7 +99,10 @@ end;
{
$Log$
Revision 1.1 2004-04-25 19:15:43 marco
Revision 1.2 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.1 2004/04/25 19:15:43 marco
* IPC reform
}

View File

@ -15,15 +15,15 @@
{ Include syscall itself }
{i syscallo.inc}
Function Sys_mmap(adr,len,prot,flags,fdes,off:longint):longint; // moved from sysunix.inc, used in sbrk
Function Sys_mmap(adr:pointer;len:size_t;prot,flags,fdes:cint;off:off_t):cint; // moved from sysunix.inc, used in sbrk
begin
fpmmap(pointer(adr),size_t(len),cint(prot),cint(flags),cint(fdes),off_t(off));
fpmmap(adr,len,prot,flags,fdes,off);
end;
Function Sys_munmap(adr,len:longint):longint; // moved from sysunix.inc, used in sbrk
Function Sys_munmap(adr:pointer;len:cint):cint; // moved from sysunix.inc, used in sbrk
begin
fpmunmap(pointer(adr),cint(len));
fpmunmap(adr,len);
end;
{
@ -33,8 +33,7 @@ end;
Data points to data needed for the Ndx function. The structure of this
data is function-dependent.
}
Function Sys_IOCtl(Handle,Ndx: Longint;Data: Pointer):LongInt; // This was missing here, instead hardcode in Do_IsDevice
Function Sys_IOCtl(Handle,Ndx: cint;Data: Pointer):cint; // This was missing here, instead hardcode in Do_IsDevice
begin
sys_ioctl:=fpioctl(handle,ndx,data);
end;
@ -42,7 +41,10 @@ end;
{
$Log$
Revision 1.3 2003-11-17 11:28:08 marco
Revision 1.4 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.3 2003/11/17 11:28:08 marco
* Clone moved to linux, + few small unit unix changes
Revision 1.2 2003/10/31 08:55:11 mazen

View File

@ -32,7 +32,7 @@ Function StatFS(Path:Pchar;Var Info:tstatfs):cint;
investigate.
}
begin
StatFS:=(do_SysCall(SysCall_nr_statfs,longint(path),longint(@Info)));
StatFS:=(do_SysCall(SysCall_nr_statfs,TSysParam(path),TSysParam(@Info)));
end;
Function fStatFS(Fd:cint;Var Info:tstatfs):cint;
@ -42,7 +42,7 @@ Function fStatFS(Fd:cint;Var Info:tstatfs):cint;
you wish to investigate.
}
begin
fStatFS:=(do_SysCall(SysCall_nr_fstatfs,fd,longint(@info)));
fStatFS:=(do_SysCall(SysCall_nr_fstatfs,fd,TSysParam(@info)));
end;
@ -84,7 +84,7 @@ begin
{$ifdef FPC_USE_LIBC}
assignpipe:=pipe(pip);
{$else}
assignPipe:=do_SysCall(SysCall_nr_pipe,longint(@pip));
assignPipe:=do_SysCall(SysCall_nr_pipe,TSysParam(@pip));
{$endif}
pipe_in:=pip[0];
pipe_out:=pip[1];
@ -117,7 +117,10 @@ end;
{
$Log$
Revision 1.26 2004-04-23 19:16:24 marco
Revision 1.27 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.26 2004/04/23 19:16:24 marco
* flock -> fpflock because of conflicting structure name
Revision 1.25 2004/01/02 22:46:29 marco

View File

@ -21,7 +21,11 @@ Type
Attr : Longint;
Name : TFileName;
ExcludeAttr : Longint;
{$ifdef unix}
FindHandle : Pointer;
{$else unix}
FindHandle : THandle;
{$endif unix}
{$ifdef Win32}
FindData : TWin32FindData;
{$endif}
@ -83,7 +87,10 @@ Function FileIsReadOnly(const FileName: String): Boolean;
{
$Log$
Revision 1.2 2004-02-08 14:50:51 michael
Revision 1.3 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.2 2004/02/08 14:50:51 michael
+ Added fileIsReadOnly
Revision 1.1 2003/10/06 21:01:06 peter

View File

@ -1017,7 +1017,7 @@ begin
end;
'P' : Begin
CheckArg(vtpointer,true);
ToAdd:=HexStr(Longint(Args[DoArg].VPointer),8);
ToAdd:=HexStr(ptrint(Args[DoArg].VPointer),sizeof(Ptrint)*2);
// Insert ':'. Is this needed in 32 bit ? No it isn't.
// Insert(':',ToAdd,5);
end;
@ -1809,7 +1809,7 @@ Var
End;
End; { Case }
End; { While .. Begin }
Result:=LongInt(Buf)-LongInt(Buffer);
Result:=PtrInt(Buf)-PtrInt(Buffer);
End;
Begin
@ -2144,7 +2144,10 @@ const
{
$Log$
Revision 1.9 2004-02-26 08:46:21 michael
Revision 1.10 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.9 2004/02/26 08:46:21 michael
+ Added AnsiSameStr
Revision 1.8 2003/11/26 22:17:42 michael

View File

@ -172,7 +172,7 @@ Var
stdout:text absolute output;
{$ENDIF}
begin
Writeln(stdout,'An unhandled exception occurred at 0x',HexStr(Longint(Addr),8),' :');
Writeln(stdout,'An unhandled exception occurred at 0x',HexStr(Ptrint(Addr),sizeof(PtrInt)*2),' :');
if Obj is exception then
begin
Message:=Exception(Obj).ClassName+' : '+Exception(Obj).Message;

View File

@ -226,7 +226,7 @@ end;
Function SafeArrayCalculateElementAddress(psa: PVarArray; aElement: Integer): Pointer;
begin
Result:=Pointer(Integer(psa^.Data)+(aElement*psa^.ElementSize));
Result:=Pointer(psa^.Data)+(aElement*psa^.ElementSize);
end;
Function CheckVarArrayAndCalculateAddress(psa: PVarArray;
@ -709,7 +709,10 @@ end;
{$endif HASVARIANT}
{
$Log$
Revision 1.10 2002-11-22 16:30:05 peter
Revision 1.11 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.10 2002/11/22 16:30:05 peter
* Widestring->PWidechar requires a typecast
Revision 1.9 2002/10/11 12:21:55 florian

View File

@ -191,7 +191,7 @@ Var SInfo : Stat;
GlobSearchRec : PGlobSearchrec;
begin
GlobSearchRec:=PGlobSearchrec(Info.FindHandle);
GlobSearchRec:=Info.FindHandle;
P:=GlobSearchRec^.GlobHandle;
Result:=P<>Nil;
If Result then
@ -224,7 +224,7 @@ Var
begin
Result:=-1;
GlobSearchRec:=PGlobSearchRec(Rslt.FindHandle);
GlobSearchRec:=Rslt.FindHandle;
If (GlobSearchRec^.GlobHandle<>Nil) then
While (GlobSearchRec^.GlobHandle<>Nil) and not (Result=0) do
If GlobToTSearchRec(Rslt) Then Result:=0;
@ -242,7 +242,7 @@ begin
GlobSearchRec^.Path:=ExpandFileName(ExtractFilePath(Path));
GlobSearchRec^.GlobHandle:=Glob(Path);
Rslt.ExcludeAttr:=Not Attr; //!! Not correct !!
Rslt.FindHandle:=Longint(GlobSearchRec);
Rslt.FindHandle:=GlobSearchRec;
Result:=DoFind (Rslt);
end;
@ -260,7 +260,7 @@ Var
GlobSearchRec : PGlobSearchRec;
begin
GlobSearchRec:=PGlobSearchRec(F.FindHandle);
GlobSearchRec:=F.FindHandle;
GlobFree (GlobSearchRec^.GlobHandle);
Dispose(GlobSearchRec);
end;
@ -635,7 +635,10 @@ end.
{
$Log$
Revision 1.39 2004-04-26 14:50:19 peter
Revision 1.40 2004-04-28 20:48:20 peter
* ordinal-pointer conversions fixed
Revision 1.39 2004/04/26 14:50:19 peter
* FileIsReadOnly fixed
Revision 1.38 2004/04/20 18:24:32 marco