https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c9aa1915df6cc4384cf69…
commit c9aa1915df6cc4384cf690b016445e8a406a07db
Author: Alexander Shaposhnikov <sanchaez(a)reactos.org>
AuthorDate: Sun Oct 22 00:00:50 2017 +0300
[RAPPS] Replace pointer array with object array in parts related to app DL.
---
base/applications/rapps/available.cpp | 6 +++---
base/applications/rapps/gui.cpp | 8 ++++----
base/applications/rapps/include/available.h | 3 ++-
base/applications/rapps/include/dialogs.h | 2 +-
base/applications/rapps/loaddlg.cpp | 9 ++-------
base/applications/rapps/unattended.cpp | 2 +-
6 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/base/applications/rapps/available.cpp
b/base/applications/rapps/available.cpp
index 6fa51ad820..8ee80c93db 100644
--- a/base/applications/rapps/available.cpp
+++ b/base/applications/rapps/available.cpp
@@ -411,15 +411,15 @@ CAvailableApplicationInfo* CAvailableApps::FindInfo(const
ATL::CStringW& szAppNa
return NULL;
}
-ATL::CSimpleArray<CAvailableApplicationInfo*> CAvailableApps::FindInfoList(const
ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const
+ATL::CSimpleArray<CAvailableApplicationInfo> CAvailableApps::FindInfoList(const
ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const
{
- ATL::CSimpleArray<CAvailableApplicationInfo*> result;
+ ATL::CSimpleArray<CAvailableApplicationInfo> result;
for (INT i = 0; i < arrAppsNames.GetSize(); ++i)
{
CAvailableApplicationInfo* Info = FindInfo(arrAppsNames[i]);
if (Info)
{
- result.Add(Info);
+ result.Add(*Info);
}
}
return result;
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 368836d7c6..76a5e76d08 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -554,20 +554,20 @@ public:
}
}
- ATL::CSimpleArray<CAvailableApplicationInfo*> GetCheckedItems()
+ ATL::CSimpleArray<CAvailableApplicationInfo> GetCheckedItems()
{
if (!bHasCheckboxes)
{
- return ATL::CSimpleArray<CAvailableApplicationInfo*>();
+ return ATL::CSimpleArray<CAvailableApplicationInfo>();
}
- ATL::CSimpleArray<CAvailableApplicationInfo*> list;
+ ATL::CSimpleArray<CAvailableApplicationInfo> list;
for (INT i = 0; i >= 0; i = GetNextItem(i, LVNI_ALL))
{
if (GetCheckState(i) != FALSE)
{
CAvailableApplicationInfo* pAppInfo = (CAvailableApplicationInfo*)
GetItemData(i);
- list.Add(pAppInfo);
+ list.Add(*pAppInfo);
}
}
return list;
diff --git a/base/applications/rapps/include/available.h
b/base/applications/rapps/include/available.h
index aa1aebda37..e005250e81 100644
--- a/base/applications/rapps/include/available.h
+++ b/base/applications/rapps/include/available.h
@@ -45,6 +45,7 @@ struct CAvailableApplicationInfo
ATL::CStringW m_szSHA1;
ATL::CStringW m_szInstalledVersion;
+ // Create an object from file
CAvailableApplicationInfo(const ATL::CStringW& sFileNameParam);
// Load all info from the file
@@ -100,7 +101,7 @@ public:
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc);
CAvailableApplicationInfo* FindInfo(const ATL::CStringW& szAppName) const;
- ATL::CSimpleArray<CAvailableApplicationInfo*> FindInfoList(const
ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const;
+ ATL::CSimpleArray<CAvailableApplicationInfo> FindInfoList(const
ATL::CSimpleArray<ATL::CStringW> &arrAppsNames) const;
const ATL::CStringW& GetFolderPath() const;
const ATL::CStringW& GetAppPath() const;
diff --git a/base/applications/rapps/include/dialogs.h
b/base/applications/rapps/include/dialogs.h
index 51efdc8b7f..ea607e0385 100644
--- a/base/applications/rapps/include/dialogs.h
+++ b/base/applications/rapps/include/dialogs.h
@@ -26,7 +26,7 @@ public:
DWORD_PTR dwRefData);
static DWORD WINAPI ThreadFunc(LPVOID Context);
- static BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo*>& AppsList, BOOL bIsModal =
FALSE);
+ static BOOL DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal = FALSE);
static BOOL DownloadApplication(CAvailableApplicationInfo* pAppInfo, BOOL bIsModal =
FALSE);
static VOID DownloadApplicationsDB(LPCWSTR lpUrl);
static VOID LaunchDownloadDialog(BOOL);
diff --git a/base/applications/rapps/loaddlg.cpp b/base/applications/rapps/loaddlg.cpp
index 6ef55b42c3..346167cd77 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -830,20 +830,15 @@ end:
return 0;
}
-BOOL CDownloadManager::DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo*>& AppsList, BOOL bIsModal)
+BOOL CDownloadManager::DownloadListOfApplications(const
ATL::CSimpleArray<CAvailableApplicationInfo>& AppsList, BOOL bIsModal)
{
if (AppsList.GetSize() == 0)
- {
return FALSE;
- }
// Initialize shared variables
for (INT i = 0; i < AppsList.GetSize(); ++i)
{
- if (AppsList[i])
- {
- AppsToInstallList.Add(*(AppsList[i]));
- }
+ AppsToInstallList.Add(AppsList[i]); // implicit conversion to DownloadInfo
}
// Create a dialog and issue a download process
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 328dbb5dc9..b785b9a6a3 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -64,7 +64,7 @@ BOOL UseCmdParameters(LPWSTR lpCmdLine)
apps.UpdateAppsDB();
apps.Enum(ENUM_ALL_AVAILABLE, NULL);
- ATL::CSimpleArray<CAvailableApplicationInfo*> arrAppInfo =
apps.FindInfoList(arrNames);
+ ATL::CSimpleArray<CAvailableApplicationInfo> arrAppInfo =
apps.FindInfoList(arrNames);
if (arrAppInfo.GetSize() > 0)
{
CDownloadManager::DownloadListOfApplications(arrAppInfo, TRUE);