소스 검색

Fixed some typos and whitespace errors.

Iain Patterson 11 년 전
부모
커밋
4798232dae
3개의 변경된 파일33개의 추가작업 그리고 34개의 파일을 삭제
  1. 0 1
      account.cpp
  2. 32 32
      gui.cpp
  3. 1 1
      service.cpp

+ 0 - 1
account.cpp

@@ -263,7 +263,6 @@ const TCHAR *well_known_username(const TCHAR *username) {
   if (! username) return NSSM_LOCALSYSTEM_ACCOUNT;
   if (! username) return NSSM_LOCALSYSTEM_ACCOUNT;
   if (str_equiv(username, NSSM_LOCALSYSTEM_ACCOUNT)) return NSSM_LOCALSYSTEM_ACCOUNT;
   if (str_equiv(username, NSSM_LOCALSYSTEM_ACCOUNT)) return NSSM_LOCALSYSTEM_ACCOUNT;
   SID *sid;
   SID *sid;
-  int r = username_sid(username, &sid);
   if (username_sid(username, &sid)) return 0;
   if (username_sid(username, &sid)) return 0;
 
 
   const TCHAR *well_known = well_known_sid(sid);
   const TCHAR *well_known = well_known_sid(sid);

+ 32 - 32
gui.cpp

@@ -107,7 +107,7 @@ int nssm_gui(int resource, nssm_service_t *service) {
         HeapFree(GetProcessHeap(), 0, formatted);
         HeapFree(GetProcessHeap(), 0, formatted);
       }
       }
     }
     }
-
+
     /* Process tab. */
     /* Process tab. */
     if (service->priority) {
     if (service->priority) {
       int priority = priority_constant_to_index(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);
       SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);
-    }
-
+    }
+
     /* Shutdown tab. */
     /* Shutdown tab. */
     if (! (service->stop_method & NSSM_STOP_METHOD_CONSOLE)) {
     if (! (service->stop_method & NSSM_STOP_METHOD_CONSOLE)) {
       SendDlgItemMessage(tablist[NSSM_TAB_SHUTDOWN], IDC_METHOD_CONSOLE, BM_SETCHECK, BST_UNCHECKED, 0);
       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.
       Special case for well-known accounts.
       Ignore the password if we're editing and the username hasn't changed.
       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 (well_known) {
-      if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {
+      if (str_equiv(well_known, NSSM_LOCALSYSTEM_ACCOUNT)) {
         HeapFree(GetProcessHeap(), 0, service->username);
         HeapFree(GetProcessHeap(), 0, service->username);
         service->username = 0;
         service->username = 0;
         service->usernamelen = 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 {
     else {
       /* Password. */
       /* 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. */
   /* Get stop method stuff. */
   check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE);
   check_stop_method(service, NSSM_STOP_METHOD_CONSOLE, IDC_METHOD_CONSOLE);
   check_stop_method(service, NSSM_STOP_METHOD_WINDOW, IDC_METHOD_WINDOW);
   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. */
   /* Get rotation stuff. */
   if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE, BM_GETCHECK, 0, 0) & BST_CHECKED) {
   if (SendDlgItemMessage(tablist[NSSM_TAB_ROTATION], IDC_ROTATE, BM_GETCHECK, 0, 0) & BST_CHECKED) {
     service->rotate_files = true;
     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_SECONDS, &service->rotate_seconds);
     check_number(tablist[NSSM_TAB_ROTATION], IDC_ROTATE_BYTES_LOW, &service->rotate_bytes_low);
     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 */
     /* Remainder of the buffer is already zeroed */
   }
   }
   ofn.lpstrFile = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, PATH_LENGTH * sizeof(TCHAR));
   ofn.lpstrFile = (TCHAR *) HeapAlloc(GetProcessHeap(), 0, PATH_LENGTH * sizeof(TCHAR));
-  if (ofn.lpstrFile) {
+  if (ofn.lpstrFile) {
     if (flags & OFN_NOVALIDATE) {
     if (flags & OFN_NOVALIDATE) {
       /* Directory hack. */
       /* Directory hack. */
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES));
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES));
       ofn.nMaxFile = DIR_LENGTH;
       ofn.nMaxFile = DIR_LENGTH;
     }
     }
