diff options
author | George Hazan <george.hazan@gmail.com> | 2013-12-30 18:32:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-12-30 18:32:36 +0000 |
commit | b52dd1c1f38d1aeeb01c303d405a51afa82efe3b (patch) | |
tree | 8f5f5d7d330b54a8188480b8acea9284fb94f727 /src | |
parent | b67369c7256dc40eb7aa7b3527c1cb45e2a27b27 (diff) |
code cleaning and reordering
git-svn-id: http://svn.miranda-ng.org/main/trunk@7432 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/database/database.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 52 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 26 | ||||
-rw-r--r-- | src/modules/plugins/pluginopts.cpp | 2 | ||||
-rw-r--r-- | src/modules/plugins/plugins.h | 4 |
5 files changed, 46 insertions, 40 deletions
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index c3afff451f..cbdcce2cea 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -442,7 +442,7 @@ int LoadDatabaseModule(void) EnsureCheckerLoaded(false); // unload dbchecker
- if ( arDbPlugins.getCount() == 0) {
+ if (arDbPlugins.getCount() == 0) {
TCHAR buf[256];
TCHAR* p = _tcsrchr(szProfile, '\\');
mir_sntprintf(buf, SIZEOF(buf), TranslateT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_mmap.dll or equivalent."), p ? ++p : szProfile);
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index 561f2a5e15..7245bd3dba 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -33,12 +33,14 @@ void EnsureCheckerLoaded(bool); typedef BOOL (__cdecl *ENUMPROFILECALLBACK) (TCHAR *fullpath, TCHAR *profile, LPARAM lParam);
-struct DetailsPageInit {
+struct DetailsPageInit
+{
int pageCount;
OPTIONSDIALOGPAGE *odp;
};
-struct DetailsPageData {
+struct DetailsPageData
+{
DLGTEMPLATE *pTemplate;
HINSTANCE hInst;
DLGPROC dlgProc;
@@ -46,31 +48,34 @@ struct DetailsPageData { int changed;
};
-struct DlgProfData {
- PROPSHEETHEADER * psh;
+struct DlgProfData
+{
+ PROPSHEETHEADER *psh;
HWND hwndOK, hwndSM;
- PROFILEMANAGERDATA * pd;
+ PROFILEMANAGERDATA *pd;
HANDLE hFileNotify;
};
-struct DetailsData {
+struct DetailsData
+{
HINSTANCE hInstIcmp;
HFONT hBoldFont;
int pageCount;
int currentPage;
- struct DetailsPageData *opd;
+ DetailsPageData *opd;
RECT rcDisplay;
- struct DlgProfData * prof;
+ struct DlgProfData *prof;
};
-struct ProfileEnumData {
+struct ProfileEnumData
+{
HWND hwnd;
TCHAR* szProfile;
};
extern TCHAR mirandabootini[MAX_PATH];
-void SetServiceModePlugin(pluginEntry* p);
+void SetServiceModePlugin(pluginEntry *p);
static void ThemeDialogBackground(HWND hwnd)
{
@@ -101,8 +106,8 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA }
}
while (FindNextFile(hFind, &ffd));
- FindClose(hFind);
+ FindClose(hFind);
return 1;
}
@@ -176,7 +181,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA }
else {
for (int i = 0; i < arDbPlugins.getCount(); i++) {
- DATABASELINK* p = arDbPlugins[i];
+ DATABASELINK *p = arDbPlugins[i];
LRESULT index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(p->szFullName));
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)p);
}
@@ -191,7 +196,7 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // decide if there is a default profile name given in the INI and if it should be used
if (dat->pd->noProfiles || (shouldAutoCreate(dat->pd->szProfile) && _taccess(dat->pd->szProfile, 0))) {
- TCHAR* profile = _tcsrchr(dat->pd->szProfile, '\\');
+ TCHAR *profile = _tcsrchr(dat->pd->szProfile, '\\');
if (profile) ++profile;
else profile = dat->pd->szProfile;
@@ -229,7 +234,9 @@ static INT_PTR CALLBACK DlgProfileNew(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if (hdr && hdr->code == PSN_APPLY && dat && IsWindowVisible(hwndDlg)) {
TCHAR szName[MAX_PATH];
LRESULT curSel = SendDlgItemMessage(hwndDlg, IDC_PROFILEDRIVERS, CB_GETCURSEL, 0, 0);
- if (curSel == CB_ERR) break; // should never happen
+ if (curSel == CB_ERR)
+ break; // should never happen
+
GetDlgItemText(hwndDlg, IDC_PROFILENAME, szName, SIZEOF(szName));
if (szName[0] == 0)
break;
@@ -254,11 +261,9 @@ BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam) HWND hwndList = GetDlgItem(ped->hwnd, IDC_PROFILELIST);
TCHAR sizeBuf[64];
- int iItem = 0;
- struct _stat statbuf;
bool bFileExists = false, bFileLocked = true;
- TCHAR* p = _tcsrchr(profile, '.');
+ TCHAR *p = _tcsrchr(profile, '.');
_tcscpy(sizeBuf, _T("0 KB"));
if (p != NULL) *p = 0;
@@ -267,6 +272,7 @@ BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam) item.pszText = profile;
item.iItem = 0;
+ struct _stat statbuf;
if (_tstat(fullpath, &statbuf) == 0) {
if (statbuf.st_size > 1000000) {
mir_sntprintf(sizeBuf, SIZEOF(sizeBuf), _T("%.3lf"), (double)statbuf.st_size / 1048576.0);
@@ -282,7 +288,7 @@ BOOL EnumProfilesForList(TCHAR *fullpath, TCHAR *profile, LPARAM lParam) item.iImage = bFileLocked;
- iItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
+ int iItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item);
if (lstrcmpi(ped->szProfile, fullpath) == 0)
ListView_SetItemState(hwndList, iItem, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
@@ -540,17 +546,17 @@ static INT_PTR CALLBACK DlgProfileSelect(HWND hwndDlg, UINT msg, WPARAM wParam, static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- struct DetailsData* dat = (struct DetailsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ DetailsData *dat = (DetailsData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
- struct DlgProfData * prof = (struct DlgProfData *)lParam;
+ DlgProfData *prof = (struct DlgProfData*)lParam;
PROPSHEETHEADER *psh = prof->psh;
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_DETAILSLOGO), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0));
- dat = (struct DetailsData*)mir_alloc(sizeof(struct DetailsData));
+ dat = (DetailsData*)mir_alloc(sizeof(DetailsData));
dat->prof = prof;
prof->hwndOK = GetDlgItem(hwndDlg, IDOK);
prof->hwndSM = GetDlgItem(hwndDlg, IDC_SM_COMBO);
@@ -563,7 +569,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, dat->currentPage = 0;
dat->pageCount = psh->nPages;
- dat->opd = (struct DetailsPageData*)mir_calloc(sizeof(struct DetailsPageData)*dat->pageCount);
+ dat->opd = (DetailsPageData*)mir_calloc(sizeof(DetailsPageData)*dat->pageCount);
OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
TCITEM tci;
@@ -610,7 +616,7 @@ static INT_PTR CALLBACK DlgProfileManager(HWND hwndDlg, UINT msg, WPARAM wParam, SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)-1);
SendMessage(hwndCombo, CB_SETCURSEL, 0, 0);
for (int i = 0; i < servicePlugins.getCount(); i++) {
- pluginEntry* p = servicePlugins[i];
+ pluginEntry *p = servicePlugins[i];
index = SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)TranslateTS(p->pluginname));
SendMessage(hwndCombo, CB_SETITEMDATA, index, (LPARAM)i);
}
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 9fab4512f0..0e799b933c 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -163,7 +163,7 @@ char* GetPluginNameByInstance(HINSTANCE hInstance) return NULL;
for (int i=0; i < pluginList.getCount(); i++) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
return p->bpi.pluginInfo->shortName;
}
@@ -176,7 +176,7 @@ int GetPluginLangByInstance(HINSTANCE hInstance) return NULL;
for (int i=0; i < pluginList.getCount(); i++) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if (p->bpi.pluginInfo && p->bpi.hInst == hInstance)
return p->hLangpack;
}
@@ -186,7 +186,7 @@ int GetPluginLangByInstance(HINSTANCE hInstance) int GetPluginFakeId(const MUUID &uuid, int hLangpack)
{
for (int i=0; i < pluginList.getCount(); i++) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if ( !p->bpi.hInst)
continue;
@@ -287,7 +287,7 @@ LBL_Ok: }
// perform any API related tasks to freeing
-void Plugin_Uninit(pluginEntry* p)
+void Plugin_Uninit(pluginEntry *p)
{
// if the basic API check had passed, call Unload if Load(void) was ever called
if (p->pclass & PCLASS_LOADED) {
@@ -390,7 +390,7 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam) pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
{
- pluginEntry* p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
+ pluginEntry *p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
_tcsncpy(p->pluginname, tszFileName, SIZEOF(p->pluginname));
// add it to the list anyway
@@ -620,7 +620,7 @@ static pluginEntry* getCListModule(TCHAR *exe, TCHAR *slice) int UnloadPlugin(TCHAR* buf, int bufLen)
{
for (int i = pluginList.getCount()-1; i >= 0; i--) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if ( !_tcsicmp(p->pluginname, buf)) {
GetModuleFileName(p->bpi.hInst, buf, bufLen);
Plugin_Uninit(p);
@@ -639,7 +639,7 @@ void SetServiceModePlugin(pluginEntry *p) serviceModePlugin = p;
}
-static int LaunchServicePlugin(pluginEntry* p)
+static int LaunchServicePlugin(pluginEntry *p)
{
// plugin load failed - terminating Miranda
if ( !( p->pclass & PCLASS_LOADED)) {
@@ -667,7 +667,7 @@ int LoadDefaultServiceModePlugin() size_t cbLen = _tcslen(param);
for (int i=0; i < servicePlugins.getCount(); i++) {
- pluginEntry* p = servicePlugins[i];
+ pluginEntry *p = servicePlugins[i];
if ( !_tcsnicmp(p->pluginname, param, cbLen)) {
int res = LaunchServicePlugin(p);
if (res == SERVICE_ONLYDB) // load it later
@@ -687,7 +687,7 @@ int LoadServiceModePlugin() void EnsureCheckerLoaded(bool bEnable)
{
for (int i=0; i < pluginList.getCount(); i++) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if ( _tcsicmp(p->pluginname, _T("dbchecker.dll")))
continue;
@@ -714,7 +714,7 @@ void UnloadNewPlugins(void) {
// unload everything but the special db/clist plugins
for (int i = pluginList.getCount()-1; i >= 0; i--) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if ( !(p->pclass & PCLASS_LAST) && (p->pclass & PCLASS_OK))
Plugin_Uninit(p);
}
@@ -791,7 +791,7 @@ int LoadNewPluginsModule(void) static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM)
{
- pluginEntry* p = OpenPlugin(fd->cFileName, _T("Plugins"), path);
+ pluginEntry *p = OpenPlugin(fd->cFileName, _T("Plugins"), path);
if ( !(p->pclass & PCLASS_FAILED)) {
if (pluginList_freeimg == NULL && lstrcmpi(fd->cFileName, _T("advaimg.dll")) == 0)
pluginList_freeimg = p;
@@ -848,7 +848,7 @@ void UnloadNewPluginsModule(void) // unload everything but the DB
for (int i = pluginList.getCount()-1; i >= 0; i--) {
- pluginEntry* p = pluginList[i];
+ pluginEntry *p = pluginList[i];
if (!(p->pclass & (PCLASS_DB | PCLASS_CRYPT)) && p != pluginList_crshdmp)
Plugin_Uninit(p);
}
@@ -859,7 +859,7 @@ void UnloadNewPluginsModule(void) UnloadDatabase();
for (int k = pluginList.getCount()-1; k >= 0; k--) {
- pluginEntry* p = pluginList[k];
+ pluginEntry *p = pluginList[k];
Plugin_Uninit(p);
}
diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index d3b362ad84..4190ec275a 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -198,7 +198,7 @@ LBL_Error: static bool UnloadPluginDynamically(PluginListItemData *dat)
{
- pluginEntry* p = pluginList.find((pluginEntry*)dat->fileName);
+ pluginEntry *p = pluginList.find((pluginEntry*)dat->fileName);
if (p) {
if ( !Plugin_UnloadDyn(p))
return false;
diff --git a/src/modules/plugins/plugins.h b/src/modules/plugins/plugins.h index 2b7adb7f9b..35ae742b60 100644 --- a/src/modules/plugins/plugins.h +++ b/src/modules/plugins/plugins.h @@ -66,8 +66,8 @@ int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int ch pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path);
bool TryLoadPlugin(pluginEntry *p, bool bDynamic);
-void Plugin_Uninit(pluginEntry* p);
-int Plugin_UnloadDyn(pluginEntry* p);
+void Plugin_Uninit(pluginEntry *p);
+int Plugin_UnloadDyn(pluginEntry *p);
typedef BOOL (*SCAN_PLUGINS_CALLBACK) (WIN32_FIND_DATA * fd, TCHAR *path, WPARAM wParam, LPARAM lParam);
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam);
|