diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-10 21:41:21 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-10 21:41:21 +0000 |
commit | 2ca49d1d8f694b763fde90fad9a3c9898132f8e9 (patch) | |
tree | 6a97c8fb8a9a1a11049c880293dd3147cd93f81c /src | |
parent | 771ccdb89c2ec0733cf16104709ad8670fc34c55 (diff) |
more fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12760 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/core/miranda.h | 1 | ||||
-rw-r--r-- | src/modules/clist/clistmod.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clistsettings.cpp | 13 | ||||
-rw-r--r-- | src/modules/clist/clui.cpp | 4 | ||||
-rw-r--r-- | src/modules/clist/genmenu.cpp | 89 | ||||
-rw-r--r-- | src/modules/database/database.cpp | 28 | ||||
-rw-r--r-- | src/modules/database/dbini.cpp | 1 | ||||
-rw-r--r-- | src/modules/database/mdatabasecache.cpp | 4 | ||||
-rw-r--r-- | src/modules/netlib/netlibupnp.cpp | 4 | ||||
-rw-r--r-- | src/modules/utils/utils.cpp | 36 |
10 files changed, 104 insertions, 78 deletions
diff --git a/src/core/miranda.h b/src/core/miranda.h index 88ee4b92f7..e5f6c88c1f 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -170,6 +170,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char* szModule, const char* void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key);
WORD GetHotkeyValue(INT_PTR idHotkey);
+int AssertInsideScreen(RECT &rc);
HBITMAP ConvertIconToBitmap(HICON hIcon, HIMAGELIST hIml, int iconId);
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp index 5a2346748c..22e7fbb493 100644 --- a/src/modules/clist/clistmod.cpp +++ b/src/modules/clist/clistmod.cpp @@ -392,7 +392,7 @@ int fnShowHide(WPARAM, LPARAM) //this forces the window onto the visible screen
GetWindowRect(cli.hwndContactList, &rcWindow);
- if (Utils_AssertInsideScreen(&rcWindow) == 1) {
+ if (AssertInsideScreen(rcWindow) == 1) {
MoveWindow(cli.hwndContactList, rcWindow.left, rcWindow.top,
rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp index b07344462f..5d748b175f 100644 --- a/src/modules/clist/clistsettings.cpp +++ b/src/modules/clist/clistsettings.cpp @@ -153,7 +153,7 @@ INT_PTR GetContactDisplayName(WPARAM hContact, LPARAM lParam) else if (lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
if (cacheEntry->tszName) {
- strncpy(retVal, _T2A(cacheEntry->tszName), SIZEOF(retVal));
+ strncpy_s(retVal, _T2A(cacheEntry->tszName), _TRUNCATE);
return (INT_PTR)retVal;
}
}
@@ -166,7 +166,7 @@ INT_PTR GetContactDisplayName(WPARAM hContact, LPARAM lParam) ci.dwFlag = ((lParam == GCDNF_NOMYHANDLE) ? CNF_DISPLAYNC : CNF_DISPLAY) | CNF_TCHAR;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
- strncpy(retVal, _T2A(ci.pszVal), SIZEOF(retVal));
+ strncpy_s(retVal, _T2A(ci.pszVal), _TRUNCATE);
if (cacheEntry == NULL) {
mir_free(ci.pszVal);
return (INT_PTR)mir_strdup(retVal);
@@ -212,20 +212,21 @@ int ContactDeleted(WPARAM wParam, LPARAM) int ContactSettingChanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- DBVARIANT dbv;
// Early exit
if (hContact == NULL)
return 0;
+ DBVARIANT dbv;
dbv.pszVal = NULL;
if (!db_get(hContact, "Protocol", "p", &dbv)) {
if (!strcmp(cws->szModule, dbv.pszVal)) {
cli.pfnInvalidateDisplayNameCacheEntry(hContact);
if (!strcmp(cws->szSetting, "UIN") || !strcmp(cws->szSetting, "Nick") || !strcmp(cws->szSetting, "FirstName")
- || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail")) {
- CallService(MS_CLUI_CONTACTRENAMED, hContact, 0);
- }
+ || !strcmp(cws->szSetting, "LastName") || !strcmp(cws->szSetting, "e-mail"))
+ {
+ CallService(MS_CLUI_CONTACTRENAMED, hContact, 0);
+ }
else if (!strcmp(cws->szSetting, "Status")) {
if (!db_get_b(hContact, "CList", "Hidden", 0)) {
if (db_get_b(NULL, "CList", "HideOffline", SETTING_HIDEOFFLINE_DEFAULT)) {
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index 8c03793121..74afdda313 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -291,7 +291,7 @@ int LoadCLUIModule(void) pos.right = pos.left + (int)db_get_dw(NULL, "CList", "Width", 108);
pos.bottom = pos.top + (int)db_get_dw(NULL, "CList", "Height", 310);
- Utils_AssertInsideScreen(&pos);
+ AssertInsideScreen(pos);
cli.hwndContactList = CreateWindowEx(
(db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
@@ -750,7 +750,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM {
RECT rc;
GetWindowRect(hwnd, &rc);
- if (Utils_AssertInsideScreen(&rc) == 1)
+ if (AssertInsideScreen(rc) == 1)
MoveWindow(hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
}
return DefWindowProc(hwnd, msg, wParam, lParam);
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 9391a8693d..d3a9728510 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -109,8 +109,9 @@ PMO_IntMenuItem MO_RecursiveWalkMenu(PMO_IntMenuItem parent, pfnWalkFunc func, v }
///////////////////////////////////////////////////////////////////////////////
-//wparam = 0
-//lparam = LPMEASUREITEMSTRUCT
+// wparam = 0
+// lparam = LPMEASUREITEMSTRUCT
+
int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis)
{
if (!bIsGenMenuInited)
@@ -136,8 +137,9 @@ int MO_MeasureMenuItem(LPMEASUREITEMSTRUCT mis) }
///////////////////////////////////////////////////////////////////////////////
-//wparam = 0
-//lparam = LPDRAWITEMSTRUCT
+// wparam = 0
+// lparam = LPDRAWITEMSTRUCT
+
int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis)
{
if (!bIsGenMenuInited)
@@ -190,7 +192,9 @@ int MO_RemoveAllObjects() return 0;
}
-//wparam = MenuObjectHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+
INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM)
{
if (!bIsGenMenuInited)
@@ -206,8 +210,10 @@ INT_PTR MO_RemoveMenuObject(WPARAM wParam, LPARAM) return 0;
}
-//wparam = MenuObjectHandle
-//lparam = vKey
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = vKey
+
INT_PTR MO_ProcessHotKeys(HANDLE menuHandle, INT_PTR vKey)
{
if (!bIsGenMenuInited)
@@ -255,8 +261,9 @@ INT_PTR MO_GetProtoRootMenu(WPARAM wParam, LPARAM lParam) return NULL;
}
-//wparam = MenuItemHandle
-//lparam = PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuItemHandle
+// lparam = PMO_MenuItem
INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam)
{
PMO_MenuItem mi = (PMO_MenuItem)lParam;
@@ -290,8 +297,10 @@ INT_PTR MO_GetDefaultMenuItem(WPARAM wParam, LPARAM) return (pimi) ? (INT_PTR)MO_RecursiveWalkMenu(pimi, FindDefaultItem, NULL) : NULL;
}
-//wparam MenuItemHandle
-//lparam PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam MenuItemHandle
+// lparam PMO_MenuItem
+
int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi)
{
int oldflags;
@@ -349,9 +358,11 @@ int MO_ModifyMenuItem(PMO_IntMenuItem menuHandle, PMO_MenuItem pmi) return 0;
}
-//wparam MenuItemHandle
-//return ownerdata useful to free ownerdata before delete menu item,
-//NULL on error.
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam MenuItemHandle
+// return ownerdata useful to free ownerdata before delete menu item,
+// NULL on error.
+
INT_PTR MO_MenuItemGetOwnerData(WPARAM wParam, LPARAM)
{
if (!bIsGenMenuInited)
@@ -381,7 +392,8 @@ PMO_IntMenuItem MO_GetIntMenuItem(HGENMENU wParam) return result;
}
-//LOWORD(wparam) menuident
+/////////////////////////////////////////////////////////////////////////////////////////
+// LOWORD(wparam) menuident
static int FindMenuByCommand(PMO_IntMenuItem pimi, void* pCommand)
{
@@ -495,9 +507,11 @@ int MO_SetOptionsMenuObject(HANDLE handle, int setting, INT_PTR value) return res;
}
-//wparam = LPCSTR szDisplayName;
-//lparam = PMenuParam;
-//result = MenuObjectHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = LPCSTR szDisplayName;
+// lparam = PMenuParam;
+// result = MenuObjectHandle
+
INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam)
{
TMenuParam *pmp = (TMenuParam *)lParam;
@@ -517,8 +531,9 @@ INT_PTR MO_CreateNewMenuObject(WPARAM wParam, LPARAM lParam) return p->id;
}
-//wparam = MenuItemHandle
-//lparam = 0
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuItemHandle
+// lparam = 0
static int FreeMenuItem(TMO_IntMenuItem* pimi, void*)
{
@@ -612,15 +627,17 @@ static int GetNextObjectMenuItemId() return NextObjectMenuItemId++;
}
-//wparam = MenuObjectHandle
-//lparam = PMO_MenuItem
-//return MenuItemHandle
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = PMO_MenuItem
+// return MenuItemHandle
+
PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi)
{
if (!bIsGenMenuInited || pmi == NULL || pmi->cbSize != sizeof(TMO_MenuItem))
return NULL;
- //old mode
+ // old mode
if (!(pmi->flags & CMIF_ROOTHANDLE))
return MO_AddOldNewMenuItem(menuobjecthandle, pmi);
@@ -674,8 +691,9 @@ PMO_IntMenuItem MO_AddNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) return p;
}
-//wparam = MenuObjectHandle
-//lparam = PMO_MenuItem
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = MenuObjectHandle
+// lparam = PMO_MenuItem
int FindRoot(PMO_IntMenuItem pimi, void* param)
{
@@ -703,7 +721,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) //is item with popup or not
if (pmi->root == 0) {
- //yes, this without popup
+ // yes, this without popup
pmi->root = NULL; //first level
}
else { // no, search for needed root and create it if need
@@ -717,22 +735,22 @@ PMO_IntMenuItem MO_AddOldNewMenuItem(HANDLE menuobjecthandle, PMO_MenuItem pmi) mir_free(tszRoot);
if (oldroot == NULL) {
- //not found, creating root
+ // not found, creating root
TMO_MenuItem tmi = *pmi;
tmi.flags |= CMIF_ROOTHANDLE;
tmi.ownerdata = 0;
tmi.root = NULL;
- //copy pszPopupName
+ // copy pszPopupName
tmi.ptszName = (TCHAR*)pmi->root;
if ((oldroot = MO_AddNewMenuItem(menuobjecthandle, &tmi)) != NULL)
MO_SetOptionsMenuItem(oldroot, OPT_MENUITEMSETUNIQNAME, (INT_PTR)pmi->root);
}
pmi->root = oldroot;
- //popup will be created in next commands
+ // popup will be created in next commands
}
pmi->flags |= CMIF_ROOTHANDLE;
- //add popup(root allready exists)
+ // add popup(root allready exists)
return MO_AddNewMenuItem(menuobjecthandle, pmi);
}
@@ -786,12 +804,12 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l if (pimi == NULL)
return;
- //check for separator before
+ // check for separator before
if (uItem) {
UINT fType = GetMenuItemTypeData(hMenu, uItem-1, p);
if (p != NULL && fType != MFT_SEPARATOR) {
if ((p->mi.position / SEPARATORPOSITIONINTERVAL) != (pimi->mi.position / SEPARATORPOSITIONINTERVAL)) {
- //but might be supposed to be after the next one instead
+ // but might be supposed to be after the next one instead
if (!(uItem < GetMenuItemCount(hMenu) && GetMenuItemType(hMenu, uItem) == MFT_SEPARATOR))
InsertSeparator(hMenu, uItem);
uItem++;
@@ -799,7 +817,7 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l }
}
- //check for separator after
+ // check for separator after
if (uItem < GetMenuItemCount(hMenu)) {
UINT fType = GetMenuItemTypeData(hMenu, uItem, p);
if (p != NULL && fType != MFT_SEPARATOR)
@@ -1030,7 +1048,6 @@ int OnIconLibChanges(WPARAM, LPARAM) }
/////////////////////////////////////////////////////////////////////////////////////////
-//
static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*)
{
@@ -1084,7 +1101,7 @@ static int MO_RegisterIcon(PMO_IntMenuItem pmi, void*) int RegisterAllIconsInIconLib()
{
- //register all icons
+ // register all icons
for (int mo=0; mo < g_menus.getCount(); mo++) {
if ((int)hStatusMenuObject == g_menus[mo]->id) //skip status menu
continue;
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 3ae83a71c0..c39a7eb434 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -116,7 +116,7 @@ bool shouldAutoCreate(TCHAR *szProfile) return _tcsicmp(ac, _T("yes")) == 0;
}
-static void getDefaultProfile(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+static void getDefaultProfile(TCHAR *szProfile, size_t cch)
{
TCHAR defaultProfile[MAX_PATH];
GetPrivateProfileString(_T("Database"), _T("DefaultProfile"), _T(""), defaultProfile, SIZEOF(defaultProfile), mirandabootini);
@@ -126,13 +126,13 @@ static void getDefaultProfile(TCHAR *szProfile, size_t cch, TCHAR *profiledir) VARST res(defaultProfile);
if (res)
- mir_sntprintf(szProfile, cch, _T("%s\\%s\\%s%s"), profiledir, (TCHAR*)res, (TCHAR*)res, isValidProfileName(res) ? _T("") : _T(".dat"));
+ mir_sntprintf(szProfile, cch, _T("%s\\%s\\%s%s"), g_profileDir, (TCHAR*)res, (TCHAR*)res, isValidProfileName(res) ? _T("") : _T(".dat"));
else
szProfile[0] = 0;
}
// returns 1 if something that looks like a profile is there
-static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch)
{
TCHAR buf[MAX_PATH];
_tcsncpy(buf, src, SIZEOF(buf));
@@ -149,14 +149,14 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc _tcscpy(profileName, p);
p = _tcsrchr(profileName, '.'); if (p) *p = 0;
- mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), profiledir, profileName);
+ mir_sntprintf(newProfileDir, cch, _T("%s\\%s\\"), g_profileDir, profileName);
PathToAbsoluteT(buf, szProfile, newProfileDir);
if ( _tcschr(buf, '\\')) {
- _tcscpy(profiledir, szProfile);
+ _tcsncpy_s(g_profileDir, szProfile, _TRUNCATE);
if (profileName[0]) {
- p = _tcsrchr(profiledir, '\\'); *p = 0;
- p = _tcsrchr(profiledir, '\\');
+ p = _tcsrchr(g_profileDir, '\\'); *p = 0;
+ p = _tcsrchr(g_profileDir, '\\');
if (p && _tcsicmp(p + 1, profileName) == 0)
*p = 0;
}
@@ -164,17 +164,17 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc }
}
-void getProfileCmdLine(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+void getProfileCmdLine(TCHAR *szProfile, size_t cch)
{
LPCTSTR ptszProfileName = CmdLine_GetOption( _T("profile"));
if (ptszProfileName != NULL)
- loadProfileByShortName(ptszProfileName, szProfile, cch, profiledir);
+ loadProfileByShortName(ptszProfileName, szProfile, cch);
}
-void getProfileDefault(TCHAR *szProfile, size_t cch, TCHAR *profiledir)
+void getProfileDefault(TCHAR *szProfile, size_t cch)
{
if (g_defaultProfile != NULL) {
- loadProfileByShortName(g_defaultProfile, szProfile, cch, profiledir);
+ loadProfileByShortName(g_defaultProfile, szProfile, cch);
mir_free(g_defaultProfile);
}
}
@@ -302,9 +302,9 @@ static int getProfile(TCHAR *szProfile, size_t cch) if (WritePrivateProfileString(_T("Database"), _T("ProfileDir"), _T(""), mirandabootini))
getProfilePath(g_profileDir, SIZEOF(g_profileDir));
- getDefaultProfile(szProfile, cch, g_profileDir);
- getProfileCmdLine(szProfile, cch, g_profileDir);
- getProfileDefault(szProfile, cch, g_profileDir);
+ getDefaultProfile(szProfile, cch);
+ getProfileCmdLine(szProfile, cch);
+ getProfileDefault(szProfile, cch);
if (IsInsideRootDir(g_profileDir, true)) {
MessageBox(NULL,
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index 19915ce51c..4bd9c42f96 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -130,6 +130,7 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM switch (LOWORD(wParam)) {
case IDCANCEL:
warnInfo->cancel = 1;
+ // fall through
case IDYES:
case IDNO:
warnInfo->warnNoMore = IsDlgButtonChecked(hwndDlg, IDC_WARNNOMORE);
diff --git a/src/modules/database/mdatabasecache.cpp b/src/modules/database/mdatabasecache.cpp index 27283ebb8d..c864394261 100644 --- a/src/modules/database/mdatabasecache.cpp +++ b/src/modules/database/mdatabasecache.cpp @@ -38,7 +38,9 @@ MDatabaseCache::MDatabaseCache(size_t _size) : m_contactSize(_size),
m_lSettings(100, stringCompare),
m_lContacts(50, NumericKeySortT),
- m_lGlobalSettings(50, compareGlobals)
+ m_lGlobalSettings(50, compareGlobals),
+ m_lastSetting(NULL),
+ m_lastVL(NULL)
{
m_hCacheHeap = HeapCreate(0, 0, 0);
}
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 3ab139cf30..4e6813b8c9 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -772,7 +772,7 @@ void NetlibUPnPCleanup(void*) num = atol(buf);
WORD ports[30];
- for (int i = 0; i < num && !Miranda_Terminated(); i++) {
+ for (unsigned i = 0; i < num && !Miranda_Terminated(); i++) {
mir_snprintf(szData, 4096, get_port_mapping, i);
ReleaseMutex(portListMutex);
@@ -804,7 +804,7 @@ void NetlibUPnPCleanup(void*) ReleaseMutex(portListMutex);
- for (int i = 0; i < j && !Miranda_Terminated(); i++)
+ for (unsigned i = 0; i < j && !Miranda_Terminated(); i++)
NetlibUPnPDeletePortMapping(ports[i], "TCP");
}
}
diff --git a/src/modules/utils/utils.cpp b/src/modules/utils/utils.cpp index 466d5c04ea..9373759ab5 100644 --- a/src/modules/utils/utils.cpp +++ b/src/modules/utils/utils.cpp @@ -346,33 +346,36 @@ static INT_PTR SaveWindowPosition(WPARAM, LPARAM lParam) return 0;
}
-
-static INT_PTR AssertInsideScreen(WPARAM wParam, LPARAM lParam)
+static INT_PTR svcAssertInsideScreen(WPARAM wParam, LPARAM lParam)
{
- LPRECT rc = (LPRECT) wParam;
+ LPRECT rc = (LPRECT)wParam;
if (rc == NULL)
return -1;
+ return AssertInsideScreen(*rc);
+}
+
+int AssertInsideScreen(RECT &rc)
+{
RECT rcScreen;
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcScreen, FALSE);
-
- if (MonitorFromRect(rc, MONITOR_DEFAULTTONULL))
+ if (MonitorFromRect(&rc, MONITOR_DEFAULTTONULL))
return 0;
MONITORINFO mi = {0};
- HMONITOR hMonitor = MonitorFromRect(rc, MONITOR_DEFAULTTONEAREST);
+ HMONITOR hMonitor = MonitorFromRect(&rc, MONITOR_DEFAULTTONEAREST);
mi.cbSize = sizeof(mi);
if (GetMonitorInfo(hMonitor, &mi))
rcScreen = mi.rcWork;
- if (rc->top >= rcScreen.bottom)
- OffsetRect(rc, 0, rcScreen.bottom - rc->bottom);
- else if (rc->bottom <= rcScreen.top)
- OffsetRect(rc, 0, rcScreen.top - rc->top);
- if (rc->left >= rcScreen.right)
- OffsetRect(rc, rcScreen.right - rc->right, 0);
- else if (rc->right <= rcScreen.left)
- OffsetRect(rc, rcScreen.left - rc->left, 0);
+ if (rc.top >= rcScreen.bottom)
+ OffsetRect(&rc, 0, rcScreen.bottom - rc.bottom);
+ else if (rc.bottom <= rcScreen.top)
+ OffsetRect(&rc, 0, rcScreen.top - rc.top);
+ if (rc.left >= rcScreen.right)
+ OffsetRect(&rc, rcScreen.right - rc.right, 0);
+ else if (rc.right <= rcScreen.left)
+ OffsetRect(&rc, rcScreen.left - rc.left, 0);
return 1;
}
@@ -409,13 +412,14 @@ static INT_PTR RestoreWindowPosition(WPARAM wParam, LPARAM lParam) wp.showCmd = SW_SHOWNOACTIVATE;
if (!(wParam & RWPF_NOMOVE))
- AssertInsideScreen((WPARAM) &wp.rcNormalPosition, 0);
+ AssertInsideScreen(wp.rcNormalPosition);
SetWindowPlacement(swp->hwnd, &wp);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR RestartMiranda(WPARAM wParam, LPARAM)
{
TCHAR mirandaPath[MAX_PATH], cmdLine[MAX_PATH];
@@ -465,7 +469,7 @@ int LoadUtilsModule(void) CreateServiceFunction(MS_UTILS_RESIZEDIALOG, ResizeDialog);
CreateServiceFunction(MS_UTILS_SAVEWINDOWPOSITION, SaveWindowPosition);
CreateServiceFunction(MS_UTILS_RESTOREWINDOWPOSITION, RestoreWindowPosition);
- CreateServiceFunction(MS_UTILS_ASSERTINSIDESCREEN, AssertInsideScreen);
+ CreateServiceFunction(MS_UTILS_ASSERTINSIDESCREEN, svcAssertInsideScreen);
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYNUMBER, GetCountryByNumber);
CreateServiceFunction(MS_UTILS_GETCOUNTRYBYISOCODE, GetCountryByISOCode);
CreateServiceFunction(MS_UTILS_GETCOUNTRYLIST, GetCountryList);
|