diff options
127 files changed, 1814 insertions, 1814 deletions
diff --git a/plugins/!Deprecated/Clist_mw/src/clui.cpp b/plugins/!Deprecated/Clist_mw/src/clui.cpp index 69ea15f8e1..80ccfb8282 100644 --- a/plugins/!Deprecated/Clist_mw/src/clui.cpp +++ b/plugins/!Deprecated/Clist_mw/src/clui.cpp @@ -1,765 +1,765 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org),
-Copyright (c) 2000-03 Miranda ICQ/IM project,
-all portions of this codebase are copyrighted to the people
-listed in contributors.txt.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-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 "commonheaders.h"
-
-#define TM_AUTOALPHA 1
-#define TM_STATUSBARUPDATE 200
-#define MENU_MIRANDAMENU 0xFFFF1234
-
-extern int DefaultImageListColorDepth;
-
-HMENU hMenuMain;
-static HANDLE hContactDraggingEvent,hContactDroppedEvent,hContactDragStopEvent;
-UINT hMsgGetProfile = 0;
-
-extern boolean canloadstatusbar;
-boolean OnModulesLoadedCalled = FALSE;
-
-static int transparentFocus = 1;
-static byte oldhideoffline;
-static int lastreqh = 0,requr = 0,disableautoupd = 1;
-HANDLE hFrameContactTree;
-BYTE showOpts;//for statusbar
-
-typedef struct
-{
- int IconsCount;
- int CycleStartTick;
- char *szProto;
- int n;
- int TimerCreated;
-}
- ProtoTicks,*pProtoTicks;
-
-ProtoTicks CycleStartTick[64];//max 64 protocols
-
-int CycleTimeInterval = 2000;
-int CycleIconCount = 8;
-int DefaultStep = 100;
-
-int CluiOptInit(WPARAM wParam, LPARAM lParam);
-int SortList(WPARAM wParam, LPARAM lParam);
-
-void CluiProtocolStatusChanged(int parStatus, const char* szProto);
-
-extern void ReloadExtraIcons();
-extern HWND CreateStatusBarhWnd(HWND parent);
-extern HANDLE CreateStatusBarFrame();
-extern int CLUIFramesUpdateFrame(WPARAM wParam, LPARAM lParam);
-extern void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis);
-extern void InitGroupMenus();
-extern int UseOwnerDrawStatusBar;
-
-HICON GetConnectingIconForProto(char *szProto,int b);
-HICON GetConnectingIconForProto_DLL(char *szProto,int b);
-
-void RegisterProtoIconsForAllProtoIconLib();
-
-static int CluiModulesLoaded(WPARAM wParam, LPARAM lParam)
-{
- MENUITEMINFO mii = { sizeof(mii) };
- mii.fMask = MIIM_SUBMENU;
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0);
- SetMenuItemInfo(hMenuMain,0,TRUE,&mii);
- mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- SetMenuItemInfo(hMenuMain,1,TRUE,&mii);
-
- canloadstatusbar = TRUE;
- SendMessage(pcli->hwndContactList,WM_SIZE,0,0);
- CluiProtocolStatusChanged(0,0);
- Sleep(0);
- PostMessage(pcli->hwndContactList,M_CREATECLC,0,0);
-
- OnModulesLoadedCalled = TRUE;
- pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
- InitGroupMenus();
- RegisterProtoIconsForAllProtoIconLib();
- return 0;
-}
-
-pProtoTicks GetProtoTicksByProto(char * szProto)
-{
- int i;
-
- for (i = 0;i<64;i++)
- {
- if (CycleStartTick[i].szProto == NULL) break;
- if (strcmp(CycleStartTick[i].szProto,szProto)) continue;
- return(&CycleStartTick[i]);
- }
- for (i = 0;i<64;i++)
- {
- if (CycleStartTick[i].szProto == NULL)
- {
- CycleStartTick[i].szProto = mir_strdup(szProto);
- CycleStartTick[i].CycleStartTick = 0;
- CycleStartTick[i].n = i;
- return(&CycleStartTick[i]);
- }
- }
- return NULL;
-}
-
-int GetConnectingIconForProtoCount(char *szProto)
-{
- char file[MAX_PATH],fileFull[MAX_PATH],szFullPath[MAX_PATH];
- char szPath[MAX_PATH];
- char *str;
- int ret;
-
- GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH);
- str = strrchr(szPath,'\\');
- if (str != NULL) *str = 0;
- mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto);
-
- lstrcpynA(file,szFullPath,SIZEOF(file));
- PathToAbsolute(file, fileFull);
- ret = ExtractIconExA(fileFull,-1,NULL,NULL,1);
- if (ret == 0&&!strcmp(szProto,"ICQ")) ret = 8;
- return ret;
-}
-
-static HICON ExtractIconFromPath(const char *path)
-{
- char *comma;
- char file[MAX_PATH],fileFull[MAX_PATH];
- int n;
- HICON hIcon;
- lstrcpynA(file,path,SIZEOF(file));
- comma = strrchr(file,',');
- if (comma == NULL) n = 0;
- else {n = atoi(comma+1); *comma = 0;}
- PathToAbsolute(file, fileFull);
-
- hIcon = NULL;
- ExtractIconExA(fileFull,n,NULL,&hIcon,1);
- return hIcon;
-}
-
-HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon)
-{
- char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str;
- HICON hIcon = NULL;
-
- memset(szMyPath,0,SIZEOF(szMyPath));
- memset(szFullPath,0,SIZEOF(szFullPath));
-
- if (filename != NULL)
- {
- GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH);
- GetModuleFileNameA(g_hInst, szMyPath, MAX_PATH);
- str = strrchr(szPath,'\\');
- if (str != NULL) *str = 0;
- mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i);
- }
-
- if ( !UseLibrary) {
- hIcon = ExtractIconFromPath(szFullPath);
- if (hIcon) return hIcon;
- }
- else {
- if (registerit && IconName != NULL && SectName != NULL) {
- SKINICONDESC sid = { sizeof(sid) };
- sid.pszSection = SectName;
- sid.pszName = IconName;
- sid.pszDescription = Description;
- if (szMyPath[0] != 0)
- sid.pszDefaultFile = szMyPath;
-
- sid.iDefaultIndex = internalidx;
- sid.hDefaultIcon = DefIcon;
-
- Skin_AddIcon(&sid);
- }
- return Skin_GetIcon(IconName);
- }
-
- return (HICON)0;
-}
-
-void RegisterProtoIcons (char *protoname)
-{
- if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1))
- {
- int i;
- char buf[256];
- char buf2[256];
- for (i = 0;i<8;i++)
- {
- mir_snprintf(buf, SIZEOF(buf), "%s #%d", protoname, i);
- mir_snprintf(buf2, SIZEOF(buf2), "Contact list/Connection Icons %s", protoname);
-
- LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i));
- }
- }
-}
-
-void RegisterProtoIconsForAllProtoIconLib()
-{
- int protoCount,i;
- PROTOACCOUNT **accs;
-
- ProtoEnumAccounts( &protoCount, &accs );
- for ( i = 0; i < protoCount; i++ )
- if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 ))
- RegisterProtoIcons( accs[i]->szModuleName );
-}
-
-HICON GetConnectingIconForProto_DLL(char *szProto,int b)
-{
- char szFullPath[MAX_PATH];
- HICON hIcon = NULL;
-
- b = b-1;
- mir_snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll", szProto);
- // hIcon = ExtractIconFromPath(szFullPath);
- // if (hIcon) return hIcon;
-
- hIcon = LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,0);
- if (hIcon) return hIcon;
-
-#ifdef _DEBUG
- {
- char buf [256];
- mir_snprintf(buf, SIZEOF(buf), "IconNotFound %s %d\r\n", szProto, b);
- // OutputDebugStringA(buf);
- }
-#endif
-
- if ( !strcmp(szProto,"ICQ"))
- {
-
-#ifdef _DEBUG
- char buf [256];
- mir_snprintf(buf, SIZEOF(buf), "Icon %d %d\r\n", GetTickCount(), b);
- //OutputDebugStringA(buf);
-#endif
- return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b)));
- }
-
- return(hIcon);
-}
-
-HICON GetConnectingIconForProto(char *szProto,int b)
-{
- if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1)) {
- HICON hIcon = 0;
- char buf[256];
- mir_snprintf(buf, SIZEOF(buf), "%s #%d", szProto, b);
-
- hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact list/Connection icons",buf,0,NULL);
- if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b));
- return (CopyIcon(hIcon));
- }
-
- return GetConnectingIconForProto_DLL(szProto, b);
-}
-
-//wParam == szProto
-INT_PTR GetConnectingIconService(WPARAM wParam, LPARAM lParam)
-{
- int b;
- ProtoTicks *pt = NULL;
- HICON hIcon = NULL;
-
- char *szProto = (char *)wParam;
- if ( !szProto) return 0;
-
- pt = GetProtoTicksByProto(szProto);
-
- if (pt != NULL) {
- if (pt->CycleStartTick != 0&&pt->IconsCount != 0) {
- b = ((GetTickCount()-pt->CycleStartTick)/(DefaultStep))%pt->IconsCount;
- hIcon = GetConnectingIconForProto(szProto,b);
- }
- }
-
- return (INT_PTR)hIcon;
-}
-
-int CreateTimerForConnectingIcon(WPARAM wParam, LPARAM lParam)
-{
- int status = (int)wParam;
- char *szProto = (char *)lParam;
- if ( !szProto) return 0;
- if ( !status) return 0;
-
- if (( db_get_b(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) {
- ProtoTicks *pt = NULL;
- int cnt;
-
- pt = GetProtoTicksByProto(szProto);
- if (pt != NULL) {
- if (pt->CycleStartTick == 0) {
- KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n);
- cnt = GetConnectingIconForProtoCount(szProto);
- if ( db_get_b(NULL,"Clist","UseProtoIconFromIcoLib",1))
- cnt = 8;
-
- if (cnt != 0) {
- DefaultStep = db_get_w(NULL,"CLUI","DefaultStepConnectingIcon",100);
- pt->IconsCount = cnt;
- SetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n,(int)(DefaultStep)/1,0);
- pt->TimerCreated = 1;
- pt->CycleStartTick = GetTickCount();
- }
- }
- }
- }
- return 0;
-}
-
-// Restore protocols to the last global status.
-// Used to reconnect on restore after standby.
-
-int OnSettingChanging(WPARAM hContact, LPARAM lParam)
-{
- DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam;
- if (hContact == 0) {
- if ((dbcws->value.type == DBVT_BYTE) && !strcmp(dbcws->szModule,"CLUI")) {
- if (!strcmp(dbcws->szSetting,"SBarShow")) {
- showOpts = dbcws->value.bVal;
- return 0;
- }
- }
- }
- return 0;
-}
-
-HWND PreCreateCLC(HWND parent)
-{
- pcli->hwndContactTree = CreateWindow( _T(CLISTCONTROL_CLASS),_T(""),
- WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST
- |( db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0)
- | CLS_HIDEOFFLINE
- //|( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0)
- |( db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0)
- |( db_get_b(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0)
- |CLS_MULTICOLUMN
- //|db_get_b(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0
- ,0,0,0,0,parent,NULL,g_hInst,NULL);
-
- return pcli->hwndContactTree;
-}
-
-int CreateCLC(HWND parent)
-{
- Sleep(0);
- {
- // create contact list frame
- CLISTFrame Frame;
- memset(&Frame,0,sizeof(Frame));
- Frame.cbSize = sizeof(CLISTFrame);
- Frame.hWnd = pcli->hwndContactTree;
- Frame.align = alClient;
- Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME);
- //LoadIcon(hInst,MAKEINTRESOURCE(IDI_MIRANDA));
- Frame.Flags = F_VISIBLE|F_SHOWTB|F_SHOWTBTIP|F_TCHAR;
- Frame.tname = _T("My contacts");
- Frame.TBtname = TranslateT("My contacts");
- hFrameContactTree = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0);
- //free(Frame.name);
- CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,hFrameContactTree),(LPARAM)TranslateT("My Contacts"));
- }
-
- lastreqh = 0;
- CallService(MS_CLIST_SETHIDEOFFLINE,(WPARAM)oldhideoffline,0);
-
- int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL);
- if (state == SETTING_STATE_NORMAL) ShowWindow(pcli->hwndContactList, SW_SHOW);
- else if (state == SETTING_STATE_MINIMIZED) ShowWindow(pcli->hwndContactList, SW_SHOWMINIMIZED);
-
- lastreqh = 0;
- disableautoupd = 0;
-
- HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging);
- return 0;
-}
-
-int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc)
-{
- int nParts,nPanel;
- ProtocolData *PD;
- int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
-
- if ( !UseOwnerDrawStatusBar) startoffset = 0;
-
- nParts = SendMessage(hwnd,SB_GETPARTS,0,0);
- FillMemory(rc,sizeof(RECT),0);
-
- for (nPanel = 0;nPanel<nParts;nPanel++)
- {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if ( PD == NULL )
- return 0;
-
- if ( !strcmp(szProto,PD->RealName))
- {
- SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc);
- rc->left += startoffset;
- rc->right += startoffset;
- return 0;
- }
- }
- return 0;
-}
-
-extern LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- /*
- This registers a window message with RegisterWindowMessage() and then waits for such a message,
- if it gets it, it tries to open a file mapping object and then maps it to this process space,
- it expects 256 bytes of data (incl. NULL) it will then write back the profile it is using the DB to fill in the answer.
-
- The caller is expected to create this mapping object and tell us the ID we need to open ours.
- */
-
- if (msg == hMsgGetProfile && wParam != 0) { /* got IPC message */
- HANDLE hMap;
- char szName[MAX_PATH];
- int rc = 0;
- mir_snprintf(szName, SIZEOF(szName), "Miranda::%u", wParam); // caller will tell us the ID of the map
- hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,szName);
- if (hMap != NULL) {
- void *hView = NULL;
- hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH);
- if (hView) {
- char szFilePath[MAX_PATH], szProfile[MAX_PATH];
- CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath);
- CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile);
- mir_snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile);
- UnmapViewOfFile(hView);
- rc = 1;
- }
- CloseHandle(hMap);
- }
- return rc;
- }
-
- switch (msg) {
- case WM_CREATE:
- TranslateMenu(GetMenu(hwnd));
- DrawMenuBar(hwnd);
- showOpts = db_get_b(NULL,"CLUI","SBarShow",1);
-
- //create the status wnd
- //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0);
- CluiProtocolStatusChanged(0,0);
-
- hMsgGetProfile = RegisterWindowMessageA( "Miranda::GetProfile" ); // don't localise
-
- if ( db_get_b( NULL, "CList", "Transparent", 0 )) {
- SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
- SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA);
- }
- transparentFocus = 1;
- return FALSE;
-
- case M_SETALLEXTRAICONS:
- return TRUE;
-
- case M_CREATECLC:
- CreateCLC(hwnd);
- return TRUE;
-
- case WM_SIZE:
- {
- RECT rc;
- if ( wParam != SIZE_MINIMIZED ) {
- if ( pcli->hwndContactList != NULL )
- CLUIFramesOnClistResize((WPARAM)hwnd,0);
-
- GetWindowRect(hwnd, &rc);
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) {
- //if docked, dont remember pos (except for width)
- db_set_dw(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top));
- db_set_dw(NULL,"CList","x",(DWORD)rc.left);
- db_set_dw(NULL,"CList","y",(DWORD)rc.top);
- }
- db_set_dw(NULL,"CList","Width",(DWORD)(rc.right - rc.left));
- }
- if ( wParam == SIZE_MINIMIZED ) {
- if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) {
- ShowWindow(hwnd, SW_HIDE);
- db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN);
- }
- else db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED);
- }
- return 0;
- }
-
- case WM_SETFOCUS:
- {
- boolean isfloating;
- if ( hFrameContactTree ) {
- isfloating = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLOATING,hFrameContactTree),0);
- if ( isfloating == FALSE)
- SetFocus(pcli->hwndContactTree);
- }
- return 0;
- }
- case WM_TIMER:
- if ((int)wParam>=TM_STATUSBARUPDATE&&(int)wParam<=TM_STATUSBARUPDATE+64) {
- int status,i;
-
- ProtoTicks *pt = NULL;
- for (i = 0;i<64;i++) {
- pt = &CycleStartTick[i];
- if (pt->szProto != NULL&&pt->TimerCreated == 1) {
- status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0);
- if ( !(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES))
- {
- pt->CycleStartTick = 0;
- KillTimer(hwnd,TM_STATUSBARUPDATE+pt->n);
- pt->TimerCreated = 0;
- } } }
-
- pt = &CycleStartTick[wParam-TM_STATUSBARUPDATE];
- {
- RECT rc;
- GetStatsuBarProtoRect(pcli->hwndStatus,pt->szProto,&rc);
- rc.right = rc.left+GetSystemMetrics(SM_CXSMICON)+1;
- rc.top = 0;
-
- if (IsWindowVisible(pcli->hwndStatus)) InvalidateRect(pcli->hwndStatus,&rc,TRUE);
- pcli->pfnTrayIconUpdateBase(pt->szProto);
- }
- //SendMessage(pcli->hwndStatus,WM_PAINT,0,0);
- UpdateWindow(pcli->hwndStatus);
- return TRUE;
- }
- break;
-
- case WM_DRAWITEM:
- {
- LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
- if (dis->hwndItem == pcli->hwndStatus) {
- DrawDataForStatusBar(dis);
- return 0;
- }
- if (dis->CtlType != ODT_MENU)
- return 0;
- }
- break;
-
- case WM_KEYDOWN:
- CallService(MS_CLIST_MENUPROCESSHOTKEY, wParam, MPCF_MAINMENU | MPCF_CONTACTMENU);
- if (wParam == VK_F5)
- pcli->pfnInitAutoRebuild(pcli->hwndContactTree);
- return TRUE;
-
- case WM_GETMINMAXINFO:
- DefWindowProc(hwnd,msg,wParam,lParam);
- ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 18;
- if (requr == 0){((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight();}
- return 0;
-
- //MSG FROM CHILD CONTROL
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndContactTree) {
- switch (((LPNMHDR)lParam)->code) {
- case CLN_LISTSIZECHANGE:
- {
- NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam;
- RECT rcWindow,rcTree,rcWorkArea;
- int maxHeight,newHeight;
- int winstyle;
-
- if ( !disableautoupd && db_get_b( NULL, "CLUI", "AutoSize", 0 )) {
- if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0) && hFrameContactTree != 0 ) {
- maxHeight = db_get_b(NULL,"CLUI","MaxSizeHeight",75);
- GetWindowRect(hwnd,&rcWindow);
- GetWindowRect(pcli->hwndContactTree,&rcTree);
- winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE);
-
- SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,FALSE);
- lastreqh = nmc->pt.y;
- newHeight = max(nmc->pt.y,3)+1+((winstyle&WS_BORDER)?2:0)+(rcWindow.bottom-rcWindow.top)-(rcTree.bottom-rcTree.top);
- if (newHeight != rcWindow.bottom - rcWindow.top ) {
- if (newHeight>(rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100)
- newHeight = (rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100;
- if ( db_get_b(NULL,"CLUI","AutoSizeUpward",0)) {
- rcWindow.top = rcWindow.bottom-newHeight;
- if (rcWindow.top<rcWorkArea.top) rcWindow.top = rcWorkArea.top;
- }
- else {
- rcWindow.bottom = rcWindow.top+newHeight;
- if (rcWindow.bottom>rcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom;
- }
-
- if (requr == 0) {
- requr = 1;
- SetWindowPos(hwnd,0,rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE);
- GetWindowRect(hwnd,&rcWindow);
- requr = 0;
- } } } }
- return TRUE;
- }
- }
- }
- else if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) {
- if (((LPNMHDR)lParam)->code == NM_CLICK ) {
- int nParts = 0, nPanel = 0;
- NMMOUSE *nm = (NMMOUSE*)lParam;
- HMENU hMenu;
- RECT rc;
- POINT pt;
- int totcount;
- ProtocolData *PD;
- int menuid;
- int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0);
- int extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0);
- boolean UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0);
-
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0);
-
- if (nm->dwItemSpec == 0xFFFFFFFE) {
- nPanel = nParts-1;
- SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc);
- if (nm->pt.x < rc.left) return FALSE;
- }
- else {
- if ( !((startoffset) != 0 && UseOwnerDrawStatusBar)) {
- nPanel = nm->dwItemSpec;
- SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc);
- }
- else {
- RECT clrc = { 0 };
- GetClientRect(pcli->hwndStatus,&clrc);
- clrc.right -= clrc.left;
- clrc.right -= startoffset;
- int sectwidth = clrc.right/nParts;
-
- for (nPanel = 0;nPanel<nParts;nPanel++) {
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if (PD == NULL)
- continue;
-
- rc.top = 0;
- rc.bottom = clrc.bottom;
- rc.left = nPanel*sectwidth+startoffset;
- rc.right = rc.left+sectwidth-1;
-
- if (PtInRect(&rc,nm->pt))
- break;
- } } }
-
- totcount = db_get_dw(0,"Protocols","ProtoCount",0);
- PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0);
- if (PD == NULL){return 0;}
- menuid = nPanel;
-
- if (menuid<0){break;}
- hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0);
- {
- unsigned int cpnl = 0;
- int mcnt = GetMenuItemCount(hMenu);
- for (int i = 0; i<mcnt; ++i) {
- HMENU hMenus = GetSubMenu(hMenu, i);
- if (hMenus && cpnl++ == menuid) {
- hMenu = hMenus;
- break;
- }
- }
- }
-
- if (hMenu != NULL) {
- GetCursorPos(&pt);
- TrackPopupMenu(hMenu,TPM_BOTTOMALIGN|TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,NULL);
- }
- }
- return TRUE;
- }
- break;
-
- case WM_DESTROY:
- //saving state
- int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL);
-
- FreeProtocolData();
- if (state == SETTING_STATE_NORMAL)
- ShowWindow(hwnd,SW_HIDE);
-
- CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,0);
- DestroyWindow(pcli->hwndContactTree);
- pcli->hwndContactList = NULL;
-
- UnLoadCLUIFramesModule();
- db_set_b(NULL, "CList", "State", (BYTE)state);
- PostQuitMessage(0);
- break;
- }
-
- return saveContactListWndProc( hwnd, msg, wParam, lParam );
-}
-
-int LoadCLUIModule(void)
-{
- DBVARIANT dbv;
- TCHAR titleText[256];
- canloadstatusbar = FALSE;
- hFrameContactTree = 0;
-
- HookEvent(ME_SYSTEM_MODULESLOADED,CluiModulesLoaded);
- HookEvent(ME_OPT_INITIALISE,CluiOptInit);
- hContactDraggingEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGGING);
- hContactDroppedEvent = CreateHookableEvent(ME_CLUI_CONTACTDROPPED);
- hContactDragStopEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGSTOP);
-
- CreateServiceFunction("CLUI/GetConnectingIconForProtocol",GetConnectingIconService);
-
- if (db_get_ts(NULL,"CList","TitleText",&dbv))
- lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText));
- else {
- lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText));
- db_free(&dbv);
- }
-
- oldhideoffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT);
-
- int laster = GetLastError();
- PreCreateCLC(pcli->hwndContactList);
-
- // create status bar frame
- CreateStatusBarhWnd(pcli->hwndContactList);
-
- hMenuMain = GetMenu(pcli->hwndContactList);
- if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
- SetMenu(pcli->hwndContactList, NULL);
- SetWindowPos(pcli->hwndContactList, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
-
- lastreqh = 0;
- return 0;
-}
-
-void UnloadCLUIModule()
-{
- for (int i = 0; i < SIZEOF(CycleStartTick); i++)
- if ( CycleStartTick[i].szProto != NULL)
- mir_free(CycleStartTick[i].szProto);
+/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (c) 2012-14 Miranda NG project (http://miranda-ng.org), +Copyright (c) 2000-03 Miranda ICQ/IM project, +all portions of this codebase are copyrighted to the people +listed in contributors.txt. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +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 "commonheaders.h" + +#define TM_AUTOALPHA 1 +#define TM_STATUSBARUPDATE 200 +#define MENU_MIRANDAMENU 0xFFFF1234 + +extern int DefaultImageListColorDepth; + +HMENU hMenuMain; +static HANDLE hContactDraggingEvent,hContactDroppedEvent,hContactDragStopEvent; +UINT hMsgGetProfile = 0; + +extern boolean canloadstatusbar; +boolean OnModulesLoadedCalled = FALSE; + +static int transparentFocus = 1; +static byte oldhideoffline; +static int lastreqh = 0,requr = 0,disableautoupd = 1; +HANDLE hFrameContactTree; +BYTE showOpts;//for statusbar + +typedef struct +{ + int IconsCount; + int CycleStartTick; + char *szProto; + int n; + int TimerCreated; +} + ProtoTicks,*pProtoTicks; + +ProtoTicks CycleStartTick[64];//max 64 protocols + +int CycleTimeInterval = 2000; +int CycleIconCount = 8; +int DefaultStep = 100; + +int CluiOptInit(WPARAM wParam, LPARAM lParam); +int SortList(WPARAM wParam, LPARAM lParam); + +void CluiProtocolStatusChanged(int parStatus, const char* szProto); + +extern void ReloadExtraIcons(); +extern HWND CreateStatusBarhWnd(HWND parent); +extern HANDLE CreateStatusBarFrame(); +extern int CLUIFramesUpdateFrame(WPARAM wParam, LPARAM lParam); +extern void DrawDataForStatusBar(LPDRAWITEMSTRUCT dis); +extern void InitGroupMenus(); +extern int UseOwnerDrawStatusBar; + +HICON GetConnectingIconForProto(char *szProto,int b); +HICON GetConnectingIconForProto_DLL(char *szProto,int b); + +void RegisterProtoIconsForAllProtoIconLib(); + +static int CluiModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + MENUITEMINFO mii = { sizeof(mii) }; + mii.fMask = MIIM_SUBMENU; + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETMAIN,0,0); + SetMenuItemInfo(hMenuMain,0,TRUE,&mii); + mii.hSubMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + SetMenuItemInfo(hMenuMain,1,TRUE,&mii); + + canloadstatusbar = TRUE; + SendMessage(pcli->hwndContactList,WM_SIZE,0,0); + CluiProtocolStatusChanged(0,0); + Sleep(0); + PostMessage(pcli->hwndContactList,M_CREATECLC,0,0); + + OnModulesLoadedCalled = TRUE; + pcli->pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); + InitGroupMenus(); + RegisterProtoIconsForAllProtoIconLib(); + return 0; +} + +pProtoTicks GetProtoTicksByProto(char * szProto) +{ + int i; + + for (i = 0;i<64;i++) + { + if (CycleStartTick[i].szProto == NULL) break; + if (strcmp(CycleStartTick[i].szProto,szProto)) continue; + return(&CycleStartTick[i]); + } + for (i = 0;i<64;i++) + { + if (CycleStartTick[i].szProto == NULL) + { + CycleStartTick[i].szProto = mir_strdup(szProto); + CycleStartTick[i].CycleStartTick = 0; + CycleStartTick[i].n = i; + return(&CycleStartTick[i]); + } + } + return NULL; +} + +int GetConnectingIconForProtoCount(char *szProto) +{ + char file[MAX_PATH],fileFull[MAX_PATH],szFullPath[MAX_PATH]; + char szPath[MAX_PATH]; + char *str; + int ret; + + GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); + str = strrchr(szPath,'\\'); + if (str != NULL) *str = 0; + mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\proto_conn_%s.dll", szPath, szProto); + + lstrcpynA(file,szFullPath,SIZEOF(file)); + PathToAbsolute(file, fileFull); + ret = ExtractIconExA(fileFull,-1,NULL,NULL,1); + if (ret == 0&&!strcmp(szProto,"ICQ")) ret = 8; + return ret; +} + +static HICON ExtractIconFromPath(const char *path) +{ + char *comma; + char file[MAX_PATH],fileFull[MAX_PATH]; + int n; + HICON hIcon; + lstrcpynA(file,path,SIZEOF(file)); + comma = strrchr(file,','); + if (comma == NULL) n = 0; + else {n = atoi(comma+1); *comma = 0;} + PathToAbsolute(file, fileFull); + + hIcon = NULL; + ExtractIconExA(fileFull,n,NULL,&hIcon,1); + return hIcon; +} + +HICON LoadIconFromExternalFile(char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx,HICON DefIcon) +{ + char szPath[MAX_PATH],szMyPath[MAX_PATH], szFullPath[MAX_PATH],*str; + HICON hIcon = NULL; + + memset(szMyPath,0,sizeof(szMyPath)); + memset(szFullPath,0,sizeof(szFullPath)); + + if (filename != NULL) + { + GetModuleFileNameA(GetModuleHandle(NULL), szPath, MAX_PATH); + GetModuleFileNameA(g_hInst, szMyPath, MAX_PATH); + str = strrchr(szPath,'\\'); + if (str != NULL) *str = 0; + mir_snprintf(szFullPath, SIZEOF(szFullPath), "%s\\Icons\\%s,%d", szPath, filename, i); + } + + if ( !UseLibrary) { + hIcon = ExtractIconFromPath(szFullPath); + if (hIcon) return hIcon; + } + else { + if (registerit && IconName != NULL && SectName != NULL) { + SKINICONDESC sid = { sizeof(sid) }; + sid.pszSection = SectName; + sid.pszName = IconName; + sid.pszDescription = Description; + if (szMyPath[0] != 0) + sid.pszDefaultFile = szMyPath; + + sid.iDefaultIndex = internalidx; + sid.hDefaultIcon = DefIcon; + + Skin_AddIcon(&sid); + } + return Skin_GetIcon(IconName); + } + + return (HICON)0; +} + +void RegisterProtoIcons (char *protoname) +{ + if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1)) + { + int i; + char buf[256]; + char buf2[256]; + for (i = 0;i<8;i++) + { + mir_snprintf(buf, SIZEOF(buf), "%s #%d", protoname, i); + mir_snprintf(buf2, SIZEOF(buf2), "Contact list/Connection Icons %s", protoname); + + LoadIconFromExternalFile(NULL,i,TRUE,TRUE,buf,buf2,buf,0,GetConnectingIconForProto_DLL(protoname,i)); + } + } +} + +void RegisterProtoIconsForAllProtoIconLib() +{ + int protoCount,i; + PROTOACCOUNT **accs; + + ProtoEnumAccounts( &protoCount, &accs ); + for ( i = 0; i < protoCount; i++ ) + if ( IsAccountEnabled( accs[i] ) && CallProtoService( accs[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0 )) + RegisterProtoIcons( accs[i]->szModuleName ); +} + +HICON GetConnectingIconForProto_DLL(char *szProto,int b) +{ + char szFullPath[MAX_PATH]; + HICON hIcon = NULL; + + b = b-1; + mir_snprintf(szFullPath, SIZEOF(szFullPath), "proto_conn_%s.dll", szProto); + // hIcon = ExtractIconFromPath(szFullPath); + // if (hIcon) return hIcon; + + hIcon = LoadIconFromExternalFile(szFullPath,b+1,FALSE,FALSE,NULL,NULL,NULL,0,0); + if (hIcon) return hIcon; + +#ifdef _DEBUG + { + char buf [256]; + mir_snprintf(buf, SIZEOF(buf), "IconNotFound %s %d\r\n", szProto, b); + // OutputDebugStringA(buf); + } +#endif + + if ( !strcmp(szProto,"ICQ")) + { + +#ifdef _DEBUG + char buf [256]; + mir_snprintf(buf, SIZEOF(buf), "Icon %d %d\r\n", GetTickCount(), b); + //OutputDebugStringA(buf); +#endif + return(LoadIconA(g_hInst,(LPCSTR)(IDI_ICQC1+b))); + } + + return(hIcon); +} + +HICON GetConnectingIconForProto(char *szProto,int b) +{ + if ( db_get_b(NULL,"CList","UseProtoIconFromIcoLib",1)) { + HICON hIcon = 0; + char buf[256]; + mir_snprintf(buf, SIZEOF(buf), "%s #%d", szProto, b); + + hIcon = LoadIconFromExternalFile(NULL,b,TRUE,FALSE,buf,"Contact list/Connection icons",buf,0,NULL); + if (hIcon == NULL) return (GetConnectingIconForProto_DLL(szProto,b)); + return (CopyIcon(hIcon)); + } + + return GetConnectingIconForProto_DLL(szProto, b); +} + +//wParam == szProto +INT_PTR GetConnectingIconService(WPARAM wParam, LPARAM lParam) +{ + int b; + ProtoTicks *pt = NULL; + HICON hIcon = NULL; + + char *szProto = (char *)wParam; + if ( !szProto) return 0; + + pt = GetProtoTicksByProto(szProto); + + if (pt != NULL) { + if (pt->CycleStartTick != 0&&pt->IconsCount != 0) { + b = ((GetTickCount()-pt->CycleStartTick)/(DefaultStep))%pt->IconsCount; + hIcon = GetConnectingIconForProto(szProto,b); + } + } + + return (INT_PTR)hIcon; +} + +int CreateTimerForConnectingIcon(WPARAM wParam, LPARAM lParam) +{ + int status = (int)wParam; + char *szProto = (char *)lParam; + if ( !szProto) return 0; + if ( !status) return 0; + + if (( db_get_b(NULL,"CLUI","UseConnectingIcon",1) == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING + MAX_CONNECT_RETRIES) { + ProtoTicks *pt = NULL; + int cnt; + + pt = GetProtoTicksByProto(szProto); + if (pt != NULL) { + if (pt->CycleStartTick == 0) { + KillTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n); + cnt = GetConnectingIconForProtoCount(szProto); + if ( db_get_b(NULL,"Clist","UseProtoIconFromIcoLib",1)) + cnt = 8; + + if (cnt != 0) { + DefaultStep = db_get_w(NULL,"CLUI","DefaultStepConnectingIcon",100); + pt->IconsCount = cnt; + SetTimer(pcli->hwndContactList,TM_STATUSBARUPDATE+pt->n,(int)(DefaultStep)/1,0); + pt->TimerCreated = 1; + pt->CycleStartTick = GetTickCount(); + } + } + } + } + return 0; +} + +// Restore protocols to the last global status. +// Used to reconnect on restore after standby. + +int OnSettingChanging(WPARAM hContact, LPARAM lParam) +{ + DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING *)lParam; + if (hContact == 0) { + if ((dbcws->value.type == DBVT_BYTE) && !strcmp(dbcws->szModule,"CLUI")) { + if (!strcmp(dbcws->szSetting,"SBarShow")) { + showOpts = dbcws->value.bVal; + return 0; + } + } + } + return 0; +} + +HWND PreCreateCLC(HWND parent) +{ + pcli->hwndContactTree = CreateWindow( _T(CLISTCONTROL_CLASS),_T(""), + WS_CHILD|WS_CLIPCHILDREN|CLS_CONTACTLIST + |( db_get_b(NULL,"CList","UseGroups",SETTING_USEGROUPS_DEFAULT)?CLS_USEGROUPS:0) + | CLS_HIDEOFFLINE + //|( db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT)?CLS_HIDEOFFLINE:0) + |( db_get_b(NULL,"CList","HideEmptyGroups",SETTING_HIDEEMPTYGROUPS_DEFAULT)?CLS_HIDEEMPTYGROUPS:0) + |( db_get_b(NULL,"CList","ShowStatusMessages",1)?CLS_SHOWSTATUSMESSAGES:0) + |CLS_MULTICOLUMN + //|db_get_b(NULL,"CLUI","ExtraIconsAlignToLeft",1)?CLS_EX_MULTICOLUMNALIGNLEFT:0 + ,0,0,0,0,parent,NULL,g_hInst,NULL); + + return pcli->hwndContactTree; +} + +int CreateCLC(HWND parent) +{ + Sleep(0); + { + // create contact list frame + CLISTFrame Frame; + memset(&Frame,0,sizeof(Frame)); + Frame.cbSize = sizeof(CLISTFrame); + Frame.hWnd = pcli->hwndContactTree; + Frame.align = alClient; + Frame.hIcon = LoadSkinnedIcon(SKINICON_OTHER_FRAME); + //LoadIcon(hInst,MAKEINTRESOURCE(IDI_MIRANDA)); + Frame.Flags = F_VISIBLE|F_SHOWTB|F_SHOWTBTIP|F_TCHAR; + Frame.tname = _T("My contacts"); + Frame.TBtname = TranslateT("My contacts"); + hFrameContactTree = (HWND)CallService(MS_CLIST_FRAMES_ADDFRAME,(WPARAM)&Frame,0); + //free(Frame.name); + CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,hFrameContactTree),(LPARAM)TranslateT("My Contacts")); + } + + lastreqh = 0; + CallService(MS_CLIST_SETHIDEOFFLINE,(WPARAM)oldhideoffline,0); + + int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL); + if (state == SETTING_STATE_NORMAL) ShowWindow(pcli->hwndContactList, SW_SHOW); + else if (state == SETTING_STATE_MINIMIZED) ShowWindow(pcli->hwndContactList, SW_SHOWMINIMIZED); + + lastreqh = 0; + disableautoupd = 0; + + HookEvent(ME_DB_CONTACT_SETTINGCHANGED,OnSettingChanging); + return 0; +} + +int GetStatsuBarProtoRect(HWND hwnd,char *szProto,RECT *rc) +{ + int nParts,nPanel; + ProtocolData *PD; + int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0); + + if ( !UseOwnerDrawStatusBar) startoffset = 0; + + nParts = SendMessage(hwnd,SB_GETPARTS,0,0); + FillMemory(rc,sizeof(RECT),0); + + for (nPanel = 0;nPanel<nParts;nPanel++) + { + PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0); + if ( PD == NULL ) + return 0; + + if ( !strcmp(szProto,PD->RealName)) + { + SendMessage(hwnd,SB_GETRECT,(WPARAM)nPanel,(LPARAM)rc); + rc->left += startoffset; + rc->right += startoffset; + return 0; + } + } + return 0; +} + +extern LRESULT ( CALLBACK *saveContactListWndProc )(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); + +LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + /* + This registers a window message with RegisterWindowMessage() and then waits for such a message, + if it gets it, it tries to open a file mapping object and then maps it to this process space, + it expects 256 bytes of data (incl. NULL) it will then write back the profile it is using the DB to fill in the answer. + + The caller is expected to create this mapping object and tell us the ID we need to open ours. + */ + + if (msg == hMsgGetProfile && wParam != 0) { /* got IPC message */ + HANDLE hMap; + char szName[MAX_PATH]; + int rc = 0; + mir_snprintf(szName, SIZEOF(szName), "Miranda::%u", wParam); // caller will tell us the ID of the map + hMap = OpenFileMappingA(FILE_MAP_ALL_ACCESS,FALSE,szName); + if (hMap != NULL) { + void *hView = NULL; + hView = MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, MAX_PATH); + if (hView) { + char szFilePath[MAX_PATH], szProfile[MAX_PATH]; + CallService(MS_DB_GETPROFILEPATH,MAX_PATH,(LPARAM)&szFilePath); + CallService(MS_DB_GETPROFILENAME,MAX_PATH,(LPARAM)&szProfile); + mir_snprintf((char*)hView, MAX_PATH, "%s\\%s", szFilePath, szProfile); + UnmapViewOfFile(hView); + rc = 1; + } + CloseHandle(hMap); + } + return rc; + } + + switch (msg) { + case WM_CREATE: + TranslateMenu(GetMenu(hwnd)); + DrawMenuBar(hwnd); + showOpts = db_get_b(NULL,"CLUI","SBarShow",1); + + //create the status wnd + //pcli->hwndStatus == CreateStatusWindow(WS_CHILD | ( db_get_b(NULL,"CLUI","ShowSBar",1)?WS_VISIBLE:0), "", hwnd, 0); + CluiProtocolStatusChanged(0,0); + + hMsgGetProfile = RegisterWindowMessageA( "Miranda::GetProfile" ); // don't localise + + if ( db_get_b( NULL, "CList", "Transparent", 0 )) { + SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED); + SetLayeredWindowAttributes(hwnd, RGB(0,0,0), (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), LWA_ALPHA); + } + transparentFocus = 1; + return FALSE; + + case M_SETALLEXTRAICONS: + return TRUE; + + case M_CREATECLC: + CreateCLC(hwnd); + return TRUE; + + case WM_SIZE: + { + RECT rc; + if ( wParam != SIZE_MINIMIZED ) { + if ( pcli->hwndContactList != NULL ) + CLUIFramesOnClistResize((WPARAM)hwnd,0); + + GetWindowRect(hwnd, &rc); + if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0)) { + //if docked, dont remember pos (except for width) + db_set_dw(NULL,"CList","Height",(DWORD)(rc.bottom - rc.top)); + db_set_dw(NULL,"CList","x",(DWORD)rc.left); + db_set_dw(NULL,"CList","y",(DWORD)rc.top); + } + db_set_dw(NULL,"CList","Width",(DWORD)(rc.right - rc.left)); + } + if ( wParam == SIZE_MINIMIZED ) { + if ( db_get_b(NULL,"CList","Min2Tray",SETTING_MIN2TRAY_DEFAULT )) { + ShowWindow(hwnd, SW_HIDE); + db_set_b(NULL,"CList","State",SETTING_STATE_HIDDEN); + } + else db_set_b(NULL,"CList","State",SETTING_STATE_MINIMIZED); + } + return 0; + } + + case WM_SETFOCUS: + { + boolean isfloating; + if ( hFrameContactTree ) { + isfloating = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS,MAKEWPARAM(FO_FLOATING,hFrameContactTree),0); + if ( isfloating == FALSE) + SetFocus(pcli->hwndContactTree); + } + return 0; + } + case WM_TIMER: + if ((int)wParam>=TM_STATUSBARUPDATE&&(int)wParam<=TM_STATUSBARUPDATE+64) { + int status,i; + + ProtoTicks *pt = NULL; + for (i = 0;i<64;i++) { + pt = &CycleStartTick[i]; + if (pt->szProto != NULL&&pt->TimerCreated == 1) { + status = CallProtoService(pt->szProto,PS_GETSTATUS,0,0); + if ( !(status>=ID_STATUS_CONNECTING&&status<=ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) + { + pt->CycleStartTick = 0; + KillTimer(hwnd,TM_STATUSBARUPDATE+pt->n); + pt->TimerCreated = 0; + } } } + + pt = &CycleStartTick[wParam-TM_STATUSBARUPDATE]; + { + RECT rc; + GetStatsuBarProtoRect(pcli->hwndStatus,pt->szProto,&rc); + rc.right = rc.left+GetSystemMetrics(SM_CXSMICON)+1; + rc.top = 0; + + if (IsWindowVisible(pcli->hwndStatus)) InvalidateRect(pcli->hwndStatus,&rc,TRUE); + pcli->pfnTrayIconUpdateBase(pt->szProto); + } + //SendMessage(pcli->hwndStatus,WM_PAINT,0,0); + UpdateWindow(pcli->hwndStatus); + return TRUE; + } + break; + + case WM_DRAWITEM: + { + LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; + if (dis->hwndItem == pcli->hwndStatus) { + DrawDataForStatusBar(dis); + return 0; + } + if (dis->CtlType != ODT_MENU) + return 0; + } + break; + + case WM_KEYDOWN: + CallService(MS_CLIST_MENUPROCESSHOTKEY, wParam, MPCF_MAINMENU | MPCF_CONTACTMENU); + if (wParam == VK_F5) + pcli->pfnInitAutoRebuild(pcli->hwndContactTree); + return TRUE; + + case WM_GETMINMAXINFO: + DefWindowProc(hwnd,msg,wParam,lParam); + ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = 18; + if (requr == 0){((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight();} + return 0; + + //MSG FROM CHILD CONTROL + case WM_NOTIFY: + if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndContactTree) { + switch (((LPNMHDR)lParam)->code) { + case CLN_LISTSIZECHANGE: + { + NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam; + RECT rcWindow,rcTree,rcWorkArea; + int maxHeight,newHeight; + int winstyle; + + if ( !disableautoupd && db_get_b( NULL, "CLUI", "AutoSize", 0 )) { + if ( !CallService(MS_CLIST_DOCKINGISDOCKED,0,0) && hFrameContactTree != 0 ) { + maxHeight = db_get_b(NULL,"CLUI","MaxSizeHeight",75); + GetWindowRect(hwnd,&rcWindow); + GetWindowRect(pcli->hwndContactTree,&rcTree); + winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE); + + SystemParametersInfo(SPI_GETWORKAREA,0,&rcWorkArea,FALSE); + lastreqh = nmc->pt.y; + newHeight = max(nmc->pt.y,3)+1+((winstyle&WS_BORDER)?2:0)+(rcWindow.bottom-rcWindow.top)-(rcTree.bottom-rcTree.top); + if (newHeight != rcWindow.bottom - rcWindow.top ) { + if (newHeight>(rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100) + newHeight = (rcWorkArea.bottom-rcWorkArea.top)*maxHeight/100; + if ( db_get_b(NULL,"CLUI","AutoSizeUpward",0)) { + rcWindow.top = rcWindow.bottom-newHeight; + if (rcWindow.top<rcWorkArea.top) rcWindow.top = rcWorkArea.top; + } + else { + rcWindow.bottom = rcWindow.top+newHeight; + if (rcWindow.bottom>rcWorkArea.bottom) rcWindow.bottom = rcWorkArea.bottom; + } + + if (requr == 0) { + requr = 1; + SetWindowPos(hwnd,0,rcWindow.left,rcWindow.top,rcWindow.right-rcWindow.left,rcWindow.bottom-rcWindow.top,SWP_NOZORDER|SWP_NOACTIVATE); + GetWindowRect(hwnd,&rcWindow); + requr = 0; + } } } } + return TRUE; + } + } + } + else if (((LPNMHDR)lParam)->hwndFrom == pcli->hwndStatus) { + if (((LPNMHDR)lParam)->code == NM_CLICK ) { + int nParts = 0, nPanel = 0; + NMMOUSE *nm = (NMMOUSE*)lParam; + HMENU hMenu; + RECT rc; + POINT pt; + int totcount; + ProtocolData *PD; + int menuid; + int startoffset = db_get_dw(NULL,"StatusBar","FirstIconOffset",0); + int extraspace = db_get_dw(NULL,"StatusBar","BkExtraSpace",0); + boolean UseOwnerDrawStatusBar = db_get_b(NULL,"CLUI","UseOwnerDrawStatusBar",0); + + hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); + + if (nm->dwItemSpec == 0xFFFFFFFE) { + nPanel = nParts-1; + SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); + if (nm->pt.x < rc.left) return FALSE; + } + else { + if ( !((startoffset) != 0 && UseOwnerDrawStatusBar)) { + nPanel = nm->dwItemSpec; + SendMessage(pcli->hwndStatus,SB_GETRECT,nPanel,(LPARAM)&rc); + } + else { + RECT clrc = { 0 }; + GetClientRect(pcli->hwndStatus,&clrc); + clrc.right -= clrc.left; + clrc.right -= startoffset; + int sectwidth = clrc.right/nParts; + + for (nPanel = 0;nPanel<nParts;nPanel++) { + PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0); + if (PD == NULL) + continue; + + rc.top = 0; + rc.bottom = clrc.bottom; + rc.left = nPanel*sectwidth+startoffset; + rc.right = rc.left+sectwidth-1; + + if (PtInRect(&rc,nm->pt)) + break; + } } } + + totcount = db_get_dw(0,"Protocols","ProtoCount",0); + PD = (ProtocolData *)SendMessage(pcli->hwndStatus,SB_GETTEXT,(WPARAM)nPanel,0); + if (PD == NULL){return 0;} + menuid = nPanel; + + if (menuid<0){break;} + hMenu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS,0,0); + { + unsigned int cpnl = 0; + int mcnt = GetMenuItemCount(hMenu); + for (int i = 0; i<mcnt; ++i) { + HMENU hMenus = GetSubMenu(hMenu, i); + if (hMenus && cpnl++ == menuid) { + hMenu = hMenus; + break; + } + } + } + + if (hMenu != NULL) { + GetCursorPos(&pt); + TrackPopupMenu(hMenu,TPM_BOTTOMALIGN|TPM_LEFTALIGN,pt.x,pt.y,0,hwnd,NULL); + } + } + return TRUE; + } + break; + + case WM_DESTROY: + //saving state + int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL); + + FreeProtocolData(); + if (state == SETTING_STATE_NORMAL) + ShowWindow(hwnd,SW_HIDE); + + CallService(MS_CLIST_FRAMES_REMOVEFRAME,(WPARAM)hFrameContactTree,0); + DestroyWindow(pcli->hwndContactTree); + pcli->hwndContactList = NULL; + + UnLoadCLUIFramesModule(); + db_set_b(NULL, "CList", "State", (BYTE)state); + PostQuitMessage(0); + break; + } + + return saveContactListWndProc( hwnd, msg, wParam, lParam ); +} + +int LoadCLUIModule(void) +{ + DBVARIANT dbv; + TCHAR titleText[256]; + canloadstatusbar = FALSE; + hFrameContactTree = 0; + + HookEvent(ME_SYSTEM_MODULESLOADED,CluiModulesLoaded); + HookEvent(ME_OPT_INITIALISE,CluiOptInit); + hContactDraggingEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGGING); + hContactDroppedEvent = CreateHookableEvent(ME_CLUI_CONTACTDROPPED); + hContactDragStopEvent = CreateHookableEvent(ME_CLUI_CONTACTDRAGSTOP); + + CreateServiceFunction("CLUI/GetConnectingIconForProtocol",GetConnectingIconService); + + if (db_get_ts(NULL,"CList","TitleText",&dbv)) + lstrcpyn(titleText,_T(MIRANDANAME),SIZEOF(titleText)); + else { + lstrcpyn(titleText,dbv.ptszVal,SIZEOF(titleText)); + db_free(&dbv); + } + + oldhideoffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); + + int laster = GetLastError(); + PreCreateCLC(pcli->hwndContactList); + + // create status bar frame + CreateStatusBarhWnd(pcli->hwndContactList); + + hMenuMain = GetMenu(pcli->hwndContactList); + if ( !db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT)) + SetMenu(pcli->hwndContactList, NULL); + SetWindowPos(pcli->hwndContactList, db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); + + lastreqh = 0; + return 0; +} + +void UnloadCLUIModule() +{ + for (int i = 0; i < SIZEOF(CycleStartTick); i++) + if ( CycleStartTick[i].szProto != NULL) + mir_free(CycleStartTick[i].szProto); }
\ No newline at end of file diff --git a/plugins/Alarms/src/options.cpp b/plugins/Alarms/src/options.cpp index 3b877dc602..d67cc11bfc 100644 --- a/plugins/Alarms/src/options.cpp +++ b/plugins/Alarms/src/options.cpp @@ -532,10 +532,10 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDOK:
{
TCHAR buff[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_TITLE, buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_TITLE, buff, SIZEOF(buff));
replaceStrT(add_edit_alarm->szTitle, buff);
- GetDlgItemText(hwndDlg, IDC_DESC, buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_DESC, buff, SIZEOF(buff));
replaceStrT(add_edit_alarm->szDesc, buff);
if (add_edit_alarm->szTitle == 0 || add_edit_alarm->szTitle[0] == '\0') {
@@ -562,9 +562,9 @@ static INT_PTR CALLBACK DlgProcAddEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LP add_edit_alarm->flags |= IsDlgButtonChecked(hwndDlg, IDC_CHK_NOREMINDER) ? ALF_NOREMINDER: 0;
if (add_edit_alarm->action & AAF_COMMAND) {
- GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_COMMAND, buff, SIZEOF(buff));
replaceStrT(add_edit_alarm->szCommand, buff);
- GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_PARAMS, buff, SIZEOF(buff));
replaceStrT(add_edit_alarm->szCommandParams, buff);
}
diff --git a/plugins/BasicHistory/src/ExportManager.cpp b/plugins/BasicHistory/src/ExportManager.cpp index 0143aeed2d..853d2d0229 100644 --- a/plugins/BasicHistory/src/ExportManager.cpp +++ b/plugins/BasicHistory/src/ExportManager.cpp @@ -58,7 +58,7 @@ std::wstring GetFile(const TCHAR* ext, HWND hwnd, bool open) ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = open ? TranslateT("Import") : TranslateT("Export");
- ofn.nMaxFile = 1024;
+ ofn.nMaxFile = SIZEOF(stzFilePath);
ofn.lpstrDefExt = ext;
if (open) {
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 1036f9945b..8f4f9fcc09 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -842,7 +842,7 @@ bool OpenFileDlg(HWND hwndDlg, HWND hwndEdit, const TCHAR* defName, const TCHAR* ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = title;
- ofn.nMaxFile = 1024;
+ ofn.nMaxFile = SIZEOF(stzFilePath);
ofn.lpstrDefExt = ext;
if (open) {
ofn.Flags = OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
@@ -1767,7 +1767,7 @@ INT_PTR CALLBACK Options::DlgProcOptsTask(HWND hwndDlg, UINT msg, WPARAM wParam, toCp.importType = (enum IImport::ImportType)ComboBox_GetCurSel(GetDlgItem(hwndDlg, IDC_IMPORT_TYPE));
toCp.compress = Button_GetCheck(GetDlgItem(hwndDlg, IDC_COMPRESS)) != 0;
char bufC[100];
- GetWindowTextA(GetDlgItem(hwndDlg, IDC_PASSWORD), bufC, 100);
+ GetWindowTextA(GetDlgItem(hwndDlg, IDC_PASSWORD), bufC, SIZEOF(bufC));
toCp.zipPassword = bufC;
HWND exportPath = GetDlgItem(hwndDlg, IDC_EXPORT_PATH);
int exLen = Edit_GetTextLength(exportPath);
diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 1d352aa13f..143d452177 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -328,7 +328,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (!bTranslated)
Config.AnswerThinkTime = 4;
TCHAR c[MAX_WARN_TEXT];
- bTranslated = GetDlgItemText(hwndDlg, IDC_WARNTXT, c, MAX_WARN_TEXT);
+ bTranslated = GetDlgItemText(hwndDlg, IDC_WARNTXT, c, SIZEOF(c));
if(bTranslated)
Config.WarnText = c;
else
@@ -464,7 +464,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP Config.EngineUnderstandAlways = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_UNDERSTAND_ALWAYS) == BST_CHECKED ? TRUE : FALSE;
UpdateEngine();
TCHAR c[MAX_MIND_FILE];
- bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, MAX_MIND_FILE);
+ bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, SIZEOF(c));
if (bTranslated)
Config.MindFileName = c;
else
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index fa3cdf2e41..11863ee70b 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -119,7 +119,7 @@ INT_PTR CALLBACK DlgStdInProc(HWND hDlg, UINT uMsg,WPARAM wParam,LPARAM lParam) UINT uid = LOWORD(wParam);
if (uid == IDOK){
char password[MAXPASSLEN + 1] = {0};
- int passlen = GetDlgItemTextA(hDlg,IDC_EDIT1,password,MAXPASSLEN+1);
+ int passlen = GetDlgItemTextA(hDlg,IDC_EDIT1,password,SIZEOF(password));
if (passlen == 0)
{
diff --git a/plugins/BossKeyPlus/src/Options.cpp b/plugins/BossKeyPlus/src/Options.cpp index cbda2e1dd5..dd96a48fd7 100644 --- a/plugins/BossKeyPlus/src/Options.cpp +++ b/plugins/BossKeyPlus/src/Options.cpp @@ -80,7 +80,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) // status msg, if needed
if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_MAINOPT_STATMSG))) { // meaning we should save it
TCHAR tszMsg[1025];
- GetDlgItemText(hwndDlg,IDC_MAINOPT_STATMSG,tszMsg,1024);
+ GetDlgItemText(hwndDlg,IDC_MAINOPT_STATMSG,tszMsg,SIZEOF(tszMsg));
if (tszMsg[0] != 0)
db_set_ts(NULL,MOD_NAME,"statmsg",tszMsg);
else // delete current setting
@@ -92,7 +92,7 @@ INT_PTR CALLBACK MainOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) // checkbox
if (IsDlgButtonChecked(hwndDlg,IDC_MAINOPT_REQPASS) == BST_CHECKED) {
char szPass[MAXPASSLEN+1];
- GetDlgItemTextA(hwndDlg,IDC_MAINOPT_PASS,szPass,MAXPASSLEN+1);
+ GetDlgItemTextA(hwndDlg,IDC_MAINOPT_PASS,szPass,SIZEOF(szPass));
if (szPass[0] != 0){
db_set_s(NULL,MOD_NAME,"password",szPass);
wMask |= OPT_REQPASS;
@@ -258,7 +258,7 @@ INT_PTR CALLBACK AdvOptDlg(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam) BossKeyMenuItemUnInit();
TCHAR szMinutes[4] = {0};
- GetDlgItemText(hwndDlg,IDC_MAINOPT_TIME,szMinutes,3);
+ GetDlgItemText(hwndDlg,IDC_MAINOPT_TIME,szMinutes,SIZEOF(szMinutes));
minutes = _ttoi(szMinutes);
if(minutes<1) minutes = 1;
db_set_b(NULL,MOD_NAME,"time",minutes);
diff --git a/plugins/BuddyPounce/src/dialog.cpp b/plugins/BuddyPounce/src/dialog.cpp index 9de338aeb1..3dd354e32f 100644 --- a/plugins/BuddyPounce/src/dialog.cpp +++ b/plugins/BuddyPounce/src/dialog.cpp @@ -37,11 +37,11 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) case 6: // nothing to do...
break;
case 3: // Reuse Pounce
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
db_set_b(hContact, modname, "Reuse", (BYTE)_ttoi(number));
break;
case 4: // Give Up delay
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
db_set_b(hContact, modname, "GiveUpDays", (BYTE)_ttoi(number));
{
time_t today = time(NULL);
@@ -49,7 +49,7 @@ void saveLastSetting(MCONTACT hContact, HWND hwnd) }
break;
case 5: // confirm window
- GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, 8);
+ GetDlgItemText(hwnd, IDC_SETTINGNUMBER, number, SIZEOF(number));
db_set_w(hContact, modname, "ConfirmTimeout", (WORD)_ttoi(number));
break;
}
@@ -90,7 +90,7 @@ INT_PTR CALLBACK StatusModesDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case IDCANCEL:
windowInfo *wi = (windowInfo *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
TCHAR type[32];
- GetDlgItemText(hwnd, IDC_CHECK1, type, 32);
+ GetDlgItemText(hwnd, IDC_CHECK1, type, SIZEOF(type));
WORD flag = (IsDlgButtonChecked(hwnd, IDC_CHECK1))
|(IsDlgButtonChecked(hwnd, IDC_CHECK2)<<1)
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 95d699b330..32bc9c85d3 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -390,7 +390,7 @@ void CSWindow::toggleEmptyListMessage() BOOL CSWindow::itemPassedFilter( ListItem< StatusItem >* li ) { TCHAR filter[MAX_PATH]; - GetDlgItemText( m_handle, IDC_FILTER_FIELD, filter, MAX_PATH ); + GetDlgItemText( m_handle, IDC_FILTER_FIELD, filter, SIZEOF(filter) ); if ( lstrlen( filter )) { @@ -566,7 +566,7 @@ void CSAMWindow::checkItemValidity() TCHAR tszInputMessage[EXTRASTATUS_MESSAGE_LIMIT]; - GetDlgItemText( m_handle, IDC_MESSAGE, tszInputMessage, EXTRASTATUS_MESSAGE_LIMIT ); + GetDlgItemText( m_handle, IDC_MESSAGE, tszInputMessage, SIZEOF(tszInputMessage) ); PROTOACCOUNT* pdescr = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)m_parent->m_protoName); if (pdescr == NULL) diff --git a/plugins/Clist_blind/src/clcopts.cpp b/plugins/Clist_blind/src/clcopts.cpp index 97f6f4ee6b..ad927ebce5 100644 --- a/plugins/Clist_blind/src/clcopts.cpp +++ b/plugins/Clist_blind/src/clcopts.cpp @@ -235,13 +235,13 @@ static INT_PTR CALLBACK DlgProcClcMainOpts(HWND hwndDlg, UINT msg, WPARAM wParam (BYTE) SendDlgItemMessage(hwndDlg, IDC_GROUPINDENTSPIN, UDM_GETPOS, 0, 0));
db_set_b(NULL, "CLC", "NoVScrollBar", (BYTE) (IsDlgButtonChecked(hwndDlg, IDC_NOSCROLLBAR) ? 1 : 0));
- GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, 1024);
+ GetDlgItemText(hwndDlg, IDC_T_CONTACT, tmp, SIZEOF(tmp));
db_set_ts(NULL, "CLC", "TemplateContact", tmp);
- GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, 1024);
+ GetDlgItemText(hwndDlg, IDC_T_GROUP, tmp, SIZEOF(tmp));
db_set_ts(NULL, "CLC", "TemplateGroup", tmp);
- GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, 1024);
+ GetDlgItemText(hwndDlg, IDC_T_DIVIDER, tmp, SIZEOF(tmp));
db_set_ts(NULL, "CLC", "TemplateDivider", tmp);
- GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, 1024);
+ GetDlgItemText(hwndDlg, IDC_T_INFO, tmp, SIZEOF(tmp));
db_set_ts(NULL, "CLC", "TemplateInfo", tmp);
pcli->pfnClcOptionsChanged();
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index aa5e376f25..42741e8028 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -1765,7 +1765,7 @@ static HFONT CLUILoadTitleBarFont() HFONT hfont;
LOGFONTA logfont;
memset(&logfont, 0, sizeof(logfont));
- memmove(logfont.lfFaceName,facename,sizeof(facename));
+ memcpy(logfont.lfFaceName,facename,sizeof(facename));
logfont.lfWeight = FW_NORMAL;
logfont.lfHeight = -10;
logfont.lfCharSet = DEFAULT_CHARSET;
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index d32a94710d..34fffc42ce 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -810,7 +810,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
TCHAR szBuf[256];
szBuf[0] = 0;
- GetDlgItemText(hwndDlg, IDC_NEWVIEMODE, szBuf, 256);
+ GetDlgItemText(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf));
szBuf[255] = 0;
if (szBuf[0] != 0) {
diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index ca1688dce8..a969811aea 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -747,7 +747,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, OPENFILENAMEA ofn = { 0 };
char filter[512];
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
@@ -755,7 +755,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "bmp";
if (!GetOpenFileNameA(&ofn))
@@ -789,7 +789,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, {
char str[MAX_PATH], strrel[MAX_PATH];
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
if ( PathToRelative(str, strrel))
cfg::writeString(NULL, "CLC", "BkBitmap", strrel);
else
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 5b176c7a3f..0c4832ba3e 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -1564,7 +1564,7 @@ static INT_PTR CALLBACK DlgProcSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L {
TCHAR tszFilename[MAX_PATH], tszFinalPath[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_SKINFILE, tszFilename, SIZEOF(tszFilename));
tszFilename[MAX_PATH - 1] = 0;
MY_pathToAbsolute(tszFilename, tszFinalPath);
if (PathFileExists(tszFinalPath)) {
@@ -1666,7 +1666,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "clist";
if (!GetSaveFileNameA(&ofn))
@@ -1685,7 +1685,7 @@ INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara ofn.lpstrFilter = "*.clist";
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "";
if (!GetOpenFileNameA(&ofn))
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index 7cd3539ea2..c4909b02b6 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP char szBuf[256];
szBuf[0] = 0;
- GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, 256);
+ GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf));
szBuf[255] = 0;
if (lstrlenA(szBuf) > 2) {
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 7c2ffab9e5..70f6006372 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -251,20 +251,20 @@ static INT_PTR CALLBACK FilterEditProc(HWND hWnd, UINT message, WPARAM wParam, L case ID_OK:
{
TCHAR tmpPort[6];
- GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, sizeof(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort));
if (tmpPort[0]=='*')
connCurrentEditModal->intIntPort=-1;
else
connCurrentEditModal->intIntPort=GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, sizeof(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort));
if (tmpPort[0]=='*')
connCurrentEditModal->intExtPort=-1;
else
connCurrentEditModal->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, sizeof(connCurrentEditModal->strIntIp));
- GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, sizeof(connCurrentEditModal->strExtIp));
- GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, sizeof(connCurrentEditModal->PName));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEditModal->strIntIp, SIZEOF(connCurrentEditModal->strIntIp));
+ GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEditModal->strExtIp, SIZEOF(connCurrentEditModal->strExtIp));
+ GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEditModal->PName, SIZEOF(connCurrentEditModal->PName));
connCurrentEditModal->Pid=!(BOOL)SendMessage(GetDlgItem(hWnd,ID_CBO_ACTION),CB_GETCURSEL, 0, 0);
diff --git a/plugins/ConnectionNotify/src/filter.cpp b/plugins/ConnectionNotify/src/filter.cpp index fbcfbe1bba..9cccb4fc8c 100644 --- a/plugins/ConnectionNotify/src/filter.cpp +++ b/plugins/ConnectionNotify/src/filter.cpp @@ -95,20 +95,20 @@ static INT_PTR CALLBACK ConnectionFilterEditProc(HWND hWnd, UINT message, WPARAM connCurrentEdit->next=connExceptions;
connExceptions=connCurrentEdit;
}
- GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, sizeof(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_PORT, tmpPort, SIZEOF(tmpPort));
if (tmpPort[0]=='*')
connCurrentEdit->intIntPort=-1;
else
connCurrentEdit->intIntPort=GetDlgItemInt(hWnd, ID_TXT_LOCAL_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, sizeof(tmpPort));
+ GetDlgItemText(hWnd, ID_TXT_REMOTE_PORT, tmpPort, SIZEOF(tmpPort));
if (tmpPort[0]=='*')
connCurrentEdit->intExtPort=-1;
else
connCurrentEdit->intExtPort = GetDlgItemInt(hWnd, ID_TXT_REMOTE_PORT, NULL, FALSE);
- GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, sizeof(connCurrentEdit->strIntIp));
- GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, sizeof(connCurrentEdit->strExtIp));
- GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, sizeof(connCurrentEdit->PName));
+ GetDlgItemText(hWnd, ID_TXT_LOCAL_IP, connCurrentEdit->strIntIp, SIZEOF(connCurrentEdit->strIntIp));
+ GetDlgItemText(hWnd, ID_TXT_REMOTE_IP, connCurrentEdit->strExtIp, SIZEOF(connCurrentEdit->strExtIp));
+ GetDlgItemText(hWnd, ID_TEXT_NAME, connCurrentEdit->PName, SIZEOF(connCurrentEdit->PName));
connCurrentEdit->Pid=!(BOOL)SendMessage(GetDlgItem(hWnd,ID_CBO_ACTION),CB_GETCURSEL, 0, 0);
connCurrentEdit=NULL;
diff --git a/plugins/CryptoPP/src/GPGw/passdialog.cpp b/plugins/CryptoPP/src/GPGw/passdialog.cpp index f367d66eba..8dfde8e09b 100644 --- a/plugins/CryptoPP/src/GPGw/passdialog.cpp +++ b/plugins/CryptoPP/src/GPGw/passdialog.cpp @@ -15,7 +15,7 @@ INT_PTR CALLBACK PassphraseDialogProcedure(HWND hdlg, UINT msg, WPARAM wparam, L {
case IDOK:
ZeroMemory(dlgpassphrase, sizeof(dlgpassphrase));
- GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, sizeof(dlgpassphrase));
+ GetDlgItemText(hdlg, IDC_PASSPHRASE, dlgpassphrase, SIZEOF(dlgpassphrase));
case IDCANCEL:
EndDialog(hdlg, wparam);
return TRUE;
diff --git a/plugins/DbChecker/src/wizard.cpp b/plugins/DbChecker/src/wizard.cpp index ca4b95885d..7eec2f9434 100644 --- a/plugins/DbChecker/src/wizard.cpp +++ b/plugins/DbChecker/src/wizard.cpp @@ -71,7 +71,7 @@ int DoMyControlProcessing(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam, case WM_CTLCOLORSTATIC:
if ((GetWindowLongPtr((HWND)lParam, GWL_STYLE) & 0xFFFF) == 0) {
char szText[256];
- GetWindowTextA((HWND)lParam, szText, sizeof(szText));
+ GetWindowTextA((HWND)lParam, szText, SIZEOF(szText));
if (!strcmp(szText, "whiterect")) {
SetTextColor((HDC)wParam, RGB(255, 255, 255));
SetBkColor((HDC)wParam, RGB(255, 255, 255));
diff --git a/plugins/DbEditorPP/src/deletemodule.cpp b/plugins/DbEditorPP/src/deletemodule.cpp index 572502a4e2..4a110628e3 100644 --- a/plugins/DbEditorPP/src/deletemodule.cpp +++ b/plugins/DbEditorPP/src/deletemodule.cpp @@ -91,7 +91,7 @@ INT_PTR CALLBACK DeleteModuleDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case IDOK:
{
char text[128];
- GetDlgItemText(hwnd,IDC_CONTACTS,text,128);
+ GetDlgItemText(hwnd,IDC_CONTACTS,text,SIZEOF(text));
SetCursor(LoadCursor(NULL,IDC_WAIT));
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
deleteModule(text,hContact,1);
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 173288c211..4e2aa2b3e0 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -550,26 +550,26 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam GetDlgItemText(hwnd, IDC_TEXT, string, length+1);
if (Min == -1)
- memcpy(string, crlf_string, SIZEOF(crlf_string));
+ memcpy(string, crlf_string, sizeof(crlf_string));
else
if (Max == -1 || Max >= length)
- memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
+ memcpy(&string[Min], crlf_string, sizeof(crlf_string));
else
if (Max-Min > 2)
{
- memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
+ memcpy(&string[Min], crlf_string, sizeof(crlf_string));
memmove(&string[Min+2], &string[Max], length - Max + 1);
}
else
{
memmove(&string[Min+2], &string[Max], length - Max + 1);
- memcpy(&string[Min], crlf_string, SIZEOF(crlf_string));
+ memcpy(&string[Min], crlf_string, sizeof(crlf_string));
}
if (Min) Pos += Min;
}
else
- memcpy(string, crlf_string, SIZEOF(crlf_string));
+ memcpy(string, crlf_string, sizeof(crlf_string));
SetDlgItemText(hwnd, IDC_TEXT, string);
SendDlgItemMessage(hwnd,IDC_TEXT,EM_SETSEL,Pos,Pos);
diff --git a/plugins/DbEditorPP/src/modules.cpp b/plugins/DbEditorPP/src/modules.cpp index 014b252980..f0793a9853 100644 --- a/plugins/DbEditorPP/src/modules.cpp +++ b/plugins/DbEditorPP/src/modules.cpp @@ -52,7 +52,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case IDOK:
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_MODNAME))) {
char modulename[256];
- GetDlgItemText(hwnd, IDC_MODNAME, modulename, 256);
+ GetDlgItemText(hwnd, IDC_MODNAME, modulename, SIZEOF(modulename));
if (IsDlgButtonChecked(hwnd, CHK_ADD2ALL)) {
// null contact
db_set_b(NULL, modulename, "(Default)", 0);
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp index 6faeb33ece..6457bf6426 100644 --- a/plugins/Db_autobackups/src/options.cpp +++ b/plugins/Db_autobackups/src/options.cpp @@ -294,9 +294,9 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY ) {
TCHAR buff[10];
- GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, sizeof(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_PERIOD, buff, SIZEOF(buff));
new_options.period = _ttoi(buff);
- GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, sizeof(buff));
+ GetDlgItemText(hwndDlg, IDC_ED_NUMBACKUPS, buff, SIZEOF(buff));
new_options.num_backups = _ttoi(buff);
switch(SendDlgItemMessage(hwndDlg, IDC_PT, CB_GETCURSEL, 0, 0)) {
@@ -305,7 +305,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case 2: new_options.period_type = PT_MINUTES; break;
}
- GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_FOLDER, folder_buff, SIZEOF(folder_buff));
{
TCHAR backupfolder[MAX_PATH] = {0};
BOOL folder_ok = TRUE;
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 5b50ef19d7..9ca66fa2a7 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -1173,7 +1173,7 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ZeroMemory(&ofn, sizeof(ofn));
*str = 0;
- GetDlgItemText(hDlg, IDC_FILENAME, str, sizeof(str));
+ GetDlgItemText(hDlg, IDC_FILENAME, str, SIZEOF(str));
//ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
@@ -1181,7 +1181,7 @@ INT_PTR CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ofn.lpstrFile = str;
ofn.Flags = dat->inSend?OFN_FILEMUSTEXIST:0;
ofn.lpstrTitle = dat->inSend?Translate("Select a file"):Translate("Save as");
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
if(!GetOpenFileName(&ofn)) break;
if(!dat->inSend && dat->iState == STATE_FINISHED) break;
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp index 4462cb8227..e82087ccd2 100644 --- a/plugins/FloatingContacts/src/options.cpp +++ b/plugins/FloatingContacts/src/options.cpp @@ -248,7 +248,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP OPENFILENAMEA ofn = {0};
char filter[512];
- GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
ofn.lStructSize = sizeof(OPENFILENAMEA);
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
@@ -256,7 +256,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "bmp";
if (!GetOpenFileNameA(&ofn))
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 3783efb176..8ac8e51e64 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -136,12 +136,12 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA OPENFILENAME OpenFileName;
TCHAR szName[_MAX_PATH];
memset(&OpenFileName, 0, sizeof(OPENFILENAME));
- GetDlgItemText(hwndDlg, IDC_PRG, szName, _MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_PRG, szName, SIZEOF(szName));
OpenFileName.lStructSize = sizeof(OPENFILENAME);
OpenFileName.hwndOwner = hwndDlg;
OpenFileName.lpstrFilter = _T("Executables (*.exe;*.com;*.bat)\0*.exe;*.com;*.bat\0\0");
OpenFileName.lpstrFile = szName;
- OpenFileName.nMaxFile = _MAX_PATH;
+ OpenFileName.nMaxFile = SIZEOF(szName);
OpenFileName.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
if (!GetOpenFileName(&OpenFileName))
return 0;
@@ -163,7 +163,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA break;
case IDC_BTNSAV:
- if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, 64)) {
+ if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, SIZEOF(acc[curIndex].name))) {
tail = strstr(acc[curIndex].name, "@");
if (tail && lstrcmpA(tail + 1, "gmail.com") != 0)
lstrcpyA(acc[curIndex].hosted, tail + 1);
@@ -172,7 +172,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0);
db_set_s(acc[curIndex].hContact, pluginName, "name", acc[curIndex].name);
db_set_s(acc[curIndex].hContact, pluginName, "Nick", acc[curIndex].name);
- GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, 64);
+ GetDlgItemTextA(hwndDlg, IDC_PASS, acc[curIndex].pass, SIZEOF(acc[curIndex].pass));
db_set_s(acc[curIndex].hContact, pluginName, "Password", acc[curIndex].pass);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
@@ -238,7 +238,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else if (IsDlgButtonChecked(hwndDlg, IDC_STARTPRG) == BST_CHECKED) {
opt.OpenUsePrg = 2;
}
- GetDlgItemTextA(hwndDlg, IDC_PRG, str, MAX_PATH);
+ GetDlgItemTextA(hwndDlg, IDC_PRG, str, SIZEOF(str));
db_set_dw(NULL, pluginName, "OpenUsePrg", opt.OpenUsePrg);
db_set_s(NULL, pluginName, "OpenUsePrgPath", str);
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index 67d80af9de..f6f5132ee4 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -1214,8 +1214,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_TEST_EXTERNALIP: {
char szUrl[ 500 ];
char szKeyWord[ 1000 ];
- GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szUrl, sizeof(szUrl));
- GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, sizeof(szKeyWord));
+ GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szUrl, SIZEOF(szUrl));
+ GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szKeyWord, SIZEOF(szKeyWord));
DWORD dwExternalIP = GetExternIP(szUrl, szKeyWord);
mir_snprintf(szKeyWord, sizeof(szKeyWord), Translate("Your external IP was detected as %d.%d.%d.%d\r\nby: %s") ,
@@ -1231,7 +1231,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (p->code) {
case PSN_APPLY: {
char szTemp[ 500 ];
- if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, sizeof(szTemp)))
+ if (GetDlgItemText(hwndDlg, IDC_EXTERNAL_SRV_NAME, szTemp, SIZEOF(szTemp)))
db_set_s(NULL, MODULE, "ExternalSrvName", szTemp);
bool b = db_get_b(NULL, MODULE, "AddStatisticsMenuItem", 1) != 0;
@@ -1254,11 +1254,11 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP bShowPopups = IsDlgButtonChecked(hwndDlg, IDC_SHOW_POPUPS) == BST_CHECKED;
db_set_b(NULL, MODULE, "ShowPopups", bShowPopups);
- GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, sizeof(szTemp));
+ GetDlgItemText(hwndDlg, IDC_URL_ADDRESS, szTemp, SIZEOF(szTemp));
sUrlAddress = szTemp;
db_set_s(NULL, MODULE, "UrlAddress", sUrlAddress.c_str());
- GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, sizeof(szTemp));
+ GetDlgItemText(hwndDlg, IDC_PAGE_KEYWORD, szTemp, SIZEOF(szTemp));
sPageKeyword = szTemp;
db_set_s(NULL, MODULE, "PageKeyword", sPageKeyword.c_str());
dwExternalIpAddress = 0;
diff --git a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp index 8ed8ba5cd9..8154146c11 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_dlg.cpp @@ -519,7 +519,7 @@ INT_PTR WINAPI SearchDlgProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam flags = flags | SLL_DEEP;
length = GetWindowTextLength(GetDlgItem(hDlg, IDC_SEARCHSTRING))+1;
- buffer = (LPTSTR)malloc( length*sizeof(TCHAR));
+ buffer = (LPTSTR)malloc( (length + 1)*sizeof(TCHAR));
GetDlgItemText(hDlg, IDC_SEARCHSTRING, buffer, length);
WriteLinkList(hListDlg, flags, DlgParam->listStart, buffer, 0);
free(buffer);
diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index 81dc82af75..1da3264c10 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -1283,7 +1283,7 @@ BOOL SaveEditAsStream( HWND hDlg ) mir_sntprintf(temp, SIZEOF(temp), _T("%s (*.rtf)%c*.rtf%c%s (*.*)%c*.*%c%c"), TranslateT("RTF file"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = temp;
ofn.lpstrFile = szFilename;
- ofn.nMaxFile = _countof(szFilename);
+ ofn.nMaxFile = SIZEOF(szFilename);
ofn.lpstrTitle = TranslateT("Save RTF File");
ofn.Flags = OFN_OVERWRITEPROMPT;
// Get a filename or quit
diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index c9ea0b3e4a..167cde0769 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -78,11 +78,11 @@ static void SaveSRMMProtoSettings(HWND hwndDlg, ProtocolSettings *proto) i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setSRMMFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
proto->setSRMMBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
proto->setSRMMCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
proto->setSRMMTemplateFilenameTemp(path);
}
}
@@ -108,11 +108,11 @@ static void SaveChatProtoSettings(HWND hwndDlg, ProtocolSettings *proto) i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setChatFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
proto->setChatBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
proto->setChatCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
proto->setChatTemplateFilenameTemp(path);
}
}
@@ -138,11 +138,11 @@ static void SaveHistoryProtoSettings(HWND hwndDlg, ProtocolSettings *proto) i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE) ? Options::LOG_RELATIVE_DATE : 0;
i |= IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES) ? Options::LOG_GROUP_MESSAGES : 0;
proto->setHistoryFlagsTemp(i);
- GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, SIZEOF(path));
proto->setHistoryBackgroundFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, SIZEOF(path));
proto->setHistoryCssFilenameTemp(path);
- GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path));
+ GetDlgItemTextA(hwndDlg, IDC_TEMPLATES_FILENAME, path, SIZEOF(path));
proto->setHistoryTemplateFilenameTemp(path);
}
}
diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 728b97e6d0..492ef5d43e 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -786,7 +786,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) { - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, MAX_PATH); + GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, customAux, SIZEOF(customAux)); if (wcscmp(str, customAux)) EnableWindow(GetDlgItem(hwndDlg, IDC_UPDATE), TRUE); else @@ -798,7 +798,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { TCHAR custom[MAX_PATH+1]; - GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, MAX_PATH); + GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, custom, SIZEOF(custom)); SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(custom)); testSequence(custom); } diff --git a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp index 66a1f5984d..1844186570 100644 --- a/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp +++ b/plugins/ListeningTo/src/players/winamp_mlt/mlt_winamp.cpp @@ -1,470 +1,470 @@ -/*
-Copyright (C) 2005-2009 Ricardo Pescuma Domenecci
-
-This is free software; you can redistribute it and/or
-modify it under the terms of the GNU Library General Public
-License as published by the Free Software Foundation; either
-version 2 of the License, or (at your option) any later version.
-
-This is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-Library General Public License for more details.
-
-You should have received a copy of the GNU Library General Public
-License along with this file; see the file license.txt. If
-not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.
-*/
-
-
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-#include <process.h>
-#include "m_listeningto.h"
-
-#include "wa_ipc.h"
-#include "GEN.h"
-
-// Plugin data //////////////////////////////////////////////////////////////////////////
-
-int init();
-void quit();
-void config();
-
-winampGeneralPurposePlugin plugin = {
- GPPHDR_VER,
- "Miranda ListeningTo Winamp Plugin", // Plug-in description
- init,
- config,
- quit,
- 0, // handle to Winamp main window, loaded by winamp when this dll is loaded
- 0 // hinstance to this dll, loaded by winamp when this dll is loaded
-};
-
-
-// Globals //////////////////////////////////////////////////////////////////////////////
-
-
-#define MIRANDA_DW_PROTECTION 0x8754
-
-#define MESSAGE_WINDOWCLASS MIRANDA_WINDOWCLASS ".Winamp"
-
-#define DATA_SIZE 1024
-
-#define WA_STATE_CHANGE 0x0000029A
-
-WNDPROC oldWndProc = NULL;
-WNDPROC oldMainWndProc = NULL;
-HMENU hMenuCreated = NULL;
-HWND hMsgWnd = NULL;
-HWND hPlWnd = NULL;
-HINSTANCE hInst = NULL;
-
-// Message window proc
-LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-
-// Playlist window message processor
-LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
-
-
-
-// Functions ////////////////////////////////////////////////////////////////////////////
-
-
-void WindowThread(void *param)
-{
- // Create window
- WNDCLASS wc = {0};
- wc.lpfnWndProc = MsgWndProc;
- wc.hInstance = hInst;
- wc.lpszClassName = MESSAGE_WINDOWCLASS;
-
- RegisterClass(&wc);
-
- hMsgWnd = CreateWindow(MESSAGE_WINDOWCLASS, _T("Miranda ListeningTo Winamp Plugin"),
- 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL);
-
- if (hMsgWnd != NULL)
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SetTimer(hMsgWnd, 0, 5000, NULL);
-
- MSG msg;
- BOOL bRet;
- while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
- {
- if (bRet == -1)
- {
- // handle the error and possibly exit
- break;
- }
- else
- {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- }
-
- _endthread();
-}
-
-extern "C" BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved)
-{
- if (fdwReason == DLL_PROCESS_ATTACH)
- {
- hInst = hInstDll;
-
- plugin.hwndParent = NULL;
-
- _beginthread(WindowThread, 0, NULL);
- }
-
- return TRUE;
-}
-
-// Winamp interface function
-extern "C" __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin()
-{
- KillTimer(hMsgWnd, 0);
-
- return &plugin;
-}
-
-BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
-{
- // Find the windows
- char class_name[1024];
- if (GetClassName(hwnd, class_name, sizeof(class_name)))
- {
- class_name[sizeof(class_name)-1] = '\0';
-
- if (_strcmpi(MIRANDA_WINDOWCLASS, class_name) == 0)
- {
- COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam;
- SendMessage(hwnd, WM_COPYDATA, (WPARAM) plugin.hwndParent, (LPARAM) cds);
- }
- }
-
- return TRUE;
-}
-
-inline void SendData(WCHAR *text)
-{
- static WCHAR lastMsg[1024] = L"";
-
- if (wcscmp(lastMsg, text) == 0)
- return;
-
- // Prepare the struct
- COPYDATASTRUCT cds;
- cds.dwData = MIRANDA_DW_PROTECTION;
- cds.lpData = text;
- cds.cbData = (wcslen(text) + 1) * sizeof(WCHAR);
-
- EnumWindows(EnumWindowsProc, (LPARAM) &cds);
-
- wcsncpy(lastMsg, text, 1024);
- lastMsg[1023] = L'\0';
-}
-
-
-void Concat(WCHAR *data, size_t &size, char *str, size_t len = 0)
-{
- if (size < 3 * sizeof(WCHAR))
- return;
-
- if (str != NULL)
- {
- if (len == 0)
- len = strlen(str);
-
- if (size >= len + 3)
- {
- MultiByteToWideChar(CP_ACP, 0, str, len * sizeof(char), &data[DATA_SIZE - size], size * sizeof(WCHAR));
- size -= len;
- data[DATA_SIZE - size] = L'\0';
- }
- }
-
- wcscat(data, L"\\0");
- size -= 2;
-}
-
-
-void GetMetadata(extendedFileInfoStruct *efi, char *field, WCHAR *data, size_t &size)
-{
- efi->ret[0] = '\0';
- efi->metadata = field;
- if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi->ret[0] != '\0')
- {
- Concat(data, size, efi->ret);
- }
- else
- {
- Concat(data, size, NULL);
- }
-}
-
-
-void SendDataToMiranda(char *filename, char *title)
-{
- extendedFileInfoStruct efi;
- char tmp[256];
-
- efi.ret = tmp;
- efi.retlen = sizeof(tmp);
- efi.filename = filename;
-
- WCHAR data[DATA_SIZE];
- size_t size = DATA_SIZE;
- data[0] = L'\0';
-
- // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0"
- Concat(data, size, "1");
- Concat(data, size, "Winamp");
-
- int version = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETVERSION);
- BOOL is_radio = (strstr(filename, "://") != 0) && (strncmp(filename, "cda://", 6) != 0);
-
- if (is_radio)
- Concat(data, size, "Radio");
- else if (WINAMP_VERSION_MAJOR(version) >= 5 && SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_IS_PLAYING_VIDEO))
- Concat(data, size, "Video");
- else
- Concat(data, size, "Music");
-
- efi.ret[0] = '\0';
- efi.metadata = "TITLE";
- if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi.ret[0] != '\0')
- {
- Concat(data, size, efi.ret);
- }
- else if (title != NULL && title[0] != '\0' && strcmpi(title, filename) != 0)
- {
- Concat(data, size, title);
- }
- else
- {
- char *name = strrchr(filename, '\\');
- if (name == NULL)
- strrchr(filename, '/');
-
- if (name == NULL)
- {
- Concat(data, size, NULL);
- }
- else
- {
- char *dot = strrchr(name, '.');
- Concat(data, size, name + 1, dot == NULL ? 0 : dot - name - 1);
- }
- }
-
- GetMetadata(&efi, "ARTIST", data, size);
- GetMetadata(&efi, "ALBUM", data, size);
- GetMetadata(&efi, "TRACK", data, size);
- GetMetadata(&efi, "YEAR", data, size);
- GetMetadata(&efi, "GENRE", data, size);
-
- efi.ret[0] = '\0';
- efi.metadata = "LENGTH";
- if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE)
- && efi.ret[0] != '\0' && efi.ret[1] != '\0')
- {
- char tmp[10];
- itoa(atoi(efi.ret) / 1000, tmp, 10);
- Concat(data, size, tmp);
- }
- else
- {
- Concat(data, size, NULL);
- }
- Concat(data, size, NULL);
-
- SendData(data);
-}
-
-
-// Message window proc
-LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- static BOOL last_was_stop = TRUE;
- static DWORD last_notification = 0;
- static char last_filename[1024] = {0};
-
- switch(message)
- {
- case WM_TIMER:
- {
- KillTimer(hwnd, wParam);
-
- if (wParam == 0)
- {
- // Startup
- if (plugin.hwndParent == NULL)
- {
- plugin.hwndParent = FindWindow("Winamp v1.x", NULL);
- if (plugin.hwndParent != NULL)
- {
- init();
-
- // If playing, show current song
- if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1)
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SetTimer(hMsgWnd, 1, 500, NULL);
- }
- }
- }
- else if (wParam == 1)
- {
- // Song change
- if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1)
- {
- int track = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETLISTPOS);
- char *filename = (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTFILE);
-
- if (filename == NULL || filename[0] == '\0')
- {
- if (!last_was_stop)
- {
- last_was_stop = TRUE;
-
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
- }
- }
- else
- {
- BOOL is_radio = (strstr(filename, "://") != 0);
- if (last_was_stop || is_radio || strcmpi(last_filename, filename) != 0)
- {
- last_was_stop = FALSE;
- strncpy(last_filename, filename, sizeof(last_filename));
- last_filename[sizeof(last_filename) - 1] = '\0';
-
- // Miranda is running?
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SendDataToMiranda(last_filename, (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTTITLE));
-
- if (is_radio)
- // To try to get info from radio stations
- SetTimer(hMsgWnd, 1, 3000, NULL);
- }
- }
- }
- else
- {
- if (!last_was_stop)
- {
- last_was_stop = TRUE;
-
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
- }
- }
- }
-
- break;
- }
- }
-
- return DefWindowProc(hwnd, message, wParam, lParam);
-}
-
-// Playlist window message processor
-LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message)
- {
- case WM_USER:
- {
- if(wParam == WA_STATE_CHANGE)
- {
- int type = HIWORD(lParam);
- if(type == 0x4000 || type == 0)
- {
- KillTimer(hMsgWnd, 1);
- SetTimer(hMsgWnd, 1, 1000, NULL);
- }
- }
- break;
- }
- }
-
- return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam);
-}
-
-
-LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
-{
- switch(message)
- {
- case WM_COMMAND:
- {
- switch(wParam)
- {
- case 40045: // Play
- case 40046: // Pause
- {
- KillTimer(hMsgWnd, 1);
- SetTimer(hMsgWnd, 1, 500, NULL);
- break;
- }
- }
- break;
- }
- case WM_WA_IPC:
- {
- switch(lParam)
- {
- case IPC_PLAYING_FILE:
- {
- KillTimer(hMsgWnd, 1);
- SetTimer(hMsgWnd, 1, 500, NULL);
- break;
- }
- }
- break;
- }
- case WM_CLOSE:
- {
- PostMessage(hMsgWnd, WM_TIMER, 1, 0);
- PostMessage(hMsgWnd, WM_CLOSE, 0, 0);
- break;
- }
- }
-
- return CallWindowProc(oldMainWndProc, hwnd, message, wParam, lParam);
-}
-
-
-void quit()
-{
- if (oldMainWndProc != NULL)
- SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG) oldMainWndProc);
-
- if (oldWndProc != NULL)
- SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG) oldWndProc);
-
- if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL)
- SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0");
-
-}
-
-
-int init()
-{
- KillTimer(hMsgWnd, 0);
-
- oldMainWndProc = (WNDPROC)SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG) MainWndProc);
-
- hPlWnd = (HWND) SendMessage(plugin.hwndParent, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND);
- oldWndProc = (WNDPROC) SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG)WndProc);
-
- return 0;
-}
-
-void config() {
- MessageBox(NULL, _T("Copyright (C) 2006 Ricardo Pescuma Domenecci"), _T("Miranda ListeningTo Winamp Plugin"), 0);
-}
+/* +Copyright (C) 2005-2009 Ricardo Pescuma Domenecci + +This is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public +License as published by the Free Software Foundation; either +version 2 of the License, or (at your option) any later version. + +This is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with this file; see the file license.txt. If +not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +Boston, MA 02111-1307, USA. +*/ + + +#include <windows.h> +#include <tchar.h> +#include <stdio.h> +#include <process.h> +#include "m_listeningto.h" + +#include "wa_ipc.h" +#include "GEN.h" + +// Plugin data ////////////////////////////////////////////////////////////////////////// + +int init(); +void quit(); +void config(); + +winampGeneralPurposePlugin plugin = { + GPPHDR_VER, + "Miranda ListeningTo Winamp Plugin", // Plug-in description + init, + config, + quit, + 0, // handle to Winamp main window, loaded by winamp when this dll is loaded + 0 // hinstance to this dll, loaded by winamp when this dll is loaded +}; + + +// Globals ////////////////////////////////////////////////////////////////////////////// + + +#define MIRANDA_DW_PROTECTION 0x8754 + +#define MESSAGE_WINDOWCLASS MIRANDA_WINDOWCLASS ".Winamp" + +#define DATA_SIZE 1024 + +#define WA_STATE_CHANGE 0x0000029A + +WNDPROC oldWndProc = NULL; +WNDPROC oldMainWndProc = NULL; +HMENU hMenuCreated = NULL; +HWND hMsgWnd = NULL; +HWND hPlWnd = NULL; +HINSTANCE hInst = NULL; + +// Message window proc +LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + +// Playlist window message processor +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam); + + + +// Functions //////////////////////////////////////////////////////////////////////////// + + +void WindowThread(void *param) +{ + // Create window + WNDCLASS wc = {0}; + wc.lpfnWndProc = MsgWndProc; + wc.hInstance = hInst; + wc.lpszClassName = MESSAGE_WINDOWCLASS; + + RegisterClass(&wc); + + hMsgWnd = CreateWindow(MESSAGE_WINDOWCLASS, _T("Miranda ListeningTo Winamp Plugin"), + 0, 0, 0, 0, 0, NULL, NULL, hInst, NULL); + + if (hMsgWnd != NULL) + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SetTimer(hMsgWnd, 0, 5000, NULL); + + MSG msg; + BOOL bRet; + while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) + { + if (bRet == -1) + { + // handle the error and possibly exit + break; + } + else + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + _endthread(); +} + +extern "C" BOOL WINAPI DllMain(HINSTANCE hInstDll, DWORD fdwReason, LPVOID lpvReserved) +{ + if (fdwReason == DLL_PROCESS_ATTACH) + { + hInst = hInstDll; + + plugin.hwndParent = NULL; + + _beginthread(WindowThread, 0, NULL); + } + + return TRUE; +} + +// Winamp interface function +extern "C" __declspec(dllexport) winampGeneralPurposePlugin * winampGetGeneralPurposePlugin() +{ + KillTimer(hMsgWnd, 0); + + return &plugin; +} + +BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) +{ + // Find the windows + char class_name[1024]; + if (GetClassName(hwnd, class_name, sizeof(class_name))) + { + class_name[sizeof(class_name)-1] = '\0'; + + if (_strcmpi(MIRANDA_WINDOWCLASS, class_name) == 0) + { + COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; + SendMessage(hwnd, WM_COPYDATA, (WPARAM) plugin.hwndParent, (LPARAM) cds); + } + } + + return TRUE; +} + +inline void SendData(WCHAR *text) +{ + static WCHAR lastMsg[1024] = L""; + + if (wcscmp(lastMsg, text) == 0) + return; + + // Prepare the struct + COPYDATASTRUCT cds; + cds.dwData = MIRANDA_DW_PROTECTION; + cds.lpData = text; + cds.cbData = (wcslen(text) + 1) * sizeof(WCHAR); + + EnumWindows(EnumWindowsProc, (LPARAM) &cds); + + wcsncpy(lastMsg, text, 1024); + lastMsg[1023] = L'\0'; +} + + +void Concat(WCHAR *data, size_t &size, char *str, size_t len = 0) +{ + if (size < 3 * sizeof(WCHAR)) + return; + + if (str != NULL) + { + if (len == 0) + len = strlen(str); + + if (size >= len + 3) + { + MultiByteToWideChar(CP_ACP, 0, str, len * sizeof(char), &data[DATA_SIZE - size], size * sizeof(WCHAR)); + size -= len; + data[DATA_SIZE - size] = L'\0'; + } + } + + wcscat(data, L"\\0"); + size -= 2; +} + + +void GetMetadata(extendedFileInfoStruct *efi, char *field, WCHAR *data, size_t &size) +{ + efi->ret[0] = '\0'; + efi->metadata = field; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi->ret[0] != '\0') + { + Concat(data, size, efi->ret); + } + else + { + Concat(data, size, NULL); + } +} + + +void SendDataToMiranda(char *filename, char *title) +{ + extendedFileInfoStruct efi; + char tmp[256]; + + efi.ret = tmp; + efi.retlen = sizeof(tmp); + efi.filename = filename; + + WCHAR data[DATA_SIZE]; + size_t size = DATA_SIZE; + data[0] = L'\0'; + + // L"<Status 0-stoped 1-playing>\\0<Player>\\0<Type>\\0<Title>\\0<Artist>\\0<Album>\\0<Track>\\0<Year>\\0<Genre>\\0<Length (secs)>\\0\\0" + Concat(data, size, "1"); + Concat(data, size, "Winamp"); + + int version = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETVERSION); + BOOL is_radio = (strstr(filename, "://") != 0) && (strncmp(filename, "cda://", 6) != 0); + + if (is_radio) + Concat(data, size, "Radio"); + else if (WINAMP_VERSION_MAJOR(version) >= 5 && SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_IS_PLAYING_VIDEO)) + Concat(data, size, "Video"); + else + Concat(data, size, "Music"); + + efi.ret[0] = '\0'; + efi.metadata = "TITLE"; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) && efi.ret[0] != '\0') + { + Concat(data, size, efi.ret); + } + else if (title != NULL && title[0] != '\0' && strcmpi(title, filename) != 0) + { + Concat(data, size, title); + } + else + { + char *name = strrchr(filename, '\\'); + if (name == NULL) + strrchr(filename, '/'); + + if (name == NULL) + { + Concat(data, size, NULL); + } + else + { + char *dot = strrchr(name, '.'); + Concat(data, size, name + 1, dot == NULL ? 0 : dot - name - 1); + } + } + + GetMetadata(&efi, "ARTIST", data, size); + GetMetadata(&efi, "ALBUM", data, size); + GetMetadata(&efi, "TRACK", data, size); + GetMetadata(&efi, "YEAR", data, size); + GetMetadata(&efi, "GENRE", data, size); + + efi.ret[0] = '\0'; + efi.metadata = "LENGTH"; + if (SendMessage(plugin.hwndParent, WM_WA_IPC, (WPARAM) &efi, IPC_GET_EXTENDED_FILE_INFO_HOOKABLE) + && efi.ret[0] != '\0' && efi.ret[1] != '\0') + { + char tmp[10]; + itoa(atoi(efi.ret) / 1000, tmp, 10); + Concat(data, size, tmp); + } + else + { + Concat(data, size, NULL); + } + Concat(data, size, NULL); + + SendData(data); +} + + +// Message window proc +LRESULT CALLBACK MsgWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + static BOOL last_was_stop = TRUE; + static DWORD last_notification = 0; + static char last_filename[1024] = {0}; + + switch(message) + { + case WM_TIMER: + { + KillTimer(hwnd, wParam); + + if (wParam == 0) + { + // Startup + if (plugin.hwndParent == NULL) + { + plugin.hwndParent = FindWindow("Winamp v1.x", NULL); + if (plugin.hwndParent != NULL) + { + init(); + + // If playing, show current song + if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1) + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SetTimer(hMsgWnd, 1, 500, NULL); + } + } + } + else if (wParam == 1) + { + // Song change + if (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING) == 1) + { + int track = SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_GETLISTPOS); + char *filename = (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTFILE); + + if (filename == NULL || filename[0] == '\0') + { + if (!last_was_stop) + { + last_was_stop = TRUE; + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + } + } + else + { + BOOL is_radio = (strstr(filename, "://") != 0); + if (last_was_stop || is_radio || strcmpi(last_filename, filename) != 0) + { + last_was_stop = FALSE; + strncpy(last_filename, filename, sizeof(last_filename)); + last_filename[sizeof(last_filename) - 1] = '\0'; + + // Miranda is running? + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendDataToMiranda(last_filename, (char *) SendMessage(plugin.hwndParent, WM_WA_IPC, track, IPC_GETPLAYLISTTITLE)); + + if (is_radio) + // To try to get info from radio stations + SetTimer(hMsgWnd, 1, 3000, NULL); + } + } + } + else + { + if (!last_was_stop) + { + last_was_stop = TRUE; + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + } + } + } + + break; + } + } + + return DefWindowProc(hwnd, message, wParam, lParam); +} + +// Playlist window message processor +LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_USER: + { + if(wParam == WA_STATE_CHANGE) + { + int type = HIWORD(lParam); + if(type == 0x4000 || type == 0) + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 1000, NULL); + } + } + break; + } + } + + return CallWindowProc(oldWndProc, hwnd, message, wParam, lParam); +} + + +LRESULT CALLBACK MainWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch(message) + { + case WM_COMMAND: + { + switch(wParam) + { + case 40045: // Play + case 40046: // Pause + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 500, NULL); + break; + } + } + break; + } + case WM_WA_IPC: + { + switch(lParam) + { + case IPC_PLAYING_FILE: + { + KillTimer(hMsgWnd, 1); + SetTimer(hMsgWnd, 1, 500, NULL); + break; + } + } + break; + } + case WM_CLOSE: + { + PostMessage(hMsgWnd, WM_TIMER, 1, 0); + PostMessage(hMsgWnd, WM_CLOSE, 0, 0); + break; + } + } + + return CallWindowProc(oldMainWndProc, hwnd, message, wParam, lParam); +} + + +void quit() +{ + if (oldMainWndProc != NULL) + SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG_PTR) oldMainWndProc); + + if (oldWndProc != NULL) + SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG_PTR) oldWndProc); + + if (FindWindow(MIRANDA_WINDOWCLASS, NULL) != NULL) + SendData(L"0\\0Winamp\\0\\0\\0\\0\\0\\0\\0\\0\\0\\0"); + +} + + +int init() +{ + KillTimer(hMsgWnd, 0); + + oldMainWndProc = (WNDPROC)SetWindowLongPtr(plugin.hwndParent, GWLP_WNDPROC, (LONG_PTR) MainWndProc); + + hPlWnd = (HWND) SendMessage(plugin.hwndParent, WM_WA_IPC, IPC_GETWND_PE, IPC_GETWND); + oldWndProc = (WNDPROC) SetWindowLongPtr(hPlWnd, GWLP_WNDPROC, (LONG_PTR)WndProc); + + return 0; +} + +void config() { + MessageBox(NULL, _T("Copyright (C) 2006 Ricardo Pescuma Domenecci"), _T("Miranda ListeningTo Winamp Plugin"), 0); +} diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 31bae3b326..2ceafbffc6 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -716,7 +716,7 @@ void checkthread(void*) &retNoteOID, /* out: OID */
&retModified, /* out: */
&retNoteClass) ;
- ZeroMemory(strLink, SIZEOF(strLink));
+ ZeroMemory(strLink, sizeof(strLink));
mir_snprintf(strLink, SIZEOF(strLink), "%.8lX%.8lX%.8lX%.8lX",
retNoteOID.File.Innards[1],
retNoteOID.File.Innards[0],
@@ -1131,7 +1131,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L PostMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
switch(LOWORD(wParam))
{
- case IDC_DATABASE: GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, sizeof(settingDatabase)); break;
+ case IDC_DATABASE: GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, SIZEOF(settingDatabase)); break;
case IDC_SERVER:
{
switch(HIWORD(wParam))
@@ -1158,13 +1158,13 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L }
}
}
- case IDC_SERVERSEC: GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, sizeof(settingServerSec)); break;
- case IDC_PASSWORD: GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, sizeof(settingPassword)); break;
+ case IDC_SERVERSEC: GetDlgItemTextA(hwndDlg, IDC_SERVERSEC, settingServerSec, SIZEOF(settingServerSec)); break;
+ case IDC_PASSWORD: GetDlgItemTextA(hwndDlg, IDC_PASSWORD, settingPassword, SIZEOF(settingPassword)); break;
case IDC_INTERVAL: settingInterval =GetDlgItemInt(hwndDlg, IDC_INTERVAL, NULL, FALSE); break;
case IDC_INTERVAL1: settingInterval1 =GetDlgItemInt(hwndDlg, IDC_INTERVAL1, NULL, TRUE); break;
- case IDC_COMMAND: GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, sizeof(settingCommand)); break;
- case IDC_PARAMETERS: GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, sizeof(settingParameters)); break;
+ case IDC_COMMAND: GetDlgItemTextA(hwndDlg, IDC_COMMAND, settingCommand, SIZEOF(settingCommand)); break;
+ case IDC_PARAMETERS: GetDlgItemTextA(hwndDlg, IDC_PARAMETERS, settingParameters, SIZEOF(settingParameters)); break;
case IDC_ONCEONLY:
{
HWND hwnd = GetDlgItem(hwndDlg, IDC_NONCLICKEDONLY);
@@ -1191,8 +1191,8 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_BUTTON_DETECT:
{
lookupLotusDefaultSettings(hwndDlg);
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, sizeof(settingServer));
- GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, sizeof(settingDatabase));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, SIZEOF(settingServer));
+ GetDlgItemTextA(hwndDlg, IDC_DATABASE, settingDatabase, SIZEOF(settingDatabase));
break;
}
case IDC_BUTTON_CLEAR:
@@ -1210,7 +1210,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_BUTTON_ADD_SENDER_FILTER:
{
char tmp[255];
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, sizeof(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SENDER, tmp, SIZEOF(tmp));
SendDlgItemMessageA(hwndDlg, IDC_FILTER_SENDER, CB_ADDSTRING, 0, (LPARAM)tmp);
break;
}
@@ -1222,7 +1222,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_BUTTON_ADD_SUBJECT_FILTER:
{
char tmp[255];
- GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, sizeof(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_SUBJECT, tmp, SIZEOF(tmp));
SendDlgItemMessageA(hwndDlg, IDC_FILTER_SUBJECT, CB_ADDSTRING, 0, (LPARAM)tmp);
break;
}
@@ -1234,7 +1234,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_BUTTON_ADD_TO_FILTER:
{
char tmp[255];
- GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, sizeof(tmp));
+ GetDlgItemTextA(hwndDlg, IDC_FILTER_TO, tmp, SIZEOF(tmp));
SendDlgItemMessageA(hwndDlg, IDC_FILTER_TO, CB_ADDSTRING, 0, (LPARAM)tmp);
break;
}
@@ -1262,7 +1262,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L {
char buff[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, sizeof(settingServer));
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, SIZEOF(settingServer));
db_set_s(NULL, PLUGINNAME, "LNServer", settingServer );
db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec);
db_set_s(NULL, PLUGINNAME, "LNPassword", settingPassword);
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index b9ca2178c2..e686eef680 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -406,7 +406,7 @@ INT_PTR CALLBACK AuthReqWndProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case IDOK:
{
TCHAR tszReason[256] = {0};
- GetDlgItemText(hdlg,IDC_REASON,tszReason,255);
+ GetDlgItemText(hdlg,IDC_REASON,tszReason,SIZEOF(tszReason));
CallContactService(hcontact,PSS_AUTHREQUESTT,0,(LPARAM)tszReason);
} // fall through
case IDCANCEL:
diff --git a/plugins/MenuItemEx/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index 48c764df7c..5d0d978232 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -47,7 +47,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) {
for (i = 0; i < 4; i++)
{
- GetDlgItemText(hdlg, checkboxes[i].idc, buffer, SIZEOF(buffer) - 3);
+ GetDlgItemText(hdlg, checkboxes[i].idc, buffer, (SIZEOF(buffer) - 3));
_tcscat(buffer, _T(" *"));
SetDlgItemText(hdlg, checkboxes[i].idc, buffer);
}
diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index 109860fa0c..a35feaa0a3 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -553,10 +553,10 @@ INT_PTR CALLBACK CConfig::ChatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP m_abBoolSettings[MAXIMIZED_TITLE] = IsDlgButtonChecked(hwndDlg,IDC_MAXIMIZED_TITLE) == BST_UNCHECKED ? true : false;
m_abBoolSettings[MAXIMIZED_LABELS] = IsDlgButtonChecked(hwndDlg,IDC_MAXIMIZED_LABELS) == BST_UNCHECKED ? true : false;
- GetDlgItemTextA(hwndDlg,IDC_SESSION_LOGSIZE,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_SESSION_LOGSIZE,buf,SIZEOF(buf));
m_aiIntSettings[SESSION_LOGSIZE] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_SESSION_CLOSETIMER,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_SESSION_CLOSETIMER,buf,SIZEOF(buf));
m_aiIntSettings[SESSION_CLOSETIMER] = atoi(buf) >= 0 ? atoi(buf):1;
CConfig::SaveSettings();
@@ -709,16 +709,16 @@ INT_PTR CALLBACK CConfig::NotificationsDlgProc(HWND hwndDlg, UINT uMsg, WPARAM w m_abBoolSettings[NOTIFY_SKIP_SIGNOFF] = IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_SKIP_SIGNOFF) == BST_CHECKED ? true : false;
m_abBoolSettings[NOTIFY_SKIP_STATUS] = IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_SKIP_STATUS) == BST_CHECKED ? true : false;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_CHANNELCUTOFF_OFFSET,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_CHANNELCUTOFF_OFFSET,buf,SIZEOF(buf));
m_aiIntSettings[NOTIFY_CHANNELCUTOFF_OFFSET] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_NICKCUTOFF_OFFSET,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_NICKCUTOFF_OFFSET,buf,SIZEOF(buf));
m_aiIntSettings[NOTIFY_NICKCUTOFF_OFFSET] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_DURATION,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_DURATION,buf,SIZEOF(buf));
m_aiIntSettings[NOTIFY_DURATION] = atoi(buf) > 0 ? atoi(buf):1;
- GetDlgItemTextA(hwndDlg,IDC_NOTIFY_LOGSIZE,buf,256);
+ GetDlgItemTextA(hwndDlg,IDC_NOTIFY_LOGSIZE,buf,SIZEOF(buf));
m_aiIntSettings[NOTIFY_LOGSIZE] = atoi(buf) > 0 ? atoi(buf):1;
if(IsDlgButtonChecked(hwndDlg,IDC_NOTIFY_TITLEHIDE) == BST_CHECKED)
diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index 6d7ef44862..599ff08953 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -297,7 +297,7 @@ void SetToDefault( HWND hParent ) }
TCHAR szTemp[ 500 ];
- if ( !GetDlgItemText( hParent, IDC_DEFAULT_FILE, szTemp, sizeof( szTemp)) )
+ if ( !GetDlgItemText( hParent, IDC_DEFAULT_FILE, szTemp, SIZEOF(szTemp)) )
return;
LVITEM sItem = { 0 };
@@ -359,16 +359,16 @@ BOOL bApplyChanges( HWND hwndDlg ) nMaxLineWidth = nTmp;
}
- GetDlgItemText(hwndDlg, IDC_EXPORT_TIMEFORMAT, szTemp, sizeof( szTemp));
+ GetDlgItemText(hwndDlg, IDC_EXPORT_TIMEFORMAT, szTemp, SIZEOF(szTemp));
sTimeFormat = szTemp;
- GetDlgItemText(hwndDlg, IDC_EXPORT_DIR, szTemp, sizeof( szTemp));
+ GetDlgItemText(hwndDlg, IDC_EXPORT_DIR, szTemp, SIZEOF(szTemp));
sExportDir = szTemp;
- GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szTemp, sizeof( szTemp));
+ GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szTemp, SIZEOF(szTemp));
sDefaultFile = szTemp;
- GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szTemp, sizeof( szTemp));
+ GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szTemp, SIZEOF(szTemp));
sFileViewerPrg = szTemp;
bUseInternalViewer( IsDlgButtonChecked(hwndDlg, IDC_USE_INTERNAL_VIEWER ) == BST_CHECKED);
@@ -469,7 +469,7 @@ void AutoFindeFileNames(HWND hwndDlg) {
TCHAR szDefaultFile[500];
- GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szDefaultFile, sizeof( szDefaultFile));
+ GetDlgItemText(hwndDlg, IDC_DEFAULT_FILE, szDefaultFile, SIZEOF(szDefaultFile));
LVITEM sItem = { 0 };
@@ -891,13 +891,13 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar OPENFILENAME ofn = { 0 }; // common dialog box structure
TCHAR szFile[260]; // buffer for file name
- GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, sizeof(szFile));
+ GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, SIZEOF(szFile));
// Initialize OPENFILENAME
//ZeroMemory(&ofn, sizeof(OPENFILENAME));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = sizeof(szFile);
+ ofn.nMaxFile = SIZEOF(szFile);
TCHAR buf[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c"), TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0);
ofn.lpstrFilter = buf;
diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index 0dc51f7af1..763be95870 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -943,7 +943,7 @@ void DisplayErrorDialog( const TCHAR *pszError, tstring& sFilePath, DBEVENTINFO ofn.lStructSize = sizeof(OPENFILENAME);
//ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = sizeof(szFile);
+ ofn.nMaxFile = SIZEOF(szFile);
ofn.lpstrFilter = TranslateT("All\0*.*\0Text\0*.TXT\0\0");
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index bd6f4cdf7b..364946146a 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -368,7 +368,7 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w case IDOK:
{
TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
- GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp));
+ GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, SIZEOF(tmp));
SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
diff --git a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp index e829b7cbb1..62a621fae1 100644 --- a/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/ReadAwayMsg.cpp @@ -72,7 +72,7 @@ static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam GetWindowText(hwndDlg, format, SIZEOF(format));
_sntprintf(str, SIZEOF(str), format, status, contactName);
SetWindowText(hwndDlg, str);
- GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, sizeof(format));
+ GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, SIZEOF(format));
_sntprintf(str, SIZEOF(str), format, status);
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, str);
}
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index f0d2f4a0bd..6e2ef86b28 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -249,7 +249,7 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA TCHAR buff[MAX_PATH];
OPENFILENAME ofn = {0};
- GetDlgItemText(hwndDlg, IDC_LOGFILE, buff, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_LOGFILE, buff, SIZEOF(buff));
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrFile = buff;
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 97ba1eabe9..de39d4a36e 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -322,7 +322,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR boost::algorithm::erase_all(out, "\r"); { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -351,7 +351,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } } TCHAR passwd[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, 64); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, passwd, SIZEOF(passwd)); if(passwd[0]) { string dbsetting = "szKey_"; @@ -497,7 +497,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_unset(NULL, szGPGModuleName, "GPGPubKey"); @@ -625,7 +625,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { db_set_s(NULL, szGPGModuleName, "GPGPubKey", out.c_str()); @@ -650,7 +650,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR case IDC_ACCOUNT: { char buf[64]; - GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, 63); + GetDlgItemTextA(hwndDlg, IDC_ACCOUNT, buf, SIZEOF(buf)); if(!strcmp(buf, Translate("Default"))) { string keyinfo = Translate("key ID"); @@ -1002,7 +1002,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case ID_OK: { TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1052,7 +1052,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended to use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) @@ -1080,7 +1080,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case IDC_GENERATE_RANDOM: { TCHAR tmp[512]; - GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512); + GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp)); if(tmp[0]) { char *mir_path = new char [MAX_PATH]; @@ -1130,7 +1130,7 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, MessageBox(0, TranslateT("Unsupported GnuPG version found, use at you own risk!\nIt is recommended to use GnuPG v1.x.x with this plugin."), TranslateT("Warning"), MB_OK); } db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); - GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512); + GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp)); while(tmp[_tcslen(tmp)-1] == '\\') tmp[_tcslen(tmp)-1] = '\0'; if(!tmp[0]) diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index fbc4f428ed..d1cae49e04 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -998,7 +998,7 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam case IDOK: { TCHAR tmp[64]; - GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, 64); + GetDlgItemText(hwndDlg, IDC_KEY_PASSWORD, tmp, SIZEOF(tmp)); if(tmp[0]) { extern TCHAR *password; diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 8490ca1fd1..039d91cc35 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -437,7 +437,7 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP bAutoExchange = CheckStateStoreDB(hwndDlg, IDC_AUTO_EXCHANGE, "bAutoExchange") != 0;
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_LOG_FILE_EDIT, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szLogFilePath", tmp);
}
return TRUE;
@@ -566,9 +566,9 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY:
{
TCHAR tmp[512];
- GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp);
- GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, 512);
+ GetDlgItemText(hwndDlg, IDC_HOME_DIR, tmp, SIZEOF(tmp));
while(tmp[_tcslen(tmp)-1] == '\\')
tmp[_tcslen(tmp)-1] = '\0';
db_set_ts(NULL, szGPGModuleName, "szHomePath", tmp);
@@ -633,22 +633,22 @@ static INT_PTR CALLBACK DlgProcGpgMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bStripTags = CheckStateStoreDB(hwndDlg, IDC_STRIP_TAGS, "bStripTags") != 0;
{
TCHAR tmp[128];
- GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_IN_OPEN_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szInOpenTag", tmp);
mir_free(inopentag);
inopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_IN_CLOSE_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szInCloseTag", tmp);
mir_free(inclosetag);
inclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(inclosetag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_OUT_OPEN_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutOpenTag", tmp);
mir_free(outopentag);
outopentag = (TCHAR*)mir_alloc(sizeof(TCHAR)* (_tcslen(tmp)+1));
_tcscpy(outopentag, tmp);
- GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, 128);
+ GetDlgItemText(hwndDlg, IDC_OUT_CLOSE_TAG, tmp, SIZEOF(tmp));
db_set_ts(NULL, szGPGModuleName, "szOutCloseTag", tmp);
mir_free(outclosetag);
outclosetag = (TCHAR*)mir_alloc(sizeof(TCHAR)*(_tcslen(tmp)+1));
diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index ece1904580..1474502e35 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -2084,16 +2084,16 @@ static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wPara std::string old_pass, new_pass; extern TCHAR key_id_global[17]; TCHAR buf[256] = {0}; - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, 255); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, SIZEOF(buf)); new_pass = toUTF8(buf); - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, 255); + GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, SIZEOF(buf)); if(new_pass != toUTF8(buf)) { MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK); //key_id_global[0] = 0; break; } - GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, 255); + GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, SIZEOF(buf)); old_pass = toUTF8(buf); bool old_pass_match = false; TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index d5a9a51dfa..0e162b3674 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -29,7 +29,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l MCONTACT hContact = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (GetWindowTextLength(GetDlgItem(hwnd,IDC_DISPLAY_NAME))) {
char text[512];
- GetDlgItemTextA(hwnd,IDC_DISPLAY_NAME,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_DISPLAY_NAME,text,SIZEOF(text));
db_set_s(hContact, MODNAME, "Name", text);
WriteSetting(hContact, MODNAME, "Name", MODNAME, "Nick");
}
@@ -40,7 +40,7 @@ INT_PTR CALLBACK DlgProcContactInfo(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (GetWindowTextLength(GetDlgItem(hwnd,IDC_TOOLTIP))) {
char text[2048];
- GetDlgItemTextA(hwnd,IDC_TOOLTIP,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_TOOLTIP,text,SIZEOF(text));
db_set_s(hContact, MODNAME, "ToolTip", text);
WriteSetting(hContact, MODNAME, "ToolTip", "UserInfo", "MyNotes");
}
@@ -227,7 +227,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (GetWindowTextLength(GetDlgItem(hwnd,IDC_LINK))) {
char text[512];
- GetDlgItemTextA(hwnd,IDC_LINK,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_LINK,text,SIZEOF(text));
db_set_s(hContact, MODNAME, "ProgramString", text);
WriteSetting(hContact, MODNAME, "ProgramString", MODNAME, "Program");
}
@@ -235,7 +235,7 @@ INT_PTR CALLBACK DlgProcOtherStuff(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (GetWindowTextLength(GetDlgItem(hwnd,IDC_PARAMS))) {
char text[512];
- GetDlgItemTextA(hwnd,IDC_PARAMS,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_PARAMS,text,SIZEOF(text));
db_set_s(hContact, MODNAME, "ProgramParamsString", text);
WriteSetting(hContact, MODNAME, "ProgramParamsString", MODNAME, "ProgramParams");
}
diff --git a/plugins/Non-IM Contact/src/dialog.cpp b/plugins/Non-IM Contact/src/dialog.cpp index e3bb42af03..4c73fefa2e 100644 --- a/plugins/Non-IM Contact/src/dialog.cpp +++ b/plugins/Non-IM Contact/src/dialog.cpp @@ -68,7 +68,7 @@ INT_PTR CALLBACK DlgProcNimcOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar TCHAR tmp[5];
db_set_b(NULL, MODNAME, "AwayAsStatus", (BYTE)IsDlgButtonChecked(hwnd, IDC_AWAYISNOTONLINE));
if (!IsDlgButtonChecked(hwnd, IDC_DISABLETIMER) && GetWindowTextLength(GetDlgItem(hwnd, IDC_TIMER_INT))) {
- GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, 4);
+ GetDlgItemText(hwnd, IDC_TIMER_INT, tmp, SIZEOF(tmp));
db_set_w(NULL, MODNAME, "Timer",(WORD)_ttoi(tmp));
}
else db_set_w(NULL, MODNAME, "Timer",0);
@@ -142,7 +142,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP char tmp[MAX_STRING_LENGTH];
int i=0,j;
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, tmp, MAX_STRING_LENGTH);
+ GetDlgItemTextA(hwnd, IDC_STRING, tmp, SIZEOF(tmp));
if (tmp[strlen(tmp)-1] == '(') {
for (i=0; i<VARS; i++) {
if (!strcmp(braceList[i].var,&tmp[strlen(tmp)-strlen(braceList[i].var)])) {
@@ -184,7 +184,7 @@ INT_PTR CALLBACK TestWindowDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP char str2replace[MAX_STRING_LENGTH], replacedString[MAX_STRING_LENGTH];
int error;
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING))) {
- GetDlgItemTextA(hwnd, IDC_STRING, str2replace, MAX_STRING_LENGTH);
+ GetDlgItemTextA(hwnd, IDC_STRING, str2replace, SIZEOF(str2replace));
switch (stringReplacer(str2replace, replacedString, NULL)) {
case ERROR_NO_LINE_AFTER_VAR_F:
mir_snprintf(replacedString, SIZEOF(replacedString), "ERROR: no %s","%line or %wholeline or %lastline after %fn");
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index f5202e5b6d..226935c79e 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -183,7 +183,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
char text[512], url[512], fn[10] = "fn0", szFileName[MAX_PATH], temp[512];
int i, timer;
- GetDlgItemTextA(hwnd,IDC_URL,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_URL,text,SIZEOF(text));
strcpy(url, text);
if (!InternetDownloadFile(text))
{
@@ -202,7 +202,7 @@ INT_PTR CALLBACK DlgProcFiles(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) timer = 60;
else
{
- GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,sizeof(text));
+ GetDlgItemTextA(hwnd,IDC_WWW_TIMER,text,SIZEOF(text));
timer = atoi(text);
}
db_set_w(NULL, MODNAME, strcat(fn, "_timer"), (WORD)timer);
diff --git a/plugins/NotifyAnything/src/options.cpp b/plugins/NotifyAnything/src/options.cpp index 99ce325044..4393ed1a62 100644 --- a/plugins/NotifyAnything/src/options.cpp +++ b/plugins/NotifyAnything/src/options.cpp @@ -57,7 +57,7 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case NA_LOG_BROWSE:
if (HIWORD(wParam) == BN_CLICKED) {
TCHAR szTemp[MAX_PATH + 1], szTemp1[MAX_PATH + 1], szProfileDir[MAX_PATH + 1];
- GetDlgItemText(hwndDlg, NA_LOG_FILENAME, szTemp, MAX_PATH);
+ GetDlgItemText(hwndDlg, NA_LOG_FILENAME, szTemp, SIZEOF(szTemp));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.lpstrFile = szTemp;
diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 633ceb92f6..a2222f6453 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -84,7 +84,7 @@ std::wstring GetFile() ofn.nFilterIndex = 1;
ofn.lpstrFile = stzFilePath;
ofn.lpstrTitle = TranslateT("Paste It - Select file");
- ofn.nMaxFile = 1024;
+ ofn.nMaxFile = SIZEOF(stzFilePath);
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER | OFN_NOCHANGEDIR;
if(GetOpenFileName(&ofn))
{
diff --git a/plugins/Ping/src/options.cpp b/plugins/Ping/src/options.cpp index a4775eb105..5a0a264f70 100644 --- a/plugins/Ping/src/options.cpp +++ b/plugins/Ping/src/options.cpp @@ -128,7 +128,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA options.block_reps = IsDlgButtonChecked(hwndDlg, IDC_CHK_BLOCK) == BST_CHECKED;
options.logging = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOG) == BST_CHECKED;
options.log_csv = IsDlgButtonChecked(hwndDlg, IDC_CHK_LOGCSV) == BST_CHECKED;
- GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_FILENAME, options.log_filename, SIZEOF(options.log_filename));
options.no_test_icon = IsDlgButtonChecked(hwndDlg, IDC_CHK_NOTESTICON) == BST_CHECKED;
@@ -232,14 +232,14 @@ INT_PTR CALLBACK DlgProcDestEdit(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l EnableWindow(GetDlgItem(hwndDlg, IDC_ED_DESTPORT), IsDlgButtonChecked(hwndDlg, IDC_CHK_DESTTCP));
break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName, MAX_PINGADDRESS_STRING_LENGTH);
- GetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel, MAX_PINGADDRESS_STRING_LENGTH);
- GetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand, MAX_PATH);
- GetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_ED_DESTADDR, add_edit_addr.pszName, SIZEOF(add_edit_addr.pszName));
+ GetDlgItemText(hwndDlg, IDC_ED_DESTLAB, add_edit_addr.pszLabel, SIZEOF(add_edit_addr.pszLabel));
+ GetDlgItemText(hwndDlg, IDC_ED_COMMAND, add_edit_addr.pszCommand, SIZEOF(add_edit_addr.pszCommand));
+ GetDlgItemText(hwndDlg, IDC_ED_PARAMS, add_edit_addr.pszParams, SIZEOF(add_edit_addr.pszParams));
if(SendDlgItemMessage(hwndDlg, IDC_COMBO_DESTPROTO, CB_GETCURSEL, 0, 0) != -1)
{
- GetDlgItemTextA(hwndDlg, IDC_COMBO_DESTPROTO, add_edit_addr.pszProto, MAX_PINGADDRESS_STRING_LENGTH);
+ GetDlgItemTextA(hwndDlg, IDC_COMBO_DESTPROTO, add_edit_addr.pszProto, SIZEOF(add_edit_addr.pszProto));
if(!strcmp(add_edit_addr.pszProto, Translate("<none>")))
add_edit_addr.pszProto[0] = '\0';
else {
diff --git a/plugins/SMS/src/AdditionalFunctions/ListMT.h b/plugins/SMS/src/AdditionalFunctions/ListMT.h index 76fd432d6d..04f2552aaf 100644 --- a/plugins/SMS/src/AdditionalFunctions/ListMT.h +++ b/plugins/SMS/src/AdditionalFunctions/ListMT.h @@ -20,7 +20,7 @@ typedef CONST PLIST_MT_ITEM PCLIST_MT_ITEM, LPCLIST_MT_ITEM; // ñòðóêòóðà äëÿ ðàáîòû ñî ñïèñêîì, çàãîëîâîê ñïèñêà
typedef struct _LIST_MT
{
- SIZE_T nCount; // *êîëëè÷åñòâî ýëåìåíòîâ â ñïèñêå
+ size_t nCount; // *êîëëè÷åñòâî ýëåìåíòîâ â ñïèñêå
PLIST_MT_ITEM plmtiFirst; // *óêàçûâàåò íà ïåðâûé ýëåìåíò â ñïèñêå
PLIST_MT_ITEM plmtiLast; // *óêàçûâàåò íà ïîñëåäíèé ýëåìåíò â ñïèñêå
CRITICAL_SECTION cs; // *section for exclysive access to List
@@ -92,15 +92,15 @@ __inline void ListMTUnLock(PCLIST_MT pclmtListMT) }
-__inline SIZE_T ListMTGetCount(PCLIST_MT pclmtListMT)
+__inline size_t ListMTGetCount(PCLIST_MT pclmtListMT)
{
- return((SIZE_T)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL));
+ return((size_t)InterlockedCompareExchangePointer((LPVOID*)&pclmtListMT->nCount,NULL,NULL));
}
-__inline SIZE_T ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem,LPVOID lpData)
+__inline size_t ListMTItemAdd(PCLIST_MT pclmtListMT,PCLIST_MT_ITEM pclmtListMTItem,LPVOID lpData)
{
- SIZE_T dwRet=(SIZE_T)InterlockedIncrementPointer(&pclmtListMT->nCount);//pclmtListMT->nCount++;
+ size_t dwRet=(size_t)InterlockedIncrementPointer(&pclmtListMT->nCount);//pclmtListMT->nCount++;
pclmtListMTItem->lpData=lpData;
pclmtListMTItem->lpListMT=pclmtListMT;
diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h b/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h index a357dd1d67..c9d58a3b6f 100644 --- a/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h +++ b/plugins/SMS/src/AdditionalFunctions/MemoryCompare.h @@ -1,7 +1,7 @@ #if !defined(AFX_MEMORYCOMPARE__H__INCLUDED_)
#define AFX_MEMORYCOMPARE__H__INCLUDED_
-__inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpcSource2,SIZE_T dwSource2Size)
+__inline DWORD MemoryCompare(LPCVOID lpcSource1,size_t dwSource1Size,LPCVOID lpcSource2,size_t dwSource2Size)
{
if (dwSource1Size == dwSource2Size) {
if (lpcSource1 == lpcSource2)
@@ -11,14 +11,14 @@ __inline DWORD MemoryCompare(LPCVOID lpcSource1,SIZE_T dwSource1Size,LPCVOID lpc #ifdef _INC_MEMORY
return 2 + memcmp(lpcSource1,lpcSource2,dwSource1Size));
#else
- SIZE_T dwDiffPosition;
+ size_t dwDiffPosition;
//dwDiffPosition=RtlCompareMemory(lpcSource1,lpcSource2,dwSource1Size);
for(dwDiffPosition=0; (dwDiffPosition<dwSource1Size) && (((const BYTE*)lpcSource1)[dwDiffPosition]==((const BYTE*)lpcSource2)[dwDiffPosition]); dwDiffPosition++);
if (dwDiffPosition==dwSource1Size)
return CSTR_EQUAL;
- if ((*((BYTE*)(((SIZE_T)lpcSource1)+dwDiffPosition)))>(*((BYTE*)(((SIZE_T)lpcSource2)+dwDiffPosition))))
+ if ((*((BYTE*)(((size_t)lpcSource1)+dwDiffPosition)))>(*((BYTE*)(((size_t)lpcSource2)+dwDiffPosition))))
return CSTR_GREATER_THAN;
return CSTR_LESS_THAN;
diff --git a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h index a0731a0054..98fed3c44e 100644 --- a/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h +++ b/plugins/SMS/src/AdditionalFunctions/MemoryFindByte.h @@ -1,7 +1,7 @@ #if !defined(AFX_MEMORYFINDBYTE__H__INCLUDED_)
#define AFX_MEMORYFINDBYTE__H__INCLUDED_
-__inline LPVOID MemoryFindByte(SIZE_T dwFrom,LPCVOID lpcSource,SIZE_T dwSourceSize,unsigned char chWhatFind)
+__inline LPVOID MemoryFindByte(size_t dwFrom,LPCVOID lpcSource,size_t dwSourceSize,unsigned char chWhatFind)
{
if (lpcSource && dwSourceSize)
if (dwFrom < dwSourceSize)
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 6637f05733..89f751dbde 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -8,7 +8,7 @@ int LoadServices(void) pszServiceFunctionName=szServiceFunction+PROTOCOL_NAME_LEN;
// Service creation
- for (SIZE_T i=0;i<SIZEOF(siPluginServices);i++)
+ for (size_t i=0;i<SIZEOF(siPluginServices);i++)
{
CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
CreateServiceFunction(szServiceFunction,(MIRANDASERVICE)siPluginServices[i].lpFunc);
diff --git a/plugins/SMS/src/common.h b/plugins/SMS/src/common.h index 9256139ea4..2b3f917afa 100644 --- a/plugins/SMS/src/common.h +++ b/plugins/SMS/src/common.h @@ -54,16 +54,16 @@ struct GUI_DISPLAY_ITEM typedef struct
{
HANDLE hHeap;
- HINSTANCE hInstance;
+ HINSTANCE hInstance;
- HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
- HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
+ HGENMENU hMainMenuItems[MAIN_MENU_ITEMS_COUNT+1];
+ HGENMENU hContactMenuItems[CONTACT_MENU_ITEMS_COUNT+1];
- LIST_MT lmtSendSMSWindowsListMT;
- LIST_MT lmtRecvSMSWindowsListMT;
+ LIST_MT lmtSendSMSWindowsListMT;
+ LIST_MT lmtRecvSMSWindowsListMT;
- PROTOACCOUNT **ppaSMSAccounts;
- SIZE_T dwSMSAccountsCount;
+ PROTOACCOUNT **ppaSMSAccounts;
+ size_t dwSMSAccountsCount;
} SMS_SETTINGS;
@@ -74,8 +74,8 @@ extern SMS_SETTINGS ssSMSSettings; -#define MEMALLOC(Size) HeapAlloc(ssSMSSettings.hHeap,HEAP_ZERO_MEMORY,(Size+sizeof(SIZE_T)))
-#define MEMREALLOC(Mem,Size) HeapReAlloc(ssSMSSettings.hHeap,(HEAP_ZERO_MEMORY),(LPVOID)Mem,(Size+sizeof(SIZE_T)))
+#define MEMALLOC(Size) HeapAlloc(ssSMSSettings.hHeap,HEAP_ZERO_MEMORY,(Size+sizeof(size_t)))
+#define MEMREALLOC(Mem,Size) HeapReAlloc(ssSMSSettings.hHeap,(HEAP_ZERO_MEMORY),(LPVOID)Mem,(Size+sizeof(size_t)))
#define MEMFREE(Mem) if (Mem) {HeapFree(ssSMSSettings.hHeap,0,(LPVOID)Mem);Mem=NULL;}
@@ -92,7 +92,7 @@ extern SMS_SETTINGS ssSMSSettings; #define DB_SMS_SetWord(Contact,valueName,parValue) db_set_w(Contact,PROTOCOL_NAMEA,valueName,parValue)
#define DB_SMS_GetByte(Contact,valueName,parDefltValue) db_get_b(Contact,PROTOCOL_NAMEA,valueName,parDefltValue)
#define DB_SMS_SetByte(Contact,valueName,parValue) db_set_b(Contact,PROTOCOL_NAMEA,valueName,parValue)
-BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize);
+BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpszRetBuff,size_t dwRetBuffSize,size_t *pdwRetBuffSize);
#define DB_SMS_GetStaticStringW(Contact,ValueName,Ret,RetBuffSize,pRetBuffSize) DB_GetStaticStringW(Contact,PROTOCOL_NAMEA,ValueName,Ret,RetBuffSize,pRetBuffSize)
#define DB_SetStringW(Contact,Module,valueName,parValue) db_set_ws(Contact,Module,valueName,parValue)
#define DB_SMS_SetStringW(Contact,valueName,parValue) db_set_ws(Contact,PROTOCOL_NAMEA,valueName,parValue)
@@ -100,24 +100,24 @@ BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName, LRESULT CALLBACK MessageSubclassProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam);
LPSTR GetModuleName(MCONTACT hContact);
-void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled);
+void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,size_t dwControlsListCount,BOOL bEnabled);
// Declaration of function that returns received string with only numbers
-SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen);
-SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen);
-bool IsPhoneW(LPWSTR lpwszString,SIZE_T dwStringLen);
+size_t CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,size_t dwLen);
+size_t CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,size_t dwLen);
+bool IsPhoneW(LPWSTR lpwszString,size_t dwStringLen);
DWORD GetContactPhonesCount(MCONTACT hContact);
-BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize);
+BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,size_t dwPhoneSize);
// Declaration of function that returns HANDLE of contact by his cellular number
-MCONTACT HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize);
-BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,SIZE_T *pdwPhoneSizeRet,UINT *piIcon);
+MCONTACT HContactFromPhone(LPWSTR lpwszPhone,size_t dwPhoneSize);
+BOOL GetDataFromMessage(LPSTR lpszMessage,size_t dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,size_t *pdwPhoneSizeRet,UINT *piIcon);
// Declaration of function that gets a XML string and return the asked tag.
-BOOL GetXMLFieldEx(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR *plpszData,SIZE_T *pdwDataSize,const char *tag1,...);
-BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet,const char *tag1,...);
-DWORD DecodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
-DWORD EncodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize);
+BOOL GetXMLFieldEx(LPSTR lpszXML,size_t dwXMLSize,LPSTR *plpszData,size_t *pdwDataSize,const char *tag1,...);
+BOOL GetXMLFieldExBuff(LPSTR lpszXML,size_t dwXMLSize,LPSTR lpszBuff,size_t dwBuffSize,size_t *pdwBuffSizeRet,const char *tag1,...);
+DWORD DecodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize);
+DWORD EncodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize);
void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour);
int RefreshAccountList(WPARAM eventCode,LPARAM lParam);
void FreeAccountList();
@@ -134,6 +134,6 @@ void RestoreUnreadMessageAlerts(); // Declaration of Menu SMS send click function
int SmsRebuildContactMenu(WPARAM wParam,LPARAM lParam);
-void StartSmsSend(HWND hWndDlg,SIZE_T dwModuleIndex,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPWSTR lpwszMessage,SIZE_T dwMessageSize);
+void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwPhoneSize,LPWSTR lpwszMessage,size_t dwMessageSize);
#endif
\ No newline at end of file diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index 48c7abc01f..cdf497067e 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -1,9 +1,9 @@ #include "common.h"
-BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszRetBuff,SIZE_T dwRetBuffSize,SIZE_T *pdwRetBuffSize)
+BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszRetBuff,size_t dwRetBuffSize,size_t *pdwRetBuffSize)
{// sizes in wchars
BOOL bRet=FALSE;
- SIZE_T dwReadedStringLen;
+ size_t dwReadedStringLen;
DBVARIANT dbv={0};
if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv)==0)
{
@@ -40,18 +40,18 @@ LPSTR GetModuleName(MCONTACT hContact) return lpszRet;
}
-void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,SIZE_T dwControlsListCount,BOOL bEnabled)
+void EnableControlsArray(HWND hWndDlg,WORD *pwControlsList,size_t dwControlsListCount,BOOL bEnabled)
{
- for(SIZE_T i=0;i<dwControlsListCount;i++) EnableWindow(GetDlgItem(hWndDlg,pwControlsList[i]),bEnabled);
+ for(size_t i=0;i<dwControlsListCount;i++) EnableWindow(GetDlgItem(hWndDlg,pwControlsList[i]),bEnabled);
}
//This function gets a Cellular string szPhone and clean it from symbools.
-SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen)
+size_t CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,size_t dwLen)
{
BYTE btChar;
LPBYTE lpbOutBuff=(LPBYTE)lpszOutBuff,lpbInBuff=(LPBYTE)lpszBuff;
- for(SIZE_T i=0;i<dwLen;i++)
+ for(size_t i=0;i<dwLen;i++)
{
btChar=(*lpbInBuff++);
if (btChar>='0' && btChar<='9') (*lpbOutBuff++)=btChar;
@@ -61,12 +61,12 @@ SIZE_T CopyNumberA(LPSTR lpszOutBuff,LPSTR lpszBuff,SIZE_T dwLen) return((lpbOutBuff-(LPBYTE)lpszOutBuff));
}
-SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen)
+size_t CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,size_t dwLen)
{
WCHAR wChar;
LPWSTR lpwszOutBuff=lpcOutBuff,lpwszInBuff=lpcBuff;
- for(SIZE_T i=0;i<dwLen;i++)
+ for(size_t i=0;i<dwLen;i++)
{
wChar=(*lpwszInBuff++);
if (wChar>='0' && wChar<='9') (*lpwszOutBuff++)=wChar;
@@ -77,12 +77,12 @@ SIZE_T CopyNumberW(LPWSTR lpcOutBuff,LPWSTR lpcBuff,SIZE_T dwLen) }
-bool IsPhoneW(LPWSTR lpwszString,SIZE_T dwStringLen)
+bool IsPhoneW(LPWSTR lpwszString,size_t dwStringLen)
{
if (dwStringLen <= 1)
return false;
- for(SIZE_T i=0; i < dwStringLen; i++) {
+ for(size_t i=0; i < dwStringLen; i++) {
WCHAR wChar=(*lpwszString++);
if (wChar<'0' || wChar>'9')
if (wChar!='+' && wChar!='S' && wChar!='M' && wChar!=' ' && wChar!='(' && wChar!=')')
@@ -97,7 +97,7 @@ DWORD GetContactPhonesCountParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszVa DWORD dwRet=0;
char szBuff[MAX_PATH];
WCHAR wszPhone[MAX_PHONE_LEN];
- SIZE_T i,dwPhoneSize;
+ size_t i,dwPhoneSize;
if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhone,SIZEOF(wszPhone),&dwPhoneSize))
if ( IsPhoneW(wszPhone,dwPhoneSize))
@@ -130,11 +130,11 @@ DWORD GetContactPhonesCount(MCONTACT hContact) }
-BOOL IsContactPhoneParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+BOOL IsContactPhoneParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName,LPWSTR lpwszPhone,size_t dwPhoneSize)
{
char szBuff[MAX_PATH];
WCHAR wszPhoneLocal[MAX_PHONE_LEN];
- SIZE_T i,dwPhoneSizeLocal;
+ size_t i,dwPhoneSizeLocal;
if ( DB_GetStaticStringW(hContact,lpszModule,lpszValueName,wszPhoneLocal,SIZEOF(wszPhoneLocal),&dwPhoneSizeLocal))
if ( IsPhoneW(wszPhoneLocal,dwPhoneSizeLocal)) {
@@ -157,12 +157,12 @@ BOOL IsContactPhoneParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName, }
-BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,size_t dwPhoneSize)
{
BOOL bRet=FALSE;
WCHAR wszPhoneLocal[MAX_PHONE_LEN];
- SIZE_T dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,lpwszPhone,dwPhoneSize);
+ size_t dwPhoneSizeLocal = CopyNumberW(wszPhoneLocal,lpwszPhone,dwPhoneSize);
LPSTR lpszProto = GetContactProto(hContact);
if (lpszProto) {
if (bRet==FALSE) bRet=IsContactPhoneParam(hContact,lpszProto,"Phone",wszPhoneLocal,dwPhoneSizeLocal);
@@ -181,7 +181,7 @@ BOOL IsContactPhone(MCONTACT hContact,LPWSTR lpwszPhone,SIZE_T dwPhoneSize) //This function get a string cellular number and return the HANDLE of the contact that has this
//number in the miranda phonebook (and marked as an SMS able) at the User Details.
//If no one has this number function returns NULL.
-MCONTACT HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize)
+MCONTACT HContactFromPhone(LPWSTR lpwszPhone,size_t dwPhoneSize)
{
if (lpwszPhone && dwPhoneSize) {
//check not already on list
@@ -194,12 +194,12 @@ MCONTACT HContactFromPhone(LPWSTR lpwszPhone,SIZE_T dwPhoneSize) }
-BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,SIZE_T *pdwPhoneSizeRet,UINT *piIcon)
+BOOL GetDataFromMessage(LPSTR lpszMessage,size_t dwMessageSize,DWORD *pdwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,size_t *pdwPhoneSizeRet,UINT *piIcon)
{
BOOL bRet=FALSE;
DWORD dwEventTypeRet=0;
- SIZE_T dwPhoneSizeRet=0;
+ size_t dwPhoneSizeRet=0;
UINT iIconRet=0;
if (lpszMessage && dwMessageSize) {
@@ -207,7 +207,7 @@ BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventTy LPSTR lpsz = (LPSTR)strstr(lpszMessage+10, "\r\n");
if (lpsz) {
if (lpwszPhone && dwPhoneSize) {
- dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8,0,(lpszMessage+10),min((SIZE_T)(lpsz-(lpszMessage+10)),dwPhoneSize),lpwszPhone,dwPhoneSize);
+ dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8,0,(lpszMessage+10),min((size_t)(lpsz-(lpszMessage+10)),dwPhoneSize),lpwszPhone,dwPhoneSize);
dwPhoneSizeRet = CopyNumberW(lpwszPhone, lpwszPhone, dwPhoneSizeRet);
}
}
@@ -219,7 +219,7 @@ BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventTy LPSTR lpsz = (LPSTR)strstr(lpszMessage+23, "\r\n");
if (lpsz) {
if (lpwszPhone && dwPhoneSize) {
- dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8,0,(lpszMessage+23),min((SIZE_T)(lpsz-(lpszMessage+23)),dwPhoneSize),lpwszPhone,dwPhoneSize);
+ dwPhoneSizeRet = MultiByteToWideChar(CP_UTF8,0,(lpszMessage+23),min((size_t)(lpsz-(lpszMessage+23)),dwPhoneSize),lpwszPhone,dwPhoneSize);
dwPhoneSizeRet = CopyNumberW(lpwszPhone, lpwszPhone, dwPhoneSizeRet);
}
@@ -241,7 +241,7 @@ BOOL GetDataFromMessage(LPSTR lpszMessage,SIZE_T dwMessageSize,DWORD *pdwEventTy return bRet;
}
-BOOL GetXMLFieldEx(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR *plpszData,SIZE_T *pdwDataSize,const char *tag1,...)
+BOOL GetXMLFieldEx(LPSTR lpszXML,size_t dwXMLSize,LPSTR *plpszData,size_t *pdwDataSize,const char *tag1,...)
{
BOOL bRet = FALSE;
int thisLevel = 0;
@@ -284,7 +284,7 @@ BOOL GetXMLFieldEx(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR *plpszData,SIZE_T *pdwDa }
-BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBuffSize,SIZE_T *pdwBuffSizeRet,const char *tag1,...)
+BOOL GetXMLFieldExBuff(LPSTR lpszXML,size_t dwXMLSize,LPSTR lpszBuff,size_t dwBuffSize,size_t *pdwBuffSizeRet,const char *tag1,...)
{
BOOL bRet=FALSE;
int thisLevel=0;
@@ -309,7 +309,7 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBu {
if (lpszDataStart)
{
- SIZE_T dwBuffSizeRet=min((dwBuffSize-2),(SIZE_T)((lpszTagStart-1)-lpszDataStart));
+ size_t dwBuffSizeRet=min((dwBuffSize-2),(size_t)((lpszTagStart-1)-lpszDataStart));
if (lpszBuff && dwBuffSize) CopyMemory(lpszBuff,lpszDataStart,dwBuffSizeRet);(*((WORD*)(lpszBuff+dwBuffSizeRet)))=0;
if (pdwBuffSizeRet) (*pdwBuffSizeRet)=dwBuffSizeRet;
bRet=TRUE;
@@ -344,11 +344,11 @@ BOOL GetXMLFieldExBuff(LPSTR lpszXML,SIZE_T dwXMLSize,LPSTR lpszBuff,SIZE_T dwBu return(bRet);
}
-DWORD ReplaceInBuff(LPVOID lpInBuff,SIZE_T dwInBuffSize,SIZE_T dwReplaceItemsCount,LPVOID *plpInReplaceItems,SIZE_T *pdwInReplaceItemsCounts,LPVOID *plpOutReplaceItems,SIZE_T *pdwOutReplaceItemsCounts,LPVOID lpOutBuff,SIZE_T dwOutBuffSize,SIZE_T *pdwOutBuffSize)
+DWORD ReplaceInBuff(LPVOID lpInBuff,size_t dwInBuffSize,size_t dwReplaceItemsCount,LPVOID *plpInReplaceItems,size_t *pdwInReplaceItemsCounts,LPVOID *plpOutReplaceItems,size_t *pdwOutReplaceItemsCounts,LPVOID lpOutBuff,size_t dwOutBuffSize,size_t *pdwOutBuffSize)
{
DWORD dwRetErrorCode=NO_ERROR;
LPBYTE *plpszFound,lpszMessageConvertedCur,lpszMessageCur,lpszMessageCurPrev,lpszMessageConvertedMax;
- SIZE_T i,dwFirstFoundedIndex=0,dwFoundedCount=0,dwMemPartToCopy;
+ size_t i,dwFirstFoundedIndex=0,dwFoundedCount=0,dwMemPartToCopy;
plpszFound=(LPBYTE*)MEMALLOC((sizeof(LPBYTE)*dwReplaceItemsCount));
@@ -409,23 +409,23 @@ DWORD ReplaceInBuff(LPVOID lpInBuff,SIZE_T dwInBuffSize,SIZE_T dwReplaceItemsCou static const LPTSTR lpszXMLTags[] ={TEXT("'"), TEXT("""), TEXT("&"), TEXT("<"), TEXT(">")};
-static const SIZE_T dwXMLTagsCount[] ={(6*sizeof(TCHAR)), (6*sizeof(TCHAR)), (5*sizeof(TCHAR)), (4*sizeof(TCHAR)), (4*sizeof(TCHAR))};
+static const size_t dwXMLTagsCount[] ={(6*sizeof(TCHAR)), (6*sizeof(TCHAR)), (5*sizeof(TCHAR)), (4*sizeof(TCHAR)), (4*sizeof(TCHAR))};
static const LPTSTR lpszXMLSymbols[] ={TEXT("\'"), TEXT("\""), TEXT("&"), TEXT("<"), TEXT(">")};
-static const SIZE_T dwXMLSymbolsCount[] ={sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR)};
+static const size_t dwXMLSymbolsCount[] ={sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR), sizeof(TCHAR)};
//Decode XML coded string. The function translate special xml code into standard characters.
-DWORD DecodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize)
+DWORD DecodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize)
{
- DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+ DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
return(dwRet);
}
//Encode XML coded string. The function translate special saved xml characters into special characters.
-DWORD EncodeXML(LPTSTR lptszMessage,SIZE_T dwMessageSize,LPTSTR lptszMessageConverted,SIZE_T dwMessageConvertedBuffSize,SIZE_T *pdwMessageConvertedSize)
+DWORD EncodeXML(LPTSTR lptszMessage,size_t dwMessageSize,LPTSTR lptszMessageConverted,size_t dwMessageConvertedBuffSize,size_t *pdwMessageConvertedSize)
{
- DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(SIZE_T*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(SIZE_T*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
+ DWORD dwRet=ReplaceInBuff(lptszMessage,(dwMessageSize*sizeof(TCHAR)),SIZEOF(lpszXMLTags),(LPVOID*)lpszXMLSymbols,(size_t*)dwXMLSymbolsCount,(LPVOID*)lpszXMLTags,(size_t*)dwXMLTagsCount,lptszMessageConverted,(dwMessageConvertedBuffSize*sizeof(TCHAR)),pdwMessageConvertedSize);
if (pdwMessageConvertedSize) (*pdwMessageConvertedSize)/=sizeof(TCHAR);
return(dwRet);
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index cec3ebd00f..49838ca61f 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -38,7 +38,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) char szPhone[MAX_PHONE_LEN] = { 0 };
TCHAR tszPhone[MAX_PHONE_LEN] = { 0 };
LPSTR lpszXML = (LPSTR)((ACKDATA*)lParam)->lParam, lpszData, lpszPhone;
- SIZE_T dwXMLSize = 0, dwDataSize, dwPhoneSize;
+ size_t dwXMLSize = 0, dwDataSize, dwPhoneSize;
ACKDATA *ack = ((ACKDATA*)lParam);
if (lpszXML)
@@ -49,7 +49,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszPhone,&dwPhoneSize,"sms_message","sender",NULL))
{
LPSTR lpszMessageUTF;
- SIZE_T dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize;
+ size_t dwBuffLen,dwMessageXMLEncodedSize,dwMessageXMLDecodedSize;
DBEVENTINFO dbei = { sizeof(dbei) };
dwBuffLen=(dwDataSize+MAX_PATH);
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp index e112ed444c..d2aba654f3 100644 --- a/plugins/SMS/src/recvdlg.cpp +++ b/plugins/SMS/src/recvdlg.cpp @@ -166,7 +166,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l //This function create a new SMS receive window, and insert it to the list.
//The function gets void and return the window HWND
-HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize)
+HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,LPSTR lpszMessage,size_t dwMessageSize)
{
HWND hRet = NULL;
diff --git a/plugins/SMS/src/recvdlg.h b/plugins/SMS/src/recvdlg.h index 257fbf7049..26fb6bb47a 100644 --- a/plugins/SMS/src/recvdlg.h +++ b/plugins/SMS/src/recvdlg.h @@ -3,7 +3,7 @@ DWORD RecvSMSWindowInitialize ();
void RecvSMSWindowDestroy ();
-HWND RecvSMSWindowAdd (MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPSTR lpszMessage,SIZE_T dwMessageSize);
+HWND RecvSMSWindowAdd (MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,LPSTR lpszMessage,size_t dwMessageSize);
void RecvSMSWindowRemove (HWND hWndDlg);
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp index 0626216c9b..52f18ed826 100644 --- a/plugins/SMS/src/send.cpp +++ b/plugins/SMS/src/send.cpp @@ -28,14 +28,14 @@ Enjoy the code and use it smartly! #include "common.h"
//This function gets HWND of the window, the number, and the message.
-void StartSmsSend(HWND hWndDlg,SIZE_T dwModuleIndex,LPWSTR lpwszPhone,SIZE_T dwPhoneSize,LPWSTR lpwszMessage,SIZE_T dwMessageSize)
+void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwPhoneSize,LPWSTR lpwszMessage,size_t dwMessageSize)
{
if ( !ssSMSSettings.ppaSMSAccounts || dwModuleIndex == -1 || dwModuleIndex >= ssSMSSettings.dwSMSAccountsCount)
return;
LPSTR lpszMessageUTF;
LPWSTR lpwszMessageXMLEncoded;
- SIZE_T dwMessageUTFBuffSize, dwMessageXMLEncodedSize, dwBuffSize;
+ size_t dwMessageUTFBuffSize, dwMessageXMLEncodedSize, dwBuffSize;
DBEVENTINFO *pdbei;
dwMessageXMLEncodedSize = ((dwMessageSize + MAX_PATH) * sizeof(WCHAR) * 6);
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 5ebd8cee85..7035b7449f 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -44,14 +44,14 @@ typedef struct MCONTACT hMyContact;
HTREEITEM hItemSend;
BOOL bMultiple;
- SIZE_T dwContactsListCount;
+ size_t dwContactsListCount;
MCONTACT *phContactsList;
DBEVENTINFO *pdbei;
} SEND_SMS_WINDOW_DATA;
void AddContactPhonesToCombo (HWND hWnd,MCONTACT hContact);
void SendSMSWindowFillTreeView (HWND hWnd);
-SIZE_T GetSMSMessageLenMax (HWND hWndDlg);
+size_t GetSMSMessageLenMax (HWND hWndDlg);
#define GET_WINDOW_DATA(hWndDlg) ((SEND_SMS_WINDOW_DATA*)GetWindowLongPtr(hWndDlg,GWLP_USERDATA))
@@ -143,7 +143,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l {
TCHAR tszSign[1024];
- SIZE_T dwSignLen;
+ size_t dwSignLen;
if (DB_SMS_GetByte(NULL,"UseSignature",SMS_DEFAULT_USESIGNATURE))
if (DB_SMS_GetStaticStringW(NULL,"Signature",tszSign,SIZEOF(tszSign),&dwSignLen))
@@ -272,9 +272,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l case TIMEDOUT_RETRY:
{
TCHAR tszPhone[MAX_PHONE_LEN];
- SIZE_T dwPhoneSize;
+ size_t dwPhoneSize;
- SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
LPTSTR lpwszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
if (lpwszMessage)
{
@@ -325,7 +325,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l break;
case IDOK:
- if ((SIZE_T)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg))
+ if ((size_t)GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE) > GetSMSMessageLenMax(hWndDlg))
{
MessageBox(hWndDlg,TranslateT("Message is too long, press OK to continue."),TranslateT("Error - Message too long"),MB_OK);
}else{
@@ -351,10 +351,10 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l }
}else{
TCHAR tszPhone[MAX_PHONE_LEN];
- SIZE_T dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
+ size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
if (IsPhoneW(tszPhone,dwPhoneSize))
{
- SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
LPTSTR lpwszMessage=(LPTSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR));
if (lpwszMessage)
{
@@ -390,7 +390,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l if (HIWORD(wParam)==EN_CHANGE)
{
TCHAR tszBuff[MAX_PATH];
- SIZE_T dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
+ size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
EnableWindow(GetDlgItem(hWndDlg,IDOK),dwMessageSize);
mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg));
@@ -404,7 +404,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l TCHAR tszPhone[MAX_PHONE_LEN];
DBVARIANT dbv;
- SIZE_T dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(SIZEOF(tszPhone)-4));
+ size_t dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,(SIZEOF(tszPhone)-4));
if (IsPhoneW(tszPhone,dwPhoneSize))
{
if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE)
@@ -707,7 +707,7 @@ void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple) }
//
-void SendSMSWindowNumberSet(HWND hWndDlg, LPWSTR lpwszPhone, SIZE_T dwPhoneSize)
+void SendSMSWindowNumberSet(HWND hWndDlg, LPWSTR lpwszPhone, size_t dwPhoneSize)
{
SEND_SMS_WINDOW_DATA *psswdWindowData=GET_WINDOW_DATA(hWndDlg);
@@ -866,7 +866,7 @@ return(hRet); void SendSMSWindowNext(HWND hWndDlg)
{
TCHAR tszPhone[MAX_PHONE_LEN];
- SIZE_T dwPhoneSize,dwMessageSize;
+ size_t dwPhoneSize,dwMessageSize;
TVITEM tvi={0};
dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
@@ -913,7 +913,7 @@ void SendSMSWindowSMSContactAdd(HWND hWndDlg,MCONTACT hContact) }
//This function gets the number of the given contact in the combo list and return its contact.
-MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum)
+MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,size_t iNum)
{
SEND_SMS_WINDOW_DATA *psswdWindowData = GET_WINDOW_DATA(hWndDlg);
@@ -938,7 +938,7 @@ void SendSMSWindowUpdateAccountList(HWND hWndDlg) {
if (ssSMSSettings.ppaSMSAccounts && ssSMSSettings.dwSMSAccountsCount)
{
- SIZE_T i,dwCurSel;
+ size_t i,dwCurSel;
dwCurSel=SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0);
if (dwCurSel==-1) dwCurSel=DB_SMS_GetDword(NULL,"LastProto",0);
@@ -982,7 +982,7 @@ void AddContactPhonesToComboToListParam(MCONTACT hContact,LPSTR lpszModule,LPSTR {
char szBuff[MAX_PATH];
TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN];
- SIZE_T i,dwPhoneSize;
+ size_t i,dwPhoneSize;
if (DB_GetStaticStringW(hContact,lpszModule,lpszValueName,tszPhoneRaw,SIZEOF(tszPhoneRaw),&dwPhoneSize))
{
@@ -1037,7 +1037,7 @@ void AddContactPhonesToTreeViewParam(MCONTACT hContact,LPSTR lpszModule,LPSTR lp {
char szBuff[MAX_PATH];
TCHAR tszPhone[MAX_PHONE_LEN],tszPhoneRaw[MAX_PHONE_LEN];
- SIZE_T i,dwPhoneSize;
+ size_t i,dwPhoneSize;
TVINSERTSTRUCT tvis={0};
if (phParent) tvis.hParent=(*phParent);
@@ -1107,9 +1107,9 @@ void SendSMSWindowFillTreeView(HWND hWnd) }
-SIZE_T GetSMSMessageLenMax(HWND hWndDlg)
+size_t GetSMSMessageLenMax(HWND hWndDlg)
{
- SIZE_T dwMessageSize,dwLenght=160;
+ size_t dwMessageSize,dwLenght=160;
dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
diff --git a/plugins/SMS/src/senddlg.h b/plugins/SMS/src/senddlg.h index 9276ef9c62..576d1946ce 100644 --- a/plugins/SMS/src/senddlg.h +++ b/plugins/SMS/src/senddlg.h @@ -19,7 +19,7 @@ HWND SendSMSWindowHwndByHProcessGet(HANDLE hProcess); void SendSMSWindowHProcessSet(HWND hWndDlg,HANDLE hProcess);
BOOL SendSMSWindowMultipleGet(HWND hWndDlg);
void SendSMSWindowMultipleSet(HWND hWndDlg,BOOL bMultiple);
-void SendSMSWindowNumberSet(HWND hWndDlg,LPWSTR lpwszPhone,SIZE_T dwPhoneSize);
+void SendSMSWindowNumberSet(HWND hWndDlg,LPWSTR lpwszPhone,size_t dwPhoneSize);
void SendSMSWindowAsSentSet(HWND hWndDlg);
void SendSMSWindowDbeiSet(HWND hWndDlg,DBEVENTINFO *pdbei);
void SendSMSWindowDBAdd(HWND hWndDlg);
@@ -28,7 +28,7 @@ HWND SendSMSWindowIsOtherInstanceHContact(MCONTACT hContact); void SendSMSWindowNext(HWND hWndDlg);
void SendSMSWindowSMSContactAdd(HWND hWndDlg,MCONTACT hContact);
-MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,SIZE_T iNum);
+MCONTACT SendSMSWindowSMSContactGet(HWND hWndDlg,size_t iNum);
void SendSMSWindowSMSContactsRemove(HWND hWndDlg);
void SendSMSWindowUpdateAccountList(HWND hWndDlg);
void SendSMSWindowsUpdateAllAccountLists();
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 05c01332d4..0356f1dd81 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -518,7 +518,7 @@ INT_PTR CALLBACK DlgProcOptionsProto(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) {
case IDC_RSA_COPY:
char txt[128];
- GetDlgItemText(hDlg, IDC_RSA_SHA, txt, sizeof(txt));
+ GetDlgItemText(hDlg, IDC_RSA_SHA, txt, SIZEOF(txt));
CopyToClipboard(hDlg, txt);
return TRUE;
@@ -803,7 +803,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l {
char gpgexe[256];
char filter[128];
- GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, gpgexe, sizeof(gpgexe));
+ GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, gpgexe, SIZEOF(gpgexe));
// filter zusammensetzen
mir_snprintf(filter, SIZEOF(filter), _T("%s (*.exe)%c*.exe%c%c"), Translate("Executable Files"), 0, 0, 0);
@@ -813,7 +813,7 @@ INT_PTR CALLBACK DlgProcOptionsGPG(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l ofn.hwndOwner = hDlg;
ofn.lpstrFilter = filter;
ofn.lpstrFile = gpgexe;
- ofn.nMaxFile = sizeof(gpgexe);
+ ofn.nMaxFile = SIZEOF(gpgexe);
ofn.lpstrTitle = Translate("Select GnuPG Executable");
ofn.Flags = OFN_FILEMUSTEXIST | OFN_LONGNAMES | OFN_HIDEREADONLY;
@@ -1327,9 +1327,9 @@ void ApplyGPGSettings(HWND hDlg) {
char tmp[256];
- GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, sizeof(tmp));
+ GetDlgItemText(hDlg, IDC_GPGEXECUTABLE_EDIT, tmp, SIZEOF(tmp));
db_set_s(0, MODULENAME, "gpgExec", tmp);
- GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, sizeof(tmp));
+ GetDlgItemText(hDlg, IDC_GPGHOME_EDIT, tmp, SIZEOF(tmp));
db_set_s(0, MODULENAME, "gpgHome", tmp);
bSavePass = (SendMessage(GetDlgItem(hDlg, IDC_SAVEPASS_CBOX), BM_GETCHECK, 0L, 0L) == BST_CHECKED);
@@ -1337,14 +1337,14 @@ void ApplyGPGSettings(HWND hDlg) BOOL bgpgLogFlag = (SendMessage(GetDlgItem(hDlg, IDC_LOGGINGON_CBOX), BM_GETCHECK, 0L, 0L) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgLogFlag", bgpgLogFlag);
- GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, sizeof(tmp));
+ GetDlgItemText(hDlg, IDC_GPGLOGFILE_EDIT, tmp, SIZEOF(tmp));
db_set_s(0, MODULENAME, "gpgLog", tmp);
if (bgpgLogFlag) gpg_set_log(tmp);
else gpg_set_log(0);
BOOL bgpgTmpFlag = (SendMessage(GetDlgItem(hDlg, IDC_TMPPATHON_CBOX), BM_GETCHECK, 0L, 0L) == BST_CHECKED);
db_set_b(0, MODULENAME, "gpgTmpFlag", bgpgTmpFlag);
- GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, sizeof(tmp));
+ GetDlgItemText(hDlg, IDC_GPGTMPPATH_EDIT, tmp, SIZEOF(tmp));
db_set_s(0, MODULENAME, "gpgTmp", tmp);
if (bgpgTmpFlag) gpg_set_tmp(tmp);
else gpg_set_tmp(0);
diff --git a/plugins/SecureIM/src/popupOptions.cpp b/plugins/SecureIM/src/popupOptions.cpp index 6ef609b077..3feae47a6c 100644 --- a/plugins/SecureIM/src/popupOptions.cpp +++ b/plugins/SecureIM/src/popupOptions.cpp @@ -111,19 +111,19 @@ INT_PTR CALLBACK PopOptionsDlgProc(HWND hDlg, UINT wMsg, WPARAM wParam, LPARAM l break;
case IDC_TIMEKEY:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMEKEY, getTimeout, sizeof(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMEKEY, getTimeout, SIZEOF(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutKey", getTimeout);
break;
case IDC_TIMESEC:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMESEC, getTimeout, sizeof(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMESEC, getTimeout, SIZEOF(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutSec", getTimeout);
break;
case IDC_TIMESR:
//set timeout value
- GetDlgItemText(hDlg, IDC_TIMESR, getTimeout, sizeof(getTimeout));
+ GetDlgItemText(hDlg, IDC_TIMESR, getTimeout, SIZEOF(getTimeout));
mir_itoa(atoi(getTimeout), getTimeout, 10);
db_set_s(0, MODULENAME, "timeoutSR", getTimeout);
break;
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index cb18639223..51074118d6 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -166,7 +166,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP memcpy(tmp+len,_T("[/img][/url]"),13*sizeof(TCHAR)); len+=12; } }else - len=GetDlgItemText(hwndDlg,edtID,tmp,2048); + len=GetDlgItemText(hwndDlg,edtID,tmp,SIZEOF(tmp)); int retries=3; do{ if(!OpenClipboard(hwndDlg)){ diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp index 90a980ade6..efc7063416 100644 --- a/plugins/SendScreenshotPlus/src/UMainForm.cpp +++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp @@ -68,7 +68,7 @@ INT_PTR CALLBACK TfrmMain::DlgProc_CaptureTabPage(HWND hDlg, UINT uMsg, WPARAM w if(HIWORD(wParam)==BN_CLICKED && LOWORD(wParam)==ID_btnExplore){ /// local file tab OPENFILENAME ofn={sizeof(OPENFILENAME)}; TCHAR filename[MAX_PATH]; - GetDlgItemText(hDlg,ID_edtSize,filename,MAX_PATH); + GetDlgItemText(hDlg,ID_edtSize,filename,SIZEOF(filename)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = hDlg; ofn.lpstrFilter = _T("Images\0*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tif;*.tiff\0"); @@ -781,7 +781,7 @@ void TfrmMain::btnCaptureClick() { if(m_opt_tabCapture==1) m_hTargetWindow=GetDesktopWindow(); else if(m_opt_tabCapture==2){ TCHAR filename[MAX_PATH]; - GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, MAX_PATH); + GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, SIZEOF(filename)); FILE* fp=_wfopen(filename,_T("rb")); if(!fp){ TCHAR *err = TranslateT("Select a file"); @@ -959,7 +959,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { mir_tcsadd(pszFileDesc, TranslateT("for Client area ")); } mir_tcsadd(pszFileDesc, TranslateT("of \"")); - GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, 1024); + GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, SIZEOF(winText)); mir_tcsadd(pszFileDesc, winText); if(m_opt_tabCapture==1) mir_tcsadd(pszFileDesc, _T("\"")); @@ -1110,7 +1110,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) { void TfrmMain::FormClose() { if(m_opt_tabCapture==2){ /// existing file TCHAR description[1024]; - GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, 1024); + GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, SIZEOF(description)); if(!IsWindowEnabled(GetDlgItem(m_hWnd,ID_btnDesc)) || !m_opt_btnDesc) *description='\0'; if(m_cSend) { diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp index 83ab8907ca..41773048c5 100644 --- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp +++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp @@ -192,7 +192,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien RECT sizeText; HFONT hOldFont; - ccText = GetWindowTextW(ctl->hwnd, wszText, sizeof(wszText) / sizeof(WCHAR)); + ccText = GetWindowTextW(ctl->hwnd, wszText, SIZEOF(wszText)); if (ccText > 0) { hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont); diff --git a/plugins/StatusPlugins/StartupStatus/options.cpp b/plugins/StatusPlugins/StartupStatus/options.cpp index a43c52f003..21f84acbc3 100644 --- a/plugins/StatusPlugins/StartupStatus/options.cpp +++ b/plugins/StatusPlugins/StartupStatus/options.cpp @@ -224,7 +224,7 @@ INT_PTR CALLBACK CmdlOptionsDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM l EmptyClipboard();
char cmdl[2048];
- GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, sizeof(cmdl));
+ GetDlgItemTextA(hwndDlg,IDC_CMDL, cmdl, SIZEOF(cmdl));
HGLOBAL cmdlGlob = GlobalAlloc(GMEM_MOVEABLE, sizeof(cmdl));
if (cmdlGlob == NULL) {
CloseClipboard();
@@ -870,7 +870,7 @@ INT_PTR CALLBACK addProfileDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lP case WM_COMMAND:
if (LOWORD(wParam) == IDC_OK) {
TCHAR profileName[128];
- GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, sizeof(profileName));
+ GetDlgItemText(hwndDlg, IDC_PROFILENAME, profileName, SIZEOF(profileName));
SendMessage(hwndParent, UM_ADDPROFILE, 0, (LPARAM)profileName);
// done and exit
DestroyWindow(hwndDlg);
diff --git a/plugins/TabSRMM/src/containeroptions.cpp b/plugins/TabSRMM/src/containeroptions.cpp index 10a96c9673..827b9587be 100644 --- a/plugins/TabSRMM/src/containeroptions.cpp +++ b/plugins/TabSRMM/src/containeroptions.cpp @@ -345,7 +345,7 @@ INT_PTR CALLBACK DlgProcContainerOptions(HWND hwndDlg, UINT msg, WPARAM wParam, if (GetWindowTextLengthA(GetDlgItem(hwndDlg, IDC_THEME)) > 0) {
wchar_t szFinalThemeFile[MAX_PATH], szFilename[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_THEME, szFilename, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_THEME, szFilename, SIZEOF(szFilename));
szFilename[MAX_PATH - 1] = 0;
PathToAbsoluteT(szFilename, szFinalThemeFile, M.getDataPath());
diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index dfe11df618..0ee0234859 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -346,7 +346,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR szTemp[TEMPLATE_LENGTH + 2]; if (teInfo->changed) { - CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH * sizeof(TCHAR)); + CopyMemory(szTemp, tSet->szTemplates[teInfo->inEdit], (TEMPLATE_LENGTH * sizeof(TCHAR))); GetDlgItemText(hwndDlg, IDC_EDITTEMPLATE, tSet->szTemplates[teInfo->inEdit], TEMPLATE_LENGTH); } dbei.szModule = dat->szProto; diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 2f10a335e7..b9edda957c 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -769,10 +769,10 @@ INT_PTR CALLBACK DlgProcAddSubst(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else
{
ds->type = DVT_DB;
- GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, MODULE_NAME_LEN);
+ GetDlgItemTextA(hwndDlg, IDC_ED_MODULE, ds->szModuleName, SIZEOF(ds->szModuleName));
}
- GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, SETTING_NAME_LEN);
+ GetDlgItemTextA(hwndDlg, IDC_ED_SETTING, ds->szSettingName, SIZEOF(ds->szSettingName));
int sel = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETCURSEL, 0, 0);
ds->iTranslateFuncId = SendDlgItemMessage(hwndDlg, IDC_CMB_TRANSLATE, CB_GETITEMDATA, sel, 0);
diff --git a/plugins/TopToolBar/src/ttbopt.cpp b/plugins/TopToolBar/src/ttbopt.cpp index a333a18959..c951951434 100644 --- a/plugins/TopToolBar/src/ttbopt.cpp +++ b/plugins/TopToolBar/src/ttbopt.cpp @@ -241,14 +241,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
- GetDlgItemText(hwndDlg, IDC_EPATH, str, sizeof(str));
+ GetDlgItemText(hwndDlg, IDC_EPATH, str, SIZEOF(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.hInstance = NULL;
ofn.lpstrFilter = NULL;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("exe");
if (!GetOpenFileName(&ofn))
@@ -290,14 +290,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TreeView_SetItem(hTree, &tvi);
}
- GetDlgItemText(hwndDlg, IDC_ENAME, buf, 255);
+ GetDlgItemText(hwndDlg, IDC_ENAME, buf, SIZEOF(buf));
replaceStr(btn->pszName, _T2A(buf));
tvi.mask = TVIF_TEXT;
tvi.pszText = buf;
TreeView_SetItem(hTree, &tvi);
- GetDlgItemText(hwndDlg, IDC_EPATH, buf, 255);
+ GetDlgItemText(hwndDlg, IDC_EPATH, buf, SIZEOF(buf));
replaceStrT(btn->ptszProgram, buf);
}
break;
diff --git a/plugins/UserInfoEx/src/ctrl_button.cpp b/plugins/UserInfoEx/src/ctrl_button.cpp index aeb5477553..9bb58ef736 100644 --- a/plugins/UserInfoEx/src/ctrl_button.cpp +++ b/plugins/UserInfoEx/src/ctrl_button.cpp @@ -192,7 +192,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien RECT sizeText;
HFONT hOldFont;
- ccText = GetWindowTextW(ctl->hwnd, wszText, sizeof(wszText) / sizeof(WCHAR));
+ ccText = GetWindowTextW(ctl->hwnd, wszText, SIZEOF(wszText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
diff --git a/plugins/UserInfoEx/src/ctrl_contact.cpp b/plugins/UserInfoEx/src/ctrl_contact.cpp index 1bf0f67b00..a64ad354f2 100644 --- a/plugins/UserInfoEx/src/ctrl_contact.cpp +++ b/plugins/UserInfoEx/src/ctrl_contact.cpp @@ -294,7 +294,7 @@ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam TCHAR szText[MAXDATASIZE];
int errorPos;
- if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, MAXDATASIZE) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
+ if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, SIZEOF(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) {
MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only."));
break;
}
diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index 3b52fc4062..a809ad1a18 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -204,7 +204,7 @@ static void GetInitialDir(LPSTR pszInitialDir) {
CHAR szRelative[MAX_PATH];
- ZeroMemory(szRelative, SIZEOF(szRelative));
+ ZeroMemory(szRelative, sizeof(szRelative));
// is some standard path defined
if (!db_get_static(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) {
diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index ce4a474bb2..9f0aabd22a 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -383,7 +383,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha case CONTROL_FILE:
{
TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
TCHAR rel[1024];
PathToRelative(rel, 1024, tmp);
db_set_ts(NULL, module, ctrl->setting, rel);
@@ -392,7 +392,7 @@ INT_PTR CALLBACK SaveOptsDlgProc(OptPageControl *controls, int controlsSize, cha case CONTROL_COMBO_TEXT:
{
TCHAR tmp[1024];
- GetDlgItemText(hwndDlg, ctrl->nID, tmp, 1024);
+ GetDlgItemText(hwndDlg, ctrl->nID, tmp, SIZEOF(tmp));
db_set_ts(NULL, module, ctrl->setting, tmp);
}
break;
diff --git a/plugins/Watrack_MPD/src/options.cpp b/plugins/Watrack_MPD/src/options.cpp index f79a68ec4f..03471e3c83 100755 --- a/plugins/Watrack_MPD/src/options.cpp +++ b/plugins/Watrack_MPD/src/options.cpp @@ -47,13 +47,13 @@ static INT_PTR CALLBACK DlgProcWaMpdOpts(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY: { - TCHAR szText[128]; + TCHAR szText[256]; db_set_w(NULL, szModuleName, "Port", (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE)); gbPort = (WORD)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE); - GetDlgItemText(hwndDlg, IDC_SERVER, szText, sizeof(szText)); + GetDlgItemText(hwndDlg, IDC_SERVER, szText, SIZEOF(szText)); db_set_ts(NULL, szModuleName, "Server", szText); _tcscpy(gbHost, szText); - GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, sizeof(szText)); + GetDlgItemText(hwndDlg, IDC_PASSWORD, szText, SIZEOF(szText)); db_set_ts(NULL, szModuleName, "Password", szText); _tcscpy(gbPassword, szText); return TRUE; diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index f8951396ce..b97dba6b32 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -211,7 +211,7 @@ INT_PTR WeatherAdvancedSearch(WPARAM wParam, LPARAM lParam) if (searchId != -1) return 0; //only one search at a time
searchId = 1;
- GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, 256);
+ GetDlgItemText((HWND)lParam, IDC_SEARCHCITY, name1, SIZEOF(name1));
// search for the weather station using a thread
mir_forkthread(NameSearchTimerProc, NULL);
diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 1b4573da80..87facdb349 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -373,14 +373,14 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) }
// get update time and remove the old timer
- GetDlgItemText(hdlg, IDC_UPDATETIME, str, sizeof(str));
+ GetDlgItemText(hdlg, IDC_UPDATETIME, str, SIZEOF(str));
opt.UpdateTime = (WORD)_ttoi(str);
if (opt.UpdateTime < 1) opt.UpdateTime = 1;
KillTimer(NULL, timerId);
timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, (TIMERPROC)timerProc);
// other general options
- GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, sizeof(opt.DegreeSign));
+ GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, SIZEOF(opt.DegreeSign));
opt.StartupUpdate = IsDlgButtonChecked(hdlg, IDC_STARTUPUPD);
opt.AutoUpdate = IsDlgButtonChecked(hdlg, IDC_UPDATE);
opt.NoProtoCondition = !IsDlgButtonChecked(hdlg, IDC_PROTOCOND);
@@ -578,21 +578,21 @@ INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) // free memory for old settings
FreeTextVar();
// save new settings to memory
- GetDlgItemText(hdlg, IDC_CTEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_CTEXT, textstr, SIZEOF(textstr));
wSetData(&opt.cText, textstr);
- GetDlgItemText(hdlg, IDC_BTEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_BTEXT, textstr, SIZEOF(textstr));
wSetData(&opt.bText, textstr);
- GetDlgItemText(hdlg, IDC_BTITLE, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_BTITLE, textstr, SIZEOF(textstr));
wSetData(&opt.bTitle, textstr);
- GetDlgItemText(hdlg, IDC_ETEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_ETEXT, textstr, SIZEOF(textstr));
wSetData(&opt.eText, textstr);
- GetDlgItemText(hdlg, IDC_NTEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_NTEXT, textstr, SIZEOF(textstr));
wSetData(&opt.nText, textstr);
- GetDlgItemText(hdlg, IDC_HTEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_HTEXT, textstr, SIZEOF(textstr));
wSetData(&opt.hText, textstr);
- GetDlgItemText(hdlg, IDC_XTEXT, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_XTEXT, textstr, SIZEOF(textstr));
wSetData(&opt.xText, textstr);
- GetDlgItemText(hdlg, IDC_BTITLE2, textstr, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_BTITLE2, textstr, SIZEOF(textstr));
wSetData(&opt.sText, textstr);
SaveOptions();
UpdateAllInfo(0, 0);
diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 47f80c3eb5..81fda09026 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -219,7 +219,7 @@ void ReadPopupOpt(HWND hdlg) opt.BGColour = SendDlgItemMessage(hdlg,IDC_BGCOLOUR,CPM_GETCOLOUR,0,0);
// get delay time
- GetDlgItemText(hdlg, IDC_DELAY, str, sizeof(str));
+ GetDlgItemText(hdlg, IDC_DELAY, str, SIZEOF(str));
num = _ttoi(str);
opt.pDelay = num;
@@ -234,9 +234,9 @@ void ReadPopupOpt(HWND hdlg) // popup texts
wfree(&opt.pText);
wfree(&opt.pTitle);
- GetDlgItemText(hdlg, IDC_PText, text, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_PText, text, SIZEOF(text));
wSetData(&opt.pText, text);
- GetDlgItemText(hdlg, IDC_PTitle, text, MAX_TEXT_SIZE);
+ GetDlgItemText(hdlg, IDC_PTitle, text, SIZEOF(text));
wSetData(&opt.pTitle, text);
}
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 23acc4efd6..4fde49d657 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -230,7 +230,7 @@ INT_PTR ImportBirthdaysService(WPARAM wParam, LPARAM lParam) mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c"), TranslateT("Birthdays files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = 1024;
+ of.nMaxFile = SIZEOF(fileName);
of.lpstrTitle = TranslateT("Please select a file to import birthdays from...");
of.Flags = OFN_FILEMUSTEXIST;
@@ -255,7 +255,7 @@ INT_PTR ExportBirthdaysService(WPARAM wParam, LPARAM lParam) mir_sntprintf(filter, SIZEOF(filter), _T("%s (*") _T(BIRTHDAY_EXTENSION) _T(")%c*") _T(BIRTHDAY_EXTENSION) _T("%c%s (*.*)%c*.*%c"), TranslateT("Birthdays files"), 0, 0, TranslateT("All Files"), 0, 0);
of.lpstrFilter = filter;
of.lpstrFile = fileName;
- of.nMaxFile = 1024;
+ of.nMaxFile = SIZEOF(fileName);
of.lpstrTitle = TranslateT("Please select a file to export birthdays to...");
if ( GetSaveFileName(&of)) {
diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 0669dae70d..6d7c207b70 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -266,7 +266,7 @@ void ChooseFile(HWND hDlg) ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = hDlg;
ofn.lpstrFile = szFile;
- ofn.nMaxFile = 260;
+ ofn.nMaxFile = SIZEOF(szFile);
ofn.lpstrFilter = _T("All files (*.*)\0*.*\0Text files (*.txt)\0*.txt\0Log files (*.log)\0*.log\0\0");
ofn.nFilterIndex = 2;
ofn.Flags = OFN_CREATEPROMPT;
diff --git a/plugins/WinterSpeak/src/DialogConfigEngine.cpp b/plugins/WinterSpeak/src/DialogConfigEngine.cpp index 2e285c0d05..1350b4d90e 100644 --- a/plugins/WinterSpeak/src/DialogConfigEngine.cpp +++ b/plugins/WinterSpeak/src/DialogConfigEngine.cpp @@ -203,7 +203,7 @@ std::wstring DialogConfigEngine::getEngine(HWND window) {
WCHAR *text = Hlp_GetDlgItemText(window, IDC_SELECT_ENGINE);
/*char text[100];
- GetDlgItemText(window, IDC_SELECT_ENGINE, mir_a2u(text), sizeof(text));*/
+ GetDlgItemText(window, IDC_SELECT_ENGINE, mir_a2u(text), SIZEOF(text));*/
return text;
}
diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 3cdc5c7c54..7dbdaff8ee 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -734,14 +734,14 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara ActualAccount=NULL;
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
- if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput)))
+ if (GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput)))
DlgEnableAccount(hDlg,TRUE,FALSE);
else
DlgEnableAccount(hDlg,FALSE,FALSE);
break;
case CBN_KILLFOCUS:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))) {
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
@@ -892,7 +892,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara break;
case IDC_BTNDEL:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
if ((CB_ERR==(Result=SendDlgItemMessage(hDlg,IDC_COMBOACCOUNT,CB_GETCURSEL,0,0)))
|| (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))))
@@ -939,7 +939,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara size_t Length,index;
UINT Port,Interval;
- if ( GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT, Text, sizeof(Text))) {
+ if ( GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT, Text, SIZEOF(Text))) {
Check = (IsDlgButtonChecked(hDlg,IDC_CHECK)==BST_CHECKED);
CheckSSL = (IsDlgButtonChecked(hDlg,IDC_CHECKSSL)==BST_CHECKED);
CheckNoTLS = (IsDlgButtonChecked(hDlg,IDC_CHECKNOTLS)==BST_CHECKED);
@@ -975,15 +975,15 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara break;
}
- GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, sizeof(Text));
+ GetDlgItemTextA(hDlg, IDC_EDITAPP, Text, SIZEOF(Text));
if (CheckApp && !(Length = strlen(Text))) {
MessageBox(hDlg,TranslateT("Please select application to run"),TranslateT("Input error"),MB_OK);
break;
}
- GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, sizeof(Text));
+ GetDlgItemTextA(hDlg, IDC_COMBOACCOUNT, Text, SIZEOF(Text));
if ( !( Length = strlen(Text))) {
- GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, sizeof(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITNAME, Text, SIZEOF(Text));
if ( !(Length = strlen( Text )))
break;
}
@@ -1036,7 +1036,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara DebugLog(SynchroFile,"Options:APPLY:ActualAccountSO-write enter\n");
#endif
- GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, sizeof(Text));
+ GetDlgItemTextA(hDlg, IDC_EDITNAME, Text, SIZEOF(Text));
if ( !(Length = strlen( Text )))
break;
if (NULL != ActualAccount->Name)
@@ -1044,19 +1044,19 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara ActualAccount->Name = new char[ strlen(Text)+1];
strcpy(ActualAccount->Name,Text);
- GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,sizeof(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITSERVER,Text,SIZEOF(Text));
if (NULL != ActualAccount->Server->Name)
delete[] ActualAccount->Server->Name;
ActualAccount->Server->Name=new char[ strlen(Text)+1];
strcpy(ActualAccount->Server->Name,Text);
- GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,sizeof(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITLOGIN,Text,SIZEOF(Text));
if (NULL != ActualAccount->Server->Login)
delete[] ActualAccount->Server->Login;
ActualAccount->Server->Login=new char[ strlen(Text)+1];
strcpy(ActualAccount->Server->Login,Text);
- GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,sizeof(Text));
+ GetDlgItemTextA(hDlg,IDC_EDITPASS,Text,SIZEOF(Text));
if (NULL != ActualAccount->Server->Passwd)
delete[] ActualAccount->Server->Passwd;
ActualAccount->Server->Passwd=new char[ strlen(Text)+1];
@@ -1258,7 +1258,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa {
case CBN_KILLFOCUS:
- GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,sizeof(DlgInput));
+ GetDlgItemTextA(hDlg,IDC_COMBOACCOUNT,DlgInput,SIZEOF(DlgInput));
if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
@@ -1437,7 +1437,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa BOOL CheckPopN;
UINT Time,TimeN,TimeF;
- if (GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,sizeof(Text)/sizeof(TCHAR)))
+ if (GetDlgItemText(hDlg,IDC_COMBOACCOUNT,Text,SIZEOF(Text)))
{
CheckPopup = (IsDlgButtonChecked(hDlg,IDC_CHECKPOP)==BST_CHECKED);
CheckPopupW = (IsDlgButtonChecked(hDlg,IDC_CHECKCOL)==BST_CHECKED);
diff --git a/plugins/YARelay/src/options.cpp b/plugins/YARelay/src/options.cpp index 0a8d151f2b..3cc678c36d 100644 --- a/plugins/YARelay/src/options.cpp +++ b/plugins/YARelay/src/options.cpp @@ -156,7 +156,7 @@ static INT_PTR CALLBACK OptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK6), BM_GETCHECK, 0, 0) == BST_CHECKED) iForwardOnStatus |= STATUS_DND;
if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK7), BM_GETCHECK, 0, 0) == BST_CHECKED) iForwardOnStatus |= STATUS_FREECHAT;
if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK8), BM_GETCHECK, 0, 0) == BST_CHECKED) iForwardOnStatus |= STATUS_INVISIBLE;
- GetDlgItemText(hwndDlg, IDC_EDIT_TEMPLATE, tszForwardTemplate, MAXTEMPLATESIZE);
+ GetDlgItemText(hwndDlg, IDC_EDIT_TEMPLATE, tszForwardTemplate, SIZEOF(tszForwardTemplate));
if (SendMessage(GetDlgItem(hwndDlg, IDC_CHECK_SPLIT), BM_GETCHECK, 0, 0) == BST_CHECKED) iSplit = 1; else iSplit = 0;
iSplitMaxSize = GetDlgItemInt(hwndDlg, IDC_EDIT_MAXSIZE, NULL, FALSE);
iSendParts = GetDlgItemInt(hwndDlg, IDC_EDIT_SENDPARTS, NULL, FALSE);
diff --git a/protocols/AimOscar/src/ui.cpp b/protocols/AimOscar/src/ui.cpp index 382d51b00c..5521b00598 100644 --- a/protocols/AimOscar/src/ui.cpp +++ b/protocols/AimOscar/src/ui.cpp @@ -691,7 +691,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar break;
char name[64];
- GetDlgItemTextA(hwndDlg, IDC_FNAME, name, sizeof(name));
+ GetDlgItemTextA(hwndDlg, IDC_FNAME, name, SIZEOF(name));
if (strlen(trim_str(name)) > 0 && !ppro->getString(AIM_KEY_SN, &dbv))
{
if (strcmp(name, dbv.pszVal))
@@ -700,7 +700,7 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar }
char email[254];
- GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, sizeof(email));
+ GetDlgItemTextA(hwndDlg, IDC_CEMAIL, email, SIZEOF(email));
if (strlen(trim_str(email)) > 1 && !ppro->getString(AIM_KEY_EM, &dbv)) // Must be greater than 1 or a SNAC error is thrown.
{
if (strcmp(email, dbv.pszVal))
@@ -711,9 +711,9 @@ INT_PTR CALLBACK admin_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar ShowWindow(GetDlgItem(hwndDlg, IDC_PINFO), SW_HIDE);
char cpw[256], npw1[256], npw2[256];
- GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, sizeof(cpw));
- GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, sizeof(npw1));
- GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, sizeof(npw2));
+ GetDlgItemTextA(hwndDlg, IDC_CPW, cpw, SIZEOF(cpw));
+ GetDlgItemTextA(hwndDlg, IDC_NPW1, npw1, SIZEOF(npw1));
+ GetDlgItemTextA(hwndDlg, IDC_NPW2, npw2, SIZEOF(npw2));
if (cpw[0] != 0 && npw1[0] != 0 && npw2[0] != 0)
{
// AOL only requires that you send the current password and a (single) new password.
@@ -864,7 +864,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
char str[128];
//SN
- GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_SN, str);
else
@@ -872,17 +872,17 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //END SN
//NK
- if (GetDlgItemTextA(hwndDlg, IDC_NK, str, sizeof(str)))
+ if (GetDlgItemTextA(hwndDlg, IDC_NK, str, SIZEOF(str)))
ppro->setString(AIM_KEY_NK, str);
else
{
- GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
ppro->setString(AIM_KEY_NK, str);
}
//END NK
//PW
- GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
if (str[0] != 0)
ppro->setString(AIM_KEY_PW, str);
else
@@ -890,7 +890,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP //END PW
//HN
- GetDlgItemTextA(hwndDlg, IDC_HN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_HN, str, SIZEOF(str));
if (str[0] != 0 && strcmp(str, AIM_DEFAULT_SERVER))
ppro->setString(AIM_KEY_HN, str);
else
@@ -1196,10 +1196,10 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_SN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_SN, str, SIZEOF(str));
ppro->setString(AIM_KEY_SN, str);
- GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(str));
ppro->setString(AIM_KEY_PW, str);
return TRUE;
}
@@ -1306,7 +1306,7 @@ INT_PTR CALLBACK join_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM switch (LOWORD(wParam)) {
case IDOK:
char room[128];
- GetDlgItemTextA(hwndDlg, IDC_ROOM, room, sizeof(room));
+ GetDlgItemTextA(hwndDlg, IDC_ROOM, room, SIZEOF(room));
if (ppro->state == 1 && room[0] != 0) {
chatnav_param* par = new chatnav_param(room, 4);
ppro->ForkThread(&CAimProto::chatnav_request_thread, par);
@@ -1461,7 +1461,7 @@ INT_PTR CALLBACK invite_to_chat_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (item)
{
char msg[1024];
- GetDlgItemTextA(hwndDlg, IDC_MSG, msg, sizeof(msg));
+ GetDlgItemTextA(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
clist_chat_invite_send(NULL, hwndList, item, param->ppro, msg);
diff --git a/protocols/FacebookRM/src/dialogs.cpp b/protocols/FacebookRM/src/dialogs.cpp index 0e13fc8317..024e920626 100644 --- a/protocols/FacebookRM/src/dialogs.cpp +++ b/protocols/FacebookRM/src/dialogs.cpp @@ -88,10 +88,10 @@ INT_PTR CALLBACK FBAccountProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; - GetDlgItemTextA(hwnd, IDC_UN, str, sizeof(str)); + GetDlgItemTextA(hwnd, IDC_UN, str, SIZEOF(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_LOGIN, str); - GetDlgItemTextA(hwnd, IDC_PW, str, sizeof(str)); + GetDlgItemTextA(hwnd, IDC_PW, str, SIZEOF(str)); db_set_s(NULL, proto->ModuleName(), FACEBOOK_KEY_PASS, str); return TRUE; } @@ -395,13 +395,13 @@ INT_PTR CALLBACK FBOptionsProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp { char str[128]; TCHAR tstr[128]; - GetDlgItemTextA(hwnd,IDC_UN,str,sizeof(str)); + GetDlgItemTextA(hwnd,IDC_UN,str,SIZEOF(str)); db_set_s(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,str); - GetDlgItemTextA(hwnd,IDC_PW,str,sizeof(str)); + GetDlgItemTextA(hwnd,IDC_PW,str,SIZEOF(str)); proto->setString(FACEBOOK_KEY_PASS, str); - GetDlgItemText(hwnd,IDC_GROUP,tstr,sizeof(tstr)); + GetDlgItemText(hwnd,IDC_GROUP,tstr,SIZEOF(tstr)); if (tstr[0] != '\0') { proto->setTString(FACEBOOK_KEY_DEF_GROUP, tstr); diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index e828504623..b0226022a6 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -337,9 +337,9 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, { char email[128]; uin_t uin; - GetDlgItemTextA(hwndDlg, IDC_UIN, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_UIN, email, SIZEOF(email)); uin = atoi(email); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); if (!strlen(email)) MessageBox(NULL, TranslateT("You need to specify your registration e-mail first."), gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION); @@ -370,10 +370,10 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, GGUSERUTILDLGDATA dat; int ret; char pass[128], email[128]; - GetDlgItemTextA(hwndDlg, IDC_UIN, pass, sizeof(pass)); + GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); dat.pass = pass; dat.email = email; dat.gg = gg; @@ -457,15 +457,15 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, uin_t uin; // Write Gadu-Gadu number & password - GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); gg->checknewuser(uin, str); gg->setDword(GG_KEY_UIN, uin); gg->setString(GG_KEY_PASSWORD, str); // Write Gadu-Gadu email - GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str)); gg->setString(GG_KEY_EMAIL, str); // Write checkboxes @@ -564,9 +564,9 @@ static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam gg->setWord(GG_KEY_GC_POLICY_UNKNOWN, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_UNKNOWN, CB_GETCURSEL, 0, 0)); gg->setWord(GG_KEY_GC_POLICY_DEFAULT, (WORD)SendDlgItemMessage(hwndDlg, IDC_GC_POLICY_DEFAULT, CB_GETCURSEL, 0, 0)); - GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_TOTAL, str, SIZEOF(str)); gg->setWord(GG_KEY_GC_COUNT_TOTAL, (WORD)atoi(str)); - GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_GC_COUNT_UNKNOWN, str, SIZEOF(str)); gg->setWord(GG_KEY_GC_COUNT_UNKNOWN, (WORD)atoi(str)); } break; @@ -664,16 +664,16 @@ static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg->setByte(GG_KEY_FORWARDING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FORWARDING)); // Write custom servers - GetDlgItemTextA(hwndDlg, IDC_HOST, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_HOST, str, SIZEOF(str)); gg->setString(GG_KEY_SERVERHOSTS, str); // Write direct port - GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_DIRECTPORT, str, SIZEOF(str)); gg->setWord(GG_KEY_DIRECTPORT, (WORD)atoi(str)); // Write forwarding host - GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDHOST, str, SIZEOF(str)); gg->setString(GG_KEY_FORWARDHOST, str); - GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_FORWARDPORT, str, SIZEOF(str)); gg->setWord(GG_KEY_FORWARDPORT, (WORD)atoi(str)); break; } @@ -831,28 +831,28 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, req = gg_pubdir50_new(GG_PUBDIR50_WRITE); - GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_LASTNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_NICKNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_CITY, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, text_utf8); @@ -871,21 +871,21 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, gg_pubdir50_add(req, GG_PUBDIR50_GENDER, ""); } - GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, text_utf8); mir_free(text_utf8); } - GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, sizeof(text)); + GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, SIZEOF(text)); if (_tcslen(text)){ char* text_utf8 = mir_utf8encodeT(text); gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, text_utf8); @@ -986,10 +986,10 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP GGUSERUTILDLGDATA dat; int ret; char pass[128], email[128]; - GetDlgItemTextA(hwndDlg, IDC_UIN, pass, sizeof(pass)); + GetDlgItemTextA(hwndDlg, IDC_UIN, pass, SIZEOF(pass)); dat.uin = atoi(pass); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass)); - GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email)); dat.pass = pass; dat.email = email; dat.gg = gg; @@ -1037,15 +1037,15 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP uin_t uin; // Write Gadu-Gadu number & password - GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str)); uin = atoi(str); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); gg->checknewuser(uin, str); gg->setDword(GG_KEY_UIN, uin); gg->setString(GG_KEY_PASSWORD, str); // Write Gadu-Gadu email - GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_EMAIL, str, SIZEOF(str)); gg->setString(GG_KEY_EMAIL, str); } } diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 4b06361a18..248f33e393 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -420,7 +420,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
// Fetch search data
- GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *firstName_utf8 = mir_utf8encodeT(text);
@@ -430,7 +430,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 1 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_LASTNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_LASTNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *lastName_utf8 = mir_utf8encodeT(text);
@@ -440,7 +440,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 2 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_NICKNAME, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_NICKNAME, text, SIZEOF(text));
if (_tcslen(text))
{
char *nickName_utf8 = mir_utf8encodeT(text);
@@ -450,7 +450,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 3 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_CITY, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_CITY, text, SIZEOF(text));
if (_tcslen(text))
{
char *city_utf8 = mir_utf8encodeT(text);
@@ -460,7 +460,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) }
/* 4 */ strncat(data, ".", sizeof(data) - strlen(data));
- GetDlgItemText(hwndDlg, IDC_AGEFROM, text, sizeof(text));
+ GetDlgItemText(hwndDlg, IDC_AGEFROM, text, SIZEOF(text));
if (_tcslen(text))
{
int yearTo = _tstoi(text);
@@ -470,7 +470,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) int ay = lt->tm_year + 1900;
char age[16];
- GetDlgItemTextA(hwndDlg, IDC_AGETO, age, sizeof(age));
+ GetDlgItemTextA(hwndDlg, IDC_AGETO, age, SIZEOF(age));
yearFrom = atoi(age);
// Count & fix ranges
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index a8c58c3190..27c7830354 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -364,7 +364,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
@@ -429,7 +429,7 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(str);
+ ofn.nMaxFile = SIZEOF(str);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index d6ff406fd5..e208becaf5 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -57,7 +57,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l {
case IDOK:
{
- GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, sizeof(dat->val));
+ GetDlgItemTextA(hwndDlg, IDC_TOKEN, dat->val, SIZEOF(dat->val));
EndDialog(hwndDlg, IDOK);
break;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index d7b4643de8..bbd3e6b01f 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -224,8 +224,8 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
char pass[128], cpass[128];
BOOL enable;
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, sizeof(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
enable = strlen(pass) && strlen(cpass) && !strcmp(cpass, pass);
if (dat && dat->mode == GG_USERUTIL_REMOVE)
EnableWindow(GetDlgItem(hwndDlg, IDOK), IsDlgButtonChecked(hwndDlg, IDC_CONFIRM) ? enable : FALSE);
@@ -237,18 +237,18 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
{
char pass[128], cpass[128], email[128];
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, sizeof(pass));
- GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, sizeof(cpass));
- GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, sizeof(email));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, pass, SIZEOF(pass));
+ GetDlgItemTextA(hwndDlg, IDC_CPASSWORD, cpass, SIZEOF(cpass));
+ GetDlgItemTextA(hwndDlg, IDC_EMAIL, email, SIZEOF(email));
EndDialog(hwndDlg, IDOK);
// Check dialog box mode
if (!dat) break;
switch (dat->mode)
{
- case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break;
- case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break;
- case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break;
+ case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break;
+ case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break;
+ case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break;
case GG_USERUTIL_EMAIL: gg_dochemail(dat->gg, dat->uin, dat->pass, dat->email, email); break;
}
break;
diff --git a/protocols/IRCG/src/windows.cpp b/protocols/IRCG/src/windows.cpp index bfd6fb58e6..52b9d32726 100644 --- a/protocols/IRCG/src/windows.cpp +++ b/protocols/IRCG/src/windows.cpp @@ -911,7 +911,7 @@ void CManagerDlg::OnClose() }
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, 255);
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
CMString S = _T("");
TCHAR temp[1000];
for (int i = 0; i < 5; i++) {
@@ -1246,7 +1246,7 @@ void CManagerDlg::OnRadio(CCtrlData*) void CManagerDlg::ApplyQuestion()
{
TCHAR window[256];
- GetDlgItemText(m_hwnd, IDC_CAPTION, window, 255);
+ GetDlgItemText(m_hwnd, IDC_CAPTION, window, SIZEOF(window));
TCHAR mode[3];
lstrcpy(mode, _T("+b"));
diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index da8fe181bf..3464db871a 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -66,7 +66,7 @@ INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ppro->m_bRememberPwd = (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVEPASS);
ppro->setByte("RememberPass", ppro->m_bRememberPwd);
- GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, sizeof(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_LOGINPW, ppro->m_szPassword, SIZEOF(ppro->m_szPassword));
ppro->icq_login(ppro->m_szPassword);
diff --git a/protocols/IcqOscarJ/src/changeinfo/db.cpp b/protocols/IcqOscarJ/src/changeinfo/db.cpp index d4d8d6881c..963ed4eb4c 100644 --- a/protocols/IcqOscarJ/src/changeinfo/db.cpp +++ b/protocols/IcqOscarJ/src/changeinfo/db.cpp @@ -136,7 +136,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, {
char szTest[16];
- GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, sizeof(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_OLDPASS, szTest, SIZEOF(szTest));
if (strcmpnull(szTest, dat->ppro->GetUserPassword(TRUE))) {
MessageBox(hwndDlg, TranslateT("The password does not match your current password. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
@@ -145,7 +145,7 @@ static INT_PTR CALLBACK PwConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, break;
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, sizeof(szTest));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, szTest, SIZEOF(szTest));
if (strcmpnull(szTest, dat->Pass)) {
MessageBox(hwndDlg, TranslateT("The password does not match the password you originally entered. Check Caps Lock and try again."), TranslateT("Change ICQ Details"), MB_OK);
SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_SETSEL, 0, (LPARAM)-1);
diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index 510c1bc03b..c50d7dcc8b 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -72,7 +72,7 @@ static void searchPackTLVLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT idC {
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
ppackLETLVLNTS(buf, buflen, str, wType, 0);
}
@@ -81,7 +81,7 @@ static void searchPackTLVWordLNTS(PBYTE *buf, size_t *buflen, HWND hwndDlg, UINT {
char str[512];
- GetDlgItemTextA(hwndDlg, idControl, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, idControl, str, SIZEOF(str));
ppackLETLVWordLNTS(buf, buflen, w, str, wType, 0);
}
diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 5cd1ceece3..1880dd3364 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -86,10 +86,10 @@ INT_PTR CALLBACK icq_FirstRunDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UIN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_UIN, str, SIZEOF(str));
ppro->setDword(UNIQUEIDSETTING, atoi(str));
- GetDlgItemTextA(hwndDlg, IDC_PW, str, sizeof(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PW, str, SIZEOF(ppro->m_szPassword));
strcpy(ppro->m_szPassword, str);
ppro->setString("Password", str);
break;
diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index d3466c6770..87c2a451cd 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -146,7 +146,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP char str[128];
ppro->setDword(UNIQUEIDSETTING, GetDlgItemInt(hwndDlg, IDC_ICQNUM, NULL, FALSE));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(ppro->m_szPassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(ppro->m_szPassword));
if (mir_strlen(str)) {
strcpy(ppro->m_szPassword, str);
ppro->m_bRememberPwd = true;
@@ -154,7 +154,7 @@ static INT_PTR CALLBACK DlgProcIcqOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP else ppro->m_bRememberPwd = ppro->getByte("RememberPass", 0);
ppro->setString("Password", str);
- GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_ICQSERVER, str, SIZEOF(str));
ppro->setString("OscarServer", str);
ppro->setWord("OscarPort", (WORD)GetDlgItemInt(hwndDlg, IDC_ICQPORT, NULL, FALSE));
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 9b225a91e5..f4171a6eba 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -1268,7 +1268,7 @@ void CJabberProto::_RosterImportFromFile(HWND hwndDlg) ofn.lpstrFilter = filter;
ofn.lpstrFile = filename;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
- ofn.nMaxFile = sizeof(filename);
+ ofn.nMaxFile = SIZEOF(filename);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = "xml";
if (!GetOpenFileNameA(&ofn))
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 3893bab587..a9af00ed8c 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -187,7 +187,7 @@ bool DB_GetStaticStringA(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN DBVARIANT dbv = { 0 };
if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) {
- int dwRetBuffSizeLocal, dwReadedStringLen = lstrlenW(dbv.pwszVal);
+ size_t dwRetBuffSizeLocal, dwReadedStringLen = mir_wstrlen(dbv.pwszVal);
if (lpszRetBuff && (dwRetBuffSize > dwReadedStringLen)) {
dwRetBuffSizeLocal = WideCharToMultiByte(MRA_CODE_PAGE, 0, dbv.pwszVal, dwReadedStringLen, lpszRetBuff, dwRetBuffSize, NULL, NULL);
(*((CHAR*)(lpszRetBuff + dwRetBuffSizeLocal))) = 0;
@@ -1041,7 +1041,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg, UINT message, WPARAM wParam, LP if (dat) { // set our xStatus
TCHAR szBuff[STATUS_TITLE_MAX + STATUS_DESC_MAX];
- DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, STATUS_DESC_MAX + 1);
+ DWORD dwBuffSize = GetDlgItemText(hWndDlg, IDC_XMSG, szBuff, (STATUS_DESC_MAX + 1));
char szValueName[MAX_PATH];
mir_snprintf(szValueName, SIZEOF(szValueName), "XStatus%ldMsg", dat->dwXStatus);
diff --git a/protocols/MRA/src/Mra_options.cpp b/protocols/MRA/src/Mra_options.cpp index d30e207549..9498b1ceca 100644 --- a/protocols/MRA/src/Mra_options.cpp +++ b/protocols/MRA/src/Mra_options.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg, UINT msg, WPARAM wParam, LPARA if (GetDlgItemText(hWndDlg, IDC_PASSWORD, szBuff, SIZEOF(szBuff))) {
ppro->setTString("Password", szBuff);
- SecureZeroMemory(szBuff, SIZEOF(szBuff));
+ SecureZeroMemory(szBuff, sizeof(szBuff));
}
return TRUE;
}
diff --git a/protocols/MSN/src/msn_opts.cpp b/protocols/MSN/src/msn_opts.cpp index 9f35d48978..6003c2c5e5 100644 --- a/protocols/MSN/src/msn_opts.cpp +++ b/protocols/MSN/src/msn_opts.cpp @@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcMsnOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP {
HWND tEditField = GetDlgItem(hwndDlg, IDC_MAILER_APP);
- GetWindowTextA(tEditField, szFile, sizeof(szFile));
+ GetWindowTextA(tEditField, szFile, SIZEOF(szFile));
size_t tSelectLen = 0;
@@ -196,7 +196,7 @@ LBL_Continue: OPENFILENAMEA ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
- ofn.nMaxFile = sizeof(szFile);
+ ofn.nMaxFile = SIZEOF(szFile);
ofn.lpstrFile = szFile;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;
if (GetOpenFileNameA(&ofn) != TRUE)
@@ -225,14 +225,14 @@ LBL_Continue: CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
if (strcmp(_strlwr(szEmail), proto->MyOptions.szEmail)) {
reconnectRequired = true;
strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
if (!proto->getString("Password", &dbv)) {
if (strcmp(password, dbv.pszVal)) {
reconnectRequired = true;
@@ -379,13 +379,13 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_DIRECTSERVER, str, SIZEOF(str));
if (strcmp(str, MSN_DEFAULT_LOGIN_SERVER))
proto->setString("DirectServer", str);
else
proto->delSetting("DirectServer");
- GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_GATEWAYSERVER, str, SIZEOF(str));
if (strcmp(str, MSN_DEFAULT_GATEWAY))
proto->setString("GatewayServer", str);
else
@@ -406,7 +406,7 @@ static INT_PTR CALLBACK DlgProcMsnConnOpts(HWND hwndDlg, UINT msg, WPARAM wParam proto->setByte("AutoGetHost", (BYTE)gethst);
if (gethst == 0) {
- GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_YOURHOST, str, SIZEOF(str));
proto->setString("YourHost", str);
}
else proto->delSetting("YourHost");
@@ -547,13 +547,13 @@ static INT_PTR CALLBACK DlgProcAccMgrUI(HWND hwndDlg, UINT msg, WPARAM wParam, L CMsnProto* proto = (CMsnProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, sizeof(szEmail));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, szEmail, SIZEOF(szEmail));
if (strcmp(szEmail, proto->MyOptions.szEmail)) {
strcpy(proto->MyOptions.szEmail, szEmail);
proto->setString("e-mail", szEmail);
}
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, sizeof(password));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, password, SIZEOF(password));
if (!proto->getString("Password", &dbv)) {
if (strcmp(password, dbv.pszVal))
proto->setString("Password", password);
diff --git a/protocols/Omegle/src/dialogs.cpp b/protocols/Omegle/src/dialogs.cpp index b531e58b45..2b42a930af 100644 --- a/protocols/Omegle/src/dialogs.cpp +++ b/protocols/Omegle/src/dialogs.cpp @@ -50,7 +50,7 @@ static void StoreDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* sz {
TCHAR tstr[250+1];
- GetDlgItemText(hwnd, idCtrl, tstr, sizeof(tstr));
+ GetDlgItemText(hwnd, idCtrl, tstr, SIZEOF(tstr));
if ( _tcsclen( tstr ) > 0 ) {
db_set_ts(NULL, ppro->m_szModuleName, szSetting, tstr);
} else {
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 6037abcc7d..d69db969f9 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -224,7 +224,7 @@ HWND CSametimeProto::SearchAdvanced(HWND owner) {
TCHAR buf[512];
int ret = 0;
- if (GetDlgItemText(owner, IDC_EDIT1, buf, 512)) {
+ if (GetDlgItemText(owner, IDC_EDIT1, buf, SIZEOF(buf))) {
debugLog(_T("CSametimeProto::SearchAdvanced() buf:len=[%d]"), buf == NULL ? -1 : _tcslen(buf));
char* buf_utf8 = mir_utf8encodeT(buf);
ret = SearchForUser(buf_utf8, TRUE);
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index afbde43ec8..8ed5900f57 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -738,7 +738,7 @@ static INT_PTR CALLBACK DialDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR switch (LOWORD(wParam)) {
case IDDIAL:
EnableWindow(GetDlgItem(hwndDlg, IDDIAL), FALSE);
- GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, sizeof(number));
+ GetDlgItemTextA(hwndDlg, IDC_NUMBER, number, SIZEOF(number));
if (!strncmp(number, "00", 2)) {
memmove(number, number+1, sizeof(number)-1);
number[0]='+';
@@ -834,15 +834,15 @@ static INT_PTR CALLBACK CallstatDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, TranslateDialogDefault(hwndDlg);
SendMessage(hwndDlg, WM_COMMAND, IDC_JOIN, 0);
- GetWindowTextA(hwndDlg, buf, sizeof(buf));
+ GetWindowTextA(hwndDlg, buf, SIZEOF(buf));
_snprintf(buf2, sizeof(buf), buf, CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)lParam,0));
SetWindowTextA(hwndDlg, buf2);
- GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, sizeof(buf));
+ GetDlgItemTextA(hwndDlg, IDC_JOIN, buf, SIZEOF(buf));
_snprintf(buf2, sizeof(buf), buf, szOtherCaller);
SetDlgItemTextA(hwndDlg, IDC_JOIN, buf2);
- GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, sizeof(buf));
+ GetDlgItemTextA(hwndDlg, IDC_HOLD, buf, SIZEOF(buf));
_snprintf(buf2, sizeof(buf), buf, szOtherCaller);
SetDlgItemTextA(hwndDlg, IDC_HOLD, buf2);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 0f2f89a298..f260107b2c 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -396,13 +396,13 @@ INT_PTR CALLBACK OptionsProxyDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA case PSN_KILLACTIVE:
{
char buf[1024];
- GetDlgItemTextA(hwndDlg, IDC_HOST, buf, sizeof(buf));
+ GetDlgItemTextA(hwndDlg, IDC_HOST, buf, SIZEOF(buf));
db_set_s(NULL, SKYPE_PROTONAME, "Host", buf);
db_set_w(NULL, SKYPE_PROTONAME, "Port", (unsigned short)GetDlgItemInt(hwndDlg, IDC_PORT, NULL, FALSE));
db_set_b(NULL, SKYPE_PROTONAME, "RequiresPassword", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REQPASS), BM_GETCHECK,0,0)));
db_set_b (NULL, SKYPE_PROTONAME, "UseSkype2Socket", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_USES2S), BM_GETCHECK,0,0)));
ZeroMemory(buf, sizeof(buf));
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, sizeof(buf));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf));
db_set_s(NULL, SKYPE_PROTONAME, "Password", buf);
return TRUE;
}
@@ -622,22 +622,22 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L db_set_b (NULL, SKYPE_PROTONAME, "removable", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_REMOVEABLE), BM_GETCHECK,0,0)));
db_set_b (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(SendMessage(GetDlgItem(hwndDlg, IDC_SECONDARY), BM_GETCHECK,0,0)));
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,sizeof(text));
+ GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,SIZEOF(text));
strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath);
- GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,sizeof(text));
+ GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,SIZEOF(text));
strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "datapath", szRelativePath);
// LoginUserName
- GetDlgItemText(hwndDlg,IDC_USERNAME,wtext,sizeof(wtext)/sizeof(TCHAR));
+ GetDlgItemText(hwndDlg,IDC_USERNAME,wtext,SIZEOF(wtext));
db_set_ts(NULL, SKYPE_PROTONAME, "LoginUserName", wtext);
// LoginPassword
- GetDlgItemText(hwndDlg,IDC_PASSWORD,wtext,sizeof(wtext)/sizeof(TCHAR));
+ GetDlgItemText(hwndDlg,IDC_PASSWORD,wtext,SIZEOF(wtext));
db_set_ts(NULL, SKYPE_PROTONAME, "LoginPassword", wtext);
return TRUE;
@@ -681,12 +681,12 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L ofn.lStructSize=sizeof(ofn);
ofn.hwndOwner=hwndDlg;
ofn.lpstrFilter="Executable files (*.exe)\0*.exe\0All files (*.*)\0*.*\0";
- ofn.nMaxFile=sizeof(szFileName);
+ ofn.nMaxFile=SIZEOF(szFileName);
ofn.lpstrDefExt="exe";
ofn.lpstrFile=szFileName;
ofn.Flags=OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING;
- GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,sizeof(szFileName));
+ GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,szFileName,SIZEOF(szFileName));
TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
strcpy (szFileName, szAbsolutePath);
@@ -707,7 +707,7 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
char szFileName[MAX_PATH], szAbsolutePath[MAX_PATH];
- GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, MAX_PATH);
+ GetDlgItemTextA (hwndDlg, IDC_DATAPATH, szFileName, SIZEOF(szFileName));
TranslateMirandaRelativePathToAbsolute(szFileName, szAbsolutePath, FALSE);
BROWSEINFOA bi={0};
@@ -880,12 +880,12 @@ INT_PTR CALLBACK DetailsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) if ( HIWORD( wParam ) == BN_CLICKED ) {
switch( LOWORD( wParam )) {
case IDC_SAVEDETAILS:
- GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,sizeof(myProfile.FullName)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,sizeof(myProfile.HomePage)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,sizeof(myProfile.HomePhone)/sizeof(TCHAR));
- GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,sizeof(myProfile.OfficePhone)/sizeof(TCHAR));
- GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,sizeof(myProfile.City)/sizeof(TCHAR));
- GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,sizeof(myProfile.Province)/sizeof(TCHAR));
+ GetDlgItemText(hwndDlg,IDC_FULLNAME,myProfile.FullName,SIZEOF(myProfile.FullName));
+ GetDlgItemTextA(hwndDlg,IDC_HOMEPAGE,myProfile.HomePage,SIZEOF(myProfile.HomePage));
+ GetDlgItemTextA(hwndDlg,IDC_HOMEPHONE,myProfile.HomePhone,SIZEOF(myProfile.HomePhone));
+ GetDlgItemTextA(hwndDlg,IDC_OFFICEPHONE,myProfile.OfficePhone,SIZEOF(myProfile.OfficePhone));
+ GetDlgItemText(hwndDlg,IDC_CITY,myProfile.City,SIZEOF(myProfile.City));
+ GetDlgItemText(hwndDlg,IDC_PROVINCE,myProfile.Province,SIZEOF(myProfile.Province));
sex = SendMessage(GetDlgItem(hwndDlg,IDC_SEX),CB_GETCURSEL,0,0);
myProfile.Sex = 0;
diff --git a/protocols/Tlen/src/tlen_advsearch.cpp b/protocols/Tlen/src/tlen_advsearch.cpp index 33d7e907a9..1689a93173 100644 --- a/protocols/Tlen/src/tlen_advsearch.cpp +++ b/protocols/Tlen/src/tlen_advsearch.cpp @@ -61,7 +61,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 580de2c3cb..e7e73be5be 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -158,7 +158,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -170,7 +170,7 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -302,7 +302,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { reconnectRequired = true; } @@ -314,7 +314,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { - GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { reconnectRequired = true; } @@ -527,7 +527,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { reconnectRequired = true; } @@ -538,7 +538,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, } db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); - GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_HOST, text, SIZEOF(text)); if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { reconnectRequired = true; } @@ -568,16 +568,16 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, db_set_b(NULL, proto->m_szModuleName, "UseFileProxy", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_USE_PROXY)); db_set_w(NULL, proto->m_szModuleName, "FileProxyType", (WORD) SendDlgItemMessage(hwndDlg, IDC_FILE_PROXY_TYPE, CB_GETCURSEL, 0, 0)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_HOST, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyHost", text); db_set_w(NULL, proto->m_szModuleName, "FileProxyPort", (WORD) GetDlgItemInt(hwndDlg, IDC_FILE_PROXY_PORT, NULL, FALSE)); db_set_b(NULL, proto->m_szModuleName, "FileProxyAuth", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FILE_PROXY_USE_AUTH)); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_USER, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyUsername", text); - GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, sizeof(text)); + GetDlgItemTextA(hwndDlg, IDC_FILE_PROXY_PASSWORD, text, SIZEOF(text)); db_set_s(NULL, proto->m_szModuleName, "FileProxyPassword", text); if (reconnectRequired && proto->isConnected) diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index 0f4a9f8143..0f634b6cff 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -78,7 +78,7 @@ static INT_PTR CALLBACK TlenPasswordDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDOK:
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, sizeof(onlinePassword));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, onlinePassword, SIZEOF(onlinePassword));
//EndDialog(hwndDlg, (int) onlinePassword);
//return TRUE;
// Fall through
diff --git a/protocols/Tlen/src/tlen_userinfo.cpp b/protocols/Tlen/src/tlen_userinfo.cpp index 108214ebf2..dd927f4806 100644 --- a/protocols/Tlen/src/tlen_userinfo.cpp +++ b/protocols/Tlen/src/tlen_userinfo.cpp @@ -99,7 +99,7 @@ static void FetchField(HWND hwndDlg, UINT idCtrl, char *fieldName, char **str, i if (hwndDlg == NULL || fieldName == NULL || str == NULL || strSize == NULL)
return;
- GetDlgItemTextA(hwndDlg, idCtrl, text, sizeof(text));
+ GetDlgItemTextA(hwndDlg, idCtrl, text, SIZEOF(text));
if (text[0]) {
if ((localFieldName=TlenTextEncode(fieldName)) != NULL) {
if ((localText=TlenTextEncode(text)) != NULL) {
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 0cc3f16297..8b6331a8a7 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -1,107 +1,107 @@ -#include "common.h"
-
-INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
-
- switch (uMsg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwnd);
- {
- proto = (CToxProto*)lParam;
- SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
-
- ptrT nick(proto->getTStringA("Nick"));
- SetDlgItemText(hwnd, IDC_NAME, nick);
-
- ptrT pass(proto->getTStringA("Password"));
- SetDlgItemText(hwnd, IDC_PASSWORD, pass);
-
- ptrA address(proto->getStringA(TOX_SETTINGS_ID));
- if (address != NULL)
- {
- SetDlgItemTextA(hwnd, IDC_TOXID, address);
- }
-
- ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP));
- SetDlgItemText(hwnd, IDC_GROUP, group);
- SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0);
-
- CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0));
- CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0));
- }
- return TRUE;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_NAME:
- case IDC_GROUP:
- case IDC_PASSWORD:
- if ((HWND)lParam == GetFocus())
- {
- if (HIWORD(wParam) != EN_CHANGE) return 0;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
-
- case IDC_DISABLE_UDP:
- case IDC_DISABLE_IPV6:
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- break;
- }
-
- case IDC_CLIPBOARD:
- {
- char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1];
- GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId));
- if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID)))
- {
- EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, SIZEOF(toxId));
- memcpy(GlobalLock(hMem), toxId, SIZEOF(toxId));
- GlobalUnlock(hMem);
- SetClipboardData(CF_TEXT, hMem);
- CloseClipboard();
- }
- }
- break;
- }
- break;
-
- case WM_NOTIFY:
- if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY)
- {
- TCHAR nick[TOX_MAX_NAME_LENGTH], pass[MAX_PATH];
- GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH);
- proto->setTString("Nick", nick);
-
- GetDlgItemText(hwnd, IDC_PASSWORD, pass, SIZEOF(pass));
- proto->setTString("Password", pass);
-
- proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP));
- proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6));
-
- TCHAR group[64];
- GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group));
- if (_tcslen(group) > 0)
- {
- proto->setTString(NULL, TOX_SETTINGS_GROUP, group);
- Clist_CreateGroup(0, group);
- }
- else
- {
- proto->delSetting(NULL, TOX_SETTINGS_GROUP);
- }
-
- proto->SaveToxProfile();
-
- return TRUE;
- }
- break;
- }
-
- return FALSE;
+#include "common.h" + +INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA); + + switch (uMsg) + { + case WM_INITDIALOG: + TranslateDialogDefault(hwnd); + { + proto = (CToxProto*)lParam; + SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); + + ptrT nick(proto->getTStringA("Nick")); + SetDlgItemText(hwnd, IDC_NAME, nick); + + ptrT pass(proto->getTStringA("Password")); + SetDlgItemText(hwnd, IDC_PASSWORD, pass); + + ptrA address(proto->getStringA(TOX_SETTINGS_ID)); + if (address != NULL) + { + SetDlgItemTextA(hwnd, IDC_TOXID, address); + } + + ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP)); + SetDlgItemText(hwnd, IDC_GROUP, group); + SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); + + CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0)); + CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0)); + } + return TRUE; + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_NAME: + case IDC_GROUP: + case IDC_PASSWORD: + if ((HWND)lParam == GetFocus()) + { + if (HIWORD(wParam) != EN_CHANGE) return 0; + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + } + break; + + case IDC_DISABLE_UDP: + case IDC_DISABLE_IPV6: + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + break; + } + + case IDC_CLIPBOARD: + { + char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1]; + GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId)); + if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID))) + { + EmptyClipboard(); + HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(toxId)); + memcpy(GlobalLock(hMem), toxId, sizeof(toxId)); + GlobalUnlock(hMem); + SetClipboardData(CF_TEXT, hMem); + CloseClipboard(); + } + } + break; + } + break; + + case WM_NOTIFY: + if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) + { + TCHAR nick[TOX_MAX_NAME_LENGTH], pass[MAX_PATH]; + GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH); + proto->setTString("Nick", nick); + + GetDlgItemText(hwnd, IDC_PASSWORD, pass, SIZEOF(pass)); + proto->setTString("Password", pass); + + proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP)); + proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6)); + + TCHAR group[64]; + GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group)); + if (_tcslen(group) > 0) + { + proto->setTString(NULL, TOX_SETTINGS_GROUP, group); + Clist_CreateGroup(0, group); + } + else + { + proto->delSetting(NULL, TOX_SETTINGS_GROUP); + } + + proto->SaveToxProfile(); + + return TRUE; + } + break; + } + + return FALSE; }
\ No newline at end of file diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index 7f9a582836..27ee2f4553 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -81,7 +81,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128];
TCHAR tstr[128];
- GetDlgItemTextA(hwndDlg, IDC_SERVER, str, sizeof(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str) - 1);
if (str[strlen(str) - 1] != '/')
strncat(str, "/", sizeof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
@@ -225,21 +225,21 @@ INT_PTR CALLBACK options_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_UN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_UN, str, SIZEOF(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_UN, str);
- /*GetDlgItemTextA(hwndDlg,IDC_PW,str,sizeof(str));
+ /*GetDlgItemTextA(hwndDlg,IDC_PW,str,SIZEOF(str));
CallService(MS_DB_CRYPT_ENCODESTRING,sizeof(str),reinterpret_cast<LPARAM>(str));
db_set_s(0,proto->ModuleName(),TWITTER_KEY_PASS,str);*/
- GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, sizeof(str) - 1);
+ GetDlgItemTextA(hwndDlg, IDC_BASEURL, str, SIZEOF(str) - 1);
if (str[strlen(str) - 1] != '/')
strncat(str, "/", sizeof(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_BASEURL, str);
db_set_b(0, proto->ModuleName(), TWITTER_KEY_CHATFEED, IsDlgButtonChecked(hwndDlg, IDC_CHATFEED));
- GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_POLLRATE, str, SIZEOF(str));
int rate = atoi(str);
if (rate == 0)
rate = 80;
@@ -263,7 +263,7 @@ namespace popup_options return -1;
else if (IsDlgButtonChecked(hwndDlg, IDC_TIMEOUT_CUSTOM)) {
char str[32];
- GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_TIMEOUT, str, SIZEOF(str));
return atoi(str);
}
else // Default checked (probably)
@@ -481,7 +481,7 @@ INT_PTR CALLBACK pin_proc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) proto = reinterpret_cast<TwitterProto*>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_PIN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_PIN, str, SIZEOF(str));
db_set_s(0, proto->ModuleName(), TWITTER_KEY_OAUTH_PIN, str);
EndDialog(hwndDlg, wParam);
diff --git a/protocols/WhatsApp/src/dialogs.cpp b/protocols/WhatsApp/src/dialogs.cpp index 9392737ecf..06bb5c1371 100644 --- a/protocols/WhatsApp/src/dialogs.cpp +++ b/protocols/WhatsApp/src/dialogs.cpp @@ -53,9 +53,9 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT message, WPARAM wparam, string password;
char cc[5];
- GetDlgItemTextA(hwndDlg, IDC_CC, cc, sizeof(cc));
char number[128];
- GetDlgItemTextA(hwndDlg, IDC_LOGIN, number, sizeof(number));
+ GetDlgItemTextA(hwndDlg, IDC_CC, cc, SIZEOF(cc));
+ GetDlgItemTextA(hwndDlg, IDC_LOGIN, number, SIZEOF(number));
if (LOWORD(wparam) == IDC_BUTTON_REQUEST_CODE) {
if (IDYES == MessageBox(NULL, TranslateT(szAskSendSms), PRODUCT_NAME, MB_YESNO)) {
@@ -107,13 +107,13 @@ INT_PTR CALLBACK WhatsAppAccountProc(HWND hwndDlg, UINT message, WPARAM wparam, proto = reinterpret_cast<WhatsAppProto *>(GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
char str[128];
- GetDlgItemTextA(hwndDlg, IDC_CC, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_CC, str, SIZEOF(str));
db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_CC, str);
- GetDlgItemTextA(hwndDlg, IDC_LOGIN, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_LOGIN, str);
- GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str));
db_set_s(0, proto->ModuleName(), WHATSAPP_KEY_NICK, str);
db_set_b(0, proto->ModuleName(), WHATSAPP_KEY_SSL, IsDlgButtonChecked(hwndDlg, IDC_SSL));
diff --git a/protocols/Xfire/src/addgamedialog.cpp b/protocols/Xfire/src/addgamedialog.cpp index 26297e3bd6..8791aa76e3 100644 --- a/protocols/Xfire/src/addgamedialog.cpp +++ b/protocols/Xfire/src/addgamedialog.cpp @@ -275,7 +275,7 @@ BOOL OpenFileDialog(HWND hwndDlg, OPENFILENAMEA*ofn, char*exe) { ofn->lStructSize = sizeof(OPENFILENAMEA);
ofn->hwndOwner = hwndDlg;
ofn->lpstrFile = szFile;
- ofn->nMaxFile = sizeof(szFile);
+ ofn->nMaxFile = SIZEOF(szFile);
ofn->lpstrFilter = szFilter;
ofn->nFilterIndex = 1;
ofn->lpstrFileTitle = exe;
@@ -308,7 +308,7 @@ INT_PTR CALLBACK DlgAddGameProc(HWND hwndDlg, {
char temp[256];
//eingabe bei der suche auslesen
- GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_SEARCH, temp, SIZEOF(temp));
//eingabe in der liste suchen
int idx = SendDlgItemMessageA(hwndDlg, IDC_GAMELIST, LB_FINDSTRING, 0, (LPARAM)temp);
//gefunden?
@@ -628,7 +628,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame = new Xfire_game();
//Spielname
- GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_NAME, temp, SIZEOF(temp));
if (!strlen(temp))
{
if (!editgame) delete newgame;
@@ -643,7 +643,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//spielid nur setzen/prüfen, wenn kein editgame
if (!editgame) {
- GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_ID, temp, SIZEOF(temp));
if (!strlen(temp))
{
if (!editgame) delete newgame;
@@ -671,7 +671,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
}
//zu sendene spielid
- GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_SENDID, temp, SIZEOF(temp));
if (strlen(temp))
{
//standardmäßig wird bei einem customeintrag keine id versendet
@@ -681,7 +681,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//launcher exe
- GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_LAUNCHEREXE, temp, SIZEOF(temp));
if (strlen(temp))
{
//lowercase pfad
@@ -690,7 +690,7 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM newgame->setString(temp, &newgame->launchparams);
}
//detectexe
- GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_DETECTEXE, temp, SIZEOF(temp));
if (!strlen(temp))
{
if (!editgame) delete newgame;
@@ -708,13 +708,13 @@ INT_PTR CALLBACK DlgAddGameProc2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM }
//mustcontain parameter
- GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_CUSTOMPARAMS, temp, SIZEOF(temp));
if (strlen(temp))
{
newgame->setString(temp, &newgame->mustcontain);
}
//statusmsg speichern
- GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, 256);
+ GetDlgItemTextA(hwndDlg, IDC_ADD_STATUSMSG, temp, SIZEOF(temp));
if (strlen(temp))
{
newgame->setString(temp, &newgame->statusmsg);
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp index 056bb7b2cd..e3daffe50d 100644 --- a/protocols/Xfire/src/options.cpp +++ b/protocols/Xfire/src/options.cpp @@ -262,7 +262,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR char str[128]; DBVARIANT dbv; - GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, sizeof(login)); + GetDlgItemTextA(hwndDlg, IDC_LOGIN, login, SIZEOF(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "login", &dbv) || lstrcmpA(login, dbv.pszVal)) reconnectRequired = 1; @@ -287,7 +287,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_s(NULL, protocolname, "Username", login); //nur wenn der nick erfolgreich übertragen wurde - GetDlgItemTextA(hwndDlg, IDC_NICK, login, sizeof(login)); + GetDlgItemTextA(hwndDlg, IDC_NICK, login, SIZEOF(login)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "Nick", &dbv) || lstrcmpA(login, dbv.pszVal)) { @@ -297,14 +297,14 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (dbv.pszVal != NULL) db_free(&dbv); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); dbv.pszVal = NULL; if (db_get(NULL, protocolname, "password", &dbv) || lstrcmpA(str, dbv.pszVal)) reconnectRequired = 1; if (dbv.pszVal != NULL) db_free(&dbv); db_set_s(NULL, protocolname, "password", str); - GetDlgItemTextA(hwndDlg, IDC_SERVER, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_SERVER, str, SIZEOF(str)); //neue preferencen sichern if (bpStatus != ID_STATUS_OFFLINE&&bpStatus != ID_STATUS_CONNECTING) @@ -331,7 +331,7 @@ static INT_PTR CALLBACK DlgProcOpts2(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } //protocolversion wird autoamtisch vergeben - //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); if (reconnectRequired) @@ -558,7 +558,7 @@ static INT_PTR CALLBACK DlgProcOpts3(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR db_set_b(NULL, protocolname, "scanalways", (BYTE)ccc); //protocolversion wird autoamtisch vergeben - //GetDlgItemTextA(hwndDlg,IDC_PVER,str,sizeof(str)); + //GetDlgItemTextA(hwndDlg,IDC_PVER,str,SIZEOF(str)); //db_set_b(NULL,protocolname,"protover",(char)atoi(str)); if (reconnectRequired) MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the XFire network before they take effect"), TranslateT("XFire Options"), MB_OK | MB_ICONINFORMATION); @@ -739,7 +739,7 @@ static INT_PTR CALLBACK DlgProcOpts5(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int reconnectRequired = 0; char str[512]; - GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, str, SIZEOF(str)); db_set_s(NULL, protocolname, "setstatusmsg", str); db_set_b(NULL, protocolname, "autosetstatusmsg", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLESTSMSG)); @@ -1053,7 +1053,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR //extra parameter auslesen und das gameobj schreiben char str[128] = ""; - GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, sizeof(str)); + GetDlgItemTextA(hwndDlg, IDC_EXTRAPARAMS, str, SIZEOF(str)); if (str[0] != 0) { //extra parameter sind gesetzt, zuweisen diff --git a/protocols/Xfire/src/passworddialog.cpp b/protocols/Xfire/src/passworddialog.cpp index c395f3f630..f6cdb167c8 100644 --- a/protocols/Xfire/src/passworddialog.cpp +++ b/protocols/Xfire/src/passworddialog.cpp @@ -15,7 +15,7 @@ INT_PTR CALLBACK DlgPWProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
GetDlgItemTextA(hwndDlg, IDC_PWSTRING, (LPSTR)pw, 254);
if (usenick)
- GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, 254);
+ GetDlgItemTextA(hwndDlg, IDC_PWNICK, (LPSTR)nick, SIZEOF(nick));
EndDialog(hwndDlg, (INT_PTR)pw);
break;
}
diff --git a/protocols/Xfire/src/pwd_dlg.cpp b/protocols/Xfire/src/pwd_dlg.cpp index c9e0316627..dbb8415e80 100644 --- a/protocols/Xfire/src/pwd_dlg.cpp +++ b/protocols/Xfire/src/pwd_dlg.cpp @@ -20,7 +20,7 @@ INT_PTR CALLBACK DlgPwProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
if (LOWORD(wParam) == IDOK)
{
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, sizeof(password));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, password, SIZEOF(password));
EndDialog(hwndDlg, TRUE);
return TRUE;
}
diff --git a/protocols/Xfire/src/setnickname.cpp b/protocols/Xfire/src/setnickname.cpp index 96e69c6276..bfd5d3465a 100644 --- a/protocols/Xfire/src/setnickname.cpp +++ b/protocols/Xfire/src/setnickname.cpp @@ -24,7 +24,7 @@ INT_PTR CALLBACK DlgNickProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara if (LOWORD(wParam) == IDOK)
{
char nick[255];
- GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, sizeof(nick));
+ GetDlgItemTextA(hwndDlg, IDC_NICKNAME, nick, SIZEOF(nick));
CallService(XFIRE_SET_NICK, 0, (LPARAM)nick);
diff --git a/protocols/Yahoo/src/chat.cpp b/protocols/Yahoo/src/chat.cpp index 7b25099304..9fcd34270a 100644 --- a/protocols/Yahoo/src/chat.cpp +++ b/protocols/Yahoo/src/chat.cpp @@ -551,7 +551,7 @@ INT_PTR CALLBACK InviteToChatDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case IDOK:
{
TCHAR msg[1024];
- GetDlgItemText(hwndDlg, IDC_MSG, msg, sizeof(msg));
+ GetDlgItemText(hwndDlg, IDC_MSG, msg, SIZEOF(msg));
HWND hwndList = GetDlgItem(hwndDlg, IDC_CCLIST);
YList *who = NULL;
diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 237f5e49ce..36459e2a96 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -97,7 +97,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str)); if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; } @@ -108,7 +108,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString( YAHOO_LOGINID, str ); - GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str)); if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; } @@ -119,7 +119,7 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, } ppro->setString( YAHOO_PASSWORD, str ); - GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_NICK, str, SIZEOF(str)); if (str[0] == '\0') { @@ -213,7 +213,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar { bool reconnectRequired = false; char str[128]; - GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); + GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, SIZEOF(str)); DBVARIANT dbv; if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) { @@ -303,7 +303,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP MessageBox(hwndDlg, TranslateT("You need to be connected to Yahoo to add to Ignore List."), TranslateT("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION); else { char id[128]; - int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, sizeof( id )); + int i = GetDlgItemTextA(hwndDlg, IDC_YIGN_EDIT, id, SIZEOF(id)); if (i < 3) { MessageBox(hwndDlg, TranslateT("Please enter a valid buddy name to ignore."), TranslateT("Yahoo Ignore"), MB_OK| MB_ICONINFORMATION); diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 2d635246bf..d192490718 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -769,7 +769,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM char str[128];
bool reconnectRequired = false;
- GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, SIZEOF(str));
if (ppro->getString(YAHOO_LOGINID, &dbv)) {
reconnectRequired = true;
@@ -781,7 +781,7 @@ INT_PTR CALLBACK first_run_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM }
ppro->setString(YAHOO_LOGINID, str);
- GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof(str));
+ GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
if (ppro->getString(YAHOO_PASSWORD, &dbv)) {
reconnectRequired = true;
diff --git a/protocols/Yahoo/src/search.cpp b/protocols/Yahoo/src/search.cpp index 2b714bd3dd..065539b674 100644 --- a/protocols/Yahoo/src/search.cpp +++ b/protocols/Yahoo/src/search.cpp @@ -165,7 +165,7 @@ void __cdecl CYahooProto::searchadv_thread(void *pHWND) HWND hwndDlg = (HWND) pHWND;
TCHAR searchid[128];
- GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, 128);
+ GetDlgItemText(hwndDlg, IDC_SEARCH_ID, searchid, SIZEOF(searchid));
if (lstrlen(searchid) == 0) {
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 5fd99f9c6e..f2b179c870 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -147,7 +147,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam CYahooProto* ppro = ( CYahooProto* )GetWindowLongPtr(hwndDlg, GWLP_USERDATA );
/* Get String from dialog */
- GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str ));
+ GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str));
/* Save it for later use */
ppro->setString( YAHOO_CUSTSTATDB, str );
@@ -174,7 +174,7 @@ static INT_PTR CALLBACK DlgProcSetCustStat(HWND hwndDlg, UINT msg, WPARAM wParam BOOL toSet;
- toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, sizeof( str )) != 0;
+ toSet = GetDlgItemTextA(hwndDlg, IDC_CUSTSTAT, str, SIZEOF(str)) != 0;
EnableWindow( GetDlgItem(hwndDlg, IDOK ), toSet );
}
diff --git a/src/core/stdfile/fileopts.cpp b/src/core/stdfile/fileopts.cpp index cc36766a66..a7c361de7e 100644 --- a/src/core/stdfile/fileopts.cpp +++ b/src/core/stdfile/fileopts.cpp @@ -187,7 +187,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L if (str[0] == '"') {
TCHAR *pszQuote = _tcschr(str + 1, '"');
if (pszQuote) *pszQuote = 0;
- MoveMemory(str, str + 1, _tcslen(str) * sizeof(TCHAR));
+ MoveMemory(str, str + 1, (_tcslen(str) * sizeof(TCHAR)));
}
else {
TCHAR *pszSpace = _tcschr(str, ' ');
@@ -196,7 +196,7 @@ static INT_PTR CALLBACK DlgProcFileOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L ofn.nMaxFileTitle = MAX_PATH;
if (!GetOpenFileName(&ofn)) break;
if (_tcschr(str, ' ') != NULL) {
- MoveMemory(str + 1, str, SIZEOF(str) - 2 * sizeof(TCHAR));
+ MoveMemory(str + 1, str, ((SIZEOF(str) - 2) * sizeof(TCHAR)));
str[0] = '"';
_tcscat(str, _T("\""));
}
diff --git a/src/modules/langpack/lpopts.cpp b/src/modules/langpack/lpopts.cpp index a6963d89b1..29cf41df41 100644 --- a/src/modules/langpack/lpopts.cpp +++ b/src/modules/langpack/lpopts.cpp @@ -125,7 +125,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP {
char buf[512];
lstrcpyA(buf, "mailto:");
- if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), &buf[7], sizeof(buf)-7))
+ if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), &buf[7], SIZEOF(buf)-7))
CallService(MS_UTILS_OPENURL, FALSE, (LPARAM)buf);
}
break;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index e48a4e408c..330e8e3588 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -187,7 +187,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa return 1;
if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
- MoveMemory(str + 1, str, SIZEOF(str) - 2);
+ MoveMemory(str + 1, str, ((SIZEOF(str) - 2) * sizeof(TCHAR)));
str[0] = '"';
lstrcat(str, _T("\""));
}
@@ -196,7 +196,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa break;
case IDC_RUNNOW:
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, SIZEOF(str));
if (str[0]) {
STARTUPINFO si = { sizeof(si) };
PROCESS_INFORMATION pi;
@@ -205,7 +205,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa break;
case IDOK:
- GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, MAX_PATH);
+ GetDlgItemText(hwndDlg, IDC_RUNATSTART, str, SIZEOF(str));
db_set_ts(NULL, "Netlib", "RunAtStart", str);
db_set_b(NULL, "Netlib", "ShowLogOptsAtStart", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOWTHISDLGATSTART));
|