Ignore:
Timestamp:
Jun 25, 2024, 1:37:11 AM (3 months ago)
Author:
chronos
Message:
File:
1 moved

Legend:

Unmodified
Added
Removed
  • CoolStreaming/VarBlockSerializer.pas

    r571 r572  
    1 // 2011-02-22
    2 
    3 unit UVarBlockSerializer;
    4 
    5 {$mode Delphi}{$H+}
     1unit VarBlockSerializer;
    62
    73// One level of recursive VarInt size supported
     
    117
    128uses
    13   Classes, DateUtils, UStreamHelper, Math, SysUtils, USubStream,
     9  Classes, DateUtils, StreamHelper, Math, SysUtils, SubStream, LazUTF8,
    1410  SpecializedList, LCLProc;
    1511
     
    119115  end;
    120116
     117
    121118implementation
    122119
     
    191188  // Get bit length
    192189  Length := SizeOf(QWord) * BitAlignment;
    193   while (((Value shr Length) and 1) = 0) and (Length > 0) do
     190  while ((Value and (QWord(1) shl (Length - 1))) = 0) and (Length > 0) do
    194191    Dec(Length);
    195192  Inc(Length);
     
    698695constructor TVarBlockSerializer.Create;
    699696begin
    700   inherited Create;
     697  inherited;
    701698  Stream := TStreamHelper.Create;
    702699  OwnsStream := True;
     
    707704begin
    708705  if OwnsStream then begin
    709     Stream.Free;
    710   end;
    711   inherited Destroy;
     706    FreeAndNil(FStream);
     707  end;
     708  inherited;
    712709end;
    713710
Note: See TracChangeset for help on using the changeset viewer.