Replacing 'scopeList' contiguous placement of elements in memory more efficient and std::make_unique c++17

Signed-off-by: germanaizek <GermanAizek@yandex.ru>
This commit is contained in:
Let's All Love Lain
2022-05-12 16:40:43 +03:00
committed by ge0rdi
parent a20215d9da
commit 47cc2b2304
2 changed files with 4 additions and 4 deletions

View File

@@ -798,7 +798,7 @@ void CSearchManager::SearchThread( void )
CSession session; CSession session;
if (SUCCEEDED(dataSource.OpenFromInitializationString(L"provider=Search.CollatorDSO.1;EXTENDED PROPERTIES=\"Application=Windows\"")) && SUCCEEDED(session.Open(dataSource))) if (SUCCEEDED(dataSource.OpenFromInitializationString(L"provider=Search.CollatorDSO.1;EXTENDED PROPERTIES=\"Application=Windows\"")) && SUCCEEDED(session.Open(dataSource)))
{ {
std::list<SearchScope> scopeList; std::vector<SearchScope> scopeList;
if (searchRequest.bSearchMetroSettings && !m_bMetroSettingsFound) if (searchRequest.bSearchMetroSettings && !m_bMetroSettingsFound)
{ {
@@ -1104,7 +1104,7 @@ void CSearchManager::SearchThread( void )
command0.Close(); command0.Close();
continue; continue;
} }
for (std::list<SearchScope>::iterator it=scopeList.begin();it!=scopeList.end();++it) for (auto it=scopeList.begin();it!=scopeList.end();++it)
{ {
if (it->roots.empty()) if (it->roots.empty())
continue; continue;
@@ -1122,7 +1122,7 @@ void CSearchManager::SearchThread( void )
else else
{ {
len+=Strcpy(query+len,_countof(query)-len,L" AND System.Search.Store='FILE' AND System.ItemType!='.settingcontent-ms'"); len+=Strcpy(query+len,_countof(query)-len,L" AND System.Search.Store='FILE' AND System.ItemType!='.settingcontent-ms'");
for (std::list<SearchScope>::iterator it2=scopeList.begin();it2!=it;++it2) for (auto it2=scopeList.begin();it2!=it;++it2)
{ {
if (it2->categoryHash==CATEGORY_METROSETTING) if (it2->categoryHash==CATEGORY_METROSETTING)
continue; continue;

View File

@@ -168,7 +168,7 @@ namespace DesktopNotificationManagerCompat
ComPtr<IToastNotificationHistory> nativeHistory; ComPtr<IToastNotificationHistory> nativeHistory;
RETURN_IF_FAILED(toastStatics2->get_History(&nativeHistory)); RETURN_IF_FAILED(toastStatics2->get_History(&nativeHistory));
*history = std::unique_ptr<DesktopNotificationHistoryCompat>(new DesktopNotificationHistoryCompat(s_aumid.c_str(), nativeHistory)); *history = std::make_unique<DesktopNotificationHistoryCompat>(s_aumid.c_str(), nativeHistory);
return S_OK; return S_OK;
} }