[FORMATTING][RAPPS] available.cpp: Fix braces
authorAlexander Shaposhnikov <sanchaez@reactos.org>
Tue, 27 Jun 2017 23:33:15 +0000 (23:33 +0000)
committerAlexander Shaposhnikov <sanchaez@reactos.org>
Tue, 27 Jun 2017 23:33:15 +0000 (23:33 +0000)
svn path=/branches/GSoC_2017/rapps/; revision=75220

reactos/base/applications/rapps/available.cpp

index cd70bd7..fd26eea 100644 (file)
@@ -9,17 +9,19 @@
 
 #include "rapps.h"
 
 
 #include "rapps.h"
 
-inline void _AddText(UINT a, LPCWSTR b, DWORD c, DWORD d) {
-  if (b[0] != '\0') 
-  {
-      WCHAR szText[MAX_STR_LEN];
-      LoadStringW(hInst, a, szText, _countof(szText));
-      InsertRichEditText(szText, c); 
-      InsertRichEditText(b, d); 
-  }
+inline void _AddText(UINT a, LPCWSTR b, DWORD c, DWORD d)
+{
+    if (b[0] != '\0')
+    {
+        WCHAR szText[MAX_STR_LEN];
+        LoadStringW(hInst, a, szText, _countof(szText));
+        InsertRichEditText(szText, c);
+        InsertRichEditText(b, d);
+    }
 }
 
 }
 
-inline void _AddTextNewl(UINT a, DWORD b) {
+inline void _AddTextNewl(UINT a, DWORD b)
+{
     WCHAR szText[MAX_STR_LEN];
     LoadStringW(hInst, a, szText, _countof(szText));
     InsertRichEditText(L"\n", 0);
     WCHAR szText[MAX_STR_LEN];
     LoadStringW(hInst, a, szText, _countof(szText));
     InsertRichEditText(L"\n", 0);
@@ -28,15 +30,18 @@ inline void _AddTextNewl(UINT a, DWORD b) {
 }
 
 template<typename T, size_t N, size_t N2>
 }
 
 template<typename T, size_t N, size_t N2>
-inline BOOL _GetString(LPCWSTR a, T(&b)[N], T (&cFileName)[N2]) {
-  return ParserGetString(a, b, N, cFileName);
+inline BOOL _GetString(LPCWSTR a, T(&b)[N], T(&cFileName)[N2])
+{
+    return ParserGetString(a, b, N, cFileName);
 }
 
 template<typename T, size_t N, size_t N2>
 }
 
 template<typename T, size_t N, size_t N2>
-inline void _GetStringNullFailure(LPCWSTR a, T(&b)[N], T (&cFileName)[N2]) {
-  if (!_GetString(a, b, cFileName)) {
-    b[0] = '\0';
-  }
+inline void _GetStringNullFailure(LPCWSTR a, T(&b)[N], T(&cFileName)[N2])
+{
+    if (!_GetString(a, b, cFileName))
+    {
+        b[0] = '\0';
+    }
 }
 
 //App is "installed" if the RegName or Name is in the registry
 }
 
 //App is "installed" if the RegName or Name is in the registry
@@ -52,9 +57,10 @@ inline BOOL _AppInstallCheckWithKey(PAPPLICATION_INFO Info, REGSAM key)
 
 //Check both registry keys in 64bit system
 //TODO: check system type beforehand to avoid double checks?
 
 //Check both registry keys in 64bit system
 //TODO: check system type beforehand to avoid double checks?
-inline BOOL _AppInstallCheck(PAPPLICATION_INFO Info) {
-  return  _AppInstallCheckWithKey(Info, KEY_WOW64_32KEY) 
-    || _AppInstallCheckWithKey(Info, KEY_WOW64_64KEY);
+inline BOOL _AppInstallCheck(PAPPLICATION_INFO Info)
+{
+    return  _AppInstallCheckWithKey(Info, KEY_WOW64_32KEY)
+        || _AppInstallCheckWithKey(Info, KEY_WOW64_64KEY);
 }
 
 //App is "installed" if the RegName or Name is in the registry
 }
 
 //App is "installed" if the RegName or Name is in the registry
@@ -74,7 +80,7 @@ inline BOOL _GetInstalledVersion(PAPPLICATION_INFO Info, LPWSTR szVersion, UINT
         || _GetInstalledVersionWithKey(Info, szVersion, iVersionSize, KEY_WOW64_64KEY);
 }
 
         || _GetInstalledVersionWithKey(Info, szVersion, iVersionSize, KEY_WOW64_64KEY);
 }
 
