From 292db3d90d61fd3d58b2004853b42c847b0c856a Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Thu, 5 Feb 2015 23:58:03 +0000 Subject: AutoShutdown: -minor bugfix git-svn-id: http://svn.miranda-ng.org/main/trunk@12014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AutoShutdown/src/shutdownsvc.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'plugins/AutoShutdown/src/shutdownsvc.cpp') diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index fa4d2e576e..dde2ed0716 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -173,15 +173,13 @@ static DWORD ShutdownNow(BYTE shutdownType) ShutdownNow(SDSDT_SETMIRANDAOFFLINE); /* set Miranda offline */ /* hang up all ras connections */ { - RASCONN *paConn; - RASCONN *paConnBuf; - DWORD dwConnSize,dwConnItems,dwRetries; + DWORD dwRetries; RASCONNSTATUS rcs; DWORD dw,dwLastTickCount; - dwConnSize=sizeof(RASCONN); - dwConnItems=0; - paConn=(RASCONN*)mir_alloc(dwConnSize); + DWORD dwConnSize=sizeof(RASCONN); + DWORD dwConnItems=0; + RASCONN *paConn=(RASCONN*)mir_alloc(dwConnSize); dwErrCode=ERROR_NOT_ENOUGH_MEMORY; if (paConn != NULL) { for(dwRetries=5; dwRetries != 0; dwRetries--) { /* prevent infinite loop (rare) */ @@ -189,8 +187,8 @@ static DWORD ShutdownNow(BYTE shutdownType) paConn[0].dwSize = sizeof(RASCONN); dwErrCode = RasEnumConnections(paConn, &dwConnSize, &dwConnItems); if (dwErrCode != ERROR_BUFFER_TOO_SMALL) break; - paConnBuf=(RASCONN*)mir_realloc(paConn,dwConnSize); - if (paConnBuf != NULL) { + RASCONN *paConnBuf=(RASCONN*)mir_realloc(paConn,dwConnSize); + if (paConnBuf == NULL) { mir_free(paConn); paConn = NULL; dwErrCode = ERROR_NOT_ENOUGH_MEMORY; @@ -354,13 +352,11 @@ static INT_PTR CALLBACK ShutdownDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case M_START_SHUTDOWN: if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_BUTTON_SHUTDOWNNOW))) { - DWORD dwErrCode; EnableWindow(GetDlgItem(hwndDlg,IDC_BUTTON_SHUTDOWNNOW),FALSE); ShowWindow(hwndDlg,SW_HIDE); /* get rid of the dialog immediately */ - dwErrCode=ShutdownNow(shutdownType); + DWORD dwErrCode=ShutdownNow(shutdownType); if (dwErrCode != ERROR_SUCCESS) { - char *pszErr; - pszErr=GetWinErrorDescription(dwErrCode); + char *pszErr=GetWinErrorDescription(dwErrCode); ShowInfoMessage(NIIF_ERROR,Translate("Automatic Shutdown Error"),Translate("The shutdown process failed!\nReason: %s"),(pszErr != NULL)?pszErr:Translate("Unknown")); if (pszErr != NULL) LocalFree(pszErr); } -- cgit v1.2.3