summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-reader/util.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-reader/util.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-reader/util.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/noncore/apps/opie-reader/util.cpp b/noncore/apps/opie-reader/util.cpp
index a736f8b..2ca1cc8 100644
--- a/noncore/apps/opie-reader/util.cpp
+++ b/noncore/apps/opie-reader/util.cpp
@@ -1,2 +1,3 @@
1#include "util.h" 1#include "util.h"
2#include <limits.h>
2 3
@@ -24,3 +25,11 @@ QString percent(unsigned long pos, unsigned long len)
24 { 25 {
25 permil = (1000*pos+len/2)/len; 26 if (pos > UINT_MAX/1000)
27 {
28 unsigned long l1 = (len+500)/1000;
29 permil = (pos+l1/2)/l1;
30 }
31 else
32 {
33 permil = (1000*pos+len/2)/len;
34 }
26 } 35 }