-LIST_ENTRY CachedEntriesHead = { &CachedEntriesHead, &CachedEntriesHead };
+LIST_ENTRY CachedEntriesHead = {&CachedEntriesHead, &CachedEntriesHead};
 PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
 
 BOOL
 PLIST_ENTRY pCachedEntry = &CachedEntriesHead;
 
 BOOL
@@ -89,14 +95,15 @@ ShowAvailableAppInfo(INT Index)
     NewRichEditText(Info->szName, CFE_BOLD);
     if (bIsInstalled)
     {
     NewRichEditText(Info->szName, CFE_BOLD);
     if (bIsInstalled)
     {
-      _AddTextNewl(IDS_STATUS_INSTALLED, CFE_ITALIC);
-      if (_GetInstalledVersion(Info, szVersion, _countof(szVersion)))
-      {
-          _AddText(IDS_AINFO_VERSION, szVersion, CFE_BOLD, 0);
-      }
-    } else 
+        _AddTextNewl(IDS_STATUS_INSTALLED, CFE_ITALIC);
+        if (_GetInstalledVersion(Info, szVersion, _countof(szVersion)))
+        {
+            _AddText(IDS_AINFO_VERSION, szVersion, CFE_BOLD, 0);
+        }
+    }
+    else
     {
     {
-      _AddTextNewl(IDS_STATUS_NOTINSTALLED, CFE_ITALIC);
+        _AddTextNewl(IDS_STATUS_NOTINSTALLED, CFE_ITALIC);
     }
 
     _AddText(IDS_AINFO_AVAILABLEVERSION, Info->szVersion, CFE_BOLD, 0);
     }
 
     _AddText(IDS_AINFO_AVAILABLEVERSION, Info->szVersion, CFE_BOLD, 0);
@@ -125,8 +132,8 @@ DeleteCurrentAppsDB(VOID)
         return FALSE;
 
     hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
         return FALSE;
 
     hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                         L"%ls\\rappmgr.cab",
-                         szPath);
+        L"%ls\\rappmgr.cab",
+        szPath);
     if (FAILED(hr))
         return FALSE;
 
     if (FAILED(hr))
         return FALSE;
 
@@ -138,8 +145,8 @@ DeleteCurrentAppsDB(VOID)
         return FALSE;
 
     hr = StringCbPrintfW(szSearchPath, sizeof(szSearchPath),
         return FALSE;
 
     hr = StringCbPrintfW(szSearchPath, sizeof(szSearchPath),
-                         L"%ls*.txt",
-                         szPath);
+        L"%ls*.txt",
+        szPath);
     if (FAILED(hr))
         return FALSE;
 
     if (FAILED(hr))
         return FALSE;
 
@@ -151,13 +158,14 @@ DeleteCurrentAppsDB(VOID)
     do
     {
         hr = StringCbPrintfW(szTmp, sizeof(szTmp),
     do
     {
         hr = StringCbPrintfW(szTmp, sizeof(szTmp),
-                             L"%ls%ls",
-                             szPath, FindFileData.cFileName);
+            L"%ls%ls",
+            szPath, FindFileData.cFileName);
         if (FAILED(hr))
             continue;
         result = result && DeleteFileW(szTmp);
 
         if (FAILED(hr))
             continue;
         result = result && DeleteFileW(szTmp);
 
-    } while (FindNextFileW(hFind, &FindFileData) != 0);
+    }
+    while (FindNextFileW(hFind, &FindFileData) != 0);
 
     FindClose(hFind);
 
 
     FindClose(hFind);
 
