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

* Undo 42425

git-svn-id: branches/fixes_3_2@42440 -
michael пре 6 година
родитељ
комит
1c0ef960b0
2 измењених фајлова са 14 додато и 27 уклоњено
  1. 9 13
      rtl/objpas/classes/classesh.inc
  2. 5 14
      rtl/objpas/classes/streams.inc

+ 9 - 13
rtl/objpas/classes/classesh.inc

@@ -898,8 +898,8 @@ type
     Procedure WriteExactSizeData(Const Buffer; aSize,aCount : NativeInt);
   public
     function Read(var Buffer; Count: Longint): Longint; virtual; overload;
-    function Read(var Buffer: TBytes; Count: Longint): Longint; overload;
-    function Read( Buffer : TBytes; aOffset, Count: Longint): Longint; overload;
+    function Read(Buffer: TBytes; Count: Longint): Longint; overload;
+    function Read(Buffer : TBytes; aOffset, Count: Longint): Longint; overload;
 
     function Write(const Buffer: TBytes; Offset, Count: Longint): Longint; overload;
     function Write(const Buffer: TBytes; Count: Longint): Longint; overload;
@@ -909,7 +909,7 @@ type
     function Seek(const Offset: Int64; Origin: TSeekOrigin): Int64; virtual; overload;
 
     function ReadData(Buffer: Pointer; Count: NativeInt): NativeInt; overload;
-    function ReadData(Buffer: TBytes; Count: NativeInt): NativeInt; overload;
+    function ReadData(const Buffer: TBytes; Count: NativeInt): NativeInt; overload;
     function ReadData(var Buffer: Boolean): NativeInt; overload;
     function ReadData(var Buffer: Boolean; Count: NativeInt): NativeInt; overload;
     function ReadData(var Buffer: AnsiChar): NativeInt; overload;
@@ -936,12 +936,11 @@ type
     function ReadData(var Buffer: Single; Count: NativeInt): NativeInt; overload;
     function ReadData(var Buffer: Double): NativeInt; overload;
     function ReadData(var Buffer: Double; Count: NativeInt): NativeInt; overload;
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
     function ReadData(var Buffer: Extended): NativeInt; overload;
     function ReadData(var Buffer: Extended; Count: NativeInt): NativeInt; overload;
     function ReadData(var Buffer: TExtended80Rec): NativeInt; overload;
     function ReadData(var Buffer: TExtended80Rec; Count: NativeInt): NativeInt; overload;
-{$ENDIF}
+
     procedure ReadBuffer(var Buffer; Count: Longint);
     procedure ReadBuffer(var Buffer: TBytes; Count: NativeInt); overload;
     procedure ReadBuffer(var Buffer: TBytes; Offset, Count: NativeInt); overload;
@@ -972,12 +971,11 @@ type
     procedure ReadBufferData(var Buffer: Single; Count: NativeInt); overload;
     procedure ReadBufferData(var Buffer: Double); overload;
     procedure ReadBufferData(var Buffer: Double; Count: NativeInt); overload;
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
     procedure ReadBufferData(var Buffer: Extended); overload;
     procedure ReadBufferData(var Buffer: Extended; Count: NativeInt); overload;
     procedure ReadBufferData(var Buffer: TExtended80Rec); overload;
     procedure ReadBufferData(var Buffer: TExtended80Rec; Count: NativeInt); overload;
-{$ENDIF}
+
     procedure WriteBuffer(const Buffer; Count: Longint);
     procedure WriteBuffer(const Buffer: TBytes; Count: NativeInt); overload;
     procedure WriteBuffer(const Buffer: TBytes; Offset, Count: NativeInt); overload;
@@ -1010,14 +1008,13 @@ type
     function WriteData(const Buffer: Single; Count: NativeInt): NativeInt; overload;
     function WriteData(const Buffer: Double): NativeInt; overload;
     function WriteData(const Buffer: Double; Count: NativeInt): NativeInt; overload;
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
     function WriteData(const Buffer: Extended): NativeInt; overload;
     function WriteData(const Buffer: Extended; Count: NativeInt): NativeInt; overload;
     function WriteData(const Buffer: TExtended80Rec): NativeInt; overload;
     function WriteData(const Buffer: TExtended80Rec; Count: NativeInt): NativeInt; overload;
-{$ENDIF}
-    procedure WriteBufferData(Buffer: Int32); overload;
-    procedure WriteBufferData(Buffer: Int32; Count: NativeInt); overload;
+
+    procedure WriteBufferData(Buffer: Integer); overload;
+    procedure WriteBufferData(Buffer: Integer; Count: NativeInt); overload;
     procedure WriteBufferData(Buffer: Boolean); overload;
     procedure WriteBufferData(Buffer: Boolean; Count: NativeInt); overload;
     procedure WriteBufferData(Buffer: AnsiChar); overload;