-    else {
+    else {
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T("%s"), current);
       _sntprintf_s(ofn.lpstrFile, PATH_LENGTH, _TRUNCATE, _T("%s"), current);
       ofn.nMaxFile = PATH_LENGTH;
       ofn.nMaxFile = PATH_LENGTH;
-    }
-  }
+    }
+  }
   ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE);
   ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE);
   ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | flags;
   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);
     SendMessage(window, WM_SETTEXT, 0, (LPARAM) ofn.lpstrFile);
   }
   }
   if (ofn.lpstrFilter) HeapFree(GetProcessHeap(), 0, (void *) ofn.lpstrFilter);
   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) {
 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);
       CheckRadioButton(tablist[NSSM_TAB_LOGON], IDC_LOCALSYSTEM, IDC_ACCOUNT, IDC_LOCALSYSTEM);
       set_logon_enabled(0);
       set_logon_enabled(0);
 
 
-      /* Dependencies tab. */
+      /* Dependencies tab. */
       tab.pszText = message_string(NSSM_GUI_TAB_DEPENDENCIES);
       tab.pszText = message_string(NSSM_GUI_TAB_DEPENDENCIES);
       tab.cchTextMax = (int) _tcslen(tab.pszText);
       tab.cchTextMax = (int) _tcslen(tab.pszText);
       SendMessage(tabs, TCM_INSERTITEM, NSSM_TAB_DEPENDENCIES, (LPARAM) &tab);
       SendMessage(tabs, TCM_INSERTITEM, NSSM_TAB_DEPENDENCIES, (LPARAM) &tab);
       tablist[NSSM_TAB_DEPENDENCIES] = dialog(MAKEINTRESOURCE(IDD_DEPENDENCIES), window, tab_dlg);
       tablist[NSSM_TAB_DEPENDENCIES] = dialog(MAKEINTRESOURCE(IDD_DEPENDENCIES), window, tab_dlg);
       ShowWindow(tablist[NSSM_TAB_DEPENDENCIES], SW_HIDE);
       ShowWindow(tablist[NSSM_TAB_DEPENDENCIES], SW_HIDE);
-
+
       /* Remaining tabs are only for services we manage. */
       /* Remaining tabs are only for services we manage. */
       if (service->native) return 1;
       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);
       SendMessage(combo, CB_SETCURSEL, NSSM_NORMAL_PRIORITY, 0);
 
 
       SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_CHECKED, 0);
       SendDlgItemMessage(tablist[NSSM_TAB_PROCESS], IDC_CONSOLE, BM_SETCHECK, BST_CHECKED, 0);
-
+
       list = GetDlgItem(tablist[NSSM_TAB_PROCESS], IDC_AFFINITY);
       list = GetDlgItem(tablist[NSSM_TAB_PROCESS], IDC_AFFINITY);
       n = num_cpus();
       n = num_cpus();
       SendMessage(list, LB_SETCOLUMNWIDTH, 16, 0);
       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.
         Size to fit.
         The box is high enough for four rows.  It is wide enough for eight
         The box is high enough for four rows.  It is wide enough for eight
         columns without scrolling.  With scrollbars it shrinks to two rows.
         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) {
       if (n < 32) {
         int columns = (n - 1) / 4;
         int columns = (n - 1) / 4;
         RECT rect;
         RECT rect;
         GetWindowRect(list, &rect);
         GetWindowRect(list, &rect);
-        int width = rect.right - rect.left;
+        int width = rect.right - rect.left;
         width -= (7 - columns) * 16;
         width -= (7 - columns) * 16;
         int height = rect.bottom - rect.top;
         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);
         SetWindowPos(list, 0, 0, 0, width, height, SWP_NOMOVE | SWP_NOOWNERZORDER);
       }
       }
       SendMessage(list, LB_SELITEMRANGE, 1, MAKELPARAM(0, n));
       SendMessage(list, LB_SELITEMRANGE, 1, MAKELPARAM(0, n));

+ 1 - 1
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->env_extra) HeapFree(GetProcessHeap(), 0, service->env_extra);
   if (service->handle) CloseHandle(service->handle);
   if (service->handle) CloseHandle(service->handle);
   if (service->process_handle) CloseHandle(service->process_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_section_initialised) DeleteCriticalSection(&service->throttle_section);
   if (service->throttle_timer) CloseHandle(service->throttle_timer);
   if (service->throttle_timer) CloseHandle(service->throttle_timer);
   if (service->initial_env) FreeEnvironmentStrings(service->initial_env);
   if (service->initial_env) FreeEnvironmentStrings(service->initial_env);