@@ -181,15 +189,15 @@ UpdateAppsDB(VOID)
         return FALSE;
 
     if (FAILED(StringCbPrintfW(szCabPath, sizeof(szCabPath),
         return FALSE;
 
     if (FAILED(StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                               L"%ls\\rappmgr.cab",
-                               szPath)))
+        L"%ls\\rappmgr.cab",
+        szPath)))
     {
         return FALSE;
     }
 
     if (FAILED(StringCbPrintfW(szAppsPath, sizeof(szAppsPath),
     {
         return FALSE;
     }
 
     if (FAILED(StringCbPrintfW(szAppsPath, sizeof(szAppsPath),
-                               L"%ls\\rapps\\",
-                               szPath)))
+        L"%ls\\rapps\\",
+        szPath)))
     {
         return FALSE;
     }
     {
         return FALSE;
     }
@@ -215,8 +223,8 @@ EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
         return FALSE;
 
     hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
         return FALSE;
 
     hr = StringCbPrintfW(szCabPath, sizeof(szCabPath),
-                         L"%ls\\rappmgr.cab",
-                         szPath);
+        L"%ls\\rappmgr.cab",
+        szPath);
     if (FAILED(hr))
         return FALSE;
 
     if (FAILED(hr))
         return FALSE;
 
@@ -263,7 +271,7 @@ EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
             Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
 
             /* do we already have this entry in cache? */
             Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
 
             /* do we already have this entry in cache? */
-            if(_wcsicmp(FindFileData.cFileName, Info->cFileName) == 0)
+            if (_wcsicmp(FindFileData.cFileName, Info->cFileName) == 0)
             {
                 /* is it current enough, or the file has been modified since our last time here? */
                 if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->ftCacheStamp) == 1)
             {
                 /* is it current enough, or the file has been modified since our last time here? */
                 if (CompareFileTime(&FindFileData.ftLastWriteTime, &Info->ftCacheStamp) == 1)
@@ -283,21 +291,21 @@ EnumAvailableApplications(INT EnumType, AVAILENUMPROC lpEnumProc)
         }
 
         /* create a new entry */
         }
 
         /* create a new entry */
-        Info = (PAPPLICATION_INFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(APPLICATION_INFO));
+        Info = (PAPPLICATION_INFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(APPLICATION_INFO));
 
 
-        if(!Info)
+        if (!Info)
             break;
 
         Info->Category = ParserGetInt(L"Category", FindFileData.cFileName);
 
         /* copy the cache-related fields for the next time */
             break;
 
         Info->Category = ParserGetInt(L"Category", FindFileData.cFileName);
 
         /* copy the cache-related fields for the next time */
-        RtlCopyMemory(&Info->cFileName,    &FindFileData.cFileName, MAX_PATH);
+        RtlCopyMemory(&Info->cFileName, &FindFileData.cFileName, MAX_PATH);
         RtlCopyMemory(&Info->ftCacheStamp, &FindFileData.ftLastWriteTime, sizeof(FILETIME));
 
         /* add our cached entry to the cached list */
         InsertTailList(&CachedEntriesHead, &Info->List);
 
         RtlCopyMemory(&Info->ftCacheStamp, &FindFileData.ftLastWriteTime, sizeof(FILETIME));
 
         /* add our cached entry to the cached list */
         InsertTailList(&CachedEntriesHead, &Info->List);
 
-skip_if_cached:
+    skip_if_cached:
 
         if (Info->Category == FALSE)
             continue;
 
         if (Info->Category == FALSE)
             continue;
