Browse Source

Removed some legacy stuff.

What was #define GUI even for?
Why #define snprintf _snprintf in one file where we're using actual
_snprintf everywhere else?
Iain Patterson 11 years ago
parent
commit
f669237f05
3 changed files with 4 additions and 9 deletions
  1. 2 2
      gui.cpp
  2. 0 5
      gui.h
  3. 2 2
      service.cpp

+ 2 - 2
gui.cpp

@@ -6,7 +6,7 @@ int nssm_gui(int resource, char *name) {
   /* Create window */
   HWND dlg = CreateDialog(0, MAKEINTRESOURCE(resource), 0, install_dlg);
   if (! dlg) {
-    snprintf(blurb, sizeof(blurb), "CreateDialog() failed with error code %d", GetLastError());
+    _snprintf(blurb, sizeof(blurb), "CreateDialog() failed with error code %d", GetLastError());
     MessageBox(0, blurb, NSSM, MB_OK);
     return 1;
   }
@@ -133,7 +133,7 @@ int remove(HWND window) {
 
   /* Confirm */
   char blurb[MAX_PATH];
-  if (snprintf(blurb, sizeof(blurb), "Remove the \"%s\" service?", name) < 0) {
+  if (_snprintf(blurb, sizeof(blurb), "Remove the \"%s\" service?", name) < 0) {
     if (MessageBox(0, "Remove the service?", NSSM, MB_YESNO) != IDYES) return 0;
   }
   else if (MessageBox(0, blurb, NSSM, MB_YESNO) != IDYES) return 0;

+ 0 - 5
gui.h

@@ -6,11 +6,6 @@
 #include <commctrl.h>
 #include "resource.h"
 
-#define GUI
-#ifndef snprintf
-#define snprintf _snprintf
-#endif
-
 #define STRING_SIZE 256
 
 int nssm_gui(int, char *);

+ 2 - 2
service.cpp

@@ -101,7 +101,7 @@ int install_service(char *name, char *exe, char *flags) {
     fprintf(stderr, "The full path to " NSSM " is too long!\n");
     return 3;
   }
-  if (snprintf(command, sizeof(command), "\"%s\" %s", path, NSSM_RUN) < 0) {
+  if (_snprintf(command, sizeof(command), "\"%s\" %s", path, NSSM_RUN) < 0) {
     fprintf(stderr, "Out of memory for ImagePath!\n");
     return 4;
   }
@@ -235,7 +235,7 @@ int monitor_service() {
   int ret = start_service();
   if (ret) {
     char code[16];
-    snprintf(code, sizeof(code), "%d", ret);
+    _snprintf(code, sizeof(code), "%d", ret);
     log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_START_SERVICE_FAILED, exe, service_name, ret, 0);
     return ret;
   }