D17528: Refactor SlaveInterface::calcSpeed

David Faure noreply at phabricator.kde.org
Fri Dec 14 15:37:25 GMT 2018


dfaure requested changes to this revision.
dfaure added inline comments.
This revision now requires changes to proceed.

INLINE COMMENTS

> slaveinterface.cpp:112
> +        const TransferInfo first = d->transfer_details.first();
> +        const TransferInfo last = d->transfer_details.last();
> +        KIO::filesize_t lspeed = 1000 * (last.size - first.size) / (last.time - first.time);

why not just call "last" the (currently unnamed) TransferInfo created 2 lines above, rather than extracting it out of the vector just after appending?

> slaveinterface_p.h:39
> +
> +struct TransferInfo {
> +    qint64 time;

global namespace pollution, better keep this within KIO::SlaveInterfacePrivate.

> slaveinterface_p.h:48
>      SlaveInterfacePrivate()
> -        : connection(nullptr), filesize(0), offset(0), last_time(0), start_time(0),
> -          nums(0), slave_calcs_speed(false)
> +        : connection(nullptr), transfer_details(max_count), filesize(0), offset(0),
> +          slave_calcs_speed(false)

the old "nums" is now the vector size, right?

nums was initialized to 0, so this should not initialize the vector to max_count items

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D17528

To: chinmoyr, dfaure
Cc: bruns, kde-frameworks-devel, michaelh, ngraham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181214/ae788c5a/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list