Author: ekohl Date: Sun Feb 19 19:40:04 2017 New Revision: 73852
URL: http://svn.reactos.org/svn/reactos?rev=73852&view=rev Log: [DEVMGR] - NEVER EVER use single line if statements!!!! - Fix indentation and coding style.
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp trunk/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp trunk/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp trunk/reactos/dll/win32/devmgr/properties/advprop.cpp
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/Cl... ============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/ClassNode.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -114,7 +114,6 @@ DWORD Size; DWORD dwError;
- // First check for a semi colon */ ptr = wcschr(ResourceDescriptor, L';'); if (ptr) @@ -127,15 +126,18 @@ { // This must be a dll resource based descriptor. Find the comma ptr = wcschr(ResourceDescriptor, L','); - if (ptr == NULL) return ERROR_INVALID_DATA; + if (ptr == NULL) + return ERROR_INVALID_DATA;
// Terminate the string where the comma was *ptr = UNICODE_NULL;
// Expand any environment strings Size = ExpandEnvironmentStringsW(&ResourceDescriptor[1], ModulePath, MAX_PATH); - if (Size > MAX_PATH) return ERROR_BUFFER_OVERFLOW; - if (Size == 0) return GetLastError(); + if (Size > MAX_PATH) + return ERROR_BUFFER_OVERFLOW; + if (Size == 0) + return GetLastError();
// Put the comma back and move past it *ptr = L','; @@ -143,13 +145,15 @@
// Load the dll hModule = LoadLibraryExW(ModulePath, NULL, LOAD_LIBRARY_AS_DATAFILE); - if (hModule == NULL) return GetLastError(); + if (hModule == NULL) + return GetLastError();
// Convert the resource id to a number ResourceId = _wtoi(ptr);
// If the number is negative, make it positive - if (ResourceId < 0) ResourceId = -ResourceId; + if (ResourceId < 0) + ResourceId = -ResourceId;
// Load the string from the dll if (LoadStringW(hModule, ResourceId, ResString, 256))
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/De... ============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/DeviceNode.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -41,7 +41,6 @@ size_t size = wcslen(Node.m_DeviceId) + 1; m_DeviceId = new WCHAR[size]; StringCbCopyW(m_DeviceId, size * sizeof(WCHAR), Node.m_DeviceId); - }
CDeviceNode::~CDeviceNode() @@ -65,15 +64,14 @@
// Now get the actual device id cr = CM_Get_Device_IDW(m_DevInst, - m_DeviceId, - ulLength + 1, - 0); + m_DeviceId, + ulLength + 1, + 0); if (cr != CR_SUCCESS || wcscmp(m_DeviceId, L"HTREE\ROOT\0") == 0) { delete[] m_DeviceId; m_DeviceId = NULL; } - }
// Make sure we got the string @@ -95,7 +93,6 @@ &m_DevinfoData); }
- // Check if the device has a problem if (HasProblem()) { @@ -108,9 +105,6 @@ m_OverlayImage = OverlayProblem; } } - - -
// Get the class guid for this device ulLength = MAX_GUID_STRING_LEN * sizeof(WCHAR); @@ -131,12 +125,10 @@ m_ClassGuid = GUID_DEVCLASS_UNKNOWN; }
- // Get the image for the class this device is in SetupDiGetClassImageIndex(m_ImageListData, &m_ClassGuid, &m_ClassImage); -
// Get the description for the device ulLength = DISPLAY_NAME_LEN * sizeof(WCHAR); @@ -155,7 +147,6 @@ m_DisplayName, &ulLength, 0); - }
if (cr != CR_SUCCESS) @@ -310,7 +301,6 @@ pcp.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE; pcp.StateChange = (Enable ? DICS_ENABLE : DICS_DISABLE); pcp.HwProfile = 0; -
// check both scopes to make sure we can make the change for (int i = 0; i < 2; i++) @@ -374,7 +364,6 @@ bool CDeviceNode::UninstallDevice() { - if (CanUninstall() == false) return false;
@@ -388,7 +377,6 @@ // We probably need to walk all the siblings of this // device and ask if they're happy with the uninstall // -
// Remove it SetupDiSetClassInstallParamsW(m_hDevInfo, @@ -404,7 +392,6 @@ 0);
return true; - }
/* PRIVATE METHODS ******************************************************/ @@ -425,8 +412,7 @@ }
DWORD -CDeviceNode::GetFlags( - ) +CDeviceNode::GetFlags() { SP_DEVINSTALL_PARAMS DevInstallParams; DevInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS); @@ -480,5 +466,3 @@ } return false; } - -
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/De... ============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/DeviceView.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -56,7 +56,8 @@ // Get the device image list m_ImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA); BOOL bSuccess = SetupDiGetClassImageList(&m_ImageListData); - if (bSuccess == FALSE) return false; + if (bSuccess == FALSE) + return false;
// Create the main treeview m_hTreeView = CreateWindowExW(WS_EX_CLIENTEDGE, @@ -207,7 +208,6 @@ ThreadData->ScanForChanges = ScanForChanges; ThreadData->UpdateView = UpdateView;
- HANDLE hThread; hThread = (HANDLE)_beginthreadex(NULL, 0, @@ -348,7 +348,8 @@ cr = CM_Enumerate_Classes(ClassIndex, ClassGuid, 0); - if (cr != CR_SUCCESS) return false; + if (cr != CR_SUCCESS) + return false;
// Check if this is the unknown class if (IsEqualGUID(*ClassGuid, GUID_DEVCLASS_UNKNOWN)) @@ -421,7 +422,6 @@ case ResourcesByConnection: break; } -
This->SelectNode(LastSelectedNode);
@@ -645,7 +645,8 @@ { // Check if the parent device has anything at the same level bSuccess = GetSiblingDevice(Device, &Device); - if (bSuccess == FALSE) break; + if (bSuccess == FALSE) + break;
DeviceNode = dynamic_cast<CDeviceNode *>(GetDeviceNode(Device)); if (DeviceNode == nullptr) @@ -686,7 +687,8 @@ }
// If there was a problem, expand the ancestors - if (HasProblem) return false; + if (HasProblem) + return false;
return true; } @@ -698,7 +700,8 @@ ) { CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode()); - if (Node == nullptr) return false; + if (Node == nullptr) + return false;
if (Enable == false) { @@ -706,9 +709,9 @@ if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_DISABLE)) { if (MessageBoxW(m_hMainWnd, - str, - Node->GetDisplayName(), - MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES) + str, + Node->GetDisplayName(), + MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES) { return false; } @@ -724,7 +727,8 @@ ) { CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode()); - if (Node == nullptr) return false; + if (Node == nullptr) + return false;
DWORD dwReboot; if (InstallDevInst(m_hMainWnd, Node->GetDeviceId(), TRUE, &dwReboot)) @@ -741,15 +745,16 @@ ) { CDeviceNode *Node = dynamic_cast<CDeviceNode *>(GetSelectedNode()); - if (Node == nullptr) return false; + if (Node == nullptr) + return false;
CAtlStringW str; if (str.LoadStringW(g_hThisInstance, IDS_CONFIRM_UNINSTALL)) { if (MessageBoxW(m_hMainWnd, - str, - Node->GetDisplayName(), - MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES) + str, + Node->GetDisplayName(), + MB_YESNO | MB_ICONWARNING | MB_DEFBUTTON2) != IDYES) { return false; } @@ -765,7 +770,8 @@ HMODULE hModule;
hModule = LoadLibraryW(L"hdwwiz.cpl"); - if (hModule == NULL) return false; + if (hModule == NULL) + return false;
pAddHardwareWizard = (PADDHARDWAREWIZARD)GetProcAddress(hModule, "AddHardwareWizard"); @@ -953,7 +959,8 @@
// Check if this node has any children hItem = TreeView_GetChild(m_hTreeView, hParentItem); - if (hItem == NULL) return NULL; + if (hItem == NULL) + return NULL;
// The lParam contains the node pointer data tvItem.hItem = hItem; @@ -977,14 +984,16 @@
// This node may have its own children FoundItem = RecurseFindDevice(hItem, Node); - if (FoundItem) return FoundItem; + if (FoundItem) + return FoundItem;
// Loop all the siblings for (;;) { // Get the next item at this level hItem = TreeView_GetNextSibling(m_hTreeView, hItem); - if (hItem == NULL) break; + if (hItem == NULL) + break;
// The lParam contains the node pointer data tvItem.hItem = hItem; @@ -1007,7 +1016,8 @@
// This node may have its own children FoundItem = RecurseFindDevice(hItem, Node); - if (FoundItem) return FoundItem; + if (FoundItem) + return FoundItem; }
return hItem; @@ -1022,7 +1032,8 @@
// Check if there are any items in the tree hRoot = TreeView_GetRoot(m_hTreeView); - if (hRoot == NULL) return; + if (hRoot == NULL) + return;
// If we don't want to set select a node, just select root if (Node == nullptr || Node->GetNodeType() == RootNode) @@ -1060,7 +1071,8 @@ CClassNode *Node = nullptr;
Pos = m_ClassNodeList.GetHeadPosition(); - if (Pos == NULL) return nullptr; + if (Pos == NULL) + return nullptr;
do { @@ -1087,7 +1099,8 @@ CDeviceNode *Node = nullptr;
Pos = m_DeviceNodeList.GetHeadPosition(); - if (Pos == NULL) return nullptr; + if (Pos == NULL) + return nullptr;
do { @@ -1172,7 +1185,6 @@ ClassIndex++; } while (Success);
- // Get all the devices on the local machine hDevInfo = SetupDiGetClassDevsW(NULL, 0, @@ -1189,7 +1201,8 @@ { // Get the devinst for this device Success = SetupDiEnumDeviceInfo(hDevInfo, i, &DeviceInfoData); - if (Success == FALSE) break; + if (Success == FALSE) + break;
// create a new device node and add it to the list DeviceNode = new CDeviceNode(DeviceInfoData.DevInst, &m_ImageListData); @@ -1201,7 +1214,6 @@ { ATLASSERT(FALSE); } - }
SetupDiDestroyDeviceInfoList(hDevInfo);
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/Ma... ============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/MainWindow.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -93,7 +93,6 @@ { }
- bool CDeviceManager::Create(_In_ HWND /*hWndParent*/, _In_ HINSTANCE hInst, @@ -130,7 +129,6 @@
return (Ret == 0); } -
/* PRIVATE METHODS **********************************************/ @@ -256,11 +254,25 @@ // Get the menu item id switch (Type) { - case DevicesByType: CheckId = IDC_DEVBYTYPE; break; - case DevicesByConnection: CheckId = IDC_DEVBYCONN; break; - case ResourcesByType: CheckId = IDC_RESBYTYPE; break; - case ResourcesByConnection: CheckId = IDC_RESBYCONN; break; - default: ATLASSERT(FALSE); break; + case DevicesByType: + CheckId = IDC_DEVBYTYPE; + break; + + case DevicesByConnection: + CheckId = IDC_DEVBYCONN; + break; + + case ResourcesByType: + CheckId = IDC_RESBYTYPE; + break; + + case ResourcesByConnection: + CheckId = IDC_RESBYCONN; + break; + + default: + ATLASSERT(FALSE); + break; }
// Set the new check item @@ -291,7 +303,8 @@ (HMENU)IDC_TOOLBAR, g_hThisInstance, NULL); - if (m_hToolBar == NULL) return FALSE; + if (m_hToolBar == NULL) + return FALSE;
// Don't show clipped buttons SendMessageW(m_hToolBar, @@ -394,8 +407,6 @@ } SendMessageW(m_hToolBar, TB_SETSTATE, IDC_DISABLE_DRV, MAKELPARAM(State, 0)); } - -
bool CDeviceManager::StatusBarLoadString(_In_ HWND hStatusBar, @@ -793,6 +804,7 @@ } break; } + case WM_TIMER: { if (wParam == REFRESH_TIMER) @@ -829,9 +841,11 @@ }
case WM_ACTIVATE: + { if (LOWORD(hwnd)) This->OnActivate(); break; + }
case WM_DESTROY: {
Modified: trunk/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/devmgmt/Ro... ============================================================================== --- trunk/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/devmgmt/RootNode.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -31,7 +31,8 @@ HBITMAP hRootImage; hRootImage = LoadBitmapW(g_hThisInstance, MAKEINTRESOURCEW(IDB_ROOT_IMAGE)); - if (hRootImage == NULL) return FALSE; + if (hRootImage == NULL) + return false;
// Add this bitmap to the device image list. This is a bit hacky, but it's safe m_ClassImage = ImageList_Add(m_ImageListData->ImageList,
Modified: trunk/reactos/dll/win32/devmgr/properties/advprop.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/devmgr/properties... ============================================================================== --- trunk/reactos/dll/win32/devmgr/properties/advprop.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/devmgr/properties/advprop.cpp [iso-8859-1] Sun Feb 19 19:40:04 2017 @@ -347,7 +347,7 @@
if (ListView_GetItemCount(hDriversListView) == 0) { - if(LoadStringW(hDllInstance, IDS_NODRIVERS, szBuffer, _countof(szBuffer))) + if (LoadStringW(hDllInstance, IDS_NODRIVERS, szBuffer, _countof(szBuffer))) MessageBoxW(hwndDlg, szBuffer, dap->szDevName, MB_OK); EndDialog(hwndDlg, IDCANCEL); }