shell/Windows: Avoid memory allocations and copies when querying icons
authorJocelyn Turcotte <jturcotte@woboq.com>
Mon, 9 Jan 2017 15:28:26 +0000 (16:28 +0100)
committerJocelyn Turcotte <jturcotte@woboq.com>
Wed, 18 Jan 2017 11:15:52 +0000 (12:15 +0100)
commit47fbfbc006c1d9ba3b23580bc86309429b995c59
treeb7063fd044dd052cfcdaff966a4d6c4eba433190
parente131c142ff7b240378ae895eaac1a9cbea16caf0
shell/Windows: Avoid memory allocations and copies when querying icons

IsMemberOf is called for every file (in the ownCloud directory or not) and
with every instance of OCOverlay (we have 5) when displaying a list of
files in Explorer.

Refactor the code to avoid copying the list of watched directories, as
well as creating a wstring from a PWWSTR for files outside watched
directories.

Also change some calls of begin_with to use isDescendantOf since it
properly handles parent paths not ending with a backslash, which could
lead to SocketAPI queries for sibling folders with a name that starts with
a watched folder name.
shell_integration/windows/OCContextMenu/OCContextMenu.cpp
shell_integration/windows/OCOverlays/OCOverlay.cpp
shell_integration/windows/OCOverlays/OCOverlay.h
shell_integration/windows/OCUtil/RemotePathChecker.cpp
shell_integration/windows/OCUtil/RemotePathChecker.h
shell_integration/windows/OCUtil/StringUtil.h