* Peter's Cardinal<->Longint fixes patch

This commit is contained in:
marco 2003-11-03 09:42:27 +00:00
parent b829d3a2de
commit b15ba0a5ae
19 changed files with 173 additions and 106 deletions

View File

@ -32,7 +32,7 @@ Const
function ThreadSelf:TThread; function ThreadSelf:TThread;
var var
hp : PThreadRec; hp : PThreadRec;
sp : longint; sp : Pointer;
begin begin
sp:=SPtr; sp:=SPtr;
hp:=ThreadRoot; hp:=ThreadRoot;
@ -296,7 +296,10 @@ end;
{ {
$Log$ $Log$
Revision 1.3 2003-10-27 17:12:45 marco Revision 1.4 2003-11-03 09:42:27 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.3 2003/10/27 17:12:45 marco
* fixes for signal handling. * fixes for signal handling.
Revision 1.2 2003/10/09 10:55:20 marco Revision 1.2 2003/10/09 10:55:20 marco

View File

@ -808,7 +808,7 @@ end;
var var
__stkbottom : longint;external name '__stkbottom'; __stkbottom : pointer;external name '__stkbottom';
@ -1513,7 +1513,10 @@ Begin
End. End.
{ {
$Log$ $Log$
Revision 1.27 2003-10-16 15:43:13 peter Revision 1.28 2003-11-03 09:42:27 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.27 2003/10/16 15:43:13 peter
* THandle is platform dependent * THandle is platform dependent
Revision 1.26 2003/10/03 21:46:25 peter Revision 1.26 2003/10/03 21:46:25 peter

View File

@ -1146,7 +1146,7 @@ end ['EAX'];
{$define FPC_SYSTEM_HAS_SPTR} {$define FPC_SYSTEM_HAS_SPTR}
Function Sptr : Longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif} Function Sptr : Pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
asm asm
movl %esp,%eax movl %esp,%eax
end; end;
@ -1163,7 +1163,7 @@ var
isneg : byte; isneg : byte;
begin begin
{ Workaround: } { Workaround: }
if l=$80000000 then if l=longint($80000000) then
begin begin
s:='-2147483648'; s:='-2147483648';
exit; exit;
@ -1177,7 +1177,7 @@ begin
orl %eax,%eax // Sign ? orl %eax,%eax // Sign ?
jns .LM2 jns .LM2
movb $1,isneg movb $1,isneg
neg %eax negl %eax
.LM2: .LM2:
cltd cltd
idivl %esi idivl %esi
@ -1330,7 +1330,10 @@ end;
{ {
$Log$ $Log$
Revision 1.51 2003-10-27 09:16:57 marco Revision 1.52 2003-11-03 09:42:27 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.51 2003/10/27 09:16:57 marco
* fix from peter i386.inc to circumvent ebx destroying * fix from peter i386.inc to circumvent ebx destroying
Revision 1.50 2003/10/23 17:01:27 peter Revision 1.50 2003/10/23 17:01:27 peter

View File

@ -25,7 +25,7 @@ const
filerecnamelength = 255; filerecnamelength = 255;
type type
FileRec = Packed Record FileRec = Packed Record
Handle, Handle : THandle;
Mode, Mode,
RecSize : longint; RecSize : longint;
_private : array[1..32] of byte; _private : array[1..32] of byte;
@ -35,7 +35,10 @@ type
{ {
$Log$ $Log$
Revision 1.3 2002-09-07 15:07:45 peter Revision 1.4 2003-11-03 09:42:27 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.3 2002/09/07 15:07:45 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
} }

View File

@ -199,7 +199,7 @@ begin
if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then
begin begin
DefaultTranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) + DefaultTranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
(ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset; Byte(ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
exit; exit;
end; end;
end; end;
@ -295,7 +295,10 @@ end;
{ {
$Log$ $Log$
Revision 1.7 2002-09-07 15:07:45 peter Revision 1.8 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.7 2002/09/07 15:07:45 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
} }

View File

@ -19,7 +19,7 @@ const
errKbdNotImplemented = errKbdBase + 1; errKbdNotImplemented = errKbdBase + 1;
type type
TKeyEvent = Longint; TKeyEvent = Cardinal;
TKeyRecord = packed record TKeyRecord = packed record
KeyCode : Word; KeyCode : Word;
ShiftState, Flags : Byte; ShiftState, Flags : Byte;
@ -193,7 +193,10 @@ Function KeyEventToString(KeyEvent : TKeyEvent) : String;
{ {
$Log$ $Log$
Revision 1.4 2002-09-07 15:07:45 peter Revision 1.5 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.4 2002/09/07 15:07:45 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
} }

View File

@ -155,7 +155,9 @@ type
FNameStr = String; FNameStr = String;
const const
MaxReadBytes = $7fffffff; MaxReadBytes = $7fffffff;
invalidhandle = -1;
var
invalidhandle : THandle;
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
@ -289,8 +291,8 @@ TYPE
PROCEDURE WriteStr (P: PString); PROCEDURE WriteStr (P: PString);
PROCEDURE Seek (Pos: LongInt); Virtual; PROCEDURE Seek (Pos: LongInt); Virtual;
PROCEDURE Error (Code, Info: Integer); Virtual; PROCEDURE Error (Code, Info: Integer); Virtual;
PROCEDURE Read (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Read (Var Buf; Count: LongInt); Virtual;
PROCEDURE Write (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Write (Var Buf; Count: LongInt); Virtual;
PROCEDURE CopyFrom (Var S: TStream; Count: Longint); PROCEDURE CopyFrom (Var S: TStream; Count: Longint);
END; END;
PStream = ^TStream; PStream = ^TStream;
@ -315,8 +317,8 @@ TYPE
PROCEDURE Truncate; Virtual; PROCEDURE Truncate; Virtual;
PROCEDURE Seek (Pos: LongInt); Virtual; PROCEDURE Seek (Pos: LongInt); Virtual;
PROCEDURE Open (OpenMode: Word); Virtual; PROCEDURE Open (OpenMode: Word); Virtual;
PROCEDURE Read (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Read (Var Buf; Count: Longint); Virtual;
PROCEDURE Write (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Write (Var Buf; Count: Longint); Virtual;
private private
FileInfo : File; FileInfo : File;
END; END;
@ -335,9 +337,9 @@ TYPE
TYPE TYPE
TBufStream = OBJECT (TDosStream) TBufStream = OBJECT (TDosStream)
LastMode: Byte; { Last buffer mode } LastMode: Byte; { Last buffer mode }
BufSize : Sw_Word; { Buffer size } BufSize : Longint; { Buffer size }
BufPtr : Sw_Word; { Buffer start } BufPtr : Longint; { Buffer start }
BufEnd : Sw_Word; { Buffer end } BufEnd : Longint; { Buffer end }
Buffer : PByteArray; { Buffer allocated } Buffer : PByteArray; { Buffer allocated }
CONSTRUCTOR Init (FileName: FNameStr; Mode, Size: Word); CONSTRUCTOR Init (FileName: FNameStr; Mode, Size: Word);
DESTRUCTOR Done; Virtual; DESTRUCTOR Done; Virtual;
@ -346,8 +348,8 @@ TYPE
PROCEDURE Truncate; Virtual; PROCEDURE Truncate; Virtual;
PROCEDURE Seek (Pos: LongInt); Virtual; PROCEDURE Seek (Pos: LongInt); Virtual;
PROCEDURE Open (OpenMode: Word); Virtual; PROCEDURE Open (OpenMode: Word); Virtual;
PROCEDURE Read (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Read (Var Buf; Count: Longint); Virtual;
PROCEDURE Write (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Write (Var Buf; Count: Longint); Virtual;
END; END;
PBufStream = ^TBufStream; PBufStream = ^TBufStream;
@ -363,17 +365,17 @@ TYPE
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
TYPE TYPE
TMemoryStream = OBJECT (TStream) TMemoryStream = OBJECT (TStream)
BlkCount: Sw_Word; { Number of segments } BlkCount: Longint; { Number of segments }
BlkSize : Word; { Memory block size } BlkSize : Word; { Memory block size }
MemSize : LongInt; { Memory alloc size } MemSize : LongInt; { Memory alloc size }
BlkList : PPointerArray; { Memory block list } BlkList : PPointerArray; { Memory block list }
CONSTRUCTOR Init (ALimit: Longint; ABlockSize: Word); CONSTRUCTOR Init (ALimit: Longint; ABlockSize: Word);
DESTRUCTOR Done; Virtual; DESTRUCTOR Done; Virtual;
PROCEDURE Truncate; Virtual; PROCEDURE Truncate; Virtual;
PROCEDURE Read (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Read (Var Buf; Count: Longint); Virtual;
PROCEDURE Write (Var Buf; Count: Sw_Word); Virtual; PROCEDURE Write (Var Buf; Count: Longint); Virtual;
PRIVATE PRIVATE
FUNCTION ChangeListSize (ALimit: Sw_Word): Boolean; FUNCTION ChangeListSize (ALimit: Longint): Boolean;
END; END;
PMemoryStream = ^TMemoryStream; PMemoryStream = ^TMemoryStream;
@ -516,7 +518,8 @@ TYPE
TYPE TYPE
TStrIndexRec = Packed RECORD TStrIndexRec = Packed RECORD
Key, Count, Offset: Word; Key : Sw_word;
Count, Offset: Word;
END; END;
TStrIndex = Array [0..9999] Of TStrIndexRec; TStrIndex = Array [0..9999] Of TStrIndexRec;
@ -532,9 +535,9 @@ TYPE
PRIVATE PRIVATE
Stream : PStream; Stream : PStream;
BasePos : Longint; BasePos : Longint;
IndexSize: Sw_Word; IndexSize: Longint;
Index : PStrIndex; Index : PStrIndex;
PROCEDURE ReadStr (Var S: String; Offset, Skip: Sw_Word); PROCEDURE ReadStr (Var S: String; Offset, Skip: Longint);
END; END;
PStringList = ^TStringList; PStringList = ^TStringList;
@ -1206,7 +1209,7 @@ END;
{--TStream------------------------------------------------------------------} {--TStream------------------------------------------------------------------}
{ Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB } { Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TStream.Read (Var Buf; Count: Sw_Word); PROCEDURE TStream.Read (Var Buf; Count: Longint);
BEGIN BEGIN
Abstract; { Abstract error } Abstract; { Abstract error }
END; END;
@ -1214,7 +1217,7 @@ END;
{--TStream------------------------------------------------------------------} {--TStream------------------------------------------------------------------}
{ Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB } { Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 10May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TStream.Write (Var Buf; Count: Sw_Word); PROCEDURE TStream.Write (Var Buf; Count: Longint);
BEGIN BEGIN
Abstract; { Abstract error } Abstract; { Abstract error }
END; END;
@ -1411,8 +1414,8 @@ END;
{--TDosStream---------------------------------------------------------------} {--TDosStream---------------------------------------------------------------}
{ Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB } { Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TDosStream.Read (Var Buf; Count: Sw_Word); PROCEDURE TDosStream.Read (Var Buf; Count: Longint);
VAR BytesMoved: Sw_Word; VAR BytesMoved: Longint;
DosStreamError : Word; DosStreamError : Word;
BEGIN BEGIN
If Status = StOK then If Status = StOK then
@ -1443,8 +1446,8 @@ END;
{--TDosStream---------------------------------------------------------------} {--TDosStream---------------------------------------------------------------}
{ Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB } { Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 16May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TDosStream.Write (Var Buf; Count: Sw_Word); PROCEDURE TDosStream.Write (Var Buf; Count: Longint);
VAR BytesMoved: Sw_Word; VAR BytesMoved: Longint;
DosStreamError : Word; DosStreamError : Word;
BEGIN BEGIN
{ If status is not OK, simply exit } { If status is not OK, simply exit }
@ -1507,7 +1510,7 @@ END;
{ Flush -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB } { Flush -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TBufStream.Flush; PROCEDURE TBufStream.Flush;
VAR W: Sw_Word; VAR W: Longint;
DosStreamError : Word; DosStreamError : Word;
BEGIN BEGIN
If Status <> StOK then If Status <> StOK then
@ -1564,8 +1567,8 @@ END;
{--TBufStream---------------------------------------------------------------} {--TBufStream---------------------------------------------------------------}
{ Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB } { Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TBufStream.Read (Var Buf; Count: Sw_Word); PROCEDURE TBufStream.Read (Var Buf; Count: Longint);
VAR Success: Integer; W, Bw: Sw_Word; P: PByteArray; VAR Success: Integer; W, Bw: Longint; P: PByteArray;
DosStreamError : Word; DosStreamError : Word;
BEGIN BEGIN
If Status <> StOk then If Status <> StOk then
@ -1601,7 +1604,7 @@ BEGIN
Move(Buffer^[BufPtr], P^, W); { Data from buffer } Move(Buffer^[BufPtr], P^, W); { Data from buffer }
Dec(Count, W); { Reduce count } Dec(Count, W); { Reduce count }
Inc(BufPtr, W); { Advance buffer ptr } Inc(BufPtr, W); { Advance buffer ptr }
P := Pointer(LongInt(P) + W); { Transfer address } Inc(P, W); { Transfer address }
Inc(Position, W); { Advance position } Inc(Position, W); { Advance position }
End; End;
End; End;
@ -1612,8 +1615,10 @@ END;
{--TBufStream---------------------------------------------------------------} {--TBufStream---------------------------------------------------------------}
{ Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB } { Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 17May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TBufStream.Write (Var Buf; Count: Sw_Word); PROCEDURE TBufStream.Write (Var Buf; Count: Longint);
VAR Success: Integer; W: Sw_Word; P: PByteArray; VAR Success: Integer;
W: Longint;
P: PByteArray;
DosStreamError : Word; DosStreamError : Word;
BEGIN BEGIN
if Status <> StOK then exit; { Exit if error } if Status <> StOK then exit; { Exit if error }
@ -1636,7 +1641,7 @@ BEGIN
Move(P^, Buffer^[BufPtr], W); { Data to buffer } Move(P^, Buffer^[BufPtr], W); { Data to buffer }
Dec(Count, W); { Reduce count } Dec(Count, W); { Reduce count }
Inc(BufPtr, W); { Advance buffer ptr } Inc(BufPtr, W); { Advance buffer ptr }
P := Pointer(LongInt(P) + W); { Transfer address } Inc(P,W); { Transfer address }
Inc(Position, W); { Advance position } Inc(Position, W); { Advance position }
If (Position > StreamSize) Then { File has expanded } If (Position > StreamSize) Then { File has expanded }
StreamSize := Position; { Update new size } StreamSize := Position; { Update new size }
@ -1694,7 +1699,7 @@ END;
{--TMemoryStream------------------------------------------------------------} {--TMemoryStream------------------------------------------------------------}
{ Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB } { Read -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TMemoryStream.Read (Var Buf; Count: Sw_Word); PROCEDURE TMemoryStream.Read (Var Buf; Count: Longint);
VAR W, CurBlock, BlockPos: Word; Li: LongInt; P, Q: PByteArray; VAR W, CurBlock, BlockPos: Word; Li: LongInt; P, Q: PByteArray;
BEGIN BEGIN
If (Position + Count > StreamSize) Then { Insufficient data } If (Position + Count > StreamSize) Then { Insufficient data }
@ -1722,8 +1727,11 @@ END;
{--TMemoryStream------------------------------------------------------------} {--TMemoryStream------------------------------------------------------------}
{ Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB } { Write -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TMemoryStream.Write (Var Buf; Count: Sw_Word); PROCEDURE TMemoryStream.Write (Var Buf; Count: Longint);
VAR W, CurBlock, BlockPos: Word; Li: LongInt; P, Q: PByteArray; VAR
W, CurBlock, BlockPos: Word;
Li: LongInt;
P, Q: PByteArray;
BEGIN BEGIN
If (Position + Count > MemSize) Then Begin { Expansion needed } If (Position + Count > MemSize) Then Begin { Expansion needed }
If (Position + Count = 0) Then W := 1 Else { At least 1 block } If (Position + Count = 0) Then W := 1 Else { At least 1 block }
@ -1759,9 +1767,12 @@ END;
{--TMemoryStream------------------------------------------------------------} {--TMemoryStream------------------------------------------------------------}
{ ChangeListSize -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB } { ChangeListSize -> Platforms DOS/DPMI/WIN/OS2 - Checked 19May96 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
FUNCTION TMemoryStream.ChangeListSize (ALimit: Sw_Word): Boolean; FUNCTION TMemoryStream.ChangeListSize (ALimit: Longint): Boolean;
VAR I, W: Word; Li: LongInt; P: PPointerArray; VAR
OldVal : Boolean; I, W: Longint;
Li: LongInt;
P: PPointerArray;
OldVal : Boolean;
BEGIN BEGIN
If (ALimit <> BlkCount) Then Begin { Change is needed } If (ALimit <> BlkCount) Then Begin { Change is needed }
ChangeListSize := False; { Preset failure } ChangeListSize := False; { Preset failure }
@ -2743,7 +2754,7 @@ END;
{--TStringLis---------------------------------------------------------------} {--TStringLis---------------------------------------------------------------}
{ ReadStr -> Platforms DOS/DPMI/WIN/OS2 - Checked 30Jun97 LdB } { ReadStr -> Platforms DOS/DPMI/WIN/OS2 - Checked 30Jun97 LdB }
{---------------------------------------------------------------------------} {---------------------------------------------------------------------------}
PROCEDURE TStringList.ReadStr (Var S: String; Offset, Skip: Sw_Word); PROCEDURE TStringList.ReadStr (Var S: String; Offset, Skip: Longint);
BEGIN BEGIN
Stream^.Seek(BasePos + Offset); { Seek to position } Stream^.Seek(BasePos + Offset); { Seek to position }
Inc(Skip); { Adjust skip } Inc(Skip); { Adjust skip }
@ -2919,10 +2930,15 @@ BEGIN
END; END;
BEGIN
invalidhandle:=UnusedHandle;
END. END.
{ {
$Log$ $Log$
Revision 1.23 2003-10-25 23:43:59 hajny Revision 1.24 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.23 2003/10/25 23:43:59 hajny
* THandle in sysutils common using System.THandle * THandle in sysutils common using System.THandle
Revision 1.22 2003/09/16 15:57:33 peter Revision 1.22 2003/09/16 15:57:33 peter

View File

@ -90,7 +90,7 @@
tinterfaceentry = packed record tinterfaceentry = packed record
IID: pguid; { if assigned(IID) then Com else Corba} IID: pguid; { if assigned(IID) then Com else Corba}
VTable: Pointer; VTable: Pointer;
IOffset: LongInt; IOffset: DWord;
IIDStr: pshortstring; { never nil. Com: upper(GuidToString(IID^)) } IIDStr: pshortstring; { never nil. Com: upper(GuidToString(IID^)) }
end; end;
@ -293,7 +293,10 @@
{ {
$Log$ $Log$
Revision 1.17 2003-10-06 15:59:20 florian Revision 1.18 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.17 2003/10/06 15:59:20 florian
+ applied patch for ref. counted exceptions by Johannes Berg + applied patch for ref. counted exceptions by Johannes Berg
Revision 1.16 2003/03/17 20:55:58 peter Revision 1.16 2003/03/17 20:55:58 peter

View File

@ -551,12 +551,12 @@ End;
{$S-} {$S-}
procedure fpc_stackcheck(stack_size:Cardinal);[saveregisters,public,alias:'FPC_STACKCHECK']; procedure fpc_stackcheck(stack_size:Cardinal);[saveregisters,public,alias:'FPC_STACKCHECK'];
var var
c : cardinal; c : Pointer;
begin begin
{ Avoid recursive calls when called from the exit routines } { Avoid recursive calls when called from the exit routines }
if StackError then if StackError then
exit; exit;
c := cardinal(Sptr) - stack_size - STACK_MARGIN; c := Sptr - (stack_size + STACK_MARGIN);
if (c <= StackBottom) then if (c <= StackBottom) then
begin begin
StackError:=true; StackError:=true;
@ -853,7 +853,10 @@ end;
{ {
$Log$ $Log$
Revision 1.46 2003-10-29 18:23:45 jonas Revision 1.47 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.46 2003/10/29 18:23:45 jonas
* hack to allow repeatable random sequences using the new random number * hack to allow repeatable random sequences using the new random number
generator generator
* fixed range warning/error * fixed range warning/error

View File

@ -344,7 +344,7 @@ Var
StdErr : Text; StdErr : Text;
InOutRes : Word; InOutRes : Word;
{ Stack checking } { Stack checking }
StackBottom, StackBottom : Pointer;
StackLength : Cardinal; StackLength : Cardinal;
{**************************************************************************** {****************************************************************************
@ -617,7 +617,7 @@ function get_caller_addr(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$
function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif} function get_caller_frame(framebp:pointer):pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif} Function IOResult:Word;{$ifdef SYSTEMINLINE}inline;{$endif}
Function Sptr:Longint;{$ifdef SYSTEMINLINE}inline;{$endif} Function Sptr:Pointer;{$ifdef SYSTEMINLINE}inline;{$endif}
{***************************************************************************** {*****************************************************************************
@ -693,7 +693,10 @@ const
{ {
$Log$ $Log$
Revision 1.76 2003-10-17 20:52:12 olle Revision 1.77 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.76 2003/10/17 20:52:12 olle
* Changed m68k to cpum68k, i386 to cpui386 * Changed m68k to cpum68k, i386 to cpui386
Revision 1.75 2003/10/16 15:43:13 peter Revision 1.75 2003/10/16 15:43:13 peter

View File

@ -27,7 +27,7 @@ const
type type
TextBuf = array[0..TextRecBufSize-1] of char; TextBuf = array[0..TextRecBufSize-1] of char;
TextRec = Packed Record TextRec = Packed Record
Handle, Handle : THandle;
Mode, Mode,
bufsize, bufsize,
_private, _private,
@ -45,7 +45,10 @@ type
{ {
$Log$ $Log$
Revision 1.3 2002-09-07 15:07:46 peter Revision 1.4 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.3 2002/09/07 15:07:46 peter
* old logs removed and tabs fixed * old logs removed and tabs fixed
} }

View File

@ -32,7 +32,7 @@ Const
function ThreadSelf:TThread; function ThreadSelf:TThread;
var var
hp : PThreadRec; hp : PThreadRec;
sp : longint; sp : Pointer;
begin begin
sp:=SPtr; sp:=SPtr;
hp:=ThreadRoot; hp:=ThreadRoot;
@ -175,11 +175,11 @@ begin
Flags := CLONE_VM + CLONE_FS + CLONE_FILES + CLONE_SIGHAND + SIGCHLD; Flags := CLONE_VM + CLONE_FS + CLONE_FILES + CLONE_SIGHAND + SIGCHLD;
{ Setup 16k of stack } { Setup 16k of stack }
FStackSize:=16384; FStackSize:=16384;
Getmem(pointer(FStackPointer),FStackSize); Getmem(FStackPointer,FStackSize);
inc(FStackPointer,FStackSize); inc(FStackPointer,FStackSize);
FCallExitProcess:=false; FCallExitProcess:=false;
{ Clone } { Clone }
FHandle:= Clone(@ThreadProc,pointer(FStackPointer),Flags,self); FHandle:= Clone(@ThreadProc,FStackPointer,Flags,self);
if FSuspended then Suspend; if FSuspended then Suspend;
FThreadID := FHandle; FThreadID := FHandle;
IsMultiThread := TRUE; IsMultiThread := TRUE;
@ -197,7 +197,7 @@ begin
if FHandle <> -1 then if FHandle <> -1 then
{$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGKILL); {$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGKILL);
dec(FStackPointer,FStackSize); dec(FStackPointer,FStackSize);
Freemem(pointer(FStackPointer),FStackSize); Freemem(FStackPointer);
FFatalException.Free; FFatalException.Free;
FFatalException := nil; FFatalException := nil;
inherited Destroy; inherited Destroy;
@ -302,7 +302,10 @@ end;
{ {
$Log$ $Log$
Revision 1.1 2003-10-06 21:01:06 peter Revision 1.2 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl * moved classes unit to rtl
Revision 1.9 2003/10/06 17:06:55 florian Revision 1.9 2003/10/06 17:06:55 florian

View File

@ -1006,7 +1006,7 @@ begin
if fmtlen > 0 then if fmtlen > 0 then
Move(fmt,F[1],fmtlen); Move(fmt,F[1],fmtlen);
S:=Format (F,Args); S:=Format (F,Args);
If Length(S)<Buflen then If Cardinal(Length(S))<Buflen then
Result:=Length(S) Result:=Length(S)
else else
Result:=Buflen; Result:=Buflen;
@ -2012,7 +2012,10 @@ const
{ {
$Log$ $Log$
Revision 1.2 2003-10-07 12:02:47 marco Revision 1.3 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.2 2003/10/07 12:02:47 marco
* sametext and ansisametext added. (simple (ansi)comparetext wrappers) * sametext and ansisametext added. (simple (ansi)comparetext wrappers)
Revision 1.1 2003/10/06 21:01:06 peter Revision 1.1 2003/10/06 21:01:06 peter

View File

@ -1122,7 +1122,7 @@ begin
(* Initialize the amount of file handles *) (* Initialize the amount of file handles *)
FileHandleCount := GetFileHandleCount; FileHandleCount := GetFileHandleCount;
DosGetInfoBlocks (@TIB, @PIB); DosGetInfoBlocks (@TIB, @PIB);
StackBottom := cardinal (TIB^.Stack); StackBottom := TIB^.Stack;
Environment := pointer (PIB^.Env); Environment := pointer (PIB^.Env);
ApplicationType := PIB^.ProcType; ApplicationType := PIB^.ProcType;
IsConsole := ApplicationType <> 3; IsConsole := ApplicationType <> 3;
@ -1153,7 +1153,10 @@ begin
end. end.
{ {
$Log$ $Log$
Revision 1.55 2003-11-02 00:51:17 hajny Revision 1.56 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.55 2003/11/02 00:51:17 hajny
* corrections for do_open and os_mode back * corrections for do_open and os_mode back
Revision 1.54 2003/10/28 14:57:31 yuri Revision 1.54 2003/10/28 14:57:31 yuri

View File

@ -1440,8 +1440,8 @@ function TTYName(Handle:Longint):string;
returns empty string in case of an error. returns empty string in case of an error.
} }
var var
mydev, mydev : dev_t;
myino : longint; myino : ino_t;
st : stat; st : stat;
function mysearch(n:string): boolean; function mysearch(n:string): boolean;
@ -1475,7 +1475,7 @@ var
exit; exit;
end; end;
end end
else if (d^.d_fileno=myino) and (st.st_dev=mydev) then else if (ino_t(d^.d_fileno)=myino) and (st.st_dev=mydev) then
begin begin
fpclosedir(dirstream^); fpclosedir(dirstream^);
ttyname:=name; ttyname:=name;
@ -1715,7 +1715,10 @@ End.
{ {
$Log$ $Log$
Revision 1.42 2003-10-30 16:42:58 marco Revision 1.43 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.42 2003/10/30 16:42:58 marco
* fixes for old syscall() convention removing * fixes for old syscall() convention removing
Revision 1.41 2003/10/12 19:40:43 marco Revision 1.41 2003/10/12 19:40:43 marco

View File

@ -3,7 +3,7 @@ unit unixutil;
interface interface
var var
Tzseconds : Cardinal; Tzseconds : Longint;
Type Type
ComStr = String[255]; ComStr = String[255];
@ -302,7 +302,7 @@ Function LocalToEpoch(year,month,day,hour,minute,second:Word):Longint;
} }
Begin Begin
LocalToEpoch:=((GregorianToJulian(Year,Month,Day)-c1970)*86400)+ LocalToEpoch:=((GregorianToJulian(Year,Month,Day)-c1970)*86400)+
(LongInt(Hour)*3600)+(Minute*60)+Second-TZSeconds; (LongInt(Hour)*3600)+(Longint(Minute)*60)+Second-TZSeconds;
End; End;

View File

@ -63,10 +63,10 @@ var
WindMin: Word; { Window upper left coordinates } WindMin: Word; { Window upper left coordinates }
WindMax: Word; { Window lower right coordinates } WindMax: Word; { Window lower right coordinates }
{ FPC Specific for large screen support } { FPC Specific for large screen support }
WindMinX : Longint; WindMinX : DWord;
WindMaxX : Longint; WindMaxX : DWord;
WindMinY : Longint; WindMinY : DWord;
WindMaxY : Longint; WindMaxY : DWord ;
{ Interface procedures } { Interface procedures }
procedure AssignCrt(var F: Text); procedure AssignCrt(var F: Text);
@ -127,7 +127,7 @@ begin
end; { if } end; { if }
end; { proc. TurnMouseOff } end; { proc. TurnMouseOff }
function GetScreenHeight : longint; function GetScreenHeight : DWord;
var var
ConsoleInfo: TConsoleScreenBufferinfo; ConsoleInfo: TConsoleScreenBufferinfo;
begin begin
@ -142,7 +142,7 @@ begin
GetScreenHeight := ConsoleInfo.dwSize.Y; GetScreenHeight := ConsoleInfo.dwSize.Y;
end; { func. GetScreenHeight } end; { func. GetScreenHeight }
function GetScreenWidth : longint; function GetScreenWidth : DWord;
var var
ConsoleInfo: TConsoleScreenBufferInfo; ConsoleInfo: TConsoleScreenBufferInfo;
begin begin
@ -158,7 +158,7 @@ begin
end; { func. GetScreenWidth } end; { func. GetScreenWidth }
procedure GetScreenCursor(var x : longint; var y : longint); procedure GetScreenCursor(var x : DWord; var y : DWord);
var var
ConsoleInfo : TConsoleScreenBufferInfo; ConsoleInfo : TConsoleScreenBufferInfo;
begin begin
@ -168,7 +168,7 @@ begin
Y := ConsoleInfo.dwCursorPosition.Y + 1; Y := ConsoleInfo.dwCursorPosition.Y + 1;
end; end;
procedure SetScreenCursor(x,y : longint); procedure SetScreenCursor(x,y : DWord);
var var
CurInfo: TCoord; CurInfo: TCoord;
begin begin
@ -274,7 +274,7 @@ var
Temp: DWord; Temp: DWord;
CharInfo: Char; CharInfo: Char;
Coord: TCoord; Coord: TCoord;
X,Y: Longint; X,Y: DWord;
begin begin
GetScreenCursor(x, y); GetScreenCursor(x, y);
@ -293,7 +293,7 @@ Function WhereX: DWord;
Return current X-position of cursor. Return current X-position of cursor.
} }
var var
x,y : longint; x,y : DWord;
Begin Begin
GetScreenCursor(x, y); GetScreenCursor(x, y);
WhereX:= x - WindMinX +1; WhereX:= x - WindMinX +1;
@ -304,7 +304,7 @@ Function WhereY: DWord;
Return current Y-position of cursor. Return current Y-position of cursor.
} }
var var
x, y : longint; x, y : DWord;
Begin Begin
GetScreenCursor(x, y); GetScreenCursor(x, y);
WhereY:= y - WindMinY + 1; WhereY:= y - WindMinY + 1;
@ -540,7 +540,7 @@ end;
{**************************************************************************** {****************************************************************************
HighLevel Crt Functions HighLevel Crt Functions
****************************************************************************} ****************************************************************************}
procedure removeline(y : longint); procedure removeline(y : DWord);
var var
ClipRect: TSmallRect; ClipRect: TSmallRect;
SrcRect: TSmallRect; SrcRect: TSmallRect;
@ -580,7 +580,7 @@ var
SrcRect: TSmallRect; SrcRect: TSmallRect;
DestCoor: TCoord; DestCoor: TCoord;
CharInfo: TCharInfo; CharInfo: TCharInfo;
X,Y: Longint; X,Y: DWord;
begin begin
GetScreenCursor(X, Y); GetScreenCursor(X, Y);
@ -640,7 +640,7 @@ end;
*****************************************************************************} *****************************************************************************}
var var
CurrX, CurrY : longint; CurrX, CurrY : DWord;
procedure WriteChar(c : char); procedure WriteChar(c : char);
var var
@ -861,7 +861,10 @@ end. { unit Crt }
{ {
$Log$ $Log$
Revision 1.19 2002-12-15 20:23:30 peter Revision 1.20 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.19 2002/12/15 20:23:30 peter
* fix empty string in readln when not at end of string * fix empty string in readln when not at end of string
* fix alt-xyz in readkey * fix alt-xyz in readkey

View File

@ -57,7 +57,7 @@ const
STD_ERROR_HANDLE = $fffffff4; STD_ERROR_HANDLE = $fffffff4;
procedure UpdateStdHandle(var t:TextRec;var stdHandle:longint;newHandle:longint); procedure UpdateStdHandle(var t:TextRec;var stdHandle:Thandle;newHandle:Thandle);
{ Check if the stdHandle is the same as the one in the TextRec, then { Check if the stdHandle is the same as the one in the TextRec, then
also update the TextRec } also update the TextRec }
begin begin
@ -105,7 +105,10 @@ if setjmp(exitjmpbuf)=0 then
end. end.
{ {
$Log$ $Log$
Revision 1.8 2003-09-08 18:25:45 peter Revision 1.9 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.8 2003/09/08 18:25:45 peter
* popstack to cdecl * popstack to cdecl
Revision 1.7 2002/09/07 16:01:28 peter Revision 1.7 2002/09/07 16:01:28 peter

View File

@ -59,10 +59,10 @@ type
const const
{ Default filehandles } { Default filehandles }
UnusedHandle : Longint = -1; UnusedHandle : THandle = -1;
StdInputHandle : Longint = 0; StdInputHandle : THandle = 0;
StdOutputHandle : Longint = 0; StdOutputHandle : THandle = 0;
StdErrorHandle : Longint = 0; StdErrorHandle : THandle = 0;
FileNameCaseSensitive : boolean = true; FileNameCaseSensitive : boolean = true;
@ -553,14 +553,14 @@ begin
{ append mode } { append mode }
if ((flags and $100)<>0) and if ((flags and $100)<>0) and
(filerec(f).handle<>0) and (filerec(f).handle<>0) and
(filerec(f).handle<>-1) then (filerec(f).handle<>UnusedHandle) then
begin begin
do_seekend(filerec(f).handle); do_seekend(filerec(f).handle);
filerec(f).mode:=fmoutput; {fool fmappend} filerec(f).mode:=fmoutput; {fool fmappend}
end; end;
{ get errors } { get errors }
{ handle -1 is returned sometimes !! (PM) } { handle -1 is returned sometimes !! (PM) }
if (filerec(f).handle=0) or (filerec(f).handle=-1) then if (filerec(f).handle=0) or (filerec(f).handle=UnusedHandle) then
begin begin
errno:=GetLastError; errno:=GetLastError;
Errno2InoutRes; Errno2InoutRes;
@ -926,7 +926,7 @@ end;
var var
{ value of the stack segment { value of the stack segment
to check if the call stack can be written on exceptions } to check if the call stack can be written on exceptions }
_SS : longint; _SS : Cardinal;
procedure Exe_entry;[public, alias : '_FPC_EXE_Entry']; procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
begin begin
@ -1539,7 +1539,10 @@ end.
{ {
$Log$ $Log$
Revision 1.47 2003-10-17 22:15:10 olle Revision 1.48 2003-11-03 09:42:28 marco
* Peter's Cardinal<->Longint fixes patch
Revision 1.47 2003/10/17 22:15:10 olle
* changed i386 to cpui386 * changed i386 to cpui386
Revision 1.46 2003/10/16 15:43:13 peter Revision 1.46 2003/10/16 15:43:13 peter