diff options
author | FPtje <none@none> | 2015-11-05 21:49:14 +0300 |
---|---|---|
committer | FPtje <none@none> | 2015-11-05 21:49:14 +0300 |
commit | 160a305b3a32c943d5eb63a387221c678b2c6f8e (patch) | |
tree | 4d6d0fa53c1d102d920c7c199676223ca9fea1aa /windirstat/item.cpp | |
parent | 0fdc6a7e4b7d8463a72c9a021ebf8feb7e17a0b9 (diff) |
Fixed WinDirStat's completely broken visualisation
The bug is caused by the fact that an unsigned long long minus an
unsigned long long is ALWAYS positive. The quicksort function algorithm used
`signum` to compare unsigned long longs. With signum
always returning either 1 or 0 (because always positive), the sorting was
pretty much useless. With an arbitrary sorting order in multiple locations of
the program, nothing was grouped correctly and the wrong file extensions got a
colour assigned.
The bug was introduced in revision 151.
Diffstat (limited to 'windirstat/item.cpp')
-rw-r--r-- | windirstat/item.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/windirstat/item.cpp b/windirstat/item.cpp index 0219fe7..e4f188c 100644 --- a/windirstat/item.cpp +++ b/windirstat/item.cpp @@ -277,7 +277,7 @@ int CItem::CompareSibling(const CTreeListItem *tlib, int subitem) const case COL_SUBTREEPERCENTAGE: if(MustShowReadJobs()) { - r = signum(m_readJobs - other->m_readJobs); + r = usignum(m_readJobs, other->m_readJobs); } else { @@ -293,25 +293,25 @@ int CItem::CompareSibling(const CTreeListItem *tlib, int subitem) const case COL_SUBTREETOTAL: { - r = signum(GetSize() - other->GetSize()); + r = usignum(GetSize(), other->GetSize()); } break; case COL_ITEMS: { - r = signum(GetItemsCount() - other->GetItemsCount()); + r = usignum(GetItemsCount(), other->GetItemsCount()); } break; case COL_FILES: { - r = signum(GetFilesCount() - other->GetFilesCount()); + r = usignum(GetFilesCount(), other->GetFilesCount()); } break; case COL_SUBDIRS: { - r = signum(GetSubdirsCount() - other->GetSubdirsCount()); + r = usignum(GetSubdirsCount(), other->GetSubdirsCount()); } break; @@ -1650,7 +1650,7 @@ int __cdecl CItem::_compareBySize(const void *p1, const void *p2) // TODO: Use 2nd sort column (as set in our TreeListView?) - return signum(size2 - size1); // biggest first + return usignum(size2, size1); // biggest first } ULONGLONG CItem::GetProgressRangeMyComputer() const |