mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
Bug 41 implementation was not working with panel sorting + Failure when calculating directory sizes in local-local mode
https://winscp.net/tracker/41 Source commit: d63b35133175c7c97532883dc64b901228b90798
This commit is contained in:
@@ -231,11 +231,16 @@ UnicodeString __fastcall TUnixDirView::ItemFileName(TListItem * Item)
|
||||
#endif
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
inline __int64 GetItemFileSize(TRemoteFile * File)
|
||||
{
|
||||
return (File->CalculatedSize >= 0) ? File->CalculatedSize : File->Size;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
__int64 __fastcall TUnixDirView::ItemFileSize(TListItem * Item)
|
||||
{
|
||||
#ifndef DESIGN_ONLY
|
||||
ASSERT_VALID_ITEM;
|
||||
return (ITEMFILE->CalculatedSize >= 0) ? ITEMFILE->CalculatedSize : ITEMFILE->Size;
|
||||
return GetItemFileSize(ITEMFILE);
|
||||
#else
|
||||
DebugUsedParam(Item);
|
||||
return 0;
|
||||
@@ -779,7 +784,7 @@ int __stdcall CompareFile(TListItem * Item1, TListItem * Item2, TUnixDirView * D
|
||||
break;
|
||||
|
||||
case uvSize:
|
||||
Result = COMPARE_NUMBER(File1->Size, File2->Size);
|
||||
Result = COMPARE_NUMBER(GetItemFileSize(File1), GetItemFileSize(File2));
|
||||
break;
|
||||
|
||||
case uvChanged:
|
||||
|
||||
@@ -11701,7 +11701,7 @@ void TCustomScpExplorerForm::CalculateDirectorySizes()
|
||||
|
||||
if (Side == osLocal)
|
||||
{
|
||||
Terminal->CalculateLocalFilesSize(FileList.get(), Size, NULL, true, NULL, &CalculatedSizes);
|
||||
ManagedSession->CalculateLocalFilesSize(FileList.get(), Size, NULL, true, NULL, &CalculatedSizes);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2050,6 +2050,14 @@ begin
|
||||
else Result := fEqual; // fallback
|
||||
end;
|
||||
|
||||
function GetItemFileSize(P: PFileRec): Int64; inline;
|
||||
begin
|
||||
Result := 0;
|
||||
if P.Size >= 0 then Result := P.Size
|
||||
else
|
||||
if P.CalculatedSize >= 0 then Result := P.CalculatedSize;
|
||||
end;
|
||||
|
||||
function CompareFile(I1, I2: TListItem; AOwner: TDirView): Integer; stdcall;
|
||||
var
|
||||
ConsiderDirection: Boolean;
|
||||
@@ -2106,9 +2114,9 @@ begin
|
||||
; // fallback
|
||||
|
||||
dvSize:
|
||||
if P1.Size < P2.Size then Result := fLess
|
||||
if GetItemFileSize(P1) < GetItemFileSize(P2) then Result := fLess
|
||||
else
|
||||
if P1.Size > P2.Size then Result := fGreater
|
||||
if GetItemFileSize(P1) > GetItemFileSize(P2) then Result := fGreater
|
||||
else ; // fallback
|
||||
|
||||
dvType:
|
||||
@@ -2972,10 +2980,7 @@ function TDirView.ItemFileSize(Item: TListItem): Int64;
|
||||
begin
|
||||
Result := 0;
|
||||
if Assigned(Item) and Assigned(Item.Data) then
|
||||
with PFileRec(Item.Data)^ do
|
||||
if Size >= 0 then Result := Size
|
||||
else
|
||||
if CalculatedSize >= 0 then Result := CalculatedSize;
|
||||
Result := GetItemFileSize(PFileRec(Item.Data));
|
||||
end;
|
||||
|
||||
function TDirView.ItemFileTime(Item: TListItem;
|
||||
|
||||
Reference in New Issue
Block a user