X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=gui.cpp;h=3f34943915915a9ad37ea7b4221c33e5c6fbd962;hb=2994e17c24d8a3d32937a92733ba1ee0f26dc33d;hp=c09b363eeae00e1077cf44f7f33b45aff2da6670;hpb=143238dfe314c16bc90a6807ab0f00220efd34a2;p=nssm.git diff --git a/gui.cpp b/gui.cpp index c09b363..3f34943 100644 --- a/gui.cpp +++ b/gui.cpp @@ -508,7 +508,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 = 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; 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); } @@ -746,14 +746,17 @@ void browse(HWND window, TCHAR *current, unsigned long flags, ...) { va_end(arg); /* Remainder of the buffer is already zeroed */ } - ofn.lpstrFile = new TCHAR[MAX_PATH]; + ofn.lpstrFile = new TCHAR[PATH_LENGTH]; if (flags & OFN_NOVALIDATE) { /* Directory hack. */ - _sntprintf_s(ofn.lpstrFile, MAX_PATH, _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES)); + _sntprintf_s(ofn.lpstrFile, _countof(ofn.lpstrFile), _TRUNCATE, _T(":%s:"), message_string(NSSM_GUI_BROWSE_FILTER_DIRECTORIES)); + ofn.nMaxFile = DIR_LENGTH; } - else _sntprintf_s(ofn.lpstrFile, MAX_PATH, _TRUNCATE, _T("%s"), current); + else { + _sntprintf_s(ofn.lpstrFile, _countof(ofn.lpstrFile), _TRUNCATE, _T("%s"), current); + ofn.nMaxFile = PATH_LENGTH; + } ofn.lpstrTitle = message_string(NSSM_GUI_BROWSE_TITLE); - ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | flags; if (GetOpenFileName(&ofn)) { @@ -774,7 +777,7 @@ INT_PTR CALLBACK tab_dlg(HWND tab, UINT message, WPARAM w, LPARAM l) { /* Button was pressed or control was controlled. */ case WM_COMMAND: HWND dlg; - TCHAR buffer[MAX_PATH]; + TCHAR buffer[PATH_LENGTH]; unsigned char enabled; switch (LOWORD(w)) {