Fixed some typos and whitespace errors.
authorIain Patterson <me@iain.cx>
Sun, 29 Jun 2014 10:10:37 +0000 (11:10 +0100)
committerIain Patterson <me@iain.cx>
Sun, 29 Jun 2014 10:28:23 +0000 (11:28 +0100)
account.cpp
gui.cpp
service.cpp

index fc626b4..70bfa3e 100644 (file)
@@ -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 (file)
--- a/gui.cpp
+++ b/gui.cpp
@@ -107,7 +107,7 @@ int nssm_gui(int resource, nssm_service_t *service) {
         HeapFree(GetProcessHeap(), 0, formatted);\r
       }\r
     }\r
-
+\r
     /* Process tab. */\r
     if (service->priority) {\r
       int priority = priority_constant_to_index(service->priority);\r
@@ -130,10 +130,10 @@ int nssm_gui(int resource, nssm_service_t *service) {
       }\r
     }\r
 \r
-    if (service->no_console) {
+    if (service->no_console) {\r
       SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);\r
-    }
-
+    }\r
+\r
     /* Shutdown tab. */\r
     if (! (service->stop_method & NSSM_STOP_METHOD_CONSOLE)) {\r
       SendDlgItemMessage(tablist[NSSM_TAB_SHUTDOWN], IDC_METHOD_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);\r
@@ -383,22 +383,22 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service
       Special case for well-known accounts.\r
       Ignore the password if we're editing and the username hasn't changed.\r
     */\r
-    const TCHAR *well_known = well_known_username(service->username);
+    const TCHAR *well_known = well_known_username(service->username);\r
     if (well_known) {\r
-      if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {
+      if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {\r
         HeapFree(GetProcessHeap(), 0, service->username);\r
         service->username = 0;\r
         service->usernamelen = 0;\r
-      }
-      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));
-      }
+      }\r
+      else {\r
+        service->usernamelen = _tcslen(well_known) + 1;\r
+        service->username = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, service->usernamelen * sizeof(TCHAR));\r
+        if (! service->username) {\r
+          print_message(stderr, NSSM_MESSAGE_OUT_OF_MEMORY, _T("canon"), _T("install()"));\r
+          return 6;\r
+        }\r
+        memmove(service->username, well_known, service->usernamelen * sizeof(TCHAR));\r
+      }\r
     }\r
     else {\r
       /* Password. */\r
@@ -534,9 +534,9 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service
     }\r
   }\r
 \r
-  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;\r
+  else service->no_console = 1;\r
+\r
   /* Get stop method stuff. */\r
   check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE);\r
   check_stop_method(service, NSSM_STOP_METHOD_WINDOW, IDC_METHOD_WINDOW);\r
@@ -567,7 +567,7 @@ int configure(HWND window, nssm_service_t *service, nssm_service_t *orig_service
   /* Get rotation stuff. */\r
   if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE, BM_GETCHECK, 0, 0) & BST_CHECKED) {\r
     service->rotate_files = true;\r
-    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;\r
     check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_SECONDS, &service->rotate_seconds);\r
     check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_BYTES_LOW, &service->rotate_bytes_low);\r
   }\r
@@ -806,17 +806,17 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) {
     /* Remainder of the buffer is already zeroed */\r
   }\r
   ofn.lpstrFile = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, PATH_LENGTH * sizeof(TCHAR));\r
-  if (ofn.lpstrFile) {
+  if (ofn.lpstrFile) {\r
     if (flags & OFN_NOVALIDATE) {\r
       /* Directory hack. */\r
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES));\r
       ofn.nMaxFile = DIR_LENGTH;\r
     }\r
-    else {
+    else {\r
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T("%s"), current);\r
       ofn.nMaxFile = PATH_LENGTH;\r
-    }
-  }
+    }\r
+  }\r
   ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE);\r
   ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | flags;\r
 \r
@@ -826,7 +826,7 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) {
     SendMessage(window, WM_SETTEXT, 0, (LPARAM) ofn.lpstrFile);\r
   }\r
   if (ofn.lpstrFilter) HeapFree(GetProcessHeap(), 0, (void *) ofn.lpstrFilter);\r
-  if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);
+  if (ofn.lpstrFile) HeapFree(GetProcessHeap(), 0, ofn.lpstrFile);\r
 }\r
 \r
 INT_PTR CALLBACK tab_dlg(HWND tab, UINT message, WPARAM w, LPARAM l) {\r
@@ -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);\r
       set_logon_enabled(0);\r
 \r
-      /* Dependencies tab. */
+      /* Dependencies tab. */\r
       tab.pszText = message_string(NSSM_GUI_TAB_DEPENDENCIES);\r
       tab.cchTextMax = (int) _tcslen(tab.pszText);\r
       SendMessage(tabs, TCM_INSERTITEM, NSSM_TAB_DEPENDENCIES, (LPARAM) &tab);\r
       tablist[NSSM_TAB_DEPENDENCIES] = dialog(MAKEINTRESOURCE(IDD_DEPENDENCIES), window, tab_dlg);\r
       ShowWindow(tablist[NSSM_TAB_DEPENDENCIES], SW_HIDE);\r
-
+\r
       /* Remaining tabs are only for services we manage. */\r
       if (service->native) return 1;\r
 \r
@@ -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);\r
 \r
       SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_CHECKED, 0);\r
-
+\r
       list = GetDlgItem(tablist[NSSM_TAB_PROCESS], IDC_AFFINITY);\r
       n = num_cpus();\r
       SendMessage(list, LB_SETCOLUMNWIDTH, 16, 0);\r
@@ -1037,17 +1037,17 @@ INT_PTR CALLBACK nssm_dlg(HWND window, UINT message, WPARAM w, LPARAM l) {
         Size to fit.\r
         The box is high enough for four rows.  It is wide enough for eight\r
         columns without scrolling.  With scrollbars it shrinks to two rows.\r
-        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\r
+        adding the strings.\r
       */\r
       if (n < 32) {\r
         int columns = (n - 1) / 4;\r
         RECT rect;\r
         GetWindowRect(list, &rect);\r
-        int width = rect.right - rect.left;
+        int width = rect.right - rect.left;\r
         width -= (7 - columns) * 16;\r
         int height = rect.bottom - rect.top;\r
-        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);\r
         SetWindowPos(list, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOOWNERZORDER);\r
       }\r
       SendMessage(list, LB_SELITEMRANGE, 1, MAKELPARAM(0, n));\r
index 58ca264..4327a01 100644 (file)
@@ -711,7 +711,7 @@ void cleanup_nssm_service(nssm_service_t *service) {
   if (service->env_extra) HeapFree(GetProcessHeap(), 0, service->env_extra);\r
   if (service->handle) CloseHandle(service->handle);\r
   if (service->process_handle) CloseHandle(service->process_handle);\r
-  if (service->wait_handle) UnregisterWait(service->process_handle);\r
+  if (service->wait_handle) UnregisterWait(service->wait_handle);\r
   if (service->throttle_section_initialised) DeleteCriticalSection(&service->throttle_section);\r
   if (service->throttle_timer) CloseHandle(service->throttle_timer);\r
   if (service->initial_env) FreeEnvironmentStrings(service->initial_env);\r