@@ -1042,12 +1039,11 @@ type
     procedure WriteBufferData(Buffer: Single; Count: NativeInt); overload;
     procedure WriteBufferData(Buffer: Double); overload;
     procedure WriteBufferData(Buffer: Double; Count: NativeInt); overload;
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
     procedure WriteBufferData(Buffer: Extended); overload;
     procedure WriteBufferData(Buffer: Extended; Count: NativeInt); overload;
     procedure WriteBufferData(Buffer: TExtended80Rec); overload;
     procedure WriteBufferData(Buffer: TExtended80Rec; Count: NativeInt); overload;
-{$ENDIF}
+
     function CopyFrom(Source: TStream; Count: Int64): Int64;
     function ReadComponent(Instance: TComponent): TComponent;
     function ReadComponentRes(Instance: TComponent): TComponent;

+ 5 - 14
rtl/objpas/classes/streams.inc

@@ -30,7 +30,7 @@ begin
   Result := 0;
 end;
 
-function TStream.Read(var Buffer: TBytes; Count: Longint): Longint;
+function TStream.Read(Buffer: TBytes; Count: Longint): Longint;
 begin
   Result:=Read(Buffer,0,Count);
 end;
@@ -203,7 +203,7 @@ end;
    Result:=Read(Buffer^,Count);
  end;
 
- function TStream.ReadData({var} Buffer: TBytes; Count: NativeInt): NativeInt;
+ function TStream.ReadData(const Buffer: TBytes; Count: NativeInt): NativeInt;
  begin
    Result:=Read(Buffer,0,Count);
  end;
@@ -382,7 +382,6 @@ begin
   Result:=ReadMaxSizeData(Buffer,SizeOf(Buffer),Count);
 end;
 
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
 function TStream.ReadData(var Buffer: Extended): NativeInt;
 begin
   Result:=Read(Buffer,sizeOf(Buffer));
@@ -402,7 +401,6 @@ function TStream.ReadData(var Buffer: TExtended80Rec; Count: NativeInt): NativeI
 begin
   Result:=ReadMaxSizeData(Buffer,SizeOf(Buffer),Count);
 end;
-{$ENDIF}
 
 procedure TStream.ReadBuffer(var Buffer; Count: Longint);
 
@@ -559,7 +557,6 @@ begin
   ReadExactSizeData(Buffer,SizeOf(Buffer),Count);
 end;
 
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
 procedure TStream.ReadBufferData(var Buffer: Extended);
 begin
   ReadBuffer(Buffer,SizeOf(Buffer));
@@ -579,7 +576,6 @@ procedure TStream.ReadBufferData(var Buffer: TExtended80Rec; Count: NativeInt);
 begin
   ReadExactSizeData(Buffer,SizeOf(Buffer),Count);
 end;
-{$ENDIF}
 
 procedure TStream.WriteBuffer(const Buffer; Count: Longint);
 
@@ -746,7 +742,6 @@ begin
   Result:=WriteMaxSizeData(Buffer,SizeOf(Buffer),Count);
 end;
 
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
 function TStream.WriteData(const Buffer: Extended): NativeInt;
 begin
   Result:=Write(Buffer,SizeOf(Buffer));
@@ -766,14 +761,13 @@ function TStream.WriteData(const Buffer: TExtended80Rec; Count: NativeInt): Nati
 begin
   Result:=WriteMaxSizeData(Buffer,SizeOf(Buffer),Count);
 end;
-{$ENDIF}
 
-procedure TStream.WriteBufferData(Buffer: Int32);
+procedure TStream.WriteBufferData(Buffer: Integer);
 begin
   WriteBuffer(Buffer,SizeOf(Buffer));
 end;
 
-procedure TStream.WriteBufferData(Buffer: Int32; Count: NativeInt);
+procedure TStream.WriteBufferData(Buffer: Integer; Count: NativeInt);
 begin
   WriteMaxSizeData(Buffer,SizeOf(Buffer),Count);
 end;
@@ -898,8 +892,6 @@ begin
   WriteExactSizeData(Buffer,SizeOf(Buffer),Count);
 end;
 
-
-{$IFDEF FPC_HAS_TYPE_EXTENDED}
 procedure TStream.WriteBufferData(Buffer: Extended);
 begin
   WriteBuffer(Buffer,SizeOf(Buffer));
@@ -919,7 +911,6 @@ procedure TStream.WriteBufferData(Buffer: TExtended80Rec; Count: NativeInt);
 begin
   WriteExactSizeData(Buffer,SizeOf(Buffer),Count);
 end;
-{$ENDIF}
 
   function TStream.CopyFrom(Source: TStream; Count: Int64): Int64;
 
@@ -1870,7 +1861,7 @@ begin
         sz := sizeof(Buffer)
       else
         sz := cb;
-      sz := FStream.Read(buffer[0],sz);
+      sz := FStream.Read(buffer, sz);
       inc(cbRead, sz);
       stm.Write(@buffer[0], sz, @sz);
       inc(cbWritten, sz);