[TYPO3-core] RFC #13645: Bug and Cleanup: t3lib_div::formatSize should use IEC prefixes and appropriate units

Xavier Perseguers typo3 at perseguers.ch
Tue Mar 9 07:41:29 CET 2010


Hi Sigfried,

> First: it follows the Suggestions: "IEC prefixes suck" and introduces
> three calculation methods:
>
> traditional: base 1024 with SI like prefixes (default)
> iec: base 1024 with IEC prefixes
> si: base 1000 with SI prefixes

Great, everybody will be happy!

> The default is hardcoded atm, but could be easily moved to config defaults.

You are trying to patch core, everything that is not done now is likely to stay as this for a longer time than initially expected. Please provide a change to config_default.php too.

> any comments on this one?

I have a few in addition to the move of the constant:

- CGL is not applied. A few points:
    - method signature misses spaces (here with °) . "formatSize($sizeInBytes,°$labels°=°'')
    - default suffix array always has a space after "giga" and separator to "tera", whereas other have separator next to them without space. why? (apply to method signature too)
    - many many one line statement (with curly bracket I agree but still) => refactor to multiple lines
    - Comments traditionally start with an upper case letter
    - last 3 lines are "hard" to undertand, using comment on separate line and proper CGL would enhance it

Thanks

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en


More information about the TYPO3-team-core mailing list