@@ -310,26 +318,27 @@ skip_if_cached:
 
         if (Info->szUrlDownload[0] == 0)
         {
 
         if (Info->szUrlDownload[0] == 0)
         {
-          if (!_GetString(L"Name", Info->szName, FindFileData.cFileName)
-            || !_GetString(L"URLDownload", Info->szUrlDownload, FindFileData.cFileName))
-          {
-            continue;
-          }
-
-          _GetStringNullFailure(L"RegName",     Info->szRegName, FindFileData.cFileName);
-          _GetStringNullFailure(L"Version",     Info->szVersion, FindFileData.cFileName);
-          _GetStringNullFailure(L"License",     Info->szLicense, FindFileData.cFileName);
-          _GetStringNullFailure(L"Description", Info->szDesc, FindFileData.cFileName);
-          _GetStringNullFailure(L"Size",        Info->szSize, FindFileData.cFileName);
-          _GetStringNullFailure(L"URLSite",     Info->szUrlSite, FindFileData.cFileName);
-          _GetStringNullFailure(L"CDPath",      Info->szCDPath, FindFileData.cFileName);
-          _GetStringNullFailure(L"SHA1",        Info->szSHA1, FindFileData.cFileName);
+            if (!_GetString(L"Name", Info->szName, FindFileData.cFileName)
+                || !_GetString(L"URLDownload", Info->szUrlDownload, FindFileData.cFileName))
+            {
+                continue;
+            }
+
+            _GetStringNullFailure(L"RegName", Info->szRegName, FindFileData.cFileName);
+            _GetStringNullFailure(L"Version", Info->szVersion, FindFileData.cFileName);
+            _GetStringNullFailure(L"License", Info->szLicense, FindFileData.cFileName);
+            _GetStringNullFailure(L"Description", Info->szDesc, FindFileData.cFileName);
+            _GetStringNullFailure(L"Size", Info->szSize, FindFileData.cFileName);
+            _GetStringNullFailure(L"URLSite", Info->szUrlSite, FindFileData.cFileName);
+            _GetStringNullFailure(L"CDPath", Info->szCDPath, FindFileData.cFileName);
+            _GetStringNullFailure(L"SHA1", Info->szSHA1, FindFileData.cFileName);
         }
 
         if (!lpEnumProc(Info))
             break;
 
         }
 
         if (!lpEnumProc(Info))
             break;
 
-    } while (FindNextFileW(hFind, &FindFileData) != 0);
+    }
+    while (FindNextFileW(hFind, &FindFileData) != 0);
 
     FindClose(hFind);
 
 
     FindClose(hFind);
 
@@ -338,16 +347,16 @@ skip_if_cached:
 
 VOID FreeCachedAvailableEntries(VOID)
 {
 
 VOID FreeCachedAvailableEntries(VOID)
 {
-     PAPPLICATION_INFO Info;
+    PAPPLICATION_INFO Info;
+
     /* loop and deallocate all the cached app infos in the list */
     for (pCachedEntry = CachedEntriesHead.Flink; pCachedEntry != &CachedEntriesHead;)
     {
     /* loop and deallocate all the cached app infos in the list */
     for (pCachedEntry = CachedEntriesHead.Flink; pCachedEntry != &CachedEntriesHead;)
     {
-         Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
+        Info = CONTAINING_RECORD(pCachedEntry, APPLICATION_INFO, List);
+
         /* grab a reference to the next linked entry before getting rid of the current one */
         pCachedEntry = pCachedEntry->Flink;
         /* grab a reference to the next linked entry before getting rid of the current one */
         pCachedEntry = pCachedEntry->Flink;
+
         /* flush them down the toilet :D */
         RemoveEntryList(&Info->List);
         HeapFree(GetProcessHeap(), 0, Info);
         /* flush them down the toilet :D */
         RemoveEntryList(&Info->List);
         HeapFree(GetProcessHeap(), 0, Info);