From 367945bbb2f413d290e55b4a223a117d7003d864 Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 30 Jun 2012 14:58:24 +0100 Subject: [PATCH] Restore original logic regarding negative values in get_usage_triple() Restore intended logic accidentally changed by my recent commit: Simplify calc_usage_triple() interface and rename 6c96ab34b39eb23a906d6161a3d3b873025f4ec3 Set each display integer to zero if the associated usage value is negative, rather than setting 100% unused for unknown usage. Graphical display of partition usage for unknown and unsupported file system types is not affected and continues to be all white because of the logic in the callers. --- src/Partition.cc | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Partition.cc b/src/Partition.cc index bbae8022..e245efaf 100644 --- a/src/Partition.cc +++ b/src/Partition.cc @@ -270,13 +270,9 @@ void Partition::get_usage_triple( int imax, int & i1, int & i2, int & i3 ) const Sector s1 = get_sectors_used() ; Sector s2 = get_sectors_unused() ; Sector s3 = get_sectors_unallocated() ; - if ( ! sector_usage_known() ) - { - //Set to all unused - i1 = i3 = 0 ; - i2 = imax ; - return ; - } + if ( s1 < 0 ) s1 = 0 ; + if ( s2 < 0 ) s2 = 0 ; + if ( s3 < 0 ) s3 = 0 ; Sector stot = s1 + s2 + s3 ; if ( s1 <= s2 && s1 <= s3 ) get_usage_triple_helper( stot, s1, s2, s3, imax, i1, i2, i3 ) ;