Changeset 384 for CoolStreaming/UVarBlockSerializer.pas
- Timestamp:
- Jul 9, 2012, 3:58:43 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/UVarBlockSerializer.pas
r341 r384 40 40 function GetVarSize: Integer; 41 41 function GetVarCount: Integer; 42 function TryVarBlock: Boolean; 42 43 43 44 // Advanced data types … … 450 451 end; 451 452 453 function TVarBlockSerializer.TryVarBlock: Boolean; 454 var 455 Data: Byte; 456 StoredPosition: Integer; 457 Count: Integer; 458 begin 459 if Stream.Position < Stream.Size then 460 try 461 StoredPosition := Stream.Position; 462 Data := Stream.ReadByte; 463 if Data = $ff then begin 464 if TryVarBlock then begin 465 Count := ReadVarUInt; 466 Result := Count <= Stream.Size - Stream.Position; 467 end else Result := False; 468 end else begin 469 Count := DecodeUnaryLength(Data) - 1; 470 Result := Count <= Stream.Size - Stream.Position; 471 end; 472 Stream.Position := StoredPosition; 473 except 474 raise Exception.Create(SErrorGetVarSize); 475 end else Result := False; 476 end; 477 452 478 procedure TVarBlockSerializer.WriteVarSInt(Value: Int64); 453 479 begin
Note:
See TracChangeset
for help on using the changeset viewer.