You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/08/28 13:45:21 UTC

svn commit: r1698312 - /subversion/trunk/subversion/svnfsfs/stats-cmd.c

Author: stefan2
Date: Fri Aug 28 11:45:21 2015
New Revision: 1698312

URL: http://svn.apache.org/r1698312
Log:
Fix the lines for "length 0" in histograms produced by 'svnfsfs stats'.
They would say "-2147483648 .. < 1" instead of "0 .. < 1".

* subversion/svnfsfs/stats-cmd.c
  (print_two_power): Treat anything < 1 as 0.  

Modified:
    subversion/trunk/subversion/svnfsfs/stats-cmd.c

Modified: subversion/trunk/subversion/svnfsfs/stats-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnfsfs/stats-cmd.c?rev=1698312&r1=1698311&r2=1698312&view=diff
==============================================================================
--- subversion/trunk/subversion/svnfsfs/stats-cmd.c (original)
+++ subversion/trunk/subversion/svnfsfs/stats-cmd.c Fri Aug 28 11:45:21 2015
@@ -47,10 +47,10 @@ print_two_power(int i,
    */
   const char *si_prefixes = " kMGTPEZY";
 
-  int number = (1 << (i % 10));
-  int thousands = i / 10;
+  int number = (i >= 0) ? (1 << (i % 10)) : 0;
+  int thousands = (i >= 0) ? (i / 10) : 0;
 
-  char si_prefix = ((thousands >= 0) && (thousands < strlen(si_prefixes)))
+  char si_prefix = (thousands < strlen(si_prefixes))
                  ? si_prefixes[thousands]
                  : '?';