Changeset 174


Ignore:
Timestamp:
Feb 23, 2011, 8:57:12 AM (14 years ago)
Author:
george
Message:
Location:
CoolStreaming
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CoolStreaming/Demo/VarBlockSerializer/UMainForm.lfm

    r173 r174  
    1414    Top = 8
    1515    Width = 632
    16     ActivePage = TabSheet2
    17     TabIndex = 1
     16    ActivePage = TabSheet1
     17    Anchors = [akTop, akLeft, akRight, akBottom]
     18    TabIndex = 0
    1819    TabOrder = 0
    1920    object TabSheet1: TTabSheet
  • CoolStreaming/Demo/VarBlockSerializer/VarBlockSerializerDemo.lpi

    r173 r174  
    5959        <EditorIndex Value="0"/>
    6060        <WindowIndex Value="0"/>
    61         <TopLine Value="294"/>
    62         <CursorPos X="25" Y="296"/>
     61        <TopLine Value="167"/>
     62        <CursorPos X="40" Y="174"/>
    6363        <UsageCount Value="55"/>
    6464        <Loaded Value="True"/>
     
    8080        <EditorIndex Value="2"/>
    8181        <WindowIndex Value="0"/>
    82         <TopLine Value="753"/>
    83         <CursorPos X="54" Y="764"/>
     82        <TopLine Value="392"/>
     83        <CursorPos X="74" Y="405"/>
    8484        <UsageCount Value="28"/>
    8585        <Loaded Value="True"/>
     
    9999        <WindowIndex Value="0"/>
    100100        <TopLine Value="134"/>
    101         <CursorPos X="23" Y="151"/>
     101        <CursorPos X="26" Y="144"/>
    102102        <UsageCount Value="28"/>
    103103        <Loaded Value="True"/>
     
    125125    <JumpHistory Count="29" HistoryIndex="28">
    126126      <Position1>
    127         <Filename Value="..\..\UVarBlockSerializer.pas"/>
    128         <Caret Line="778" Column="1" TopLine="765"/>
     127        <Filename Value="UMainForm.pas"/>
     128        <Caret Line="177" Column="1" TopLine="167"/>
    129129      </Position1>
    130130      <Position2>
    131131        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    132         <Caret Line="766" Column="1" TopLine="761"/>
     132        <Caret Line="302" Column="1" TopLine="289"/>
    133133      </Position2>
    134134      <Position3>
    135135        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    136         <Caret Line="767" Column="1" TopLine="761"/>
     136        <Caret Line="303" Column="1" TopLine="289"/>
    137137      </Position3>
    138138      <Position4>
    139139        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    140         <Caret Line="768" Column="1" TopLine="761"/>
     140        <Caret Line="304" Column="1" TopLine="289"/>
    141141      </Position4>
    142142      <Position5>
    143143        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    144         <Caret Line="769" Column="1" TopLine="761"/>
     144        <Caret Line="305" Column="1" TopLine="289"/>
    145145      </Position5>
    146146      <Position6>
    147147        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    148         <Caret Line="770" Column="1" TopLine="761"/>
     148        <Caret Line="226" Column="1" TopLine="213"/>
    149149      </Position6>
    150150      <Position7>
    151         <Filename Value="UMainForm.pas"/>
    152         <Caret Line="111" Column="41" TopLine="108"/>
     151        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     152        <Caret Line="370" Column="1" TopLine="357"/>
    153153      </Position7>
    154154      <Position8>
    155         <Filename Value="UMainForm.pas"/>
    156         <Caret Line="126" Column="28" TopLine="108"/>
     155        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     156        <Caret Line="371" Column="1" TopLine="357"/>
    157157      </Position8>
    158158      <Position9>
    159159        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    160         <Caret Line="810" Column="16" TopLine="802"/>
     160        <Caret Line="372" Column="1" TopLine="357"/>
    161161      </Position9>
    162162      <Position10>
    163163        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    164         <Caret Line="766" Column="1" TopLine="760"/>
     164        <Caret Line="374" Column="1" TopLine="357"/>
    165165      </Position10>
    166166      <Position11>
    167167        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    168         <Caret Line="767" Column="1" TopLine="760"/>
     168        <Caret Line="375" Column="1" TopLine="357"/>
    169169      </Position11>
    170170      <Position12>
    171171        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    172         <Caret Line="768" Column="1" TopLine="760"/>
     172        <Caret Line="385" Column="1" TopLine="372"/>
    173173      </Position12>
    174174      <Position13>
    175175        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    176         <Caret Line="769" Column="1" TopLine="760"/>
     176        <Caret Line="386" Column="1" TopLine="372"/>
    177177      </Position13>
    178178      <Position14>
    179179        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    180         <Caret Line="770" Column="1" TopLine="760"/>
     180        <Caret Line="387" Column="1" TopLine="372"/>
    181181      </Position14>
    182182      <Position15>
    183183        <Filename Value="..\..\UVarBlockSerializer.pas"/>
    184         <Caret Line="771" Column="1" TopLine="760"/>
     184        <Caret Line="388" Column="1" TopLine="372"/>
    185185      </Position15>
    186186      <Position16>
    187         <Filename Value="UMainForm.pas"/>
    188         <Caret Line="126" Column="28" TopLine="108"/>
     187        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     188        <Caret Line="390" Column="1" TopLine="375"/>
    189189      </Position16>
    190190      <Position17>
    191         <Filename Value="UMainForm.pas"/>
    192         <Caret Line="113" Column="1" TopLine="108"/>
     191        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     192        <Caret Line="392" Column="1" TopLine="375"/>
    193193      </Position17>
    194194      <Position18>
    195         <Filename Value="UMainForm.pas"/>
    196         <Caret Line="114" Column="1" TopLine="108"/>
     195        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     196        <Caret Line="393" Column="1" TopLine="375"/>
    197197      </Position18>
    198198      <Position19>
    199         <Filename Value="UMainForm.pas"/>
    200         <Caret Line="115" Column="1" TopLine="108"/>
     199        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     200        <Caret Line="394" Column="1" TopLine="375"/>
    201201      </Position19>
    202202      <Position20>
    203         <Filename Value="UMainForm.pas"/>
    204         <Caret Line="114" Column="13" TopLine="108"/>
     203        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     204        <Caret Line="395" Column="1" TopLine="375"/>
    205205      </Position20>
    206206      <Position21>
    207         <Filename Value="UMainForm.pas"/>
    208         <Caret Line="326" Column="3" TopLine="309"/>
     207        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     208        <Caret Line="396" Column="1" TopLine="375"/>
    209209      </Position21>
    210210      <Position22>
    211         <Filename Value="UMainForm.pas"/>
    212         <Caret Line="113" Column="1" TopLine="100"/>
     211        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     212        <Caret Line="402" Column="1" TopLine="389"/>
    213213      </Position22>
    214214      <Position23>
    215         <Filename Value="UMainForm.pas"/>
    216         <Caret Line="321" Column="1" TopLine="308"/>
     215        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     216        <Caret Line="403" Column="18" TopLine="389"/>
    217217      </Position23>
    218218      <Position24>
    219         <Filename Value="UMainForm.pas"/>
    220         <Caret Line="322" Column="1" TopLine="308"/>
     219        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     220        <Caret Line="405" Column="22" TopLine="389"/>
    221221      </Position24>
    222222      <Position25>
    223         <Filename Value="UMainForm.pas"/>
    224         <Caret Line="323" Column="1" TopLine="308"/>
     223        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     224        <Caret Line="403" Column="29" TopLine="389"/>
    225225      </Position25>
    226226      <Position26>
    227         <Filename Value="UMainForm.pas"/>
    228         <Caret Line="324" Column="1" TopLine="308"/>
     227        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     228        <Caret Line="108" Column="29" TopLine="97"/>
    229229      </Position26>
    230230      <Position27>
    231         <Filename Value="UMainForm.pas"/>
    232         <Caret Line="330" Column="68" TopLine="309"/>
     231        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     232        <Caret Line="404" Column="17" TopLine="392"/>
    233233      </Position27>
    234234      <Position28>
    235235        <Filename Value="UMainForm.pas"/>
    236         <Caret Line="113" Column="1" TopLine="100"/>
     236        <Caret Line="172" Column="1" TopLine="167"/>
    237237      </Position28>
    238238      <Position29>
    239         <Filename Value="UMainForm.pas"/>
    240         <Caret Line="114" Column="1" TopLine="101"/>
     239        <Filename Value="..\..\UVarBlockSerializer.pas"/>
     240        <Caret Line="405" Column="74" TopLine="392"/>
    241241      </Position29>
    242242    </JumpHistory>
     
    264264  </CompilerOptions>
    265265  <Debugging>
     266    <BreakPoints Count="1">
     267      <Item1>
     268        <Source Value="UMainForm.pas"/>
     269        <Line Value="172"/>
     270      </Item1>
     271    </BreakPoints>
    266272    <Exceptions Count="3">
    267273      <Item1>
  • CoolStreaming/UVarBlockSerializer.pas

    r173 r174  
    106106  SMaskedValueReadError = 'Error reading masked variable length block.';
    107107  SUInt64Overflow = '64-bit UInt read overflow.';
     108  SReadError = 'Stream read error. Expected length %d, read %d. Source stream size %d.';
    108109
    109110{ TVarBlockSerializer }
     
    365366  Data: Byte;
    366367  Length: Cardinal;
    367   I: Cardinal;
     368  RealLength: Cardinal;
    368369  LengthMask: Byte;
    369370begin
    370371  AStream.Size := 0;
    371   I := 0;
    372372  Length := 1;
    373373
     
    400400
    401401  // If CopyFrom parameter count is zero then whole source is copied
    402   if Length > 1 then
    403     AStream.CopyFrom(Stream, Length - 1);
     402  if Length > 1 then begin
     403    RealLength := AStream.CopyFrom(Stream, Length - 1);
     404    if RealLength < (Length - 1) then
     405      raise EReadError.Create(Format(SReadError, [Length - 1, RealLength, Stream.Size]));
     406  end;
    404407  AStream.Position := 0;
    405408end;
     
    413416  Result := 1; // Byte block length
    414417  Data := Stream.ReadByte;
    415   if Data = $ff then Result := ReadVarUInt + 2
     418  if Data = $ff then Result := GetVarSize + ReadVarUInt + 1
    416419  else begin
    417420    Result := DecodeUnaryLength(Data);
Note: See TracChangeset for help on using the changeset viewer.