Changeset 360 for CoolStreaming
- Timestamp:
- May 7, 2012, 10:32:41 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/UStreamHelper.pas
r307 r360 6 6 7 7 uses 8 Classes, DateUtils, syncobjs ;8 Classes, DateUtils, syncobjs, SysUtils; 9 9 10 10 type … … 49 49 procedure ReadStream(AStream: TStream; Count: Integer); 50 50 procedure ReadStreamPart(AStream: TStream; Count: Integer); 51 function EqualTo(Source: TStream): Boolean; 51 52 function Sum: Byte; 52 53 procedure FillByte(Data: Byte; Count: Integer); … … 159 160 end; 160 161 162 function TStreamHelper.EqualTo(Source: TStream): Boolean; 163 const 164 BlockSize = 4096; 165 var 166 Buffer1: array[0..BlockSize - 1] of Byte; 167 Buffer2: array[0..BlockSize - 1] of Byte; 168 BufferLength: Integer; 169 OldPos1, OldPos2: Integer; 170 begin 171 OldPos1 := Source.Position; 172 Source.Position := 0; 173 OldPos2 := Position; 174 Position := 0; 175 Result := True; 176 if Source.Size = Size then begin 177 while Source.Position < Source.Size do begin 178 BufferLength := Source.Read(Buffer1, BlockSize); 179 Read(Buffer2, BlockSize); 180 if not CompareMem(@Buffer1, @Buffer2, BufferLength) then begin 181 Result := False; 182 Break; 183 end; 184 end; 185 end else Result := False; 186 Source.Position := OldPos1; 187 Position := OldPos2; 188 end; 189 161 190 procedure TStreamHelper.WriteStreamPart(AStream: TStream; Count: Integer); 162 191 var
Note:
See TracChangeset
for help on using the changeset viewer.