D28195: Avoid double fetch and temporary hex encoding for NTFS attributes

David Faure noreply at phabricator.kde.org
Sun Mar 22 10:50:28 GMT 2020


dfaure added a comment.


  Indeed the hex roundtrip was very unnecessary, well spotted.

INLINE COMMENTS

> file_unix.cpp:533
>      char *c = strAttr;
> -    char *e = hexAttr.data();
> -    *e++ ='0';
> -    *e++ = 'x';
> -    for (auto n = 0; n < length; n++, c++) {
> -        *e++ = digits[(static_cast<uchar>(*c) >> 4)];
> -        *e++ = digits[(static_cast<uchar>(*c) & 0x0F)];
> +    for (auto n = length; n > 0; --n, c++) {
> +        intAttr <<= 8;

Given that the value of `n` isn't used, any reason why this doesn't iterate upwards instead, as the old code was doing? I just find it more usual and readable.

REPOSITORY
  R241 KIO

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

To: bruns, #dolphin, dfaure
Cc: kde-frameworks-devel, LeGast00n, cblack, GB_2, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20200322/fccd8881/attachment.html>


More information about the Kde-frameworks-devel mailing list