From e3cefc7b6ca803e3f87dbadae54a110332778490 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 5 Jul 2012 22:41:06 +0000 Subject: - first of the /Core standard plugins; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@778 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/srfile/filerecvdlg.cpp | 70 +++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 35 deletions(-) (limited to 'src/modules/srfile/filerecvdlg.cpp') diff --git a/src/modules/srfile/filerecvdlg.cpp b/src/modules/srfile/filerecvdlg.cpp index 7249291b6d..93ba691266 100644 --- a/src/modules/srfile/filerecvdlg.cpp +++ b/src/modules/srfile/filerecvdlg.cpp @@ -37,10 +37,10 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDi TCHAR *pszLastBackslash; lstrcpyn(szExistingDir, szTestDir, cchExistingDir); - while ((dwAttributes=GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) { - pszLastBackslash=_tcsrchr(szExistingDir, '\\'); - if (pszLastBackslash == NULL) {*szExistingDir='\0'; break;} - *pszLastBackslash='\0'; + while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) { + pszLastBackslash = _tcsrchr(szExistingDir, '\\'); + if (pszLastBackslash == NULL) {*szExistingDir = '\0'; break;} + *pszLastBackslash = '\0'; } if (szExistingDir[0] == '\0') GetCurrentDirectory(cchExistingDir, szExistingDir); } @@ -50,7 +50,7 @@ void RemoveInvalidFilenameChars(TCHAR *tszString) { size_t i; if (tszString) { - for (i=_tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1) + for (i = _tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1) if (tszString[i] >= 0) tszString[i] = _T('_'); } @@ -61,7 +61,7 @@ void RemoveInvalidPathChars(TCHAR *tszString) { size_t i; if (tszString) { - for (i=_tcscspn(tszString, InvalidPathChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidPathChars)+1) + for (i = _tcscspn(tszString, InvalidPathChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidPathChars)+1) if (tszString[i] >= 0) tszString[i] = _T('_'); } @@ -84,17 +84,17 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p int BrowseForFolder(HWND hwnd, TCHAR *szPath) { - BROWSEINFO bi={0}; + BROWSEINFO bi = {0}; LPITEMIDLIST pidlResult; - bi.hwndOwner=hwnd; - bi.pszDisplayName=szPath; - bi.lpszTitle=TranslateT("Select Folder"); - bi.ulFlags=BIF_NEWDIALOGSTYLE|BIF_EDITBOX|BIF_RETURNONLYFSDIRS; // Use this combo instead of BIF_USENEWUI - bi.lpfn=BrowseCallbackProc; - bi.lParam=(LPARAM)szPath; + bi.hwndOwner = hwnd; + bi.pszDisplayName = szPath; + bi.lpszTitle = TranslateT("Select Folder"); + bi.ulFlags = BIF_NEWDIALOGSTYLE|BIF_EDITBOX|BIF_RETURNONLYFSDIRS; // Use this combo instead of BIF_USENEWUI + bi.lpfn = BrowseCallbackProc; + bi.lParam = (LPARAM)szPath; - pidlResult=SHBrowseForFolder(&bi); + pidlResult = SHBrowseForFolder(&bi); if (pidlResult) { SHGetPathFromIDList(pidlResult, szPath); lstrcat(szPath, _T("\\")); @@ -103,7 +103,7 @@ int BrowseForFolder(HWND hwnd, TCHAR *szPath) return pidlResult != NULL; } -static REPLACEVARSARRAY sttVarsToReplace[] = +static REPLACEVARSARRAY sttVarsToReplace[] = { { (TCHAR*)"///", (TCHAR*)"//" }, { (TCHAR*)"//", (TCHAR*)"/" }, @@ -149,13 +149,13 @@ void GetContactReceivedFilesDir(HANDLE hContact, TCHAR *szDir, int cchDir, BOOL if (hContact) { REPLACEVARSDATA dat = { 0 }; REPLACEVARSARRAY rvaVarsToReplace[4]; - rvaVarsToReplace[0].lptzKey = _T("nick"); + rvaVarsToReplace[0].lptzKey = _T("nick"); rvaVarsToReplace[0].lptzValue = mir_tstrdup((TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, GCDNF_TCHAR)); - rvaVarsToReplace[1].lptzKey = _T("userid"); + rvaVarsToReplace[1].lptzKey = _T("userid"); rvaVarsToReplace[1].lptzValue = GetContactID(hContact); - rvaVarsToReplace[2].lptzKey = _T("proto"); + rvaVarsToReplace[2].lptzKey = _T("proto"); rvaVarsToReplace[2].lptzValue = mir_a2t((char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0)); - rvaVarsToReplace[3].lptzKey = NULL; + rvaVarsToReplace[3].lptzKey = NULL; rvaVarsToReplace[3].lptzValue = NULL; for (int i=0; i < (SIZEOF(rvaVarsToReplace)-1);i++) RemoveInvalidFilenameChars(rvaVarsToReplace[i].lptzValue); @@ -204,7 +204,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { struct FileDlgData *dat; - dat=(struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + dat = (struct FileDlgData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); switch (msg) { case WM_INITDIALOG: { TCHAR *contactName; @@ -213,7 +213,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l TranslateDialogDefault(hwndDlg); - dat=(struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData)); + dat = (struct FileDlgData*)mir_calloc(sizeof(struct FileDlgData)); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); dat->hContact = cle->hContact; dat->hDbEvent = cle->hDbEvent; @@ -250,13 +250,13 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l CallService(MS_DB_EVENT_MARKREAD, (WPARAM)dat->hContact, (LPARAM)dat->hDbEvent); { - DBEVENTINFO dbei={0}; + DBEVENTINFO dbei = {0}; TCHAR datetimestr[64]; char buf[540]; - dbei.cbSize=sizeof(dbei); - dbei.cbBlob=CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0); - dbei.pBlob=(PBYTE)mir_alloc(dbei.cbBlob); + dbei.cbSize = sizeof(dbei); + dbei.cbBlob = CallService(MS_DB_EVENT_GETBLOBSIZE, (WPARAM)dat->hDbEvent, 0); + dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); CallService(MS_DB_EVENT_GET, (WPARAM)dat->hDbEvent, (LPARAM)&dbei); dat->fs = cle->lParam ? (HANDLE)cle->lParam : (HANDLE)*(PDWORD)dbei.pBlob; lstrcpynA(buf, (char*)dbei.pBlob+4, min(dbei.cbBlob+1, SIZEOF(buf))); @@ -322,15 +322,15 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam); case WM_DRAWITEM: - { LPDRAWITEMSTRUCT dis=(LPDRAWITEMSTRUCT)lParam; + { LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; if (dis->hwndItem == GetDlgItem(hwndDlg, IDC_PROTOCOL)) { char *szProto; - szProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); + szProto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)dat->hContact, 0); if (szProto) { HICON hIcon; - hIcon=(HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); + hIcon = (HICON)CallProtoServiceInt(NULL,szProto, PS_LOADICON, PLI_PROTOCOL|PLIF_SMALL, 0); if (hIcon) { DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL); DestroyIcon(hIcon); @@ -363,7 +363,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l char idstr[32]; int i; DBVARIANT dbv; - for (i=MAX_MRU_DIRS-2;i>=0;i--) { + for (i = MAX_MRU_DIRS-2;i>=0;i--) { mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i); if (DBGetContactSettingTString(NULL, "SRFile", idstr, &dbv)) continue; mir_snprintf(idstr, SIZEOF(idstr), "MruDir%d", i+1); @@ -393,16 +393,16 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDCANCEL: if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENYT, (WPARAM)dat->fs, (LPARAM)TranslateT("Cancelled")); - dat->fs=NULL; /* the protocol will free the handle */ + dat->fs = NULL; /* the protocol will free the handle */ DestroyWindow(hwndDlg); break; case IDC_ADD: - { ADDCONTACTSTRUCT acs={0}; + { ADDCONTACTSTRUCT acs = {0}; - acs.handle=dat->hContact; - acs.handleType=HANDLE_CONTACT; - acs.szProto=""; + acs.handle = dat->hContact; + acs.handleType = HANDLE_CONTACT; + acs.szProto = ""; CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs); if ( !DBGetContactSettingByte(dat->hContact, "CList", "NotOnList", 0)) ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), SW_HIDE); @@ -411,7 +411,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_USERMENU: { RECT rc; - HMENU hMenu=(HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); + HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)dat->hContact, 0); GetWindowRect((HWND)lParam, &rc); TrackPopupMenu(hMenu, 0, rc.left, rc.bottom, 0, hwndDlg, NULL); DestroyMenu(hMenu); -- cgit v1.2.3