Changeset 247 for CoolStreaming


Ignore:
Timestamp:
May 24, 2011, 12:36:12 PM (14 years ago)
Author:
george
Message:
  • Fixed: Various minor bugs and enhancements.
Location:
CoolStreaming
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CoolStreaming/UBitStream.pas

    r128 r247  
    2828    function CopyFrom(Source: TBitStream; Count: LongInt): LongInt;
    2929    function Write(const Buffer; Count: Longint): Longint; virtual;
     30    function EqualTo(Source: TBitStream): Boolean;
    3031    function GetString: string;
    3132    procedure SetString(const AValue: string);
    3233    procedure ReadBuffer(var Buffer; Count: Longint);
    3334    procedure WriteBuffer(const Buffer; Count: Longint);
    34     property Position: LongInt read GetPosition write SetPosition;
    35     property Size: LongInt read GetSize write SetSize;
    36     property Bit[Index: Integer]: Boolean read GetBit write SetBit;
    37 
    3835    function ReadBit: Boolean;
    3936    procedure WriteBit(AValue: Boolean);
    4037    function ReadNumber(Count: Byte): QWord;
    4138    procedure WriteNumber(AValue: QWord; Count: Byte);
     39    property Position: LongInt read GetPosition write SetPosition;
     40    property Size: LongInt read GetSize write SetSize;
     41    property Bit[Index: Integer]: Boolean read GetBit write SetBit;
    4242    property AsString: string read GetString write SetString;
    4343  end;
     
    6464  end;
    6565
     66
    6667implementation
    6768
     
    133134begin
    134135  Result := 0;
     136end;
     137
     138function TBitStream.EqualTo(Source: TBitStream): Boolean;
     139var
     140  I: Integer;
     141begin
     142  if Size = Source.Size then begin
     143    I := 0;
     144    Result := True;
     145    Position := 0;
     146    Source.Position := 0;
     147    while (I < Size) and (ReadBit = Source.ReadBit) do Inc(I);
     148    if I < Size then Result := False;
     149  end else Result := False;
    135150end;
    136151
  • CoolStreaming/UVarBlockSerializer.pas

    r222 r247  
    791791  VarBlock.Stream.Position := 0;
    792792  Mask := VarBlock.ReadVarUInt;
     793  Items.Clear;
    793794  I := 0;
    794795  while Mask <> 0 do begin
Note: See TracChangeset for help on using the changeset viewer.