Switch KIO::convertSize() to KFormat::formatByteSize()
ClosedPublic

Authored by pino on Jun 14 2018, 8:20 PM.

Details

Summary

Make KIO::convertSize() use KFormat::formatByteSize(), instead of using
an own copy of the same function. The handling of the user
configuration of the default dialect is left as-is, and it should work
fine since the two enums BinaryUnitDialect (the removed one, and the
one in KFormat) are the same.

Test Plan

Builds fine, no changes to the result of KIO::convertSize().

Diff Detail

Repository
R241 KIO
Branch
kformat (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 317
Build 317: arc lint + arc unit
pino created this revision.Jun 14 2018, 8:20 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJun 14 2018, 8:20 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
pino requested review of this revision.Jun 14 2018, 8:20 PM
pino added a comment.Jun 25 2018, 5:05 AM

Polite ping.

aacid added a subscriber: aacid.Jun 25 2018, 5:35 PM
aacid added inline comments.
src/core/global.cpp
44

Am i reading the code wrong or are we doing the readEntry twice? (i know the old code did the same)

Do you understand why?

pino added inline comments.Jun 25 2018, 6:43 PM
src/core/global.cpp
44

Am i reading the code wrong or are we doing the readEntry twice? (i know the old code did the same)

Apparently so.

Do you understand why?

No, that is why I chose to not touch at all, keeping the behaviour unchanged (it is not related to this patch, anyway).

aacid added inline comments.Jun 25 2018, 9:25 PM
src/core/global.cpp
58

Should this -1 be 1? Looking at the kformat code it'll use that unless unit is 0 so the old code would be using 1 and the new one -1

pino marked an inline comment as done.Jun 26 2018, 5:52 AM
pino added inline comments.
src/core/global.cpp
58

Indeed, 1 is the right value, and KFormat does the right thing when the unit is byte.

pino updated this revision to Diff 36666.Jun 26 2018, 5:53 AM
pino marked an inline comment as done.

Fix precision passed to formatByteSize().

aacid accepted this revision.Jun 27 2018, 9:50 PM

i guess you can commit this, i don't see anything totally wrong and makes sense, so if you've tested it and you're confident it's fine please go ahead.

This revision is now accepted and ready to land.Jun 27 2018, 9:50 PM
pino closed this revision.Jul 10 2018, 5:40 AM