Changeset 341
- Timestamp:
- Apr 3, 2012, 7:32:43 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/UVarBlockSerializer.pas
r307 r341 110 110 SUInt64Overflow = '64-bit UInt read overflow.'; 111 111 SReadError = 'Stream read error. Expected length %d, read %d. Source stream size %d.'; 112 SErrorGetVarSize = 'Error reading variable block size'; 112 113 113 114 { TVarBlockSerializer } … … 416 417 StoredPosition: Integer; 417 418 begin 418 StoredPosition := Stream.Position; 419 Result := 1; // Byte block length 420 Data := Stream.ReadByte; 421 if Data = $ff then Result := GetVarSize + ReadVarUInt + 1 422 else begin 423 Result := DecodeUnaryLength(Data); 424 end; 425 Stream.Position := StoredPosition; 419 try 420 StoredPosition := Stream.Position; 421 Result := 1; // Byte block length 422 Data := Stream.ReadByte; 423 424 if Data = $ff then Result := GetVarSize + ReadVarUInt + 1 425 else begin 426 Result := DecodeUnaryLength(Data); 427 end; 428 Stream.Position := StoredPosition; 429 except 430 raise Exception.Create(SErrorGetVarSize); 431 end; 426 432 end; 427 433 … … 477 483 I: Integer; 478 484 StreamHelper: TStreamHelper; 485 RequestedSize: Integer; 479 486 begin 480 487 try … … 492 499 StreamHelper.ReadStream(Data.Stream, GetVarSize); 493 500 except 494 raise Exception.Create(SMaskedValueReadError); 501 //raise Exception.Create(SMaskedValueReadError); 502 // Error recovery for not enough source data in stream 503 Data.Stream.Size := 0; 504 Data.Stream.WriteByte(0); 495 505 end; 496 506 finally
Note:
See TracChangeset
for help on using the changeset viewer.