gforge-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gforge-commits] gforge/common/include utils.php,1.33,1.34


From: tom
Subject: [Gforge-commits] gforge/common/include utils.php,1.33,1.34
Date: Fri, 13 Aug 2004 15:02:48 -0500

Update of /cvsroot/gforge/gforge/common/include
In directory db.perdue.net:/tmp/cvs-serv9003/common/include

Modified Files:
        utils.php 
Log Message:
Turning spaces into tabs in human_readable_bytes()

Index: utils.php
===================================================================
RCS file: /cvsroot/gforge/gforge/common/include/utils.php,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- utils.php   4 Aug 2004 16:18:33 -0000       1.33
+++ utils.php   13 Aug 2004 20:02:36 -0000      1.34
@@ -798,29 +798,23 @@
  * @param array     labels  strings associated to each 2^10 or
  *                  10^3(base10==true) multiple of base units
  */
-function human_readable_bytes ($bytes, $base10=false, $round=0,
-                                 $labels=array(' bytes',  ' KB', ' MB', ' 
GB')) {
-  
-  if (($bytes <= 0) ||
-      (! is_array($labels)) ||
-      (count($labels) <= 0))
-    return null;
-  
-  $step = $base10 ? 3 : 10 ;
-  $base = $base10 ? 10 : 2;
-  
-  $log = (int)(log10($bytes)/log10($base));
-  
-  krsort($labels);
-  
-  foreach ($labels as $p=>$lab) {
-    $pow = $p * $step;
-    if ($log < $pow) continue;
-    $text = round($bytes/pow($base,$pow),$round) . $lab;
-    break;
-  }
-  
-   return $text;
+function human_readable_bytes ($bytes, $base10=false, $round=0, 
$labels=array(' bytes',  ' KB', ' MB', ' GB')) {
+       if (($bytes <= 0) || (! is_array($labels)) || (count($labels) <= 0)) {
+               return null;
+       }
+       $step = $base10 ? 3 : 10 ;
+       $base = $base10 ? 10 : 2;
+       $log = (int)(log10($bytes)/log10($base));
+       krsort($labels);
+       foreach ($labels as $p=>$lab) {
+               $pow = $p * $step;
+               if ($log < $pow) {
+                       continue;
+               }
+               $text = round($bytes/pow($base,$pow),$round).$lab;
+               break;
+       }
+       return $text;
 }
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]