https://bugs.kde.org/show_bug.cgi?id=466257

            Bug ID: 466257
           Summary: Wrong calculation of cache size?
    Classification: Applications
           Product: konqueror
           Version: Git
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: konq-b...@kde.org
          Reporter: k...@huftis.org
  Target Milestone: ---

I took a look at the source code in konqueor/settings/konqhtml/cache/cache.cpp,
and the following two lines look wrong to me:

In void Cache::load():
    //Ensure that maxSizeInMB is greater than 0 if maxSizeInBytes is not 0
    int maxSizeInMB = maxSizeInBytes == 0 ? 0 : std::max(1, maxSizeInBytes /
1000);

In void Cache::save():
    //We store the size in bytes, not in MB
    grp.writeEntry("MaximumCacheSize", m_ui->cacheSize->value()*1000);

If you divide the number of bytes by 1000, you get kB, *not* MB. Similarly, if
you multiply an MB value by 1000, you get the number of kB, not the number of
bytes.

In the UI (cache.ui), the suffix is set to ‘ MB’. So either the calculation
should be changed to divide/multiply by 1000^2, or the UI string should be
changed to ‘ kB’, or, preferably, to use the correct KFormat feature for proper
formatting (https://api.kde.org/frameworks/kcoreaddons/html/classKFormat.html).

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to