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

* various rtl fixes that allow objpas.integer to be 16-bit on 16-bit targets
(still not sure if it's a good idea, but trying, at least, is harmless - we
can always rollback to integer being equal to longint)

git-svn-id: trunk@26966 -

nickysn пре 11 година
родитељ
комит
fec4c6a6e2
4 измењених фајлова са 13 додато и 13 уклоњено
  1. 3 3
      rtl/msdos/sysutils.pp
  2. 4 4
      rtl/objpas/classes/classesh.inc
  3. 3 3
      rtl/objpas/strutils.pp
  4. 3 3
      rtl/objpas/typinfo.pp

+ 3 - 3
rtl/msdos/sysutils.pp

@@ -136,13 +136,13 @@ begin
 end;
 
 
-Function FileCreate (Const FileName : RawByteString; ShareMode:longint; Rights : longint) : THandle;
+Function FileCreate (Const FileName : RawByteString; ShareMode:integer; Rights : integer) : THandle;
 begin
   FileCreate:=FileCreate(FileName);
 end;
 
 
-Function FileCreate (Const FileName : RawByteString; Rights:longint) : THandle;
+Function FileCreate (Const FileName : RawByteString; Rights:integer) : THandle;
 begin
   FileCreate:=FileCreate(FileName);
 end;
@@ -237,7 +237,7 @@ begin
 end;
 
 
-Function FileSeek (Handle : THandle; FOffset: Int64; Origin: Integer) : Int64;
+Function FileSeek (Handle : THandle; FOffset: Int64; Origin: {Integer}Longint) : Int64;
 begin
   {$warning need to add 64bit call }
   FileSeek:=FileSeek(Handle,Longint(FOffset),Longint(Origin));

+ 4 - 4
rtl/objpas/classes/classesh.inc

@@ -454,8 +454,8 @@ type
     FOwnerInterface: IInterface;
   protected
     { IInterface }
-    function _AddRef: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
-    function _Release: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+    function _AddRef: Longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+    function _Release: Longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
   public
     function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): HResult; virtual; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
     procedure AfterConstruction; override;
@@ -1771,8 +1771,8 @@ type
     procedure ValidateInsert(AComponent: TComponent); dynamic;
     { IUnknown }
     function QueryInterface({$IFDEF FPC_HAS_CONSTREF}constref{$ELSE}const{$ENDIF} IID: TGUID; out Obj): Hresult; virtual; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
-    function _AddRef: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
-    function _Release: Integer; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+    function _AddRef: Longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+    function _Release: Longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
     function iicrGetComponent: TComponent;
     { IDispatch }
     function GetTypeInfoCount(out Count: Integer): HResult; stdcall;

+ 3 - 3
rtl/objpas/strutils.pp

@@ -185,7 +185,7 @@ function intToBin(Value: int64; Digits:integer): string;
 function IntToRoman(Value: Longint): string;
 function TryRomanToInt(S: String; out N: LongInt; Strictness: TRomanConversionStrictness = rcsRelaxed): Boolean;
 function RomanToInt(const S: string; Strictness: TRomanConversionStrictness = rcsRelaxed): Longint;
-function RomanToIntDef(Const S : String; const ADefault: integer = 0; Strictness: TRomanConversionStrictness = rcsRelaxed): Integer;
+function RomanToIntDef(Const S : String; const ADefault: Longint = 0; Strictness: TRomanConversionStrictness = rcsRelaxed): Longint;
 procedure BinToHex(BinValue, HexValue: PChar; BinBufSize: Integer);
 function HexToBin(HexValue, BinValue: PChar; BinBufSize: Integer): Integer;
 
@@ -1635,8 +1635,8 @@ begin
     raise EConvertError.CreateFmt(SInvalidRomanNumeral,[S]);
 end;
 
-function RomanToIntDef(const S: String; const ADefault: integer;
-  Strictness: TRomanConversionStrictness): Integer;
+function RomanToIntDef(const S: String; const ADefault: Longint;
+  Strictness: TRomanConversionStrictness): Longint;
 begin
   if not TryRomanToInt(S, Result, Strictness) then
     Result := ADefault;

+ 3 - 3
rtl/objpas/typinfo.pp

@@ -569,7 +569,7 @@ end;
 Function SetToString(TypeInfo: PTypeInfo; Value: Integer; Brackets: Boolean) : String;
 
 type
-  tsetarr = bitpacked array[0..31] of 0..1;
+  tsetarr = bitpacked array[0..SizeOf(Integer)*8-1] of 0..1;
 Var
   I : Integer;
   PTI : PTypeInfo;
@@ -579,8 +579,8 @@ begin
   { On big endian systems, set element 0 is in the most significant bit,
     and the same goes for the elements of bitpacked arrays there.  }
   case GetTypeData(TypeInfo)^.OrdType of
-    otSByte,otUByte: Value:=Value shl 24;
-    otSWord,otUWord: Value:=Value shl 16;
+    otSByte,otUByte: Value:=Value shl (SizeOf(Integer)*8-8);
+    otSWord,otUWord: Value:=Value shl (SizeOf(Integer)*8-16);
   end;
 {$endif}