diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-05 23:58:03 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-02-05 23:58:03 +0000 |
commit | 292db3d90d61fd3d58b2004853b42c847b0c856a (patch) | |
tree | f8674aaf6f5ce7d070a6ad1571bedef5285806d7 /plugins/AutoShutdown | |
parent | e8a21391ff01376e7d76307ee2c682be222f74c0 (diff) |
AutoShutdown:
-minor bugfix
git-svn-id: http://svn.miranda-ng.org/main/trunk@12014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AutoShutdown')
-rw-r--r-- | plugins/AutoShutdown/src/shutdownsvc.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
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);
}
|