summaryrefslogtreecommitdiff
path: root/plugins/DbChecker
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/DbChecker')
-rw-r--r--plugins/DbChecker/src/cleaning.cpp7
-rw-r--r--plugins/DbChecker/src/dbchecker.h2
-rw-r--r--plugins/DbChecker/src/fileaccess.cpp5
-rw-r--r--plugins/DbChecker/src/finished.cpp10
-rw-r--r--plugins/DbChecker/src/openerror.cpp7
-rw-r--r--plugins/DbChecker/src/progress.cpp1
-rw-r--r--plugins/DbChecker/src/selectdb.cpp81
-rw-r--r--plugins/DbChecker/src/welcome.cpp11
-rw-r--r--plugins/DbChecker/src/wizard.cpp31
-rw-r--r--plugins/DbChecker/src/worker.cpp48
10 files changed, 105 insertions, 98 deletions
diff --git a/plugins/DbChecker/src/cleaning.cpp b/plugins/DbChecker/src/cleaning.cpp
index b40bdb7244..cf8d4947bc 100644
--- a/plugins/DbChecker/src/cleaning.cpp
+++ b/plugins/DbChecker/src/cleaning.cpp
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -24,7 +25,7 @@ INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
return bReturn;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
CheckDlgButton(hdlg, IDC_ERASEHISTORY, opts.bEraseHistory);
EnableWindow(GetDlgItem(hdlg, IDC_ERASEHISTORY), !opts.bAggressive);
@@ -34,13 +35,13 @@ INT_PTR CALLBACK CleaningDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
return TRUE;
case WZN_PAGECHANGING:
- opts.bEraseHistory = IsDlgButtonChecked(hdlg, IDC_ERASEHISTORY)&&!opts.bAggressive;
+ opts.bEraseHistory = IsDlgButtonChecked(hdlg, IDC_ERASEHISTORY) && !opts.bAggressive;
opts.bMarkRead = IsDlgButtonChecked(hdlg, IDC_MARKREAD);
opts.bConvertUtf = IsDlgButtonChecked(hdlg, IDC_CONVERTUTF);
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
if (opts.bCheckOnly)
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
diff --git a/plugins/DbChecker/src/dbchecker.h b/plugins/DbChecker/src/dbchecker.h
index 9742b742a4..a487bf3dd9 100644
--- a/plugins/DbChecker/src/dbchecker.h
+++ b/plugins/DbChecker/src/dbchecker.h
@@ -70,7 +70,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam);
-void OpenDatabase(HWND hdlg, INT iNextPage);
+int OpenDatabase(HWND hdlg, INT iNextPage);
#define STATUS_CLASSMASK 0x0f
void AddToStatus(int flags, const TCHAR* fmt, ...);
diff --git a/plugins/DbChecker/src/fileaccess.cpp b/plugins/DbChecker/src/fileaccess.cpp
index b545340155..19973fed07 100644
--- a/plugins/DbChecker/src/fileaccess.cpp
+++ b/plugins/DbChecker/src/fileaccess.cpp
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -24,7 +25,7 @@ INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
return bReturn;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
if (bShortMode)
EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE);
@@ -43,7 +44,7 @@ INT_PTR CALLBACK FileAccessDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARA
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
diff --git a/plugins/DbChecker/src/finished.cpp b/plugins/DbChecker/src/finished.cpp
index a61fe24780..47b272860f 100644
--- a/plugins/DbChecker/src/finished.cpp
+++ b/plugins/DbChecker/src/finished.cpp
@@ -22,19 +22,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
INT_PTR bReturn;
- if ( DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
+ if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
return bReturn;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
EnableWindow(GetDlgItem(GetParent(hdlg), IDC_BACK), FALSE);
EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), FALSE);
SetDlgItemText(GetParent(hdlg), IDCANCEL, TranslateT("&Finish"));
- SetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE)|SS_PATHELLIPSIS);
+ SetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_DBFILE), GWL_STYLE) | SS_PATHELLIPSIS);
SetDlgItemText(hdlg, IDC_DBFILE, opts.filename);
if (opts.bBackup) {
ShowWindow(GetDlgItem(hdlg, IDC_STBACKUP), TRUE);
- SetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE)|SS_PATHELLIPSIS);
+ SetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hdlg, IDC_BACKUPFILE), GWL_STYLE) | SS_PATHELLIPSIS);
SetDlgItemText(hdlg, IDC_BACKUPFILE, opts.backupFilename);
}
else ShowWindow(GetDlgItem(hdlg, IDC_STBACKUP), FALSE);
@@ -44,7 +44,7 @@ INT_PTR CALLBACK FinishedDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case WZN_CANCELCLICKED:
bLaunchMiranda = IsDlgButtonChecked(hdlg, IDC_LAUNCHMIRANDA) == BST_CHECKED;
CallService(MS_DB_SETDEFAULTPROFILE, (WPARAM)opts.filename, 0);
- EndDialog( GetParent(hdlg), 1);
+ EndDialog(GetParent(hdlg), 1);
return TRUE;
}
return FALSE;
diff --git a/plugins/DbChecker/src/openerror.cpp b/plugins/DbChecker/src/openerror.cpp
index 5f8b769af6..26a41520f1 100644
--- a/plugins/DbChecker/src/openerror.cpp
+++ b/plugins/DbChecker/src/openerror.cpp
@@ -16,15 +16,16 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
{
INT_PTR bReturn;
- if ( DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
+ if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
return bReturn;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
{
TCHAR szError[256];
@@ -38,7 +39,7 @@ INT_PTR CALLBACK OpenErrorDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
return TRUE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_BACK:
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
diff --git a/plugins/DbChecker/src/progress.cpp b/plugins/DbChecker/src/progress.cpp
index 3ba8b45bb5..467111a40b 100644
--- a/plugins/DbChecker/src/progress.cpp
+++ b/plugins/DbChecker/src/progress.cpp
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
#define WM_PROCESSINGDONE (WM_USER+1)
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp
index b0d07f458f..a013835748 100644
--- a/plugins/DbChecker/src/selectdb.cpp
+++ b/plugins/DbChecker/src/selectdb.cpp
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
static bool CheckBroken(const TCHAR *ptszFullPath)
@@ -27,7 +28,7 @@ static bool CheckBroken(const TCHAR *ptszFullPath)
return dblink->grokHeader(ptszFullPath) != EGROKPRF_NOERROR;
}
-void OpenDatabase(HWND hdlg, INT iNextPage)
+int OpenDatabase(HWND hdlg, INT iNextPage)
{
TCHAR tszMsg[1024];
@@ -35,16 +36,16 @@ void OpenDatabase(HWND hdlg, INT iNextPage)
DATABASELINK* dblink = FindDatabasePlugin(opts.filename);
if (dblink == NULL) {
mir_sntprintf(tszMsg, SIZEOF(tszMsg),
- TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
+ TranslateT("Database Checker cannot find a suitable database plugin to open '%s'."),
opts.filename);
LBL_Error:
MessageBox(hdlg, tszMsg, TranslateT("Error"), MB_OK | MB_ICONERROR);
- return;
+ return false;
}
if (dblink->CheckDB == NULL) {
mir_sntprintf(tszMsg, SIZEOF(tszMsg),
- TranslateT("Database driver '%s' doesn't support checking."),
+ TranslateT("Database driver '%s' doesn't support checking."),
TranslateTS(dblink->szFullName));
goto LBL_Error;
}
@@ -55,15 +56,16 @@ LBL_Error:
if ((opts.error = GetLastError()) == 0)
opts.error = error;
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_OPENERROR, (LPARAM)OpenErrorDlgProc);
- return;
+ return true;
}
opts.dblink = dblink;
}
-
+
if (iNextPage == IDD_FILEACCESS)
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_FILEACCESS, (LPARAM)FileAccessDlgProc);
else
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_PROGRESS, (LPARAM)ProgressDlgProc);
+ return true;
}
void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath)
@@ -72,13 +74,13 @@ void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath)
lstrcpy(szMirandaBootIni, szMirandaDir);
lstrcat(szMirandaBootIni, _T("\\mirandaboot.ini"));
- GetPrivateProfileString( _T("Database"), _T("ProfileDir"), _T("./Profiles"), szProfileDir, SIZEOF(szProfileDir), szMirandaBootIni);
+ GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T("./Profiles"), szProfileDir, SIZEOF(szProfileDir), szMirandaBootIni);
ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, SIZEOF(szExpandedProfileDir));
_tchdir(szMirandaDir);
- if ( !_tfullpath(szPath, szExpandedProfileDir, cbPath))
+ if (!_tfullpath(szPath, szExpandedProfileDir, cbPath))
lstrcpyn(szPath, szMirandaDir, cbPath);
- if (szPath[lstrlen(szPath)-1] == '\\')
- szPath[lstrlen(szPath)-1] = 0;
+ if (szPath[lstrlen(szPath) - 1] == '\\')
+ szPath[lstrlen(szPath) - 1] = 0;
}
static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir)
@@ -86,14 +88,14 @@ static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir)
LV_ITEM lvi;
lvi.mask = LVIF_PARAM;
lvi.iSubItem = 0;
- for(lvi.iItem = ListView_GetItemCount(hwndList)-1;lvi.iItem >= 0;lvi.iItem--) {
+ for (lvi.iItem = ListView_GetItemCount(hwndList) - 1; lvi.iItem >= 0; lvi.iItem--) {
ListView_GetItem(hwndList, &lvi);
if (!_tcsicmp((TCHAR*)lvi.lParam, filename))
return lvi.iItem;
}
_stat st;
- if ( _tstat(filename, &st) == -1)
+ if (_tstat(filename, &st) == -1)
return -1;
DWORD totalSize = st.st_size;
@@ -139,14 +141,13 @@ void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix)
hFind = FindFirstFile(szSearchPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
- if ( !(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !_tcscmp(fd.cFileName, _T(".")) || !_tcscmp(fd.cFileName, _T("..")))
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !_tcscmp(fd.cFileName, _T(".")) || !_tcscmp(fd.cFileName, _T("..")))
continue;
-
+
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s\\%s\\%s.dat"), szProfileDir, fd.cFileName, fd.cFileName);
- if ( _taccess(szFilename, 0) == 0)
+ if (_taccess(szFilename, 0) == 0)
AddDatabaseToList(GetDlgItem(hdlg, IDC_DBLIST), szFilename, szPrefix);
- }
- while(FindNextFile(hFind, &fd));
+ } while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
@@ -233,7 +234,10 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
}
if (bShortMode)
- OpenDatabase(hdlg, IDD_FILEACCESS);
+ if (!OpenDatabase(hdlg, IDD_FILEACCESS)) {
+ EndDialog(GetParent(hdlg), 1);
+ return FALSE;
+ }
return TRUE;
case WZN_PAGECHANGING:
@@ -241,7 +245,7 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDC_FILE:
if (HIWORD(wParam) == EN_CHANGE)
EnableWindow(GetDlgItem(GetParent(hdlg), IDOK), GetWindowTextLength(GetDlgItem(hdlg, IDC_FILE)));
@@ -249,14 +253,14 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
case IDC_OTHER:
{
- OPENFILENAME ofn = {0};
+ OPENFILENAME ofn = { 0 };
TCHAR str[MAX_PATH];
// _T("Miranda Databases (*.dat)\0*.DAT\0All Files (*)\0*\0");
TCHAR *filter, *tmp, *tmp1, *tmp2;
tmp1 = TranslateT("Miranda Databases (*.dat)");
tmp2 = TranslateT("All Files");
- filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1)+_tcslen(tmp2)+11)*sizeof(TCHAR));
+ filter = tmp = (TCHAR*)_alloca((_tcslen(tmp1) + _tcslen(tmp2) + 11)*sizeof(TCHAR));
tmp = addstring(tmp, tmp1);
tmp = addstring(tmp, _T("*.DAT"));
tmp = addstring(tmp, tmp2);
@@ -294,34 +298,31 @@ INT_PTR CALLBACK SelectDbDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM
break;
case WM_NOTIFY:
- switch(((LPNMHDR)lParam)->idFrom) {
+ switch (((LPNMHDR)lParam)->idFrom) {
case IDC_DBLIST:
- switch(((LPNMLISTVIEW)lParam)->hdr.code) {
+ switch (((LPNMLISTVIEW)lParam)->hdr.code) {
case LVN_ITEMCHANGED:
- {
- LV_ITEM lvi;
- lvi.iItem = ListView_GetNextItem(GetDlgItem(hdlg, IDC_DBLIST), -1, LVNI_SELECTED);
- if (lvi.iItem == -1) break;
- lvi.mask = LVIF_PARAM;
- ListView_GetItem(GetDlgItem(hdlg, IDC_DBLIST), &lvi);
- SetDlgItemText(hdlg, IDC_FILE, (TCHAR*)lvi.lParam);
- SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_FILE, EN_CHANGE), (LPARAM)GetDlgItem(hdlg, IDC_FILE));
- }
- break;
+ LV_ITEM lvi;
+ lvi.iItem = ListView_GetNextItem(GetDlgItem(hdlg, IDC_DBLIST), -1, LVNI_SELECTED);
+ if (lvi.iItem == -1) break;
+ lvi.mask = LVIF_PARAM;
+ ListView_GetItem(GetDlgItem(hdlg, IDC_DBLIST), &lvi);
+ SetDlgItemText(hdlg, IDC_FILE, (TCHAR*)lvi.lParam);
+ SendMessage(hdlg, WM_COMMAND, MAKEWPARAM(IDC_FILE, EN_CHANGE), (LPARAM)GetDlgItem(hdlg, IDC_FILE));
}
break;
}
break;
case WM_DESTROY:
- {
- LV_ITEM lvi;
- lvi.mask = LVIF_PARAM;
- for(lvi.iItem = ListView_GetItemCount(GetDlgItem(hdlg, IDC_DBLIST))-1;lvi.iItem >= 0;lvi.iItem--) {
- ListView_GetItem(GetDlgItem(hdlg, IDC_DBLIST), &lvi);
- free((char*)lvi.lParam);
- }
+ {
+ LV_ITEM lvi;
+ lvi.mask = LVIF_PARAM;
+ for (lvi.iItem = ListView_GetItemCount(GetDlgItem(hdlg, IDC_DBLIST)) - 1; lvi.iItem >= 0; lvi.iItem--) {
+ ListView_GetItem(GetDlgItem(hdlg, IDC_DBLIST), &lvi);
+ free((char*)lvi.lParam);
}
+ }
break;
}
return FALSE;
diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp
index 214514715e..5958b09444 100644
--- a/plugins/DbChecker/src/welcome.cpp
+++ b/plugins/DbChecker/src/welcome.cpp
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
@@ -24,19 +25,19 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
static HFONT hTitleFont;
INT_PTR bReturn;
- if ( DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
+ if (DoMyControlProcessing(hdlg, message, wParam, lParam, &bReturn))
return bReturn;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
- {
+ {
HRSRC hRsrcWatermark = FindResourceA(hInst, MAKEINTRESOURCEA(IDE_WATERMARK), "EMF");
HGLOBAL hGlobWatermark = LoadResource(hInst, hRsrcWatermark);
hEmfWatermark = SetEnhMetaFileBits(SizeofResource(hInst, hRsrcWatermark), (PBYTE)LockResource(hGlobWatermark));
}
SendDlgItemMessage(hdlg, IDC_WATERMARK, STM_SETIMAGE, IMAGE_ENHMETAFILE, (LPARAM)hEmfWatermark);
{
- NONCLIENTMETRICS ncm = {0};
+ NONCLIENTMETRICS ncm = { 0 };
ncm.cbSize = sizeof(ncm);
SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
LOGFONT TitleLogFont = ncm.lfMessageFont;
@@ -54,7 +55,7 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l
return FALSE;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
+ switch (LOWORD(wParam)) {
case IDOK:
PostMessage(GetParent(hdlg), WZM_GOTOPAGE, IDD_SELECTDB, (LPARAM)SelectDbDlgProc);
break;
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp
index bfc5c5774e..e3641f7cf8 100644
--- a/plugins/DbChecker/src/wizard.cpp
+++ b/plugins/DbChecker/src/wizard.cpp
@@ -18,6 +18,7 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+
#include "dbchecker.h"
static HFONT hBoldFont = NULL;
@@ -49,14 +50,14 @@ static BOOL CALLBACK MyControlsEnumChildren(HWND hwnd, LPARAM lParam)
}
SendMessage(hwnd, WM_SETFONT, (WPARAM)hBoldFont, 0);
SetWindowLongPtr(hwnd, GWL_EXSTYLE, exstyle&~WS_EX_CLIENTEDGE);
- SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|SWP_FRAMECHANGED);
+ SetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED);
}
return TRUE;
}
int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, INT_PTR *bReturn)
{
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
EnumChildWindows(hdlg, MyControlsEnumChildren, 0);
if (hEmfHeaderLogo == NULL) {
@@ -68,7 +69,7 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam,
break;
case WM_CTLCOLORSTATIC:
- if ((GetWindowLongPtr((HWND)lParam, GWL_STYLE)&0xFFFF) == 0) {
+ if ((GetWindowLongPtr((HWND)lParam, GWL_STYLE) & 0xFFFF) == 0) {
char szText[256];
GetWindowTextA((HWND)lParam, szText, sizeof(szText));
if (!strcmp(szText, "whiterect")) {
@@ -93,7 +94,7 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
{
static HWND hdlgPage;
- switch(message) {
+ switch (message) {
case WM_INITDIALOG:
SendMessage(hdlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_DBTOOL)));
hdlgPage = NULL;
@@ -113,21 +114,21 @@ INT_PTR CALLBACK WizardDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lP
SetDlgItemText(hdlg, IDCANCEL, TranslateT("Cancel"));
hdlgPage = CreateDialog(hInst, MAKEINTRESOURCE(wParam), hdlg, (DLGPROC)lParam);
TranslateDialogDefault(hdlgPage);
- SetWindowPos(hdlgPage, 0, 0, 0, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
+ SetWindowPos(hdlgPage, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
ShowWindow(hdlgPage, SW_SHOW);
break;
case WM_COMMAND:
- switch(LOWORD(wParam)) {
- case IDC_BACK:
- case IDOK:
- SendMessage(hdlgPage, WZN_PAGECHANGING, wParam, 0);
- SendMessage(hdlgPage, message, wParam, lParam);
- break;
- case IDCANCEL:
- if (SendMessage(hdlgPage, WZN_CANCELCLICKED, 0, 0)) break;
- EndDialog(hdlg, 0);
- break;
+ switch (LOWORD(wParam)) {
+ case IDC_BACK:
+ case IDOK:
+ SendMessage(hdlgPage, WZN_PAGECHANGING, wParam, 0);
+ SendMessage(hdlgPage, message, wParam, lParam);
+ break;
+ case IDCANCEL:
+ if (SendMessage(hdlgPage, WZN_CANCELCLICKED, 0, 0)) break;
+ EndDialog(hdlg, 0);
+ break;
}
break;
diff --git a/plugins/DbChecker/src/worker.cpp b/plugins/DbChecker/src/worker.cpp
index a20dfaef6b..4c7137f9b6 100644
--- a/plugins/DbChecker/src/worker.cpp
+++ b/plugins/DbChecker/src/worker.cpp
@@ -26,7 +26,7 @@ static void Finalize(time_t& ts)
opts.dbChecker->Destroy();
opts.dbChecker = NULL;
- if ( opts.hOutFile ) {
+ if (opts.hOutFile) {
CloseHandle(opts.hOutFile);
opts.hOutFile = NULL;
}
@@ -34,42 +34,42 @@ static void Finalize(time_t& ts)
if (errorCount && !opts.bBackup && !opts.bCheckOnly) {
time_t dlg_ts = time(NULL);
if (IDYES == MessageBox(NULL,
- TranslateT("Errors were encountered, however you selected not to backup the original database. It is strongly recommended that you do so in case important data was omitted. Do you wish to keep a backup of the original database?"),
- TranslateT("Miranda Database Tool"), MB_YESNO))
+ TranslateT("Errors were encountered, however you selected not to backup the original database. It is strongly recommended that you do so in case important data was omitted. Do you wish to keep a backup of the original database?"),
+ TranslateT("Miranda Database Tool"), MB_YESNO))
opts.bBackup = 1;
ts += time(NULL) - dlg_ts;
}
if (opts.bBackup) {
- TCHAR dbPath[MAX_PATH],dbFile[MAX_PATH];
+ TCHAR dbPath[MAX_PATH], dbFile[MAX_PATH];
_tcscpy(dbPath, opts.filename);
TCHAR* str2 = _tcsrchr(dbPath, '\\');
if (str2 != NULL) {
- _tcscpy(dbFile, str2+1);
+ _tcscpy(dbFile, str2 + 1);
*str2 = 0;
}
else {
_tcscpy(dbFile, dbPath);
dbPath[0] = 0;
}
- for (int i = 1;;i++) {
+ for (int i = 1;; i++) {
if (i == 1)
mir_sntprintf(opts.backupFilename, SIZEOF(opts.backupFilename), TranslateT("%s\\Backup of %s"), dbPath, dbFile);
else
mir_sntprintf(opts.backupFilename, SIZEOF(opts.backupFilename), TranslateT("%s\\Backup (%d) of %s"), dbPath, i, dbFile);
- if (_taccess(opts.backupFilename,0) == -1) break;
+ if (_taccess(opts.backupFilename, 0) == -1) break;
}
- if ( !MoveFile(opts.filename,opts.backupFilename))
- AddToStatus(STATUS_WARNING,TranslateT("Unable to rename original file"));
+ if (!MoveFile(opts.filename, opts.backupFilename))
+ AddToStatus(STATUS_WARNING, TranslateT("Unable to rename original file"));
}
else if (!opts.bCheckOnly)
if (!DeleteFile(opts.filename))
- AddToStatus(STATUS_WARNING,TranslateT("Unable to delete original file"));
+ AddToStatus(STATUS_WARNING, TranslateT("Unable to delete original file"));
if (!opts.bCheckOnly)
if (!MoveFile(opts.outputFilename, opts.filename))
- AddToStatus(STATUS_WARNING,TranslateT("Unable to rename output file"));
+ AddToStatus(STATUS_WARNING, TranslateT("Unable to rename output file"));
}
void __cdecl WorkerThread(void *unused)
@@ -79,19 +79,19 @@ void __cdecl WorkerThread(void *unused)
AddToStatus(STATUS_MESSAGE, TranslateT("Database worker thread activated"));
- _tcscpy(opts.workingFilename,opts.filename);
+ _tcscpy(opts.workingFilename, opts.filename);
if (opts.bCheckOnly) {
_tcscpy(opts.outputFilename, TranslateT("<check only>"));
opts.hOutFile = INVALID_HANDLE_VALUE;
}
else {
- _tcscpy(opts.outputFilename,opts.filename);
- *_tcsrchr(opts.outputFilename,'.') = 0;
- _tcscat(opts.outputFilename,TranslateT(" (Output).dat"));
- opts.hOutFile = CreateFile(opts.outputFilename,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_FLAG_SEQUENTIAL_SCAN,NULL);
+ _tcscpy(opts.outputFilename, opts.filename);
+ *_tcsrchr(opts.outputFilename, '.') = 0;
+ _tcscat(opts.outputFilename, TranslateT(" (Output).dat"));
+ opts.hOutFile = CreateFile(opts.outputFilename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
if (opts.hOutFile == INVALID_HANDLE_VALUE) {
- AddToStatus(STATUS_FATAL,TranslateT("Can't create output file (%u)"),GetLastError());
+ AddToStatus(STATUS_FATAL, TranslateT("Can't create output file (%u)"), GetLastError());
ProcessingDone();
return;
}
@@ -114,9 +114,9 @@ void __cdecl WorkerThread(void *unused)
callback.bConvertUtf = opts.bConvertUtf;
opts.dbChecker->Start(&callback);
- for(task = 0;;) {
- if (callback.spaceProcessed/(callback.spaceUsed/1000+1) > sp) {
- sp = callback.spaceProcessed/(callback.spaceUsed/1000+1);
+ for (task = 0;;) {
+ if (callback.spaceProcessed / (callback.spaceUsed / 1000 + 1) > sp) {
+ sp = callback.spaceProcessed / (callback.spaceUsed / 1000 + 1);
SetProgressBar(sp);
}
WaitForSingleObject(hEventRun, INFINITE);
@@ -124,15 +124,15 @@ void __cdecl WorkerThread(void *unused)
AddToStatus(STATUS_FATAL, TranslateT("Processing aborted by user"));
break;
}
-
+
int ret = opts.dbChecker->CheckDb(task, firstTime);
firstTime = 0;
if (ret == ERROR_OUT_OF_PAPER) {
Finalize(ts);
- AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(NULL)-ts);
- if (errorCount)
+ AddToStatus(STATUS_MESSAGE, TranslateT("Elapsed time: %d sec"), time(NULL) - ts);
+ if (errorCount)
AddToStatus(STATUS_SUCCESS, TranslateT("All tasks completed but with errors (%d)"), errorCount);
- else
+ else
AddToStatus(STATUS_SUCCESS, TranslateT("All tasks completed successfully"));
break;
}