Преглед изворни кода

* Peter's Cardinal<->Longint fixes patch

marco пре 22 година
родитељ
комит
b15ba0a5ae

+ 5 - 2
rtl/freebsd/tthread.inc

@@ -32,7 +32,7 @@ Const
 function ThreadSelf:TThread;
 var
   hp : PThreadRec;
-  sp : longint;
+  sp : Pointer;
 begin
   sp:=SPtr;
   hp:=ThreadRoot;
@@ -296,7 +296,10 @@ end;
 
 {
   $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.
 
   Revision 1.2  2003/10/09 10:55:20  marco

+ 5 - 2
rtl/go32v2/system.pp

@@ -808,7 +808,7 @@ end;
 
 
 var
-  __stkbottom : longint;external name '__stkbottom';
+  __stkbottom : pointer;external name '__stkbottom';
 
 
 
@@ -1513,7 +1513,10 @@ Begin
 End.
 {
   $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
 
   Revision 1.26  2003/10/03 21:46:25  peter

+ 7 - 4
rtl/i386/i386.inc

@@ -1146,7 +1146,7 @@ end ['EAX'];
 
 
 {$define FPC_SYSTEM_HAS_SPTR}
-Function Sptr : Longint;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
+Function Sptr : Pointer;assembler;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
         movl    %esp,%eax
 end;
@@ -1163,7 +1163,7 @@ var
   isneg  : byte;
 begin
   { Workaround: }
-  if l=$80000000 then
+  if l=longint($80000000) then
    begin
      s:='-2147483648';
      exit;
@@ -1177,7 +1177,7 @@ begin
         orl     %eax,%eax       // Sign ?
         jns     .LM2
         movb    $1,isneg
-        neg     %eax
+        negl    %eax
 .LM2:
         cltd
         idivl   %esi
@@ -1330,7 +1330,10 @@ end;
 
 {
   $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
 
   Revision 1.50  2003/10/23 17:01:27  peter

+ 5 - 2
rtl/inc/filerec.inc

@@ -25,7 +25,7 @@ const
   filerecnamelength = 255;
 type
   FileRec = Packed Record
-    Handle,
+    Handle    : THandle;
     Mode,
     RecSize   : longint;
     _private  : array[1..32] of byte;
@@ -35,7 +35,10 @@ type
 
 {
   $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
 
 }

+ 5 - 2
rtl/inc/keyboard.inc

@@ -199,7 +199,7 @@ begin
            if (TranslationTable[I].Min <= ScanCode) and (ScanCode <= TranslationTable[I].Max) then
             begin
               DefaultTranslateKeyEvent := $02000000 + (KeyEvent and $00FF0000) +
-                (ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
+                Byte(ScanCode - TranslationTable[I].Min) + TranslationTable[I].Offset;
               exit;
             end;
          end;
@@ -295,7 +295,10 @@ end;
 
 {
   $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
 
 }

+ 5 - 2
rtl/inc/keybrdh.inc

@@ -19,7 +19,7 @@ const
   errKbdNotImplemented          = errKbdBase + 1;
 
 type
-  TKeyEvent = Longint;
+  TKeyEvent = Cardinal;
   TKeyRecord = packed record
     KeyCode : Word;
     ShiftState, Flags : Byte;
@@ -193,7 +193,10 @@ Function KeyEventToString(KeyEvent : TKeyEvent) : String;
 
 {
   $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
 
 }

+ 54 - 38
rtl/inc/objects.pp

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

+ 5 - 2
rtl/inc/objpash.inc

@@ -90,7 +90,7 @@
        tinterfaceentry = packed record
          IID: pguid; { if assigned(IID) then Com else Corba}
          VTable: Pointer;
-         IOffset: LongInt;
+         IOffset: DWord;
          IIDStr: pshortstring; { never nil. Com: upper(GuidToString(IID^)) }
        end;
 
@@ -293,7 +293,10 @@
 
 {
   $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
 
   Revision 1.16  2003/03/17 20:55:58  peter

+ 6 - 3
rtl/inc/system.inc

@@ -551,12 +551,12 @@ End;
 {$S-}
 procedure fpc_stackcheck(stack_size:Cardinal);[saveregisters,public,alias:'FPC_STACKCHECK'];
 var
-  c : cardinal;
+  c : Pointer;
 begin
   { Avoid recursive calls when called from the exit routines }
   if StackError then
    exit;
-  c := cardinal(Sptr) - stack_size - STACK_MARGIN;
+  c := Sptr - (stack_size + STACK_MARGIN);
   if (c <= StackBottom) then
    begin
      StackError:=true;
@@ -853,7 +853,10 @@ end;
 
 {
   $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
       generator
     * fixed range warning/error

+ 7 - 4
rtl/inc/systemh.inc

@@ -344,7 +344,7 @@ Var
   StdErr      : Text;
   InOutRes    : Word;
   { Stack checking }
-  StackBottom,
+  StackBottom : Pointer;
   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 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$
-  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
 
   Revision 1.75  2003/10/16 15:43:13  peter
@@ -826,4 +829,4 @@ const
       instead of direct comparisons of low/high values of orddefs because
       qword is a special case
 
-}
+}

+ 5 - 2
rtl/inc/textrec.inc

@@ -27,7 +27,7 @@ const
 type
   TextBuf = array[0..TextRecBufSize-1] of char;
   TextRec = Packed Record
-    Handle,
+    Handle    : THandle;
     Mode,
     bufsize,
     _private,
@@ -45,7 +45,10 @@ type
 
 {
   $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
 
 }

+ 8 - 5
rtl/linux/tthread.inc

@@ -32,7 +32,7 @@ Const
 function ThreadSelf:TThread;
 var
   hp : PThreadRec;
-  sp : longint;
+  sp : Pointer;
 begin
   sp:=SPtr;
   hp:=ThreadRoot;
@@ -175,11 +175,11 @@ begin
   Flags := CLONE_VM + CLONE_FS + CLONE_FILES + CLONE_SIGHAND + SIGCHLD;
   { Setup 16k of stack }
   FStackSize:=16384;
-  Getmem(pointer(FStackPointer),FStackSize);
+  Getmem(FStackPointer,FStackSize);
   inc(FStackPointer,FStackSize);
   FCallExitProcess:=false;
   { Clone }
-  FHandle:= Clone(@ThreadProc,pointer(FStackPointer),Flags,self);
+  FHandle:= Clone(@ThreadProc,FStackPointer,Flags,self);
   if FSuspended then Suspend;
   FThreadID := FHandle;
   IsMultiThread := TRUE;
@@ -197,7 +197,7 @@ begin
   if FHandle <> -1 then
     {$ifdef ver1_0}Kill{$else}fpkill{$endif}(FHandle, SIGKILL);
   dec(FStackPointer,FStackSize);
-  Freemem(pointer(FStackPointer),FStackSize);
+  Freemem(FStackPointer);
   FFatalException.Free;
   FFatalException := nil;
   inherited Destroy;
@@ -302,7 +302,10 @@ end;
 
 {
   $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
 
   Revision 1.9  2003/10/06 17:06:55  florian

+ 6 - 3
rtl/objpas/sysutils/sysstr.inc

@@ -1006,7 +1006,7 @@ begin
   if fmtlen > 0 then
     Move(fmt,F[1],fmtlen);
   S:=Format (F,Args);
-  If Length(S)<Buflen then
+  If Cardinal(Length(S))<Buflen then
     Result:=Length(S)
   else
     Result:=Buflen;
@@ -2012,7 +2012,10 @@ const
 
 {
   $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)
 
   Revision 1.1  2003/10/06 21:01:06  peter
@@ -2076,4 +2079,4 @@ const
       instead of direct comparisons of low/high values of orddefs because
       qword is a special case
 
-}
+}

+ 5 - 2
rtl/os2/system.pas

@@ -1122,7 +1122,7 @@ begin
     (* Initialize the amount of file handles *)
     FileHandleCount := GetFileHandleCount;
     DosGetInfoBlocks (@TIB, @PIB);
-    StackBottom := cardinal (TIB^.Stack);
+    StackBottom := TIB^.Stack;
     Environment := pointer (PIB^.Env);
     ApplicationType := PIB^.ProcType;
     IsConsole := ApplicationType <> 3;
@@ -1153,7 +1153,10 @@ begin
 end.
 {
   $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
 
   Revision 1.54  2003/10/28 14:57:31  yuri

+ 7 - 4
rtl/unix/unix.pp

@@ -1440,8 +1440,8 @@ function TTYName(Handle:Longint):string;
   returns empty string in case of an error.
 }
 var
-  mydev,
-  myino     : longint;
+  mydev     : dev_t;
+  myino     : ino_t;
   st        : stat;
 
   function mysearch(n:string): boolean;
@@ -1475,7 +1475,7 @@ var
                 exit;
               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
              fpclosedir(dirstream^);
              ttyname:=name;
@@ -1715,7 +1715,10 @@ End.
 
 {
   $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
 
   Revision 1.41  2003/10/12 19:40:43  marco

+ 3 - 3
rtl/unix/unixutil.pp

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

+ 18 - 15
rtl/win32/crt.pp

@@ -63,10 +63,10 @@ var
   WindMin: Word;          { Window upper left coordinates }
   WindMax: Word;          { Window lower right coordinates }
   { FPC Specific for large screen support }
-  WindMinX : Longint;
-  WindMaxX : Longint;
-  WindMinY : Longint;
-  WindMaxY : Longint;
+  WindMinX : DWord;
+  WindMaxX : DWord;
+  WindMinY : DWord;
+  WindMaxY : DWord	;
 
 { Interface procedures }
 procedure AssignCrt(var F: Text);
@@ -127,7 +127,7 @@ begin
   end; { if }
 end; { proc. TurnMouseOff }
 
-function GetScreenHeight : longint;
+function GetScreenHeight : DWord;
 var
   ConsoleInfo: TConsoleScreenBufferinfo;
 begin
@@ -142,7 +142,7 @@ begin
     GetScreenHeight := ConsoleInfo.dwSize.Y;
 end; { func. GetScreenHeight }
 
-function GetScreenWidth : longint;
+function GetScreenWidth : DWord;
 var
   ConsoleInfo: TConsoleScreenBufferInfo;
 begin
@@ -158,7 +158,7 @@ begin
 end; { func. GetScreenWidth }
 
 
-procedure GetScreenCursor(var x : longint; var y : longint);
+procedure GetScreenCursor(var x : DWord; var y : DWord);
 var
   ConsoleInfo : TConsoleScreenBufferInfo;
 begin
@@ -168,7 +168,7 @@ begin
   Y := ConsoleInfo.dwCursorPosition.Y + 1;
 end;
 
-procedure SetScreenCursor(x,y : longint);
+procedure SetScreenCursor(x,y : DWord);
 var
   CurInfo: TCoord;
 begin
@@ -274,7 +274,7 @@ var
   Temp: DWord;
   CharInfo: Char;
   Coord: TCoord;
-  X,Y: Longint;
+  X,Y: DWord;
 begin
   GetScreenCursor(x, y);
 
@@ -293,7 +293,7 @@ Function WhereX: DWord;
   Return current X-position of cursor.
 }
 var
-  x,y : longint;
+  x,y : DWord;
 Begin
   GetScreenCursor(x, y);
   WhereX:= x - WindMinX +1;
@@ -304,7 +304,7 @@ Function WhereY: DWord;
   Return current Y-position of cursor.
 }
 var
-  x, y : longint;
+  x, y : DWord;
 Begin
   GetScreenCursor(x, y);
   WhereY:= y - WindMinY + 1;
@@ -540,7 +540,7 @@ end;
 {****************************************************************************
                           HighLevel Crt Functions
 ****************************************************************************}
-procedure removeline(y : longint);
+procedure removeline(y : DWord);
 var
   ClipRect: TSmallRect;
   SrcRect: TSmallRect;
@@ -580,7 +580,7 @@ var
   SrcRect: TSmallRect;
   DestCoor: TCoord;
   CharInfo: TCharInfo;
-  X,Y: Longint;
+  X,Y: DWord;
 begin
   GetScreenCursor(X, Y);
 
@@ -640,7 +640,7 @@ end;
 *****************************************************************************}
 
 var
-  CurrX, CurrY : longint;
+  CurrX, CurrY : DWord;
 
 procedure WriteChar(c : char);
 var
@@ -861,7 +861,10 @@ end. { unit Crt }
 
 {
   $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 alt-xyz in readkey
 

+ 5 - 2
rtl/win32/initc.pp

@@ -57,7 +57,7 @@ const
    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
   also update the TextRec }
 begin
@@ -105,7 +105,10 @@ if setjmp(exitjmpbuf)=0 then
 end.
 {
   $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
 
   Revision 1.7  2002/09/07 16:01:28  peter

+ 12 - 9
rtl/win32/system.pp

@@ -59,10 +59,10 @@ type
 
 const
 { Default filehandles }
-  UnusedHandle    : Longint = -1;
-  StdInputHandle  : Longint = 0;
-  StdOutputHandle : Longint = 0;
-  StdErrorHandle  : Longint = 0;
+  UnusedHandle    : THandle = -1;
+  StdInputHandle  : THandle = 0;
+  StdOutputHandle : THandle = 0;
+  StdErrorHandle  : THandle = 0;
 
   FileNameCaseSensitive : boolean = true;
 
@@ -553,14 +553,14 @@ begin
 { append mode }
   if ((flags and $100)<>0) and
      (filerec(f).handle<>0) and
-     (filerec(f).handle<>-1) then
+     (filerec(f).handle<>UnusedHandle) then
    begin
      do_seekend(filerec(f).handle);
      filerec(f).mode:=fmoutput; {fool fmappend}
    end;
 { get errors }
   { 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
       errno:=GetLastError;
       Errno2InoutRes;
@@ -926,7 +926,7 @@ end;
 var
   { value of the stack segment
     to check if the call stack can be written on exceptions }
-  _SS : longint;
+  _SS : Cardinal;
 
 procedure Exe_entry;[public, alias : '_FPC_EXE_Entry'];
   begin
@@ -1539,7 +1539,10 @@ end.
 
 {
   $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
 
   Revision 1.46  2003/10/16 15:43:13  peter
@@ -1616,4 +1619,4 @@ end.
   Revision 1.23  2002/01/25 16:23:03  peter
     * merged filesearch() fix
 
-}
+}