mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: Open small lzma archives
This commit is contained in:
parent
da7b6b1b93
commit
601683eb67
1 changed files with 11 additions and 3 deletions
|
|
@ -107,15 +107,16 @@ function VerifyLzma(Strm : TStream) : TAbArchiveType;
|
|||
implementation
|
||||
|
||||
uses
|
||||
StrUtils, SysUtils,
|
||||
StrUtils, SysUtils, Math,
|
||||
AbExcept, AbVMStrm, AbBitBkt, ULZMADecoder, ULZMAEncoder, DCOSUtils, DCClassesUtf8;
|
||||
|
||||
{ ****************** Helper functions Not from Classes Above ***************** }
|
||||
function VerifyLzma(Strm : TStream) : TAbArchiveType;
|
||||
var
|
||||
CurPos : Int64;
|
||||
Hdr : TAbLzmaHeader;
|
||||
TarStream: TStream;
|
||||
Hdr : TAbLzmaHeader;
|
||||
UncompressedSize: Int64;
|
||||
DecompStream: TLZMADecoder;
|
||||
begin
|
||||
Result := atUnknown;
|
||||
|
|
@ -130,8 +131,15 @@ begin
|
|||
try
|
||||
DecompStream := TLZMADecoder.Create;
|
||||
try
|
||||
if Hdr.UncompressedSize <> High(Int64) then
|
||||
UncompressedSize:= Min(AB_TAR_RECORDSIZE * 4, Hdr.UncompressedSize)
|
||||
else if Strm.Size < AB_TAR_RECORDSIZE * 8 then
|
||||
UncompressedSize:= -1
|
||||
else begin
|
||||
UncompressedSize:= AB_TAR_RECORDSIZE * 4;
|
||||
end;
|
||||
if DecompStream.SetDecoderProperties(Hdr.Properties) and
|
||||
DecompStream.Code(Strm, TarStream, 512 * 2) then
|
||||
DecompStream.Code(Strm, TarStream, UncompressedSize) then
|
||||
begin
|
||||
Result := atLzma;
|
||||
{ Check for embedded TAR }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue