[gparted] Restore original logic regarding negative values in get_usage_triple()
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Restore original logic regarding negative values in get_usage_triple()
- Date: Sat, 30 Jun 2012 16:40:42 +0000 (UTC)
commit 367945bbb2f413d290e55b4a223a117d7003d864
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Jun 30 14:58:24 2012 +0100
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 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/src/Partition.cc b/src/Partition.cc
index bbae802..e245efa 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 ) ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]