[UserMetaData] Untangle Windows, Linux/BSD/Mac and stub code.
ClosedPublic

Authored by bruns on Mar 30 2019, 10:13 PM.

Details

Summary

The Windows code only shares the function signature with the other
variants, while the actual code is vastly different. One example are
path and attribute names, which are UTF-16 on Windows and UTF-8 otherwise,
but QFile::encodeName() is also called on Windows.

This fixes also two small bugs on Windows, one missing CloseHandle in
case the attribute has a size of 0, and a wrong return value in case
writing the ADS fails.

Test Plan

Linux: ctest
Windows/Mac/*BSD: untested

Diff Detail

Repository
R286 KFileMetaData
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Mar 30 2019, 10:13 PM
Restricted Application added projects: Frameworks, Baloo. · View Herald TranscriptMar 30 2019, 10:13 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
bruns requested review of this revision.Mar 30 2019, 10:13 PM
adridg added a subscriber: adridg.Apr 5 2019, 3:23 PM

I'd start to think about three separate files , unix_impl.cpp, windows_impl.cpp, stub_impl.cpp (although then you get API-syncing issues, probably, when only one of them is updated).

bruns added a comment.Apr 5 2019, 11:07 PM

I don' t think there is gained much by splitting it, and as you said, there are also drawbacks ...

astippich accepted this revision.Apr 7 2019, 4:13 PM

Still kind of hard to read, especially on phabricator. Anyway, a definite improvement.
Untested on anything besides linux

This revision is now accepted and ready to land.Apr 7 2019, 4:13 PM
This revision was automatically updated to reflect the committed changes.