diff options
author | George Hazan <ghazan@miranda.im> | 2019-04-24 18:33:15 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-04-24 18:33:15 +0300 |
commit | 788a4207849b3be381daf36ecfbaeada074ec115 (patch) | |
tree | aea6ffb7e6310a021b4f1910bc5370754f8acfdd | |
parent | eb6bcc71e126d3335e7db3a18049ec448574ef16 (diff) |
warning fixes
-rw-r--r-- | plugins/Db_autobackups/src/backup.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 67722fbe0d..cdde193fd1 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -198,7 +198,6 @@ static int Backup(wchar_t *backup_filename) {
bool bZip = false;
wchar_t dbname[MAX_PATH], dest_file[MAX_PATH];
- HWND progress_dialog = nullptr;
Profile_GetNameW(_countof(dbname), dbname);
@@ -243,10 +242,11 @@ static int Backup(wchar_t *backup_filename) if (!g_plugin.disable_popups)
ShowPopup(dbname, TranslateT("Backup in progress"), nullptr);
- if (!g_plugin.disable_progress)
+ HWND progress_dialog = nullptr;
+ if (!g_plugin.disable_progress) {
progress_dialog = CreateDialog(g_plugin.getInst(), MAKEINTRESOURCE(IDD_COPYPROGRESS), nullptr, DlgProcProgress);
-
- SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
+ SetDlgItemText(progress_dialog, IDC_PROGRESSMESSAGE, TranslateT("Copying database file..."));
+ }
BOOL res;
if (bZip) {
@@ -268,8 +268,10 @@ static int Backup(wchar_t *backup_filename) CloseHandle(hFile);
}
- SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
- UpdateWindow(progress_dialog);
+ if (progress_dialog) {
+ SendDlgItemMessage(progress_dialog, IDC_PROGRESS, PBM_SETPOS, (WPARAM)(100), 0);
+ UpdateWindow(progress_dialog);
+ }
g_plugin.setDword("LastBackupTimestamp", (DWORD)time(0));
if (g_plugin.use_cloudfile) {
@@ -297,7 +299,8 @@ static int Backup(wchar_t *backup_filename) }
else DeleteFileW(dest_file);
- DestroyWindow(progress_dialog);
+ if (progress_dialog)
+ DestroyWindow(progress_dialog);
return 0;
}
@@ -327,7 +330,7 @@ VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD) {
time_t t = time(0);
time_t diff = t - (time_t)g_plugin.getDword("LastBackupTimestamp");
- if (diff > (time_t)(g_plugin.period * (g_plugin.period_type == PT_MINUTES ? 60 : (g_plugin.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24)))))
+ if (diff > time_t(g_plugin.period) * (g_plugin.period_type == PT_MINUTES ? 60 : (g_plugin.period_type == PT_HOURS ? (60 * 60) : (60 * 60 * 24))))
BackupStart(nullptr);
}
|