From: Iain Patterson Date: Sun, 29 Jun 2014 10:10:37 +0000 (+0100) Subject: Fixed some typos and whitespace errors. X-Git-Tag: v2.23~2 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=4798232daef193da47e021879f1f6653137be8bb;p=nssm.git Fixed some typos and whitespace errors. --- diff --git a/account.cpp b/account.cpp index fc626b4..70bfa3e 100644 --- a/account.cpp +++ b/account.cpp @@ -263,7 +263,6 @@ const TCHAR *well_known_username(const TCHAR *username) { if (! username) return NSSM_LOCALSYSTEM_ACCOUNT; if (str_equiv(username, NSSM_LOCALSYSTEM_ACCOUNT)) return NSSM_LOCALSYSTEM_ACCOUNT; SID *sid; - int r = username_sid(username, &sid); if (username_sid(username, &sid)) return 0; const TCHAR *well_known = well_known_sid(sid); diff --git a/gui.cpp b/gui.cpp index a69bf3b..692fb9b 100644 --- a/gui.cpp +++ b/gui.cpp @@ -107,7 +107,7 @@ int nssm_gui(int resource, nssm_service_t *service) { HeapFree(GetProcessHeap(), 0, formatted); } } - + /* Process tab. */ if (service->priority) { int priority = priority_constant_to_index(service->priority); @@ -130,10 +130,10 @@ int nssm_gui(int resource, nssm_service_t *service) { } } - if (service->no_console) { + if (service->no_console) { SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0); - } - + } + /* Shutdown tab. */ if (! (service->stop_method & NSSM_STOP_METHOD_CONSOLE)) { SendDlgItemMessage(tablist[NSSM_TAB_SHUTDOWN], IDC_METHOD_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0); @@ -383,22 +383,22 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service Special case for well-known accounts. Ignore the password if we're editing and the username hasn't changed. */ - const TCHAR *well_known = well_known_username(service->username); + const TCHAR *well_known = well_known_username(service->username); if (well_known) { - if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) { + if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) { HeapFree(GetProcessHeap(), 0, service->username); service->username = 0; service->usernamelen = 0; - } - else { - service->usernamelen = _tcslen(well_known) + 1; - service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR)); - if (! service->username) { - print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()")); - return 6; - } - memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR)); - } + } + else { + service->usernamelen = _tcslen(well_known) + 1; + service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR)); + if (! service->username) { + print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()")); + return 6; + } + memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR)); + } } else { /* Password. */ @@ -534,9 +534,9 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service } } - if (SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->no_console = 0; - else service->no_console = 1; - + if (SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->no_console = 0; + else service->no_console = 1; + /* Get stop method stuff. */ check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE); check_stop_method(service, NSSM_STOP_METHOD_WINDOW, IDC_METHOD_WINDOW); @@ -567,7 +567,7 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service /* Get rotation stuff. */ if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE, BM_GETCHECK, 0, 0) & BST_CHECKED) { service->rotate_files = true; - if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_ONLINE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_ONLINE; + if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_ONLINE, BM_GETCHECK, 0, 0) & BST_CHECKED) service->rotate_stdout_online = service->rotate_stderr_online = NSSM_ROTATE_ONLINE; check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_SECONDS, &service->rotate_seconds); check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_BYTES_LOW, &service->rotate_bytes_low); } @@ -806,17 +806,17 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) { /* Remainder of the buffer is already zeroed */ } ofn.lpstrFile = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, PATH_LENGTH * sizeof(TCHAR)); - if (ofn.lpstrFile) { + if (ofn.lpstrFile) { if (flags & OFN_NOVALIDATE) { /* Directory hack. */ _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES)); ofn.nMaxFile = DIR_LENGTH; } - else { + else { _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T("%s"), current); ofn.nMaxFile = PATH_LENGTH; - } - } + } + } ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE); ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | flags; @@ -826,7 +826,7 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) { SendMessage(window, WM_SETTEXT, 0, (LPARAM) ofn.lpstrFile); } if (ofn.lpstrFilter) HeapFree(GetProcessHeap(), 0, (void *) ofn.lpstrFilter); - if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile); + if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile); } INT_PTR CALLBACK tab_dlg(HWND tab, UINT message, WPARAM w, LPARAM l) { @@ -995,13 +995,13 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { CheckRadioButton(tablist[NSSM_TAB_LOGON], IDC_LOCALSYSTEM, IDC_ACCOUNT, IDC_LOCALSYSTEM); set_logon_enabled(0); - /* Dependencies tab. */ + /* Dependencies tab. */ tab.pszText = message_string(NSSM_GUI_TAB_DEPENDENCIES); tab.cchTextMax = (int) _tcslen(tab.pszText); SendMessage(tabs, TCM_INSERTITEM, NSSM_TAB_DEPENDENCIES, (LPARAM) &tab); tablist[NSSM_TAB_DEPENDENCIES] = dialog(MAKEINTRESOURCE(IDD_DEPENDENCIES), window, tab_dlg); ShowWindow(tablist[NSSM_TAB_DEPENDENCIES], SW_HIDE); - + /* Remaining tabs are only for services we manage. */ if (service->native) return 1; @@ -1023,7 +1023,7 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { SendMessage(combo, CB_SETCURSEL, NSSM_NORMAL_PRIORITY, 0); SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_CHECKED, 0); - + list = GetDlgItem(tablist[NSSM_TAB_PROCESS], IDC_AFFINITY); n = num_cpus(); SendMessage(list, LB_SETCOLUMNWIDTH, 16, 0); @@ -1037,17 +1037,17 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) { Size to fit. The box is high enough for four rows. It is wide enough for eight columns without scrolling. With scrollbars it shrinks to two rows. - Note that the above only holds if we set the column width BEFORE - adding the strings. + Note that the above only holds if we set the column width BEFORE + adding the strings. */ if (n < 32) { int columns = (n - 1) / 4; RECT rect; GetWindowRect(list, &rect); - int width = rect.right - rect.left; + int width = rect.right - rect.left; width -= (7 - columns) * 16; int height = rect.bottom - rect.top; - if (n < 4) height -= (int) SendMessage(list, LB_GETITEMHEIGHT, 0, 0) * (4 - n); + if (n < 4) height -= (int) SendMessage(list, LB_GETITEMHEIGHT, 0, 0) * (4 - n); SetWindowPos(list, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOOWNERZORDER); } SendMessage(list, LB_SELITEMRANGE, 1, MAKELPARAM(0, n)); diff --git a/service.cpp b/service.cpp index 58ca264..4327a01 100644 --- a/service.cpp +++ b/service.cpp @@ -711,7 +711,7 @@ void cleanup_nssm_service(nssm_service_t *service) { if (service->env_extra) HeapFree(GetProcessHeap(), 0, service->env_extra); if (service->handle) CloseHandle(service->handle); if (service->process_handle) CloseHandle(service->process_handle); - if (service->wait_handle) UnregisterWait(service->process_handle); + if (service->wait_handle) UnregisterWait(service->wait_handle); if (service->throttle_section_initialised) DeleteCriticalSection(&service->throttle_section); if (service->throttle_timer) CloseHandle(service->throttle_timer); if (service->initial_env) FreeEnvironmentStrings(service->initial_env);