Comment 4 for bug 435133

Revision history for this message
Victor Vargas (kamus) wrote :

@Luca, please could you check if this behaviour is still occurring in latest release included in Ubuntu Lucid? Anyway, I have downloaded source code and I can't find that line (maybe has lot of changes) but I found the function and now works in this way:

// SizeToStr - Convert a long into a human readable size /*{{{*/
// ---------------------------------------------------------------------
/* A max of 4 digits are shown before conversion to the next highest unit.
   The max length of the string will be 5 chars unless the size is > 10
   YottaBytes (E24) */
string SizeToStr(double Size)
{
   char S[300];
   double ASize;
   if (Size >= 0)
      ASize = Size;
   else
      ASize = -1*Size;

   /* bytes, KiloBytes, MegaBytes, GigaBytes, TeraBytes, PetaBytes,
      ExaBytes, ZettaBytes, YottaBytes */
   char Ext[] = {'\0','k','M','G','T','P','E','Z','Y'};
   int I = 0;
   while (I <= 8)
   {
      if (ASize < 100 && I != 0)
      {
         sprintf(S,"%'.1f%c",ASize,Ext[I]);
         break;
      }

      if (ASize < 10000)
      {
         sprintf(S,"%'.0f%c",ASize,Ext[I]);
         break;
      }
      ASize /= 1000.0;
      I++;
   }

   return S;
}