From b4a479a691069a0293754fa94922b77ca406fea7 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sat, 15 Nov 2008 16:22:51 +0100 Subject: VFS: Compressed size display support --- UEngines.pas | 4 +++- UMain.pas | 7 ++++++- vfs/UVFSCore.pas | 2 ++ vfs/uVFSprototypes.pas | 3 +++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/UEngines.pas b/UEngines.pas index 903bec3..9483dfb 100644 --- a/UEngines.pas +++ b/UEngines.pas @@ -61,7 +61,7 @@ type FDisplayName: PChar; // always-valid UTF-8 LnkPointTo: PChar; // ANSI ADestination: PChar; - Size: Int64; + Size, PackedSize: Int64; Mode, UID, GID: Cardinal; IsDir, IsLnk, ForceMove, IsOnRO, IsExecutable: boolean; ModifyTime: time_t; @@ -554,6 +554,7 @@ var Handle : PDIR; FName := strdup(PChar(FPath)); FDisplayName := StrToUTF8(PChar(FPath)); Size := StatBuf_local^.st_size; + PackedSize := -1; Mode := StatBuf_local^.st_mode; IsDir := __S_ISTYPE(StatBuf_local^.st_mode, __S_IFDIR); IsLnk := __S_ISTYPE(StatBuf_local^.st_mode, __S_IFLNK); @@ -653,6 +654,7 @@ begin FName := strdup(PChar(APath)); FDisplayName := StrToUTF8(PChar(APath)); Size := StatBuf^.st_size; + PackedSize := -1; Mode := StatBuf^.st_mode; IsDir := __S_ISTYPE(StatBuf^.st_mode, __S_IFDIR); IsLnk := __S_ISTYPE(StatBuf^.st_mode, __S_IFLNK); diff --git a/UMain.pas b/UMain.pas index d07a10c..e85e53d 100644 --- a/UMain.pas +++ b/UMain.pas @@ -6259,7 +6259,12 @@ begin if (ConfSizeFormat < 5) or (Stat^.Size < 1024) then s := Format(' %s', [LANGHandleRunFromArchive_Bytes]); FRunFromVFS.SizeLabel2.Caption := Format('%s%s ', [FormatSize(Stat^.Size, 0), s]); if (ConfSizeFormat < 5) or (Stat^.Size < 1024) then s := Format(' %s', [LANGHandleRunFromArchive_Bytes]); - FRunFromVFS.PackedSizeLabel2.Caption := Format('%s%s ', [FormatSize(Stat^.Size, 0), s]); + if Stat^.PackedSize >= 0 then begin + FRunFromVFS.PackedSizeLabel2.Caption := Format('%s%s ', [FormatSize(Stat^.PackedSize, 0), s]); + end else begin + FRunFromVFS.PackedSizeLabel2.Visible := False; + FRunFromVFS.PackedSizeLabel.Visible := False; + end; FRunFromVFS.DateLabel2.Caption := Format('%s ', [FormatDate(Stat^.ModifyTime, True, True)]); if (Command = '') and (not Stat^.IsExecutable) then begin FRunFromVFS.OpensWithLabel2.Caption := Format('%s ', [LANGHandleRunFromArchive_NotAssociated]); diff --git a/vfs/UVFSCore.pas b/vfs/UVFSCore.pas index a514512..270b240 100644 --- a/vfs/UVFSCore.pas +++ b/vfs/UVFSCore.pas @@ -596,6 +596,7 @@ begin UID := P^.iUID; GID := P^.iGID; Size := P^.iSize; + PackedSize := P^.iPackedSize; libc_free(P); end; Result := Item; @@ -658,6 +659,7 @@ var Item: PDataItemSL; UID := P^.iUID; GID := P^.iGID; Size := P^.iSize; + PackedSize := P^.iPackedSize; Level := ALevel + Ord(not AddCurrDirStage); end; if AddCurrDirStage then List.Add(Item) diff --git a/vfs/uVFSprototypes.pas b/vfs/uVFSprototypes.pas index 4ccde33..35d6d8f 100644 --- a/vfs/uVFSprototypes.pas +++ b/vfs/uVFSprototypes.pas @@ -112,6 +112,8 @@ type // FDisplayName - plugins must ensure correct UTF-8 string FDisplayName: PChar; iSize: Int64; + // iPackedSize - set to -1 if plugin doesn't support this feature + iPackedSize: Int64; m_time: DWORD; a_time: DWORD; c_time: DWORD; @@ -124,6 +126,7 @@ type FName: PChar; FDisplayName: PChar; iSize: Int64; + iPackedSize: Int64; m_time: QWORD; a_time: QWORD; c_time: QWORD; -- cgit v1.2.3