From 1036f81edf2e23fe0052e5a8ba8002a8adcc4f9a Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 11 Apr 2011 07:00:30 -0400
Subject: [PATCH] - Fix so 1024 bytes is displayed as 1KB, the same for MB and GB

---
 program/include/rcube_shared.inc |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index 8ed56d1..1fd6ed0 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -180,7 +180,7 @@
 
   return floatval($bytes);
 }
-    
+
 /**
  * Create a human readable string for a number of bytes
  *
@@ -189,24 +189,23 @@
  */
 function show_bytes($bytes)
 {
-  if ($bytes > 1073741824)
+  if ($bytes >= 1073741824)
   {
     $gb = $bytes/1073741824;
     $str = sprintf($gb>=10 ? "%d " : "%.1f ", $gb) . rcube_label('GB');
   }
-  else if ($bytes > 1048576)
+  else if ($bytes >= 1048576)
   {
     $mb = $bytes/1048576;
     $str = sprintf($mb>=10 ? "%d " : "%.1f ", $mb) . rcube_label('MB');
   }
-  else if ($bytes > 1024)
+  else if ($bytes >= 1024)
     $str = sprintf("%d ",  round($bytes/1024)) . rcube_label('KB');
   else
     $str = sprintf('%d ', $bytes) . rcube_label('B');
 
   return $str;
 }
-
 
 /**
  * Convert paths like ../xxx to an absolute path using a base url

--
Gitblit v1.9.1