summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-05-25 16:41:01 -0700
committerDaniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu>2010-05-25 16:41:01 -0700
commit38907b7eeb4cc83c55b30535c965c8b5d982f6a0 (patch)
tree557601c25e72d520202e5e5d2547ba08d593ff5b
parent9762474eef4d5eebb7ad81c8bf1ecb4a9528b0c9 (diff)
downloadaptitude-38907b7eeb4cc83c55b30535c965c8b5d982f6a0.tar.gz
Truncate floating-point percentages when displaying a progress message.
-rw-r--r--src/generic/apt/text_progress.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/generic/apt/text_progress.cc b/src/generic/apt/text_progress.cc
index f32b8fb2..4810e521 100644
--- a/src/generic/apt/text_progress.cc
+++ b/src/generic/apt/text_progress.cc
@@ -138,8 +138,14 @@ namespace aptitude
}
else
{
+ int percent_int = (int)Percent;
+ if(percent_int < 0)
+ percent_int = 0;
+ if(percent_int > 100)
+ percent_int = 100;
+
Clear();
- Display((format("%s... %d%%") % Op % Percent).str());
+ Display((format("%s... %d%%") % Op % percent_int).str());
last_op = Op;
}
}