diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-16 15:29:56 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-16 15:29:56 +0000 |
commit | 2def8505c21d5f20a845a90992629d072fd7250a (patch) | |
tree | 2d80abd833aa68bfc3018fe29a218921f69cb257 /src/mir_app | |
parent | 108e6336657baa03d86659944b1e96c201379ac5 (diff) |
- all name conflicts in the core fixed;
- some 64-bit issues fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14966 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat_tools.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/clc.cpp | 12 | ||||
-rw-r--r-- | src/mir_app/src/clcutils.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/database.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/descbutton.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/extracticon.cpp | 97 | ||||
-rw-r--r-- | src/mir_app/src/findadd.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/groups.cpp | 86 | ||||
-rw-r--r-- | src/mir_app/src/hotkey_opts.cpp | 45 | ||||
-rw-r--r-- | src/mir_app/src/hotkeys.cpp | 4 | ||||
-rw-r--r-- | src/mir_app/src/icolib.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/iconheader.cpp | 120 | ||||
-rw-r--r-- | src/mir_app/src/menu_clist.cpp | 20 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 28 | ||||
-rw-r--r-- | src/mir_app/src/meta_edit.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/netlibbind.cpp | 8 | ||||
-rw-r--r-- | src/mir_app/src/netlibupnp.cpp | 18 | ||||
-rw-r--r-- | src/mir_app/src/options.cpp | 12 |
18 files changed, 229 insertions, 277 deletions
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 0ba4c381c8..b4e6b78dc0 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -36,10 +36,10 @@ int GetRichTextLength(HWND hwnd) /////////////////////////////////////////////////////////////////////////////////////////
-static TCHAR szTemp[10000];
-
TCHAR* RemoveFormatting(const TCHAR *pszWord)
{
+ static TCHAR szTemp[10000];
+
if (pszWord == NULL)
return NULL;
@@ -184,7 +184,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoNa pd.lchIcon = LoadIconEx("window", FALSE);
PROTOACCOUNT *pa = Proto_GetAccount(pszProtoName);
- mir_sntprintf(pd.lptzContactName, _countof(pd.lptzContactName), _T("%s - %s"),
+ mir_sntprintf(pd.lptzContactName, _countof(pd.lptzContactName), _T("%s - %s"),
(pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
cli.pfnGetContactDisplayName(hContact, 0));
@@ -370,8 +370,8 @@ int GetColorIndex(const char *pszModule, COLORREF cr) return -1;
for (i = 0; i < pMod->nColorCount; i++)
- if (pMod->crColors[i] == cr)
- return i;
+ if (pMod->crColors[i] == cr)
+ return i;
return -1;
}
@@ -407,9 +407,9 @@ const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) {
int i, j, k;
for (i = 0; s1[i]; i++)
- for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
- if (!s2[k + 1])
- return s1 + i;
+ for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ if (!s2[k + 1])
+ return s1 + i;
return NULL;
}
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 3410754d1c..d08d7736b0 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -248,7 +248,7 @@ void UnloadClcModule() /////////////////////////////////////////////////////////////////////////////////////////
// default contact list control window procedure
-LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
ClcGroup *group;
ClcContact *contact;
@@ -256,10 +256,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, int hit;
ClcData *dat = (struct ClcData *) GetWindowLongPtr(hwnd, 0);
- if (msg >= CLM_FIRST && msg < CLM_LAST)
- return cli.pfnProcessExternalMessages(hwnd, dat, msg, wParam, lParam);
+ if (uMsg >= CLM_FIRST && uMsg < CLM_LAST)
+ return cli.pfnProcessExternalMessages(hwnd, dat, uMsg, wParam, lParam);
- switch (msg) {
+ switch (uMsg) {
case WM_CREATE:
WindowList_Add(hClcWindowList, hwnd, NULL);
cli.pfnRegisterFileDropping(hwnd);
@@ -851,7 +851,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, ReleaseCapture();
if (wParam == VK_F10 && GetKeyState(VK_SHIFT) & 0x8000)
break;
- SendMessage(GetParent(hwnd), msg, wParam, lParam);
+ SendMessage(GetParent(hwnd), uMsg, wParam, lParam);
return 0;
case WM_TIMER:
@@ -1314,5 +1314,5 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, cli.pfnUnregisterFileDropping(hwnd);
WindowList_Remove(hClcWindowList, hwnd);
}
- return DefWindowProc(hwnd, msg, wParam, lParam);
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 378fd7f809..1dff6ca3d3 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -451,9 +451,9 @@ void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat) }
}
-static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (msg) {
+ switch (uMsg) {
case WM_KEYDOWN:
switch (wParam) {
case VK_RETURN:
@@ -466,7 +466,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara break;
case WM_GETDLGCODE:
if (lParam) {
- MSG *msg = (MSG *) lParam;
+ MSG *msg = (MSG*)lParam;
if (msg->message == WM_KEYDOWN && msg->wParam == VK_TAB)
return 0;
if (msg->message == WM_CHAR && msg->wParam == '\t')
@@ -477,7 +477,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara cli.pfnEndRename(GetParent(hwnd), (struct ClcData *) GetWindowLongPtr(GetParent(hwnd), 0), 1);
return 0;
}
- return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam);
+ return mir_callNextSubclass(hwnd, RenameEditSubclassProc, uMsg, wParam, lParam);
}
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat)
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index 286a8f4793..6066d0c059 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -195,7 +195,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE) do {
TCHAR path[MAX_PATH], path2[MAX_PATH];
TCHAR* profile = mir_tstrdup(ffd.cFileName);
- TCHAR *c = _tcsrchr(profile, '.'); if (c) *c = 0;
+ c = _tcsrchr(profile, '.'); if (c) *c = 0;
mir_sntprintf(path, _countof(path), _T("%s\\%s"), pfd, ffd.cFileName);
mir_sntprintf(path2, _countof(path2), _T("%s\\%s"), profiledir, profile);
CreateDirectoryTreeT(path2);
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp index 57110d779d..ed66b46a05 100644 --- a/src/mir_app/src/descbutton.cpp +++ b/src/mir_app/src/descbutton.cpp @@ -180,7 +180,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat) GetObject(dat->hFont, sizeof(lf), &lf);
lf.lfWeight = FW_BOLD;
lf.lfHeight *= 1.5;
- HFONT hfntSave = (HFONT)SelectObject(tempDC, CreateFontIndirect(&lf));
+ HFONT hOldFont = (HFONT)SelectObject(tempDC, CreateFontIndirect(&lf));
RECT textRect;
textRect.left = DBC_BORDER_SIZE + (dat->hIcon ? 32 + DBC_VSPACING : 0);
@@ -190,7 +190,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat) DrawText(tempDC, dat->lpzTitle, -1, &textRect, DT_TOP | DT_LEFT | DT_END_ELLIPSIS);
GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
- DeleteObject(SelectObject(tempDC, hfntSave));
+ DeleteObject(SelectObject(tempDC, hOldFont));
}
if (dat->lpzDescription) {
diff --git a/src/mir_app/src/extracticon.cpp b/src/mir_app/src/extracticon.cpp index 3d9ccfcb29..149b1094de 100644 --- a/src/mir_app/src/extracticon.cpp +++ b/src/mir_app/src/extracticon.cpp @@ -49,13 +49,12 @@ typedef struct #define VER30 0x00030000
-void* _RelativeVirtualAddresstoPtr(IMAGE_DOS_HEADER* pDosHeader, DWORD rva)
+void* _RelativeVirtualAddresstoPtr(IMAGE_DOS_HEADER *pDosHeader, DWORD rva)
{
- IMAGE_NT_HEADERS* pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
- IMAGE_SECTION_HEADER* pSection = IMAGE_FIRST_SECTION(pPE);
- int i;
+ IMAGE_NT_HEADERS *pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
+ IMAGE_SECTION_HEADER *pSection = IMAGE_FIRST_SECTION(pPE);
- for (i=0; i < pPE->FileHeader.NumberOfSections; i++) {
+ for (int i = 0; i < pPE->FileHeader.NumberOfSections; i++) {
IMAGE_SECTION_HEADER* cSection = &pSection[i];
DWORD size = cSection->Misc.VirtualSize ? cSection->Misc.VirtualSize : cSection->SizeOfRawData;
@@ -68,18 +67,14 @@ void* _RelativeVirtualAddresstoPtr(IMAGE_DOS_HEADER* pDosHeader, DWORD rva) void* _GetResourceTable(IMAGE_DOS_HEADER* pDosHeader)
{
- IMAGE_NT_HEADERS* pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
-
- if (pPE->Signature != IMAGE_NT_SIGNATURE)
- return NULL;
- if (pPE->FileHeader.SizeOfOptionalHeader < 2)
+ IMAGE_NT_HEADERS *pPE = (IMAGE_NT_HEADERS*)((BYTE*)pDosHeader + pDosHeader->e_lfanew);
+ if (pPE->Signature != IMAGE_NT_SIGNATURE || pPE->FileHeader.SizeOfOptionalHeader < 2)
return NULL;
// The DataDirectory is an array of 16 structures.
// Each array entry has a predefined meaning for what it refers to.
- switch (pPE->OptionalHeader.Magic)
- {
+ switch (pPE->OptionalHeader.Magic) {
case IMAGE_NT_OPTIONAL_HDR32_MAGIC:
if (pPE->FileHeader.SizeOfOptionalHeader >= sizeof(IMAGE_OPTIONAL_HEADER32))
return _RelativeVirtualAddresstoPtr(pDosHeader, ((PIMAGE_NT_HEADERS32)pPE)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE].VirtualAddress);
@@ -94,47 +89,41 @@ void* _GetResourceTable(IMAGE_DOS_HEADER* pDosHeader) return NULL;
}
-IMAGE_RESOURCE_DIRECTORY_ENTRY* _FindResourceBase(void* prt, int resType, int* pCount)
+IMAGE_RESOURCE_DIRECTORY_ENTRY* _FindResourceBase(void *prt, DWORD resType, int *pCount)
{
- IMAGE_RESOURCE_DIRECTORY* pDir = (IMAGE_RESOURCE_DIRECTORY*)prt;
- IMAGE_RESOURCE_DIRECTORY_ENTRY* pRes;
- int i, count;
+ IMAGE_RESOURCE_DIRECTORY *pDir = (IMAGE_RESOURCE_DIRECTORY*)prt;
+ int i;
*pCount = 0;
- count = pDir->NumberOfIdEntries + pDir->NumberOfNamedEntries;
- pRes = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(pDir+1);
-
- for (i=0; i < count; i++)
- if (pRes[i].Name == (DWORD)resType) break;
+ int count = pDir->NumberOfIdEntries + pDir->NumberOfNamedEntries;
+ IMAGE_RESOURCE_DIRECTORY_ENTRY *pRes = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(pDir + 1);
- if (i == count) return NULL;
+ for (i = 0; i < count; i++)
+ if (pRes[i].Name == resType)
+ break;
- pDir = (IMAGE_RESOURCE_DIRECTORY*)((LPBYTE)prt +
- (pRes[i].OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY));
+ if (i == count)
+ return NULL;
+ pDir = (IMAGE_RESOURCE_DIRECTORY*)((LPBYTE)prt + (pRes[i].OffsetToData & ~IMAGE_RESOURCE_DATA_IS_DIRECTORY));
count = pDir->NumberOfIdEntries + pDir->NumberOfNamedEntries;
*pCount = count;
- pRes = (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(pDir+1);
-
- return pRes;
+ return (IMAGE_RESOURCE_DIRECTORY_ENTRY*)(pDir + 1);
}
-int _FindResourceCount(void* prt, int resType)
+int _FindResourceCount(void *prt, DWORD resType)
{
int count;
-
_FindResourceBase(prt, resType, &count);
return count;
}
-void* _FindResource(IMAGE_DOS_HEADER* pDosHeader, void* prt, int resIndex, int resType, DWORD* pcbSize)
+void* _FindResource(IMAGE_DOS_HEADER *pDosHeader, void *prt, int resIndex, DWORD resType, DWORD *pcbSize)
{
int count, index = 0;
- IMAGE_RESOURCE_DIRECTORY_ENTRY* pRes;
- IMAGE_RESOURCE_DATA_ENTRY* pEntry;
- pRes = _FindResourceBase(prt, resType, &count);
+ IMAGE_RESOURCE_DIRECTORY_ENTRY *pRes = _FindResourceBase(prt, resType, &count);
if (resIndex < 0) {
for (index = 0; index < count; index++)
if (pRes[index].Name == (DWORD)(-resIndex))
@@ -155,7 +144,7 @@ void* _FindResource(IMAGE_DOS_HEADER* pDosHeader, void* prt, int resIndex, int r if (pRes[index].OffsetToData & IMAGE_RESOURCE_DATA_IS_DIRECTORY)
return NULL;
- pEntry = (IMAGE_RESOURCE_DATA_ENTRY*)((LPBYTE)prt + pRes[index].OffsetToData);
+ IMAGE_RESOURCE_DATA_ENTRY *pEntry = (IMAGE_RESOURCE_DATA_ENTRY*)((LPBYTE)prt + pRes[index].OffsetToData);
*pcbSize = pEntry->Size;
return _RelativeVirtualAddresstoPtr(pDosHeader, pEntry->OffsetToData);
}
@@ -164,39 +153,34 @@ UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize {
int retval = 0;
DWORD fileLen = GetFileSize(hFile, NULL);
- HANDLE hFileMap = INVALID_HANDLE_VALUE, pFile = NULL;
- IMAGE_DOS_HEADER* pDosHeader;
- void* pRes;
- DWORD cbSize = 0;
- NEWHEADER* pIconDir;
- int idIcon;
- LPBITMAPINFOHEADER pIcon;
- // UINT res = 0;
- hFileMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if (hFileMap == NULL) goto cleanup;
+ HANDLE pFile = NULL, hFileMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+ if (hFileMap == NULL)
+ goto cleanup;
pFile = MapViewOfFile(hFileMap, FILE_MAP_READ, 0, 0, 0);
- if (pFile == NULL) goto cleanup;
+ if (pFile == NULL)
+ goto cleanup;
- pDosHeader = (IMAGE_DOS_HEADER*)(void*)pFile;
+ IMAGE_DOS_HEADER *pDosHeader = (IMAGE_DOS_HEADER*)(void*)pFile;
if (pDosHeader->e_magic != IMAGE_DOS_SIGNATURE) goto cleanup;
if (pDosHeader->e_lfanew <= 0) goto cleanup;
if ((DWORD)(pDosHeader->e_lfanew) >= fileLen) goto cleanup;
- pRes = _GetResourceTable(pDosHeader);
+ void *pRes = _GetResourceTable(pDosHeader);
if (!pRes) goto cleanup;
if (!phicon) {
- retval = _FindResourceCount(pRes, (int)RT_GROUP_ICON);
+ retval = _FindResourceCount(pRes, (ULONG_PTR)RT_GROUP_ICON);
goto cleanup;
}
- pIconDir = (NEWHEADER*)_FindResource(pDosHeader, pRes, iconIndex, (int)RT_GROUP_ICON, &cbSize);
+ DWORD cbSize = 0;
+ NEWHEADER *pIconDir = (NEWHEADER*)_FindResource(pDosHeader, pRes, iconIndex, (ULONG_PTR)RT_GROUP_ICON, &cbSize);
if (!pIconDir) goto cleanup;
if (pIconDir->Reserved || pIconDir->ResType != RES_ICON) goto cleanup;
- idIcon = LookupIconIdFromDirectoryEx((LPBYTE)pIconDir, TRUE, cxIconSize, cyIconSize, flags);
- pIcon = (LPBITMAPINFOHEADER)_FindResource(pDosHeader, pRes, -idIcon, (int)RT_ICON, &cbSize);
+ int idIcon = LookupIconIdFromDirectoryEx((LPBYTE)pIconDir, TRUE, cxIconSize, cyIconSize, flags);
+ LPBITMAPINFOHEADER pIcon = (LPBITMAPINFOHEADER)_FindResource(pDosHeader, pRes, -idIcon, (ULONG_PTR)RT_ICON, &cbSize);
if (!pIcon) goto cleanup;
if (pIcon->biSize != sizeof(BITMAPINFOHEADER) && pIcon->biSize != sizeof(BITMAPCOREHEADER)) {
@@ -208,16 +192,15 @@ UINT _ExtractFromExe(HANDLE hFile, int iconIndex, int cxIconSize, int cyIconSize retval = 1;
cleanup:
- if (pFile) UnmapViewOfFile(pFile);
- if (hFileMap != INVALID_HANDLE_VALUE) CloseHandle(hFileMap);
-
+ if (pFile)
+ UnmapViewOfFile(pFile);
+ if (hFileMap != INVALID_HANDLE_VALUE)
+ CloseHandle(hFileMap);
return retval;
}
UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, HICON* phicon, UINT flags)
{
- HICON hicon;
-
if (iconIndex >= 1)
return 0;
@@ -226,7 +209,7 @@ UINT _ExtractFromICO(LPCTSTR pFileName, int iconIndex, int cxIcon, int cyIcon, H return 1;
flags |= LR_LOADFROMFILE;
- hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
+ HICON hicon = (HICON)LoadImage(NULL, pFileName, IMAGE_ICON, cxIcon, cyIcon, flags);
if (!hicon)
return 0;
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index 2a4b5e29b8..d044dd6550 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -314,6 +314,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP { FindAddDlgData *dat = (FindAddDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); HWND hwndList = GetDlgItem(hwndDlg, IDC_RESULTS); + RECT rc, rc2; switch (msg) { case WM_INITDIALOG: @@ -328,10 +329,9 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Ctrl+Search add contact"), BATF_TCHAR); ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP); - { - RECT rc; - GetClientRect(hwndList, &rc); + GetClientRect(hwndList, &rc); + { LVCOLUMN lvc; lvc.mask = LVCF_TEXT | LVCF_WIDTH; lvc.pszText = TranslateT("Results"); @@ -440,7 +440,6 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP ReposTinySearchDlg(hwndDlg, dat); SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_SIZE, 0, 0); if (dat->notSearchedYet) { - RECT rc; GetClientRect(hwndList, &rc); ListView_SetColumnWidth(hwndList, 0, rc.right); } @@ -448,14 +447,12 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP //fall through case WM_MOVE: if (dat && dat->hwndAdvSearch) { - RECT rc; GetWindowRect(hwndList, &rc); SetWindowPos(dat->hwndAdvSearch, 0, rc.left, rc.top, 0, 0, SWP_NOZORDER | SWP_NOSIZE); } break; case WM_GETMINMAXINFO: - RECT rc, rc2; GetWindowRect(hwndList, &rc); GetWindowRect(hwndDlg, &rc2); { @@ -547,7 +544,6 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP MINMAXINFO mmi; SendMessage(hwndDlg, WM_GETMINMAXINFO, 0, (LPARAM)&mmi); - RECT rc; GetWindowRect(hwndDlg, &rc); if (rc.bottom - rc.top < mmi.ptMinTrackSize.y) SetWindowPos(hwndDlg, 0, 0, 0, rc.right - rc.left, mmi.ptMinTrackSize.y, SWP_NOZORDER | SWP_NOMOVE); @@ -559,7 +555,6 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP int borders[3]; SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETBORDERS, 0, (LPARAM)borders); - RECT rc; SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_GETRECT, 1, (LPARAM)&rc); InflateRect(&rc, -borders[2] / 2, -borders[1] / 2); HDC hdc = GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR)); @@ -787,7 +782,6 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP break; case IDC_MOREOPTIONS: - RECT rc; GetWindowRect(GetDlgItem(hwndDlg, IDC_MOREOPTIONS), &rc); ShowMoreOptionsMenu(hwndDlg, rc.left, rc.bottom); break; @@ -883,7 +877,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP LVITEM lvi = { 0 }; lvi.mask = LVIF_PARAM | LVIF_IMAGE; lvi.lParam = (LPARAM)lsr; - for (int i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { + for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); if (szComboProto == NULL) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { @@ -923,7 +917,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP LVITEM lvi = { 0 }; lvi.mask = LVIF_PARAM | LVIF_IMAGE; lvi.lParam = (LPARAM)lsr; - for (int i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { + for (i = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCOUNT, 0, 0); i--;) { char *szComboProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA, i, 0); if (szComboProto == NULL) continue; if (!mir_strcmp(szComboProto, ack->szModule)) { diff --git a/src/mir_app/src/groups.cpp b/src/mir_app/src/groups.cpp index c342ca8b8c..1788da5629 100644 --- a/src/mir_app/src/groups.cpp +++ b/src/mir_app/src/groups.cpp @@ -32,10 +32,10 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam); static int CountGroups(void)
{
- for (int i=0;; i++) {
+ for (int i = 0;; i++) {
char str[33];
_itoa(i, str, 10);
- ptrT grpName( db_get_tsa(NULL, "CListGroups", str));
+ ptrT grpName(db_get_tsa(NULL, "CListGroups", str));
if (grpName == NULL)
return i;
}
@@ -43,18 +43,18 @@ static int CountGroups(void) static int GroupNameExists(const TCHAR *name, int skipGroup)
{
- for (int i=0;; i++) {
+ for (int i = 0;; i++) {
if (i == skipGroup)
continue;
char idstr[33];
_itoa(i, idstr, 10);
- ptrT grpName( db_get_tsa(NULL, "CListGroups", idstr));
+ ptrT grpName(db_get_tsa(NULL, "CListGroups", idstr));
if (grpName == NULL)
break;
- if (!mir_tstrcmp((TCHAR*)grpName+1, name))
- return i+1;
+ if (!mir_tstrcmp((TCHAR*)grpName + 1, name))
+ return i + 1;
}
return 0;
}
@@ -99,7 +99,7 @@ static INT_PTR CreateGroupInternal(INT_PTR iParent, const TCHAR *ptszName) mir_sntprintf(newName + 1, _countof(newName) - 1, _T("%s (%d)"), newBaseName, i++);
}
if (i) {
- const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, newName };
+ CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, newName };
newName[0] = 1 | GROUPF_EXPANDED; //1 is required so we never get '\0'
db_set_ts(NULL, "CListGroups", str, newName);
@@ -139,12 +139,12 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam) _itoa(wParam - 1, idstr, 10);
if (db_get_s(NULL, "CListGroups", idstr, &dbv))
- return (INT_PTR) (char *) NULL;
+ return (INT_PTR)(char *)NULL;
mir_strncpy(name, dbv.pszVal + 1, _countof(name));
- if ((DWORD *) lParam != NULL)
- *(DWORD *) lParam = dbv.pszVal[0];
+ if ((DWORD *)lParam != NULL)
+ *(DWORD *)lParam = dbv.pszVal[0];
db_free(&dbv);
- return (INT_PTR) name;
+ return (INT_PTR)name;
}
TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags)
@@ -153,7 +153,7 @@ TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags) DBVARIANT dbv;
static TCHAR name[128];
- _itoa(idx-1, idstr, 10);
+ _itoa(idx - 1, idstr, 10);
if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
return NULL;
@@ -168,8 +168,8 @@ static INT_PTR GetGroupName(WPARAM wParam, LPARAM lParam) {
INT_PTR ret;
ret = GetGroupName2(wParam, lParam);
- if ((int *) lParam)
- *(int *) lParam = 0 != (*(int *) lParam & GROUPF_EXPANDED);
+ if ((int *)lParam)
+ *(int *)lParam = 0 != (*(int *)lParam & GROUPF_EXPANDED);
return ret;
}
@@ -187,11 +187,10 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) return 1;
mir_tstrncpy(name, dbv.ptszVal + 1, _countof(name));
db_free(&dbv);
- if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT))
- {
- TCHAR szQuestion[256+100];
+ if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
+ TCHAR szQuestion[256 + 100];
mir_sntprintf(szQuestion, _countof(szQuestion), TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), name);
- if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO|MB_ICONQUESTION) == IDNO)
+ if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
}
SetCursor(LoadCursor(NULL, IDC_WAIT));
@@ -204,29 +203,23 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) else
szNewParent[0] = '\0';
- CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), NULL, NULL };
-
for (hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
if (db_get_ts(hContact, "CList", "Group", &dbv))
continue;
- if (mir_tstrcmp(dbv.ptszVal, name))
- {
+ if (mir_tstrcmp(dbv.ptszVal, name)) {
db_free(&dbv);
continue;
}
db_free(&dbv);
- if (szNewParent[0])
- {
+ CLISTGROUPCHANGE grpChg = { sizeof(grpChg), NULL, NULL };
+ if (szNewParent[0]) {
db_set_ts(hContact, "CList", "Group", szNewParent);
grpChg.pszNewName = szNewParent;
}
- else
- {
- db_unset(hContact, "CList", "Group");
- grpChg.pszNewName = NULL;
- }
+ else db_unset(hContact, "CList", "Group");
+
NotifyEventHooks(hGroupChangeEvent, hContact, (LPARAM)&grpChg);
}
//shuffle list of groups up to fill gap
@@ -244,7 +237,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) {
TCHAR szNewName[256];
size_t len = mir_tstrlen(name);
- for (i=0;; i++) {
+ for (i = 0;; i++) {
_itoa(i, str, 10);
if (db_get_ts(NULL, "CListGroups", str, &dbv))
break;
@@ -261,10 +254,8 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) SetCursor(LoadCursor(NULL, IDC_ARROW));
cli.pfnLoadContactTree();
- {
- const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), name, NULL };
- NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
- }
+ const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), name, NULL };
+ NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
return 0;
}
@@ -304,7 +295,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) {
TCHAR szNewName[256];
size_t len = mir_tstrlen(oldName);
- for (int i=0;; i++) {
+ for (int i = 0;; i++) {
if (i == groupId)
continue;
_itoa(i, idstr, 10);
@@ -327,7 +318,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) pszLastBackslash = _tcsrchr(str, '\\');
if (pszLastBackslash != NULL) {
*pszLastBackslash = '\0';
- for (i=0;; i++) {
+ for (i = 0;; i++) {
_itoa(i, idstr, 10);
if (db_get_ts(NULL, "CListGroups", idstr, &dbv))
break;
@@ -341,16 +332,15 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) }
}
}
- {
- const CLISTGROUPCHANGE grpChg = { sizeof(CLISTGROUPCHANGE), oldName, (TCHAR*)szName };
- NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
- }
+
+ const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), oldName, (TCHAR*)szName };
+ NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
return 0;
}
int fnRenameGroup(int groupID, TCHAR* newName)
{
- return -1 != RenameGroupWithMove(groupID-1, newName, 1);
+ return -1 != RenameGroupWithMove(groupID - 1, newName, 1);
}
static INT_PTR RenameGroup(WPARAM wParam, LPARAM lParam)
@@ -404,7 +394,7 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam) TCHAR *szMoveName;
DBVARIANT dbv;
- if (wParam == 0 || (LPARAM) wParam == lParam)
+ if (wParam == 0 || (LPARAM)wParam == lParam)
return 0;
_itoa(wParam - 1, str, 10);
if (db_get_ts(NULL, "CListGroups", str, &dbv))
@@ -417,7 +407,7 @@ static INT_PTR MoveGroupBefore(WPARAM wParam, LPARAM lParam) shuffleDir = -1;
}
else {
- if ((LPARAM) wParam < lParam) {
+ if ((LPARAM)wParam < lParam) {
shuffleFrom = wParam - 1;
shuffleTo = lParam - 2;
shuffleDir = -1;
@@ -469,7 +459,7 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) int menuId, compareResult, menuItemCount;
if (db_get_utf(NULL, "CListGroups", "0", &dbv))
- return (INT_PTR) (HMENU) NULL;
+ return (INT_PTR)(HMENU)NULL;
db_free(&dbv);
hRootMenu = CreateMenu();
for (groupId = 0;; groupId++) {
@@ -550,21 +540,19 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) db_free(&dbv);
}
- return (INT_PTR) hRootMenu;
+ return (INT_PTR)hRootMenu;
}
int InitGroupServices(void)
{
- for (int i=0;; i++)
- {
+ for (int i = 0;; i++) {
char str[32];
_itoa(i, str, 10);
DBVARIANT dbv;
if (db_get_utf(NULL, "CListGroups", str, &dbv))
break;
- if (dbv.pszVal[0] & 0x80)
- {
+ if (dbv.pszVal[0] & 0x80) {
dbv.pszVal[0] &= 0x7f;
db_set_utf(NULL, "CListGroups", str, dbv.pszVal);
}
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index 015c0830cc..bf255e4693 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -879,10 +879,10 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break; case LVN_ITEMCHANGED: - { + if (initialized) { LPNMLISTVIEW param = (LPNMLISTVIEW)lParam; THotkeyItem *item = (THotkeyItem *)param->lParam; - if (!initialized || (param->uNewState >> 12 == param->uOldState >> 12)) + if (param->uNewState >> 12 == param->uOldState >> 12) break; if (item && !item->rootHotkey) { @@ -901,45 +901,42 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, if (param->uNewState >> 12 == 1) { int count = ListView_GetItemCount(lpnmhdr->hwndFrom); - LVITEM lvi = { 0 }; - lvi.mask = LVIF_PARAM; - for (lvi.iItem = 0; lvi.iItem < count; ++lvi.iItem) { - THotkeyItem *item; - ListView_GetItem(lpnmhdr->hwndFrom, &lvi); - item = (THotkeyItem *)lvi.lParam; + LVITEM lvi2 = { 0 }; + lvi2.mask = LVIF_PARAM; + for (lvi2.iItem = 0; lvi2.iItem < count; ++lvi2.iItem) { + ListView_GetItem(lpnmhdr->hwndFrom, &lvi2); + item = (THotkeyItem*)lvi2.lParam; if (!item) continue; if (!mir_tstrcmp(item->getSection(), buf)) { - ListView_DeleteItem(lpnmhdr->hwndFrom, lvi.iItem); - --lvi.iItem; + ListView_DeleteItem(lpnmhdr->hwndFrom, lvi2.iItem); + --lvi2.iItem; --count; } } } else if (param->uNewState >> 12 == 2) { - int i, nItems = ListView_GetItemCount(lpnmhdr->hwndFrom); + int nItems = ListView_GetItemCount(lpnmhdr->hwndFrom); initialized = FALSE; - for (i = 0; i < hotkeys.getCount(); i++) { - LVITEM lvi = { 0 }; - THotkeyItem *item = hotkeys[i]; - - if (item->OptDeleted) - continue; - if (mir_tstrcmp(buf, item->getSection())) + for (int i = 0; i < hotkeys.getCount(); i++) { + LVITEM lvi2 = { 0 }; + item = hotkeys[i]; + if (item->OptDeleted || mir_tstrcmp(buf, item->getSection())) continue; - lvi.mask = LVIF_PARAM | LVIF_INDENT; - lvi.iIndent = 1; - lvi.iItem = nItems++; - lvi.lParam = (LPARAM)item; - ListView_InsertItem(lpnmhdr->hwndFrom, &lvi); + lvi2.mask = LVIF_PARAM | LVIF_INDENT; + lvi2.iIndent = 1; + lvi2.iItem = nItems++; + lvi2.lParam = (LPARAM)item; + ListView_InsertItem(lpnmhdr->hwndFrom, &lvi2); sttOptionsSetupItem(lpnmhdr->hwndFrom, nItems - 1, item); } ListView_SortItemsEx(lpnmhdr->hwndFrom, sttOptionsSortList, (LPARAM)lpnmhdr->hwndFrom); initialized = TRUE; } } - break; } + break; + case NM_CUSTOMDRAW: { NMLVCUSTOMDRAW *param = (NMLVCUSTOMDRAW *)lParam; diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index dfcbd9455d..b13663b191 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -308,11 +308,11 @@ void RegisterHotkeys() }
}
-MIR_APP_DLL(void) KillModuleHotkeys(int hLangpack)
+MIR_APP_DLL(void) KillModuleHotkeys(int _hLang)
{
for (int i = hotkeys.getCount() - 1; i >= 0; i--) {
THotkeyItem *item = hotkeys[i];
- if (item->hLangpack == hLangpack) {
+ if (item->hLangpack == _hLang) {
FreeHotkey(item);
hotkeys.remove(i);
}
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 9e8706e209..ff63098fc4 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -477,7 +477,7 @@ static void IcoLib_FreeIcon(IcolibItem *pItem) /////////////////////////////////////////////////////////////////////////////////////////
// IcoLib_AddIcon
-MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int hLangpack)
+MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int _hLang)
{
mir_cslock lck(csIconList);
@@ -515,7 +515,7 @@ MIR_APP_DLL(HANDLE) IcoLib_AddIcon(SKINICONDESC *sid, int hLangpack) item->cx = sid->cx;
item->cy = sid->cy;
- item->hLangpack = hLangpack;
+ item->hLangpack = _hLang;
if (sid->hDefaultIcon) {
bool big;
@@ -607,7 +607,7 @@ MIR_APP_DLL(void) IcoLib_RemoveIconByHandle(HANDLE hIcoLib) IcoLib_RemoveIcon_Internal(i);
}
-MIR_APP_DLL(void) KillModuleIcons(int hLangpack)
+MIR_APP_DLL(void) KillModuleIcons(int _hLang)
{
if (!bModuleInitialized)
return;
@@ -615,7 +615,7 @@ MIR_APP_DLL(void) KillModuleIcons(int hLangpack) mir_cslock lck(csIconList);
for (int i = iconList.getCount() - 1; i >= 0; i--) {
IcolibItem *item = iconList[i];
- if (item->hLangpack == hLangpack) {
+ if (item->hLangpack == _hLang) {
IcoLib_FreeIcon(item);
iconList.remove(i);
mir_free(item);
diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp index 103948ef32..b8e263db16 100644 --- a/src/mir_app/src/iconheader.cpp +++ b/src/mir_app/src/iconheader.cpp @@ -317,10 +317,10 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit) return TRUE;
}
-static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
MIcoTabCtrl* itc = (MIcoTabCtrl *)GetWindowLongPtr(hwndDlg, 0);
- switch(msg) {
+ switch (uMsg) {
case WM_NCCREATE:
itc = new MIcoTabCtrl; //(MIcoTabCtrl*)mir_alloc(sizeof(MIcoTabCtrl));
itc->nSelectedIdx = -1;
@@ -331,7 +331,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (IsAeroMode()) {
RECT rc; GetWindowRect(hwndDlg, &rc);
- MARGINS margins = {0, 0, rc.bottom-rc.top, 0};
+ MARGINS margins = { 0, 0, rc.bottom - rc.top, 0 };
dwmExtendFrameIntoClientArea(GetParent(hwndDlg), &margins);
}
@@ -343,12 +343,12 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_SIZE:
GetClientRect(hwndDlg, &itc->rc);
- itc->width = itc->rc.right-itc->rc.left;
- itc->height = itc->rc.bottom-itc->rc.top;
+ itc->width = itc->rc.right - itc->rc.left;
+ itc->height = itc->rc.bottom - itc->rc.top;
if (itc->pList.getCount()) {
- itc->itemWidth = (itc->width-2*ITC_BORDER_SIZE)/itc->pList.getCount();
- itc->itemHeight = itc->height-2*ITC_BORDER_SIZE-2;
+ itc->itemWidth = (itc->width - 2 * ITC_BORDER_SIZE) / itc->pList.getCount();
+ itc->itemHeight = itc->height - 2 * ITC_BORDER_SIZE - 2;
}
else itc->itemWidth = itc->itemHeight = 0;
return TRUE;
@@ -360,7 +360,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case WM_MOUSEMOVE:
if (!itc->bMouseInside) {
- TRACKMOUSEEVENT tme = {0};
+ TRACKMOUSEEVENT tme = { 0 };
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = hwndDlg;
@@ -381,8 +381,7 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return 0;
case WM_LBUTTONUP:
- if ((itc->nHotIdx >= 0) && (itc->nHotIdx != itc->nSelectedIdx))
- {
+ if ((itc->nHotIdx >= 0) && (itc->nHotIdx != itc->nSelectedIdx)) {
itc->nSelectedIdx = itc->nHotIdx;
SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
@@ -402,19 +401,15 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return MA_ACTIVATE;
case WM_GETDLGCODE:
- {
- if (lParam)
- {
- MSG *msg = (MSG *) lParam;
- if (msg->message == WM_KEYDOWN)
- {
+ if (lParam) {
+ MSG *msg = (MSG *)lParam;
+ if (msg->message == WM_KEYDOWN) {
if (msg->wParam == VK_TAB)
return 0;
if (msg->wParam == VK_ESCAPE)
return 0;
- } else
- if (msg->message == WM_CHAR)
- {
+ }
+ else if (msg->message == WM_CHAR) {
if (msg->wParam == '\t')
return 0;
if (msg->wParam == 27)
@@ -422,33 +417,30 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L }
}
return DLGC_WANTMESSAGE;
- }
case WM_KEYDOWN:
- {
- int newIdx = itc->nSelectedIdx;
- switch (wParam)
- {
- case VK_NEXT:
- case VK_RIGHT:
- newIdx++;
- break;
- case VK_PRIOR:
- case VK_LEFT:
- newIdx--;
- break;
- }
- if ((newIdx >= 0) && (newIdx < itc->pList.getCount()) && (newIdx != itc->nSelectedIdx))
{
- itc->nSelectedIdx = newIdx;
- SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
- SendMessage(GetParent(hwndDlg), WM_COMMAND,
- MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD),
- itc->nSelectedIdx);
+ int newIdx = itc->nSelectedIdx;
+ switch (wParam) {
+ case VK_NEXT:
+ case VK_RIGHT:
+ newIdx++;
+ break;
+ case VK_PRIOR:
+ case VK_LEFT:
+ newIdx--;
+ break;
+ }
+ if ((newIdx >= 0) && (newIdx < itc->pList.getCount()) && (newIdx != itc->nSelectedIdx)) {
+ itc->nSelectedIdx = newIdx;
+ SetWindowText(hwndDlg, itc->pList[itc->nSelectedIdx]->tcsName);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND,
+ MAKEWPARAM(GetWindowLongPtr(hwndDlg, GWL_ID), ITCN_SELCHANGEDKBD),
+ itc->nSelectedIdx);
+ }
}
return 0;
- }
case WM_ERASEBKGND:
return 1;
@@ -475,32 +467,32 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L return TRUE;
case ITCM_ADDITEM:
- {
- MIcoTab* pMit = (MIcoTab *)wParam;
- if (!pMit)
- return FALSE;
-
- MIcoTab* pListMit = (MIcoTab *)mir_calloc(sizeof(MIcoTab));
- pListMit->flag = pMit->flag;
- pListMit->data = pMit->data;
- if (pMit->flag & MITCF_UNICODE)
- pListMit->tcsName = mir_u2t(pMit->lpwzName);
- else
- pListMit->tcsName = mir_a2t(pMit->lpzName);
- if (pMit->hIcon) {
- if (pListMit->flag&MITCF_SHAREDICON)
- pListMit->hIcon = pMit->hIcon;
+ {
+ MIcoTab* pMit = (MIcoTab *)wParam;
+ if (!pMit)
+ return FALSE;
+
+ MIcoTab* pListMit = (MIcoTab *)mir_calloc(sizeof(MIcoTab));
+ pListMit->flag = pMit->flag;
+ pListMit->data = pMit->data;
+ if (pMit->flag & MITCF_UNICODE)
+ pListMit->tcsName = mir_u2t(pMit->lpwzName);
else
- pListMit->hIcon = CopyIcon(pMit->hIcon);
- }
- itc->pList.insert(pListMit);
+ pListMit->tcsName = mir_a2t(pMit->lpzName);
+ if (pMit->hIcon) {
+ if (pListMit->flag&MITCF_SHAREDICON)
+ pListMit->hIcon = pMit->hIcon;
+ else
+ pListMit->hIcon = CopyIcon(pMit->hIcon);
+ }
+ itc->pList.insert(pListMit);
- itc->itemWidth = (itc->width-2*ITC_BORDER_SIZE)/itc->pList.getCount();
- itc->itemHeight = itc->height-2*ITC_BORDER_SIZE-2;
+ itc->itemWidth = (itc->width - 2 * ITC_BORDER_SIZE) / itc->pList.getCount();
+ itc->itemHeight = itc->height - 2 * ITC_BORDER_SIZE - 2;
- RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ RedrawWindow(hwndDlg, NULL, NULL, RDW_INVALIDATE);
+ }
return TRUE;
- }
case ITCM_SETSEL:
if ((int)wParam >= 0 && (int)wParam < itc->pList.getCount()) {
@@ -530,5 +522,5 @@ static LRESULT CALLBACK MIcoTabWndProc(HWND hwndDlg, UINT msg, WPARAM wParam, L delete itc;
return TRUE;
}
- return DefWindowProc(hwndDlg, msg, wParam, lParam);
+ return DefWindowProc(hwndDlg, uMsg, wParam, lParam);
}
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 5bfeeee21b..ab800a247f 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -65,7 +65,7 @@ const int skinIconStatusList[MAX_STATUS_COUNT] = static const int statusModePf2List[MAX_STATUS_COUNT] =
{
- 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND,
+ -1, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND,
PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH
};
@@ -351,7 +351,7 @@ static INT_PTR FreeOwnerDataContactMenu(WPARAM, LPARAM lParam) struct StatusMenuExecParam
{
char *szProto; // This is unique protoname
- int protoindex;
+ HGENMENU pimi;
int status;
BOOL custom;
@@ -567,7 +567,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) return 0;
}
- if (smep->status == 0 && smep->protoindex != 0 && smep->szProto != NULL) {
+ if (smep->status == 0 && smep->pimi != NULL && smep->szProto != NULL) {
char *prot = smep->szProto;
char szHumanName[64] = { 0 };
PROTOACCOUNT *acc = Proto_GetAccount(smep->szProto);
@@ -576,7 +576,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM) CallProtoServiceInt(NULL, smep->szProto, PS_GETNAME, _countof(szHumanName), (LPARAM)szHumanName);
- TMO_IntMenuItem *pimi = MO_GetIntMenuItem((HGENMENU)smep->protoindex);
+ TMO_IntMenuItem *pimi = MO_GetIntMenuItem(smep->pimi);
if (pimi == NULL)
return 0;
@@ -852,14 +852,13 @@ void RebuildMenuOrder(void) else mi.name.t = pa->tszAccountName;
TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, &mi, smep);
- smep->protoindex = (int)pimi;
+ smep->pimi = pimi;
Menu_ModifyItem(pimi, mi.name.t, mi.hIcon, mi.flags);
cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
cli.menuProtos[cli.menuProtoCount].pMenu = rootmenu;
cli.menuProtos[cli.menuProtoCount].szProto = mir_strdup(pa->szModuleName);
-
cli.menuProtoCount++;
char buf[256];
@@ -884,17 +883,16 @@ void RebuildMenuOrder(void) mi.hIcon = Skin_LoadProtoIcon(pa->szModuleName, statusModeList[j]);
// owner data
- StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
+ smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = FALSE;
smep->status = statusModeList[j];
- smep->protoindex = i;
+ smep->pimi = (HGENMENU)i;
smep->szProto = mir_strdup(pa->szModuleName);
hStatusMenuHandles[i].protoindex = i;
hStatusMenuHandles[i].protostatus[j] = statusModeList[j];
hStatusMenuHandles[i].menuhandle[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
- char buf[256];
mir_snprintf(buf, "ProtocolIcon_%s_%s", pa->szModuleName, mi.name.a);
Menu_ConfigureItem(hStatusMenuHandles[i].menuhandle[j], MCI_OPT_UNIQUENAME, buf);
@@ -1019,7 +1017,8 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) for (int i = 0; i < accounts.getCount(); i++) {
if (!mir_strcmp(accounts[i]->szModuleName, ack->szModule)) {
- if (((int)ack->hProcess >= ID_STATUS_OFFLINE || (int)ack->hProcess == 0) && (int)ack->hProcess < ID_STATUS_OFFLINE + _countof(statusModeList)) {
+ int iOldStatus = (int)ack->hProcess;
+ if ((iOldStatus >= ID_STATUS_OFFLINE || iOldStatus == 0) && iOldStatus < ID_STATUS_OFFLINE + _countof(statusModeList)) {
int pos = statustopos((int)ack->hProcess);
if (pos == -1)
pos = 0;
@@ -1036,7 +1035,6 @@ static int MenuProtoAck(WPARAM, LPARAM lParam) }
}
- //BuildStatusMenu(0, 0);
return 0;
}
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index a0e278981d..583acb9cb4 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -328,7 +328,7 @@ MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet) /////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcon, int iFlags)
+MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcolib, int iFlags)
{
if (!bIsGenMenuInited)
return -1;
@@ -348,8 +348,8 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HAND pimi->mi.flags = (iFlags & 0x07) | oldflags;
}
- if (hIcon != INVALID_HANDLE_VALUE && !bIconsDisabled) {
- HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcon);
+ if (hIcolib != INVALID_HANDLE_VALUE && !bIconsDisabled) {
+ HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcolib);
if (hIcolibItem) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
if (hIcon != NULL) {
@@ -360,9 +360,9 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HAND else pimi->iconId = -1, pimi->hIcolibItem = NULL;
}
else {
- pimi->mi.hIcolibItem = (HICON)hIcon;
- if (hIcon != NULL)
- pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcon);
+ pimi->mi.hIcon = (HICON)hIcolib;
+ if (hIcolib != NULL)
+ pimi->iconId = ImageList_ReplaceIcon(pimi->parent->m_hMenuIcons, pimi->iconId, (HICON)hIcolib);
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
@@ -409,9 +409,9 @@ TMO_IntMenuItem *MO_GetIntMenuItem(HGENMENU wParam) /////////////////////////////////////////////////////////////////////////////////////////
-static int FindMenuByCommand(TMO_IntMenuItem *pimi, void* pCommand)
+static int FindMenuByCommand(TMO_IntMenuItem *pimi, void *pCommand)
{
- return (pimi->iCommand == (int)pCommand);
+ return (pimi->iCommand == *(int*)pCommand);
}
int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam)
@@ -426,7 +426,7 @@ int MO_ProcessCommandBySubMenuIdent(int menuID, int command, LPARAM lParam) if (pmo == NULL)
return -1;
- pimi = MO_RecursiveWalkMenu(pmo->m_items.first, FindMenuByCommand, (void*)command);
+ pimi = MO_RecursiveWalkMenu(pmo->m_items.first, FindMenuByCommand, &command);
}
return (pimi) ? Menu_ProcessCommand(pimi, lParam) : -1;
@@ -441,7 +441,7 @@ MIR_APP_DLL(BOOL) Menu_ProcessCommandById(int command, LPARAM lParam) mir_cslock lck(csMenuHook);
for (int i = 0; i < g_menus.getCount(); i++)
- if (TMO_IntMenuItem *pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, (void*)command))
+ if (TMO_IntMenuItem *pimi = MO_RecursiveWalkMenu(g_menus[i]->m_items.first, FindMenuByCommand, &command))
return Menu_ProcessCommand(pimi, lParam);
return false;
@@ -624,12 +624,12 @@ int KillMenuItems(TMO_IntMenuItem *pimi, KillMenuItemsParam* param) return FALSE;
}
-MIR_APP_DLL(void) KillModuleMenus(int hLangpack)
+MIR_APP_DLL(void) KillModuleMenus(int _hLang)
{
if (!bIsGenMenuInited)
return;
- KillMenuItemsParam param(hLangpack);
+ KillMenuItemsParam param(_hLang);
mir_cslock lck(csMenuHook);
for (int i = 0; i < g_menus.getCount(); i++)
@@ -673,7 +673,7 @@ static int FindRoot(TMO_IntMenuItem *pimi, void *param) return FALSE;
}
-MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib, int hLang)
+MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int position, HANDLE hIcoLib, int _hLang)
{
mir_cslock lck(csMenuHook);
TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
@@ -687,7 +687,7 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos CMenuItem mi;
mi.flags = CMIF_TCHAR;
mi.hIcolibItem = hIcoLib;
- mi.hLangpack = hLang;
+ mi.hLangpack = _hLang;
mi.name.t = (TCHAR*)ptszName;
mi.position = position;
return Menu_AddItem(hMenuObject, &mi, NULL);
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 75becf41ab..74380b78d6 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -282,7 +282,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara if (LOWORD(wParam) == IDC_LST_CONTACTS) {
LPNMLISTVIEW pnmv = (LPNMLISTVIEW)lParam;
if (pnmv->hdr.code == LVN_ITEMCHANGED) {
- int sel = ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED | LVNI_SELECTED); // return item selected
+ sel = ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED | LVNI_SELECTED); // return item selected
// enable buttons
EnableWindow(GetDlgItem(hwndDlg, IDC_BTN_REM), sel != -1);
diff --git a/src/mir_app/src/netlibbind.cpp b/src/mir_app/src/netlibbind.cpp index 4613fab402..0d944f46e8 100644 --- a/src/mir_app/src/netlibbind.cpp +++ b/src/mir_app/src/netlibbind.cpp @@ -233,10 +233,10 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (nlbp->s != INVALID_SOCKET)
if (bind(nlbp->s, (PSOCKADDR)&sin, sizeof(sin)) == 0) {
- SOCKADDR_IN sin = { 0 };
- int len = sizeof(sin);
- if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
- sin6.sin6_port = sin.sin_port;
+ SOCKADDR_IN sin2 = { 0 };
+ int len = sizeof(sin2);
+ if (!getsockname(nlbp->s, (PSOCKADDR)&sin2, &len))
+ sin6.sin6_port = sin2.sin_port;
foundPort = 1;
}
diff --git a/src/mir_app/src/netlibupnp.cpp b/src/mir_app/src/netlibupnp.cpp index 63654ea4f5..578f641c67 100644 --- a/src/mir_app/src/netlibupnp.cpp +++ b/src/mir_app/src/netlibupnp.cpp @@ -569,7 +569,7 @@ static void discoverUPnP(void) PHOSTENT he;
fd_set readfd;
- SOCKET sock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+ SOCKET s = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
SOCKADDR_IN enetaddr;
enetaddr.sin_family = AF_INET;
@@ -593,24 +593,24 @@ static void discoverUPnP(void) for (i = 3; --i && szUrl[0] == 0;) {
for (j = 0; j < nip; j++) {
if (ips)
- setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (char *)&ips[j], sizeof(unsigned));
+ setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, (char *)&ips[j], sizeof(unsigned));
buflen = mir_snprintf(buf, 1500, search_request_msg, "WANIPConnection:1");
- sendto(sock, buf, buflen, 0, (SOCKADDR*)&enetaddr, sizeof(enetaddr));
+ sendto(s, buf, buflen, 0, (SOCKADDR*)&enetaddr, sizeof(enetaddr));
LongLog(buf);
buflen = mir_snprintf(buf, 1500, search_request_msg, "WANPPPConnection:1");
- sendto(sock, buf, buflen, 0, (SOCKADDR*)&enetaddr, sizeof(enetaddr));
+ sendto(s, buf, buflen, 0, (SOCKADDR*)&enetaddr, sizeof(enetaddr));
LongLog(buf);
}
if (Miranda_Terminated()) break;
FD_ZERO(&readfd);
- FD_SET(sock, &readfd);
+ FD_SET(s, &readfd);
while (select(1, &readfd, NULL, NULL, &tv) >= 1) {
- buflen = recv(sock, buf, 1500, 0);
+ buflen = recv(s, buf, 1500, 0);
if (buflen != SOCKET_ERROR) {
buf[buflen] = 0;
LongLog(buf);
@@ -641,14 +641,14 @@ static void discoverUPnP(void) }
}
FD_ZERO(&readfd);
- FD_SET(sock, &readfd);
+ FD_SET(s, &readfd);
}
}
mir_free(buf);
mir_free(ips);
- setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF, (char *)&any, sizeof(unsigned));
- closesocket(sock);
+ setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, (char *)&any, sizeof(unsigned));
+ closesocket(s);
}
static bool findUPnPGateway(void)
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index f82806f8a5..9790fdd325 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -339,7 +339,7 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA HFONT oldFont = (HFONT)SelectObject(hdc, hFont);
SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
FillRect(hdc, &rc, GetSysColorBrush(COLOR_WINDOW));
- int oldMode = SetBkMode(hdc, TRANSPARENT);
+ oldMode = SetBkMode(hdc, TRANSPARENT);
DrawText(hdc, buf, -1, &rc, 0);
SetBkMode(hdc, oldMode);
SelectObject(hdc, oldFont);
@@ -820,7 +820,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L OPTIONSDIALOGPAGE *odp = (OPTIONSDIALOGPAGE*)psh->ppsp;
for (UINT i = 0; i < psh->nPages; i++, odp++) {
- OptionsPageData *opd = new OptionsPageData(odp);
+ opd = new OptionsPageData(odp);
if (opd->pDialog == NULL) // smth went wrong
delete opd;
else
@@ -1169,7 +1169,7 @@ void OpenAccountOptions(PROTOACCOUNT *pa) FreeOptionsData(&opi);
}
-static void OpenOptionsNow(int hLangpack, const char *pszGroup, const char *pszPage, const char *pszTab, bool bSinglePage = false)
+static void OpenOptionsNow(int _hLang, const char *pszGroup, const char *pszPage, const char *pszTab, bool bSinglePage = false)
{
if (IsWindow(hwndOptions)) {
ShowWindow(hwndOptions, SW_RESTORE);
@@ -1179,11 +1179,11 @@ static void OpenOptionsNow(int hLangpack, const char *pszGroup, const char *pszP HTREEITEM hItem = NULL;
if (pszGroup != NULL) {
ptrT ptszGroup(mir_a2t(pszGroup));
- hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(hLangpack, ptszGroup));
+ hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(_hLang, ptszGroup));
if (hItem != NULL)
- hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateTH(hLangpack, ptszPage));
+ hItem = FindNamedTreeItemAtChildren(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem, TranslateTH(_hLang, ptszPage));
}
- else hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(hLangpack, ptszPage));
+ else hItem = FindNamedTreeItemAtRoot(GetDlgItem(hwndOptions, IDC_PAGETREE), TranslateTH(_hLang, ptszPage));
if (hItem != NULL)
TreeView_SelectItem(GetDlgItem(hwndOptions, IDC_PAGETREE), hItem);
|