From: Iain Patterson Date: Sat, 26 Feb 2011 11:52:39 +0000 (+0000) Subject: Removed some legacy stuff. X-Git-Tag: v2.8~2 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=f669237f05d127b88cd66d9dc2a32765ed6b2c23;p=nssm.git 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? --- diff --git a/gui.cpp b/gui.cpp index b1174d1..83f2165 100644 --- a/gui.cpp +++ b/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; diff --git a/gui.h b/gui.h index d9c378b..4521c32 100644 --- a/gui.h +++ b/gui.h @@ -6,11 +6,6 @@ #include #include "resource.h" -#define GUI -#ifndef snprintf -#define snprintf _snprintf -#endif - #define STRING_SIZE 256 int nssm_gui(int, char *); diff --git a/service.cpp b/service.cpp index a400ebd..6292698 100644 --- a/service.cpp +++ b/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; }