From 5b3b0020dd6b3797a5808c7362e358df48bd4e49 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 Jun 2012 21:06:11 +0000 Subject: Scriver: plusified git-svn-id: http://svn.miranda-ng.org/main/trunk@591 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/chat/clist.cpp | 2 -- plugins/Scriver/chat/colorchooser.cpp | 11 ++++------- plugins/Scriver/chat/log.cpp | 6 +++--- plugins/Scriver/chat/main.cpp | 1 - plugins/Scriver/chat/manager.cpp | 4 ++-- plugins/Scriver/chat/message.cpp | 2 +- plugins/Scriver/chat/options.cpp | 19 +++++++++---------- plugins/Scriver/chat/services.cpp | 3 +-- plugins/Scriver/chat/tools.cpp | 7 +++---- plugins/Scriver/chat/window.cpp | 13 ++++++------- 10 files changed, 29 insertions(+), 39 deletions(-) (limited to 'plugins/Scriver/chat') diff --git a/plugins/Scriver/chat/clist.cpp b/plugins/Scriver/chat/clist.cpp index 971ddfbe03..6ccf34c252 100644 --- a/plugins/Scriver/chat/clist.cpp +++ b/plugins/Scriver/chat/clist.cpp @@ -22,8 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../commonheaders.h" #include "chat.h" -extern HINSTANCE g_hInst; - extern HANDLE hJoinMenuItem, hLeaveMenuItem; HANDLE CList_AddRoom(const char* pszModule, const TCHAR* pszRoom, const TCHAR* pszDisplayName, int iType) diff --git a/plugins/Scriver/chat/colorchooser.cpp b/plugins/Scriver/chat/colorchooser.cpp index c2c4d80bce..ad95d4cc89 100644 --- a/plugins/Scriver/chat/colorchooser.cpp +++ b/plugins/Scriver/chat/colorchooser.cpp @@ -25,12 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" #include -//globals, defined int main.cpp -extern HINSTANCE g_hInst; - static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt) { - int iSquareRoot = (int)sqrt(pCC->pModule->nColorCount); + int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount); int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount?iSquareRoot+1:iSquareRoot; int col = pt.x / 25; @@ -46,7 +43,7 @@ static int CalculateCoordinatesToButton(COLORCHOOSER * pCC, POINT pt) static RECT CalculateButtonToCoordinates(COLORCHOOSER * pCC, int buttonPosition) { RECT pt; - int iSquareRoot = (int)sqrt(pCC->pModule->nColorCount); + int iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount); int nCols = iSquareRoot * iSquareRoot < pCC->pModule->nColorCount?iSquareRoot+1:iSquareRoot; int row = buttonPosition / nCols; @@ -83,7 +80,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L iCurrentHotTrack = -2; bChoosing = FALSE; - iSquareRoot = (int)sqrt(pCC->pModule->nColorCount); + iSquareRoot = (int)sqrt((double)pCC->pModule->nColorCount); iColumns = iSquareRoot * iSquareRoot == pCC->pModule->nColorCount?iSquareRoot:iSquareRoot+1; iRows = iSquareRoot; @@ -250,7 +247,7 @@ INT_PTR CALLBACK DlgProcColorToolWindow(HWND hwndDlg, UINT msg, WPARAM wParam, L rc.bottom = iThisRow * 20- 3 + 20 ; rc.right = iThisColumn * 25-3 ; - FillRect(hdc, &rc, GetStockObject(BLACK_BRUSH)); + FillRect(hdc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); hbr = CreateSolidBrush(pCC->pModule->crColors[i]); diff --git a/plugins/Scriver/chat/log.cpp b/plugins/Scriver/chat/log.cpp index 7fcae3f870..a7fc260fd1 100644 --- a/plugins/Scriver/chat/log.cpp +++ b/plugins/Scriver/chat/log.cpp @@ -950,7 +950,7 @@ void LoadMsgLogBitmaps(void) for (i = 0; i < SIZEOF(pLogIconBmpBits); i++) { hIcon = GetCachedIcon(logIconNames[i]); pLogIconBmpBits[i] = (PBYTE) mir_alloc(RTFPICTHEADERMAXSIZE + (bih.biSize + widthBytes * bih.biHeight) * 2); - rtfHeaderSize = sprintf(pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, (unsigned int)bih.biWidth, (unsigned int)bih.biHeight); + rtfHeaderSize = sprintf((char *)pLogIconBmpBits[i], "{\\pict\\dibitmap0\\wbmbitspixel%u\\wbmplanes1\\wbmwidthbytes%u\\picw%u\\pich%u ", bih.biBitCount, widthBytes, (unsigned int)bih.biWidth, (unsigned int)bih.biHeight); hoBmp = (HBITMAP) SelectObject(hdcMem, hBmp); FillRect(hdcMem, &rc, hBkgBrush); DrawIconEx(hdcMem, 0, 0, hIcon, bih.biWidth, bih.biHeight, 0, NULL, DI_NORMAL); @@ -959,9 +959,9 @@ void LoadMsgLogBitmaps(void) { int n; for (n = 0; n < sizeof(BITMAPINFOHEADER); n++) - sprintf(pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); + sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + n * 2, "%02X", ((PBYTE) & bih)[n]); for (n = 0; n < widthBytes * bih.biHeight; n += 4) - sprintf(pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); + sprintf((char *)pLogIconBmpBits[i] + rtfHeaderSize + (bih.biSize + n) * 2, "%02X%02X%02X%02X", pBmpBits[n], pBmpBits[n + 1], pBmpBits[n + 2], pBmpBits[n + 3]); } logIconBmpSize[i] = rtfHeaderSize + (bih.biSize + widthBytes * bih.biHeight) * 2 + 1; pLogIconBmpBits[i][logIconBmpSize[i] - 1] = '}'; diff --git a/plugins/Scriver/chat/main.cpp b/plugins/Scriver/chat/main.cpp index ff2d980427..4ff0eef47d 100644 --- a/plugins/Scriver/chat/main.cpp +++ b/plugins/Scriver/chat/main.cpp @@ -27,7 +27,6 @@ void RegisterChatFonts( void ); extern struct GlobalMessageData *g_dat; extern CRITICAL_SECTION cs; //globals -HINSTANCE g_hInst; HMENU g_hMenu = NULL; HANDLE hJoinMenuItem, hLeaveMenuItem; diff --git a/plugins/Scriver/chat/manager.cpp b/plugins/Scriver/chat/manager.cpp index 061955af45..30bdfc80c7 100644 --- a/plugins/Scriver/chat/manager.cpp +++ b/plugins/Scriver/chat/manager.cpp @@ -767,7 +767,7 @@ char* SM_GetUsers(SESSION_INFO* si) do { int pLen = lstrlenA(p), nameLen = lstrlen(utemp->pszUID); if ( pLen + nameLen + 2 > alloced ) - p = mir_realloc( p, alloced += 4096 ); + p = (char *)mir_realloc( p, alloced += 4096 ); WideCharToMultiByte( CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen+1, 0, 0 ); @@ -1230,7 +1230,7 @@ BOOL UM_SetStatusEx(USERINFO* pUserList, const TCHAR* pszText, int flags ) pTemp->iStatusEx = 0; if ( pszText != NULL ) { - TCHAR* s = _tcsstr( pszText, pTemp->pszUID ); + TCHAR* s = (TCHAR *)_tcsstr( pszText, pTemp->pszUID ); if ( s ) { pTemp->iStatusEx = 0; if ( s == pszText || s[-1] == cDelimiter ) { diff --git a/plugins/Scriver/chat/message.cpp b/plugins/Scriver/chat/message.cpp index a6866941d2..7739e1acef 100644 --- a/plugins/Scriver/chat/message.cpp +++ b/plugins/Scriver/chat/message.cpp @@ -94,7 +94,7 @@ TCHAR* DoRtfToTags( char* pszText, SESSION_INFO* si) // create an index of colors in the module and map them to // corresponding colors in the RTF color table - pIndex = mir_alloc(sizeof(int) * MM_FindModule(si->pszModule)->nColorCount); + pIndex = (int *)mir_alloc(sizeof(int) * MM_FindModule(si->pszModule)->nColorCount); for(i = 0; i < MM_FindModule(si->pszModule)->nColorCount ; i++) pIndex[i] = -1; diff --git a/plugins/Scriver/chat/options.cpp b/plugins/Scriver/chat/options.cpp index f030359ee6..29bb385db0 100644 --- a/plugins/Scriver/chat/options.cpp +++ b/plugins/Scriver/chat/options.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define UM_CHECKSTATECHANGE (WM_USER+100) -extern HANDLE g_hInst; extern HBRUSH hListBkgBrush; extern HBRUSH hListSelectedBkgBrush; extern FONTINFO aFonts[OPTIONS_FONTCOUNT]; @@ -340,7 +339,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_GROUP)); if(iLen > 0) { - pszText = mir_realloc(pszText, iLen+1); + pszText = (char *)mir_realloc(pszText, iLen+1); GetDlgItemTextA(hwndDlg, IDC_CHAT_GROUP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "AddToGroup", pszText); } @@ -499,8 +498,8 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam CallService(MS_UTILS_PATHTORELATIVET, (WPARAM)tszDirectory, (LPARAM)tszTemp ); SetWindowText(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), lstrlen(tszTemp) > 1?tszTemp:DEFLOGFILENAME); } - psMalloc->lpVtbl->Free(psMalloc,idList); - psMalloc->lpVtbl->Release(psMalloc); + psMalloc->Free(idList); + psMalloc->Release(); } break; } @@ -553,7 +552,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS)); if ( iLen > 0 ) { - TCHAR *ptszText = mir_alloc((iLen+2) * sizeof(TCHAR)); + TCHAR *ptszText = (TCHAR *)mir_alloc((iLen+2) * sizeof(TCHAR)); TCHAR *p2 = NULL; if(ptszText) { @@ -571,7 +570,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); if ( iLen > 0 ) { - TCHAR *pszText1 = malloc(iLen*sizeof(TCHAR) + 2); + TCHAR *pszText1 = (TCHAR *)malloc(iLen*sizeof(TCHAR) + 2); GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); DBWriteContactSettingTString(NULL, "Chat", "LogDirectory", pszText1); CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)pszText1, (LPARAM)g_Settings.pszLogDir); @@ -584,7 +583,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGTIMESTAMP)); if ( iLen > 0 ) { - pszText = mir_realloc(pszText, iLen+1); + pszText = (char *)mir_realloc(pszText, iLen+1); GetDlgItemTextA(hwndDlg, IDC_CHAT_LOGTIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "LogTimestamp", pszText); } @@ -592,7 +591,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_TIMESTAMP)); if ( iLen > 0 ) { - pszText = mir_realloc(pszText, iLen+1); + pszText = (char *)mir_realloc(pszText, iLen+1); GetDlgItemTextA(hwndDlg, IDC_CHAT_TIMESTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderTime", pszText); } @@ -600,7 +599,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_INSTAMP)); if ( iLen > 0 ) { - pszText = mir_realloc(pszText, iLen+1); + pszText = (char *)mir_realloc(pszText, iLen+1); GetDlgItemTextA(hwndDlg, IDC_CHAT_INSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderIncoming", pszText); } @@ -608,7 +607,7 @@ BOOL CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lParam iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_OUTSTAMP)); if ( iLen > 0 ) { - pszText = mir_realloc(pszText, iLen+1); + pszText = (char *)mir_realloc(pszText, iLen+1); GetDlgItemTextA(hwndDlg, IDC_CHAT_OUTSTAMP, pszText,iLen+1); DBWriteContactSettingString(NULL, "Chat", "HeaderOutgoing", pszText); } diff --git a/plugins/Scriver/chat/services.cpp b/plugins/Scriver/chat/services.cpp index eb72218e7a..24aec8e9cc 100644 --- a/plugins/Scriver/chat/services.cpp +++ b/plugins/Scriver/chat/services.cpp @@ -23,7 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "chat.h" #include "../msgwindow.h" -extern HANDLE g_hInst; extern HICON hIcons[30]; HANDLE hSendEvent; @@ -179,7 +178,7 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) mi->iMaxText= gcr->iMaxText; mi->nColorCount = gcr->nColors; if ( gcr->nColors > 0) { - mi->crColors = mir_alloc(sizeof(COLORREF) * gcr->nColors); + mi->crColors = (COLORREF *)mir_alloc(sizeof(COLORREF) * gcr->nColors); memcpy(mi->crColors, gcr->pColors, sizeof(COLORREF) * gcr->nColors); } diff --git a/plugins/Scriver/chat/tools.cpp b/plugins/Scriver/chat/tools.cpp index d18115dfae..b448ca9aa4 100644 --- a/plugins/Scriver/chat/tools.cpp +++ b/plugins/Scriver/chat/tools.cpp @@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -extern HINSTANCE g_hInst; extern FONTINFO aFonts[OPTIONS_FONTCOUNT]; extern HMENU g_hMenu; extern HANDLE hBuildMenuEvent ; @@ -150,7 +149,7 @@ static int ShowPopup (HANDLE hContact, SESSION_INFO* si, HICON hIcon, char* psz pd.colorText = crBkg; } - pd.PluginWindowProc = PopupDlgProc; + pd.PluginWindowProc = (WNDPROC)PopupDlgProc; pd.PluginData = si; return PUAddPopUpT(&pd); } @@ -465,9 +464,9 @@ BOOL IsHighlighted(SESSION_INFO* si, const TCHAR* pszText) p3 += 1; //find the end of the word - p2 = _tcschr(p3, ' '); + p2 = (TCHAR *)_tcschr(p3, ' '); if (!p2) - p2 = _tcschr(p3, '\0'); + p2 = (TCHAR *)_tcschr(p3, '\0'); if (p3 != p2) { diff --git a/plugins/Scriver/chat/window.cpp b/plugins/Scriver/chat/window.cpp index 2acd5aed25..0962503cd3 100644 --- a/plugins/Scriver/chat/window.cpp +++ b/plugins/Scriver/chat/window.cpp @@ -31,8 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HBRUSH hListBkgBrush; extern HBRUSH hListSelectedBkgBrush; extern HANDLE hSendEvent; -extern HINSTANCE g_hInst; -extern struct CREOleCallback reOleCallback; +extern CREOleCallback reOleCallback; extern HMENU g_hMenu; extern TABLIST * g_TabList; extern HANDLE hHookWinPopup; @@ -341,7 +340,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, iLen = GetRichTextLength(hwnd, gt.codepage, TRUE); if (iLen >0) { TCHAR *pszName = NULL; - pszText = mir_alloc(iLen + 100 * sizeof(TCHAR)); + pszText = (TCHAR *)mir_alloc(iLen + 100 * sizeof(TCHAR)); gt.cb = iLen + 99 * sizeof(TCHAR); gt.flags = GT_DEFAULT; @@ -364,7 +363,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } } if ( dat->szSearchQuery == NULL) { - dat->szSearchQuery = mir_alloc( sizeof(TCHAR)*( end-start+1 )); + dat->szSearchQuery = (TCHAR *)mir_alloc( sizeof(TCHAR)*( end-start+1 )); lstrcpyn( dat->szSearchQuery, pszText+start, end-start+1); dat->szSearchResult = mir_tstrdup(dat->szSearchQuery); dat->lastSession = NULL; @@ -394,7 +393,7 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, dat->szSearchResult = mir_tstrdup(pszName); if (end !=start) { if (!isRoom && !isTopic && g_Settings.AddColonToAutoComplete && start == 0) { - pszText = mir_alloc((_tcslen(pszName) + 4) * sizeof(TCHAR)); + pszText = (TCHAR *)mir_alloc((_tcslen(pszName) + 4) * sizeof(TCHAR)); _tcscpy(pszText, pszName); _tcscat(pszText, _T(": ")); pszName = pszText; @@ -1098,7 +1097,7 @@ int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth) return 0; hdc = GetDC(NULL); - hOldFont = SelectObject(hdc, hFont); + hOldFont = (HFONT)SelectObject(hdc, hFont); i = DrawText(hdc, pszText , -1, &rc, DT_CALCRECT); SelectObject(hdc, hOldFont); ReleaseDC(NULL,hdc); @@ -1703,7 +1702,7 @@ LABEL_SHOWWINDOW: HWND ColorWindow; RECT rc; BOOL bFG = lParam == IDC_CHAT_COLOR?TRUE:FALSE; - COLORCHOOSER * pCC = mir_alloc(sizeof(COLORCHOOSER)); + COLORCHOOSER * pCC = (COLORCHOOSER *)mir_alloc(sizeof(COLORCHOOSER)); GetWindowRect(GetDlgItem(hwndDlg, bFG?IDC_CHAT_COLOR:IDC_CHAT_BKGCOLOR), &rc); pCC->hWndTarget = GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE); -- cgit v1.2.3