Changeset 174 for CoolStreaming/UVarBlockSerializer.pas
- Timestamp:
- Feb 23, 2011, 8:57:12 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CoolStreaming/UVarBlockSerializer.pas
r173 r174 106 106 SMaskedValueReadError = 'Error reading masked variable length block.'; 107 107 SUInt64Overflow = '64-bit UInt read overflow.'; 108 SReadError = 'Stream read error. Expected length %d, read %d. Source stream size %d.'; 108 109 109 110 { TVarBlockSerializer } … … 365 366 Data: Byte; 366 367 Length: Cardinal; 367 I: Cardinal;368 RealLength: Cardinal; 368 369 LengthMask: Byte; 369 370 begin 370 371 AStream.Size := 0; 371 I := 0;372 372 Length := 1; 373 373 … … 400 400 401 401 // 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; 404 407 AStream.Position := 0; 405 408 end; … … 413 416 Result := 1; // Byte block length 414 417 Data := Stream.ReadByte; 415 if Data = $ff then Result := ReadVarUInt + 2418 if Data = $ff then Result := GetVarSize + ReadVarUInt + 1 416 419 else begin 417 420 Result := DecodeUnaryLength(Data);
Note:
See TracChangeset
for help on using the changeset viewer.