summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-01 14:16:46 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-01 14:16:46 +0000
commit2e5502b7b902fad22773937890654791bdf1e1ad (patch)
treedee2d9dc5cda3aa6547bd7b8fde9ed3b547d0c35 /plugins
parent6cd67368926784c3ca831517916b96c8799750a6 (diff)
warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@11200 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TabSRMM/src/TSButton.cpp2
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp4
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp17
-rw-r--r--plugins/TabSRMM/src/eventpopups.cpp8
-rw-r--r--plugins/TabSRMM/src/globals.cpp2
-rw-r--r--plugins/TabSRMM/src/infopanel.cpp18
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp14
-rw-r--r--plugins/TabSRMM/src/msgdlgutils.cpp37
-rw-r--r--plugins/TabSRMM/src/msglog.cpp2
-rw-r--r--plugins/TabSRMM/src/msgs.cpp90
-rw-r--r--plugins/TabSRMM/src/msgs.h23
-rw-r--r--plugins/TabSRMM/src/sendlater.cpp12
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp251
-rw-r--r--plugins/TabSRMM/src/sendqueue.h30
-rw-r--r--plugins/TabSRMM/src/sidebar.cpp6
-rw-r--r--plugins/TabSRMM/src/trayicon.cpp2
-rw-r--r--plugins/TabSRMM/src/utils.cpp2
17 files changed, 255 insertions, 265 deletions
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp
index 5538eb690f..6128425f75 100644
--- a/plugins/TabSRMM/src/TSButton.cpp
+++ b/plugins/TabSRMM/src/TSButton.cpp
@@ -292,7 +292,7 @@ nonflat_themed:
}
SIZE sz;
- GetTextExtentPoint32(hdcMem, szText, mir_tstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
if (ctl->cHot) {
SIZE szHot;
GetTextExtentPoint32A(hdcMem, "&", 1, &szHot);
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index 162c597360..03ad973855 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -591,7 +591,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff
}
if (szTemp[0]) {
- int iLen = mir_strlen(szTemp);
+ size_t iLen = mir_strlen(szTemp);
memcpy(d, szTemp, iLen);
d += iLen;
}
@@ -950,7 +950,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
if (lstrdat->buffer == NULL) {
lstrdat->bufferOffset = 0;
lstrdat->buffer = Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = mir_strlen(lstrdat->buffer);
+ lstrdat->bufferLen = (int)mir_strlen(lstrdat->buffer);
}
// give the RTF to the RE control
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index 44a6cf6774..bb6a77568e 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -790,10 +790,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
BOOL isShift, isCtrl, isAlt;
KbdState(mwdat, isShift, isCtrl, isAlt);
- //MAD: sound on typing..
+ // sound on typing..
if (PluginConfig.g_bSoundOnTyping&&!isAlt&&wParam == VK_DELETE)
SkinPlaySound("SoundOnTyping");
- //
+
if (wParam == VK_INSERT && !isShift && !isCtrl && !isAlt) {
mwdat->fInsertMode = !mwdat->fInsertMode;
SendMessage(hwndParent, WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwnd), EN_CHANGE), (LPARAM)hwnd);
@@ -2333,16 +2333,16 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
SIZE sz;
if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) {
COLORREF clr_orig = GetTextColor(dis->hDC);
- GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(si->szSearch), &sz);
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(si->szSearch), &sz);
SetTextColor(dis->hDC, RGB(250, 250, 0));
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(si->szSearch));
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(si->szSearch));
SetTextColor(dis->hDC, clr_orig);
x_offset += sz.cx;
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch));
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), int(mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch)));
}
else {
- GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(ui->pszNick), &sz);
- TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(ui->pszNick));
+ GetTextExtentPoint32(dis->hDC, ui->pszNick, (int)mir_tstrlen(ui->pszNick), &sz);
+ TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
}
return TRUE;
@@ -2666,7 +2666,7 @@ LABEL_SHOWWINDOW:
int iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (iRes > 0) {
- int iLen = mir_tstrlen(pszWord) - 1;
+ size_t iLen = mir_tstrlen(pszWord) - 1;
while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) {
pszWord[iLen] = '\0';
iLen--;
@@ -3638,7 +3638,6 @@ LABEL_SHOWWINDOW:
dat->sbCustom = 0;
}
- //MAD
M.RemoveWindow(hwndDlg);
TABSRMM_FireEvent(dat->hContact, hwndDlg, MSG_WINDOW_EVT_CLOSE, 0);
diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp
index 173308a77f..cfc0302c20 100644
--- a/plugins/TabSRMM/src/eventpopups.cpp
+++ b/plugins/TabSRMM/src/eventpopups.cpp
@@ -602,12 +602,12 @@ static int PopupUpdateT(MCONTACT hContact, HANDLE hEvent)
int i, available = MAX_SECONDLINE - 1;
if (pdata->pluginOptions->bShowHeaders) {
_tcsncpy(lpzText, szHeader, MAX_SECONDLINE);
- available -= mir_tstrlen(szHeader);
+ available -= (int)mir_tstrlen(szHeader);
}
else lpzText[0] = 0;
for (i = pdata->nrMerged; i >= 0; i--) {
- available -= mir_tstrlen(pdata->eventData[i].tszText);
+ available -= (int)mir_tstrlen(pdata->eventData[i].tszText);
if (available <= 0)
break;
}
@@ -748,7 +748,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced)
mii.dwItemData = 0;
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = mir_tstrlen(szMenuEntry) + 1;
+ mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, FALSE, &mii);
@@ -814,7 +814,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro
if (fromEvent == 2)
mii.dwItemData |= 0x10000000;
mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
- mii.cch = mir_tstrlen(szMenuEntry) + 1;
+ mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
mii.dwTypeData = (LPTSTR)szMenuEntry;
}
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp
index 01b222736d..5798bd871f 100644
--- a/plugins/TabSRMM/src/globals.cpp
+++ b/plugins/TabSRMM/src/globals.cpp
@@ -624,7 +624,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c)
ptrA szMsg(mir_utf8encodeT(text));
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.pBlob = (PBYTE)(char*)szMsg;
- dbei.cbBlob = mir_strlen(szMsg) + 1;
+ dbei.cbBlob = (int)mir_strlen(szMsg) + 1;
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.timestamp = time(NULL);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp
index 19bce88c6e..b88a65e5bb 100644
--- a/plugins/TabSRMM/src/infopanel.cpp
+++ b/plugins/TabSRMM/src/infopanel.cpp
@@ -431,9 +431,9 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT& rcItem)
if (szStatusMsg) {
SIZE sStatusMsg, sMask;
- ::GetTextExtentPoint32(hdc, szTextToShow, mir_tstrlen(szTextToShow), &m_szNick);
+ ::GetTextExtentPoint32(hdc, szTextToShow, (int)mir_tstrlen(szTextToShow), &m_szNick);
::GetTextExtentPoint32(hdc, _T("A"), 1, &sMask);
- ::GetTextExtentPoint32(hdc, szStatusMsg, mir_tstrlen(szStatusMsg), &sStatusMsg);
+ ::GetTextExtentPoint32(hdc, szStatusMsg, (int)mir_tstrlen(szStatusMsg), &sStatusMsg);
DWORD dtFlagsNick = DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX;
if ((m_szNick.cx + sStatusMsg.cx + 6) < (rcItem.right - rcItem.left) || (rcItem.bottom - rcItem.top) < (2 * sMask.cy)) {
@@ -466,7 +466,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT& rcItem)
CSkin::RenderText(hdc, m_dat->hThemeIP, szStatusMsg, &rcItem, dtFlags, CSkin::m_glowSize, clr);
}
else {
- GetTextExtentPoint32(hdc, szTextToShow, mir_tstrlen(szTextToShow), &m_szNick);
+ GetTextExtentPoint32(hdc, szTextToShow, (int)mir_tstrlen(szTextToShow), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
setUnderlinedFont(hdc, fShowUin ? m_ipConfig.hFonts[IPFONTID_UIN] : m_ipConfig.hFonts[IPFONTID_NICK]);
@@ -522,7 +522,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem)
}
SIZE sUIN;
- ::GetTextExtentPoint32(hdc, szBuf, mir_tstrlen(szBuf), &sUIN);
+ ::GetTextExtentPoint32(hdc, szBuf, (int)mir_tstrlen(szBuf), &sUIN);
mapRealRect(rcItem, m_rcUIN, sUIN);
CSkin::RenderText(hdc, m_dat->hThemeIP, szBuf, &rcItem, DT_SINGLELINE | DT_VCENTER, CSkin::m_glowSize, clr);
}
@@ -545,7 +545,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
DWORD oldPanelStatusCX = m_dat->panelStatusCX;
if (m_dat->szStatus[0])
- GetTextExtentPoint32(hdc, m_dat->szStatus, mir_tstrlen(m_dat->szStatus), &sStatus);
+ GetTextExtentPoint32(hdc, m_dat->szStatus, (int)mir_tstrlen(m_dat->szStatus), &sStatus);
/*
* figure out final account name
@@ -553,13 +553,13 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem)
const TCHAR *szFinalProto = m_dat->cache->getRealAccount();
if (szFinalProto) {
SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_PROTO]);
- GetTextExtentPoint32(hdc, szFinalProto, mir_tstrlen(szFinalProto), &sProto);
+ GetTextExtentPoint32(hdc, szFinalProto, (int)mir_tstrlen(szFinalProto), &sProto);
}
TCHAR szResult[80]; szResult[0] = 0;
if (m_dat->hTimeZone) {
tmi.printDateTime(m_dat->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0);
- GetTextExtentPoint32(hdc, szResult, mir_tstrlen(szResult), &sTime);
+ GetTextExtentPoint32(hdc, szResult, (int)mir_tstrlen(szResult), &sTime);
}
m_dat->panelStatusCX = 3 + sStatus.cx + sProto.cx + 14 + (m_dat->hClientIcon ? 20 : 0) + sTime.cx + 13;
@@ -641,7 +641,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem)
const TCHAR *tszNick = m_dat->cache->getNick();
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(hdc, tszNick, mir_tstrlen(tszNick), &m_szNick);
+ ::GetTextExtentPoint32(hdc, tszNick, (int)mir_tstrlen(tszNick), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
@@ -689,7 +689,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem)
SIZE szTitle;
TCHAR szPrefix[100];
mir_sntprintf(szPrefix, 100, TranslateT("Topic is: %s"), _T(""));
- ::GetTextExtentPoint32(hdc, szPrefix, mir_tstrlen(szPrefix), &szTitle);
+ ::GetTextExtentPoint32(hdc, szPrefix, (int)mir_tstrlen(szPrefix), &szTitle);
mapRealRect(rcItem, m_rcUIN, szTitle);
if (m_hoverFlags & HOVER_UIN)
setUnderlinedFont(hdc, m_ipConfig.hFonts[IPFONTID_UIN]);
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 2259922508..a3cf01be73 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -1908,7 +1908,8 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
DM_ScrollToBottom(dat, 1, 1);
return(_dlgReturn(hwndDlg, 1));
}
- //MAD: tabulation mod
+
+ // tabulation mod
if (msg == WM_KEYDOWN && wp == VK_TAB) {
if (PluginConfig.m_AllowTab) {
if (((NMHDR*)lParam)->idFrom == IDC_MESSAGE)
@@ -2748,15 +2749,16 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
rtrimt(decoded);
int bufSize = WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, 0, 0, 0);
- int memRequired = 0, flags = 0;
+ size_t memRequired = 0;
+ int flags = 0;
if (!IsUtfSendAvailable(dat->hContact)) {
flags |= PREF_UNICODE;
- memRequired = bufSize + ((mir_wstrlen(decoded) + 1) * sizeof(WCHAR));
+ memRequired = bufSize + (mir_wstrlen(decoded) + 1) * sizeof(WCHAR);
}
else {
flags |= PREF_UTF;
utfResult = mir_utf8encodeT(decoded);
- memRequired = (int)(strlen(utfResult)) + 1;
+ memRequired = strlen(utfResult) + 1;
}
// try to detect RTL
@@ -2896,13 +2898,13 @@ quote_from_last:
}
}
if (dbei.eventType == EVENTTYPE_FILE) {
- int iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
+ size_t iDescr = mir_strlen((char *)(szText + sizeof(DWORD)));
MoveMemory(szText, szText + sizeof(DWORD), iDescr);
MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD)+iDescr, dbei.cbBlob - iDescr - sizeof(DWORD)-1);
szText[iDescr] = '\r';
szText[iDescr + 1] = '\n';
szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText)));
- MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + mir_strlen((char *)szText));
+ MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + (int)mir_strlen((char *)szText));
iAlloced = true;
}
ptrT szQuoted(QuoteText(szConverted, iCharsPerLine, 0));
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp
index 7adc174039..88ad5c40a0 100644
--- a/plugins/TabSRMM/src/msgdlgutils.cpp
+++ b/plugins/TabSRMM/src/msgdlgutils.cpp
@@ -291,7 +291,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID)
szText = TranslateT("Set Your Avatar...");
}
mii.dwTypeData = szText;
- mii.cch = mir_tstrlen(szText) + 1;
+ mii.cch = (int)mir_tstrlen(szText) + 1;
SetMenuItemInfo(submenu, ID_PICMENU_SETTINGS, FALSE, &mii);
}
else if (menuID == MENU_PANELPICMENU) {
@@ -659,14 +659,12 @@ int TSAPI CheckValidSmileyPack(const char *szProto, MCONTACT hContact)
TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQuotes)
{
- int inChar, outChar, lineChar;
- int justDoneLineBreak, bufSize;
- TCHAR *strout;
-
- bufSize = mir_wstrlen(text) + 23;
- strout = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
- inChar = 0;
- justDoneLineBreak = 1;
+ int outChar, lineChar;
+
+ size_t bufSize = mir_wstrlen(text) + 23;
+ TCHAR *strout = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
+ int inChar = 0;
+ int justDoneLineBreak = 1;
for (outChar = 0, lineChar = 0; text[inChar];) {
if (outChar >= bufSize - 8) {
bufSize += 20;
@@ -675,9 +673,9 @@ TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQu
if (justDoneLineBreak && text[inChar] != '\r' && text[inChar] != '\n') {
if (removeExistingQuotes)
if (text[inChar] == '>') {
- while (text[++inChar] != '\n');
- inChar++;
- continue;
+ while (text[++inChar] != '\n');
+ inChar++;
+ continue;
}
strout[outChar++] = '>';
strout[outChar++] = ' ';
@@ -1194,16 +1192,16 @@ void TSAPI FindFirstEvent(TWindowData *dat)
switch (historyMode) {
case LOADHISTORY_COUNT:
+ int i;
+ HANDLE hPrevEvent;
{
- int i;
- HANDLE hPrevEvent;
DBEVENTINFO dbei = { sizeof(dbei) };
- //MAD: ability to load only current session's history
+ // ability to load only current session's history
if (dat->bActualHistory)
i = dat->cache->getSessionMsgCount();
else
i = db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT);
- //
+
for (; i > 0; i--) {
if (dat->hDbEventFirst == NULL)
hPrevEvent = db_event_last(dat->hContact);
@@ -1221,16 +1219,15 @@ void TSAPI FindFirstEvent(TWindowData *dat)
break;
case LOADHISTORY_TIME:
- HANDLE hPrevEvent;
- DWORD firstTime;
-
DBEVENTINFO dbei = { sizeof(dbei) };
if (dat->hDbEventFirst == NULL)
dbei.timestamp = time(NULL);
else
db_event_get(dat->hDbEventFirst, &dbei);
- firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
+
+ DWORD firstTime = dbei.timestamp - 60 * db_get_w(NULL, SRMSGMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME);
for (;;) {
+ HANDLE hPrevEvent;
if (dat->hDbEventFirst == NULL)
hPrevEvent = db_event_last(dat->hContact);
else
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp
index ac82f2133d..af624b936e 100644
--- a/plugins/TabSRMM/src/msglog.cpp
+++ b/plugins/TabSRMM/src/msglog.cpp
@@ -1188,7 +1188,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
*pcb = 0;
return 0;
}
- dat->bufferLen = mir_strlen(dat->buffer);
+ dat->bufferLen = (int)mir_strlen(dat->buffer);
}
*pcb = min(cb, dat->bufferLen - dat->bufferOffset);
CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp
index 0b88f1ef4a..3bd3e09457 100644
--- a/plugins/TabSRMM/src/msgs.cpp
+++ b/plugins/TabSRMM/src/msgs.cpp
@@ -1,32 +1,31 @@
/*
- * Miranda NG: the free IM client for Microsoft* Windows*
- *
- * Copyright (c) 2000-09 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.
- *
- * part of tabSRMM messaging plugin for Miranda.
- *
- * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
- *
- * Load, setup and shutdown the plugin
- * core plugin messaging services (single IM chats only).
- *
- */
+* Miranda NG: the free IM client for Microsoft* Windows*
+*
+* Copyright (c) 2000-09 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.
+*
+* part of tabSRMM messaging plugin for Miranda.
+*
+* (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+*
+* Load, setup and shutdown the plugin
+* core plugin messaging services (single IM chats only).
+*/
#include "commonheaders.h"
@@ -41,6 +40,7 @@ static void UnloadIcons();
void Chat_AddIcons(void);
+/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes IEView plugin options. Apply them to all open tabs
int IEViewOptionsChanged(WPARAM, LPARAM)
@@ -49,6 +49,7 @@ int IEViewOptionsChanged(WPARAM, LPARAM)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// fired event when user changes smileyadd options. Notify all open tabs about the changes
int SmileyAddOptionsChanged(WPARAM,LPARAM)
@@ -58,19 +59,21 @@ int SmileyAddOptionsChanged(WPARAM,LPARAM)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// Message API 0.0.0.3 services
static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam)
{
char *szBuf = (char*)wParam;
- int size = (int)lParam;
+ size_t size = (size_t)lParam;
mir_snprintf(szBuf, size, "tabSRMM");
return 0;
}
-//wparam = (MessageWindowInputData*)
-//lparam = (MessageWindowData*)
-//returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
+/////////////////////////////////////////////////////////////////////////////////////////
+// wparam = (MessageWindowInputData*)
+// lparam = (MessageWindowData*)
+// returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
{
@@ -112,7 +115,9 @@ static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam)
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// service function. Sets a status bar text for a contact
+
static void SetStatusTextWorker(TWindowData *dat, StatusTextData *st)
{
if (!dat)
@@ -147,6 +152,7 @@ static INT_PTR SetStatusText(WPARAM hContact, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// service function. Invoke the user preferences dialog for the contact given (by handle) in wParam
static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
@@ -160,6 +166,7 @@ static INT_PTR SetUserPrefs(WPARAM wParam, LPARAM)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// service function - open the tray menu from the TTB button
static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
@@ -168,6 +175,7 @@ static INT_PTR Service_OpenTrayMenu(WPARAM, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// service function. retrieves the message window flags for a given hcontact or window
// wParam == hContact of the window to find
// lParam == window handle (set it to 0 if you want search for hcontact, otherwise it
@@ -186,6 +194,7 @@ static INT_PTR GetMessageWindowFlags(WPARAM wParam, LPARAM lParam)
return (dat) ? dat->dwFlags : 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// return the version of the window api supported
static INT_PTR GetWindowAPI(WPARAM, LPARAM)
@@ -193,6 +202,7 @@ static INT_PTR GetWindowAPI(WPARAM, LPARAM)
return PLUGIN_MAKE_VERSION(0, 0, 0, 2);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// service function finds a message session
// wParam = contact handle for which we want the window handle
// thanks to bio for the suggestion of this service
@@ -239,6 +249,7 @@ INT_PTR MessageWindowOpened(WPARAM wParam, LPARAM lParam)
return 1;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// ReadMessageCommand is executed whenever the user wants to manually open a window.
// This can happen when double clicking a contact on the clist OR when opening a new
// message (clicking on a popup, clicking the flashing tray icon and so on).
@@ -262,6 +273,7 @@ static INT_PTR ReadMessageCommand(WPARAM, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// the SendMessageCommand() invokes a message session window for the given contact.
// e.g. it is called when user double clicks a contact on the contact list
// it is implemented as a service, so external plugins can use it to open a message window.
@@ -321,6 +333,7 @@ INT_PTR SendMessageCommand_W(WPARAM hContact, LPARAM lParam)
return SendMessageCommand_Worker(hContact, LPCSTR(lParam), true);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// open a window when user clicks on the flashing "typing message" tray icon.
// just calls SendMessageCommand() for the given contact.
@@ -397,6 +410,7 @@ int IconsChanged(WPARAM, LPARAM)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// initialises the internal API, services, events etc...
static void TSAPI InitAPI()
@@ -479,6 +493,7 @@ STDMETHODIMP REOLECallback::GetNewStorage(LPSTORAGE FAR *lplpstg)
return sc;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// tabbed mode support functions...
// (C) by Nightwish
//
@@ -529,6 +544,7 @@ int TSAPI ActivateExistingTab(TContainerData *pContainer, HWND hwndChild)
return TRUE;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// this function creates and activates a new tab within the given container.
// bActivateTab: make the new tab the active one
// bPopupContainer: restore container if it was minimized, otherwise flash it...
@@ -689,6 +705,7 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact,
return hwndNew; // return handle of the new dialog
}
+/////////////////////////////////////////////////////////////////////////////////////////
// this is used by the 2nd containermode (limit tabs on default containers).
// it searches a container with "room" for the new tabs or otherwise creates
// a new (cloned) one.
@@ -707,6 +724,7 @@ TContainerData* TSAPI FindMatchingContainer(const TCHAR *szName, MCONTACT hConta
return FindContainerByName(szName);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// load some global icons.
void TSAPI CreateImageList(BOOL bInitial)
@@ -764,6 +782,7 @@ int TABSRMM_FireEvent(MCONTACT hContact, HWND hwnd, unsigned int type, unsigned
return NotifyEventHooks(PluginConfig.m_event_MsgWin, 0, (LPARAM)&mwe);
}
+/////////////////////////////////////////////////////////////////////////////////////////
// standard icon definitions
static TIconDesc _toolbaricons[] =
@@ -860,8 +879,9 @@ static int GetIconPackVersion(HMODULE hDLL)
return version;
}
-// setup default icons for the IcoLib service. This needs to be done every time the plugin is loaded
-// default icons are taken from the icon pack in either \icons or \plugins
+/////////////////////////////////////////////////////////////////////////////////////////
+// setup default icons for the IcoLib service. This needs to be done every time the
+// plugin is loaded default icons are taken from the icon pack in either \icons or \plugins
static int TSAPI SetupIconLibConfig()
{
@@ -949,6 +969,7 @@ static int TSAPI LoadFromIconLib()
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
// load icon theme from either icon pack or IcoLib
void TSAPI LoadIconTheme()
@@ -959,7 +980,6 @@ void TSAPI LoadIconTheme()
LoadFromIconLib();
Skin->setupTabCloseBitmap();
- return;
}
static void UnloadIcons()
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h
index 4ade7610eb..d372631f2f 100644
--- a/plugins/TabSRMM/src/msgs.h
+++ b/plugins/TabSRMM/src/msgs.h
@@ -59,13 +59,11 @@
#define MWF_LOG_INDENT 16384
#define MWF_LOG_RTL 32768
-//MAD: ieview still mistakenly uses these...
+// ieview still mistakenly uses these...
#define MWF_LOG_NEWLINE 8192
#define MWF_LOG_UNDERLINE 65536
#define MWF_LOG_SWAPNICK 131072
-//
-//#define MWF_LOG_BBCODE 65536
-//#define MWF_LOG_LOCALTIME 8192
+
#define MWF_LOG_BBCODE 1
#define MWF_LOG_LOCALTIME 64
@@ -252,7 +250,7 @@ struct TWindowData
TCHAR szStatus[50];
WORD wStatus;
char *sendBuffer;
- int iSendBufferSize;
+ size_t iSendBufferSize;
int iSendLength; // message length in utf-8 octets
HICON hTabIcon, hTabStatusIcon, hXStatusIcon, hClientIcon, hTaskbarIcon;
HICON iFlashIcon;
@@ -260,8 +258,7 @@ struct TWindowData
BOOL bTabFlash;
HWND hwndIEView, hwndIWebBrowserControl, hwndHPP;
HWND hwndContactPic, hwndPanelPic, hwndPanelPicParent;
- UINT bbLSideWidth; //MAD
- UINT bbRSideWidth; //MAD
+ UINT bbLSideWidth, bbRSideWidth;
BYTE kstate[256];
SESSION_INFO *si;
@@ -366,18 +363,18 @@ struct myTabCtrl
struct TIconDesc
{
- char *szName;
- char *szDesc;
- HICON *phIcon; // where the handle is saved...
+ char *szName;
+ char *szDesc;
+ HICON *phIcon; // where the handle is saved...
INT_PTR uId; // icon ID
BOOL bForceSmall; // true: force 16x16
};
struct TIconDescW
{
- TCHAR *szName;
- TCHAR *szDesc;
- HICON *phIcon; // where the handle is saved...
+ TCHAR *szName;
+ TCHAR *szDesc;
+ HICON *phIcon; // where the handle is saved...
INT_PTR uId; // icon ID
BOOL bForceSmall; // true: force 16x16
};
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp
index 79c0edac47..7db0a84282 100644
--- a/plugins/TabSRMM/src/sendlater.cpp
+++ b/plugins/TabSRMM/src/sendlater.cpp
@@ -333,7 +333,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam)
job->hContact = hContact;
job->created = atol(&szSetting[1]);
- int iLen = mir_strlen(szOrig_Utf);
+ size_t iLen = mir_strlen(szOrig_Utf);
job->sendBuffer = reinterpret_cast<char *>(mir_alloc(iLen + 1));
strncpy(job->sendBuffer, szOrig_Utf, iLen);
job->sendBuffer[iLen] = 0;
@@ -342,16 +342,16 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam)
wchar_t *szWchar = 0;
char *szAnsi = mir_utf8decodecp(szOrig_Utf, CP_ACP, &szWchar);
iLen = mir_strlen(szAnsi);
- UINT required = iLen + 1;
+ size_t required = iLen + 1;
if (szWchar)
- required += ((mir_wstrlen(szWchar) + 1) * sizeof(wchar_t));
+ required += (mir_wstrlen(szWchar) + 1) * sizeof(wchar_t);
job->pBuf = (PBYTE)mir_calloc(required);
- strncpy((char *)job->pBuf, szAnsi, iLen);
+ strncpy((char*)job->pBuf, szAnsi, iLen);
job->pBuf[iLen] = 0;
if (szWchar)
- wcsncpy((wchar_t *)&job->pBuf[iLen + 1], szWchar, mir_wstrlen(szWchar));
+ wcsncpy((wchar_t*)&job->pBuf[iLen + 1], szWchar, mir_wstrlen(szWchar));
if (szSetting[0] == 'S')
db_free(&dbv);
@@ -475,7 +475,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack)
dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto((p->hContact));
dbei.timestamp = time(NULL);
- dbei.cbBlob = mir_strlen(p->sendBuffer) + 1;
+ dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1;
dbei.flags |= DBEF_UTF;
dbei.pBlob = (PBYTE)(p->sendBuffer);
db_event_add(p->hContact, &dbei);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 2ffc05e036..73e0e12254 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -1,44 +1,39 @@
/*
- * astyle --force-indent=tab=4 --brackets=linux --indent-switches
- * --pad=oper --one-line=keep-blocks --unpad=paren
- *
- * Miranda NG: the free IM client for Microsoft* Windows*
- *
- * Copyright (c) 2000-09 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.
- *
- * part of tabSRMM messaging plugin for Miranda.
- *
- * (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
- *
- * Implements a queued, asynchronous sending system for tabSRMM.
- *
- */
+* Miranda NG: the free IM client for Microsoft* Windows*
+*
+* Copyright (c) 2000-09 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.
+*
+* part of tabSRMM messaging plugin for Miranda.
+*
+* (C) 2005-2010 by silvercircle _at_ gmail _dot_ com and contributors
+*
+* Implements a queued, asynchronous sending system for tabSRMM.
+*/
#include "commonheaders.h"
SendQueue *sendQueue = 0;
-/*
- * searches the queue for a message belonging to the given contact which has been marked
- * as "failed" by either the ACKRESULT_FAILED or a timeout handler
- * returns: zero-based queue index or -1 if none was found
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// searches the queue for a message belonging to the given contact which has been marked
+// as "failed" by either the ACKRESULT_FAILED or a timeout handler
+// returns: zero-based queue index or -1 if none was found
int SendQueue::findNextFailed(const TWindowData *dat) const
{
@@ -64,12 +59,11 @@ void SendQueue::handleError(TWindowData *dat, const int iEntry) const
::HandleIconFeedback(dat, PluginConfig.g_iconErr);
}
-/*
- * add a message to the sending queue.
- * iLen = required size of the memory block to hold the message
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+//add a message to the sending queue.
+// iLen = required size of the memory block to hold the message
-int SendQueue::addTo(TWindowData *dat, const int iLen, int dwFlags)
+int SendQueue::addTo(TWindowData *dat, size_t iLen, int dwFlags)
{
int i;
int iFound = NR_SENDJOBS;
@@ -78,15 +72,14 @@ int SendQueue::addTo(TWindowData *dat, const int iLen, int dwFlags)
_DebugPopup(dat->hContact, _T("Send queue full"));
return 0;
}
- /*
- * find a mir_free entry in the send queue...
- */
+
+ // find a mir_free entry in the send queue...
for (i=0; i < NR_SENDJOBS; i++) {
if (m_jobs[i].hContact != 0 || m_jobs[i].iStatus != 0) {
// this entry is used, check if it's orphaned and can be removed...
- if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it
+ if (m_jobs[i].hOwnerWnd && IsWindow(m_jobs[i].hOwnerWnd)) // window exists, do not reuse it
continue;
- if (time(NULL) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
+ if (time(NULL) - m_jobs[i].dwTime < 120) // non-acked entry, but not old enough, don't re-use it
continue;
clearJob(i);
iFound = i;
@@ -119,16 +112,15 @@ entry_found:
return 0;
}
-/*
- * threshold for word-wrapping when sending messages in chunks
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// threshold for word - wrapping when sending messages in chunks
#define SPLIT_WORD_CUTOFF 20
static int SendChunkW(WCHAR *chunk, MCONTACT hContact, DWORD dwFlags)
{
- int wLen = mir_wstrlen(chunk);
- DWORD memRequired = (wLen + 1) * sizeof(WCHAR);
+ size_t wLen = mir_wstrlen(chunk);
+ size_t memRequired = (wLen + 1) * sizeof(WCHAR);
DWORD codePage = db_get_dw(hContact, SRMSGMOD_T, "ANSIcodepage", CP_ACP);
int mbcsSize = WideCharToMultiByte(codePage, 0, chunk, -1, NULL, 0, 0, 0);
@@ -157,7 +149,7 @@ static void DoSplitSendW(LPVOID param)
int chunkSize = job->chunkSize / 2;
char *szProto = GetContactProto(hContact);
- int iLen = mir_strlen(job->szSendBuffer);
+ size_t iLen = mir_strlen(job->szSendBuffer);
WCHAR *wszBegin = (WCHAR*) & job->szSendBuffer[iLen + 1];
WCHAR *wszTemp = (WCHAR*)mir_alloc(sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1));
CopyMemory(wszTemp, wszBegin, sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1));
@@ -168,11 +160,8 @@ static void DoSplitSendW(LPVOID param)
if (iCur > iLen)
fSplitting = FALSE;
- /*
- * try to "word wrap" the chunks - split on word boundaries (space characters), if possible.
- * SPLIT_WORD_CUTOFF = max length of unbreakable words, longer words may be split.
- */
-
+ // try to "word wrap" the chunks - split on word boundaries (space characters), if possible.
+ // SPLIT_WORD_CUTOFF = max length of unbreakable words, longer words may be split.
if (fSplitting) {
i = 0;
wszSaved = &wszBegin[iCur];
@@ -182,7 +171,7 @@ static void DoSplitSendW(LPVOID param)
wszSaved = &wszBegin[iCur];
break;
}
- if (i == SPLIT_WORD_CUTOFF) { // no space found backwards, restore old split position
+ if (i == SPLIT_WORD_CUTOFF) { // no space found backwards, restore old split position
iCur = iSavedCur;
wszSaved = &wszBegin[iCur];
break;
@@ -225,13 +214,13 @@ static void DoSplitSendA(LPVOID param)
int id;
BOOL fFirstSend = FALSE;
char *szBegin, *szTemp, *szSaved, savedChar;
- int iLen, iCur = 0, iSavedCur = 0, i;
+ int iCur = 0, iSavedCur = 0, i;
BOOL fSplitting = TRUE;
MCONTACT hContact = job->hContact;
DWORD dwFlags = job->dwFlags;
int chunkSize = job->chunkSize;
- iLen = mir_strlen(job->szSendBuffer);
+ size_t iLen = mir_strlen(job->szSendBuffer);
szTemp = (char *)mir_alloc(iLen + 1);
CopyMemory(szTemp, job->szSendBuffer, iLen + 1);
szBegin = szTemp;
@@ -287,23 +276,21 @@ static void DoSplitSendA(LPVOID param)
mir_free(szBegin);
}
-/**
- * return effective length of the message in bytes (utf-8 encoded)
- */
-int SendQueue::getSendLength(const int iEntry, int sendMode)
+/////////////////////////////////////////////////////////////////////////////////////////
+// return effective length of the message in bytes (utf-8 encoded)
+
+size_t SendQueue::getSendLength(const int iEntry, int sendMode)
{
- if (m_jobs[iEntry].dwFlags & PREF_UNICODE && !(sendMode & SMODE_FORCEANSI)) {
- int iLen = mir_strlen(m_jobs[iEntry].szSendBuffer);
- WCHAR *wszBuf = (WCHAR *) & m_jobs[iEntry].szSendBuffer[iLen + 1];
+ SendJob &p = m_jobs[iEntry];
+ if (p.dwFlags & PREF_UNICODE && !(sendMode & SMODE_FORCEANSI)) {
+ size_t iLen = mir_strlen(p.szSendBuffer);
+ WCHAR *wszBuf = (WCHAR*)&p.szSendBuffer[iLen + 1];
char *utf8 = mir_utf8encodeT(wszBuf);
- m_jobs[iEntry].iSendLength = mir_strlen(utf8);
+ p.iSendLength = mir_strlen(utf8);
mir_free(utf8);
- return(m_jobs[iEntry].iSendLength);
- }
- else {
- m_jobs[iEntry].iSendLength = mir_strlen(m_jobs[iEntry].szSendBuffer);
- return(m_jobs[iEntry].iSendLength);
}
+ else p.iSendLength = mir_strlen(p.szSendBuffer);
+ return p.iSendLength;
}
int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
@@ -322,7 +309,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
m_jobs[iEntry].hContact = ccActive->getActiveContact();
m_jobs[iEntry].hOwnerWnd = hwndDlg;
- int iSendLength = getSendLength(iEntry, dat->sendMode);
+ size_t iSendLength = getSendLength(iEntry, dat->sendMode);
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_FINDCONTACT, hContact, 0);
@@ -358,7 +345,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
if (dat->hContact == NULL)
return 0; //never happens
- dat->nMax = dat->cache->getMaxMessageLength(); // refresh length info
+ dat->nMax = dat->cache->getMaxMessageLength(); // refresh length info
if (dat->sendMode & SMODE_FORCEANSI && db_get_b(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "UnicodeSend", 1))
db_set_b(dat->cache->getActiveContact(), dat->cache->getActiveProto(), "UnicodeSend", 0);
@@ -391,9 +378,7 @@ int SendQueue::sendQueued(TWindowData *dat, const int iEntry)
m_jobs[iEntry].dwFlags = dwOldFlags;
}
else {
-
send_unsplitted:
-
m_jobs[iEntry].hContact = ccActive->getActiveContact();
m_jobs[iEntry].hOwnerWnd = hwndDlg;
m_jobs[iEntry].iStatus = SQ_INPROGRESS;
@@ -401,7 +386,7 @@ send_unsplitted:
if (dat->sendMode & SMODE_SENDLATER) {
TCHAR tszError[256];
- int iSendLength = getSendLength(iEntry, dat->sendMode);
+ size_t iSendLength = getSendLength(iEntry, dat->sendMode);
if (iSendLength >= dat->nMax) {
mir_sntprintf(tszError, 256, TranslateT("The message cannot be sent delayed or to multiple contacts, because it exceeds the maximum allowed message length of %d bytes"), dat->nMax);
SendMessage(dat->hwnd, DM_ACTIVATETOOLTIP, IDC_MESSAGE, LPARAM(tszError));
@@ -430,7 +415,6 @@ send_unsplitted:
m_currentIndex++;
// give icon feedback...
-
if (dat->pContainer->hwndActive == hwndDlg)
::UpdateReadChars(dat);
@@ -449,13 +433,12 @@ void SendQueue::clearJob(const int iIndex)
memset(&job, 0, sizeof(SendJob));
}
-/*
- * this is called when:
- *
- * ) a delivery has completed successfully
- * ) user decided to cancel a failed send
- * it removes the completed / canceled send job from the queue and schedules the next job to send (if any)
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// this is called when :
+//
+// ) a delivery has completed successfully
+// ) user decided to cancel a failed send
+// it removes the completed / canceled send job from the queue and schedules the next job to send (if any)
void SendQueue::checkQueue(const TWindowData *dat) const
{
@@ -472,17 +455,16 @@ void SendQueue::checkQueue(const TWindowData *dat) const
}
}
-/*
- * logs an error message to the message window. Optionally, appends the original message
- * from the given sendJob (queue index)
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// logs an error message to the message window.Optionally, appends the original message
+// from the given sendJob (queue index)
void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const TCHAR *szErrMsg) const
{
if (dat == 0)
return;
- int iMsgLen;
+ size_t iMsgLen;
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.eventType = EVENTTYPE_ERRMSG;
if (iSendJobIndex >= 0) {
@@ -500,18 +482,17 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const TCHAR
iMsgLen *= 3;
}
}
- dbei.cbBlob = iMsgLen;
+ dbei.cbBlob = (int)iMsgLen;
dbei.timestamp = time(NULL);
dbei.szModule = (char *)szErrMsg;
StreamInEvents(dat->hwnd, NULL, 1, 1, &dbei);
}
-/*
- * enable or disable the sending controls in the given window
- * ) input area
- * ) multisend contact list instance
- * ) send button
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// enable or disable the sending controls in the given window
+// ) input area
+// ) multisend contact list instance
+// ) send button
void SendQueue::EnableSending(const TWindowData *dat, const int iMode)
{
@@ -523,9 +504,8 @@ void SendQueue::EnableSending(const TWindowData *dat, const int iMode)
}
}
-/*
- * show or hide the error control button bar on top of the window
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// show or hide the error control button bar on top of the window
void SendQueue::showErrorControls(TWindowData *dat, const int showCmd) const
{
@@ -634,29 +614,26 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat)
PUAddPopupT(&ppd);
}
-/*
- * searches string for characters typical for RTL text (hebrew and other RTL languages
-*/
+/////////////////////////////////////////////////////////////////////////////////////////
+// searches string for characters typical for RTL text(hebrew and other RTL languages
int SendQueue::RTL_Detect(const WCHAR *pszwText)
{
int i, n = 0;
- int iLen = mir_wstrlen(pszwText);
+ size_t iLen = mir_wstrlen(pszwText);
- WORD *infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
- if (infoTypeC2) {
- memset(infoTypeC2, 0, (sizeof(WORD) * (iLen + 2)));
+ WORD *infoTypeC2 = (WORD*)mir_calloc(sizeof(WORD) * (iLen + 2));
+ if (infoTypeC2 == NULL)
+ return 0;
- GetStringTypeW(CT_CTYPE2, pszwText, iLen, infoTypeC2);
+ GetStringTypeW(CT_CTYPE2, pszwText, (int)iLen, infoTypeC2);
- for (i=0; i < iLen; i++)
- if (infoTypeC2[i] == C2_RIGHTTOLEFT)
- n++;
+ for (i=0; i < iLen; i++)
+ if (infoTypeC2[i] == C2_RIGHTTOLEFT)
+ n++;
- mir_free(infoTypeC2);
- return(n >= 2 ? 1 : 0);
- }
- return 0;
+ mir_free(infoTypeC2);
+ return(n >= 2 ? 1 : 0);
}
int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
@@ -670,8 +647,8 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
int iFound = (int)(LOWORD(wParam));
SendJob &job = m_jobs[iFound];
- if (job.iStatus == SQ_ERROR) { // received ack for a job which is already in error state...
- if (dat) { // window still open
+ if (job.iStatus == SQ_ERROR) { // received ack for a job which is already in error state...
+ if (dat) { // window still open
if (dat->iCurrentQueueError == iFound) {
dat->iCurrentQueueError = -1;
showErrorControls(dat, FALSE);
@@ -712,7 +689,7 @@ inform_and_discard:
dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto(job.hContact);
dbei.timestamp = time(NULL);
- dbei.cbBlob = mir_strlen(job.szSendBuffer) + 1;
+ dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1;
if (dat)
dat->cache->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1);
@@ -746,8 +723,6 @@ inform_and_discard:
job.iAcksNeeded--;
if (job.iAcksNeeded == 0) { // everything sent
- //if (job.hOwner != 0 && dat)
- // EnableSending(dat, TRUE);
clearJob(iFound);
if (dat) {
KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound);
@@ -780,17 +755,17 @@ LRESULT SendQueue::WarnPendingJobs(unsigned int uNrMessages)
TranslateT("Message window warning"), MB_YESNO | MB_ICONHAND);
}
-/**
- * This just adds the message to the database for later delivery and
- * adds the contact to the list of contacts that have queued messages
- *
- * @param iJobIndex int: index of the send job
- * dat: Message window data
- * fAddHeader: add the "message was sent delayed" header (default = true)
- * hContact : contact to which the job should be added (default = hOwner of the send job)
- *
- * @return the index on success, -1 on failure
- */
+/////////////////////////////////////////////////////////////////////////////////////////
+// This just adds the message to the database for later delivery and
+// adds the contact to the list of contacts that have queued messages
+//
+// @param iJobIndex int: index of the send job
+// dat: Message window data
+// fAddHeader: add the "message was sent delayed" header (default = true)
+// hContact : contact to which the job should be added (default = hOwner of the send job)
+//
+// @return the index on success, -1 on failure
+
int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, bool fIsSendLater)
{
bool fAvail = sendLater->isAvail();
@@ -803,16 +778,16 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
else
szNote = TranslateT("The send later feature is not available on this protocol.");
- char *utfText = mir_utf8encodeT(szNote);
+ char *utfText = mir_utf8encodeT(szNote);
DBEVENTINFO dbei;
dbei.cbSize = sizeof(dbei);
dbei.eventType = EVENTTYPE_MESSAGE;
dbei.flags = DBEF_SENT | DBEF_UTF;
dbei.szModule = GetContactProto(dat->hContact);
dbei.timestamp = time(NULL);
- dbei.cbBlob = mir_strlen(utfText) + 1;
- dbei.pBlob = (PBYTE) utfText;
- StreamInEvents(dat->hwnd, 0, 1, 1, &dbei);
+ dbei.cbBlob = (int)mir_strlen(utfText) + 1;
+ dbei.pBlob = (PBYTE)utfText;
+ StreamInEvents(dat->hwnd, 0, 1, 1, &dbei);
if (dat->hDbEventFirst == NULL)
SendMessage(dat->hwnd, DM_REMAKELOG, 0, 0);
dat->cache->saveHistory(0, 0);
@@ -845,7 +820,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
if (job->dwFlags & PREF_UTF || !(job->dwFlags & PREF_UNICODE)) {
char *utf_header = mir_utf8encodeT(tszHeader);
- UINT required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
+ size_t required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10;
char *tszMsg = reinterpret_cast<char *>(mir_alloc(required));
if (fIsSendLater) {
@@ -860,10 +835,10 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b
mir_free(tszMsg);
}
else if (job->dwFlags & PREF_UNICODE) {
- int iLen = mir_strlen(job->szSendBuffer);
+ size_t iLen = mir_strlen(job->szSendBuffer);
wchar_t *wszMsg = (wchar_t *)&job->szSendBuffer[iLen + 1];
- UINT required = sizeof(TCHAR) * (mir_tstrlen(tszHeader) + mir_wstrlen(wszMsg) + 10);
+ size_t required = sizeof(TCHAR) * (mir_tstrlen(tszHeader) + mir_wstrlen(wszMsg) + 10);
TCHAR *tszMsg = reinterpret_cast<TCHAR *>(mir_alloc(required));
if (fIsSendLater)
diff --git a/plugins/TabSRMM/src/sendqueue.h b/plugins/TabSRMM/src/sendqueue.h
index d3d51a0e7d..05a037968f 100644
--- a/plugins/TabSRMM/src/sendqueue.h
+++ b/plugins/TabSRMM/src/sendqueue.h
@@ -42,7 +42,7 @@ struct SendJob
{
HANDLE hSendId;
char *szSendBuffer;
- int iSendLength; // length of message in utf-8 octets (used to check maxlen)
+ size_t iSendLength; // length of message in utf-8 octets (used to check maxlen)
int sendCount;
MCONTACT hContact;
HWND hOwnerWnd;
@@ -81,18 +81,18 @@ public:
SendJob *getJobByIndex(const int index) { return(&m_jobs[index]); }
- void clearJob(const int index);
- int findNextFailed(const TWindowData *dat) const;
- void handleError(TWindowData *dat, const int iEntry) const;
- int addTo(TWindowData *dat, const int iLen, int dwFlags);
- int sendQueued(TWindowData *dat, const int iEntry);
- int getSendLength(const int iEntry, const int sendMode);
- void checkQueue(const TWindowData *dat) const;
- void logError(const TWindowData *dat, int iSendJobIndex, const TCHAR *szErrMsg) const;
- void recallFailed(const TWindowData *dat, int iEntry) const;
- void showErrorControls(TWindowData *dat, const int showCmd) const;
- int ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam);
- int doSendLater(int iIndex, TWindowData *dat, MCONTACT hContact = 0, bool fIsSendLater = true);
+ void clearJob(const int index);
+ int findNextFailed(const TWindowData *dat) const;
+ void handleError(TWindowData *dat, const int iEntry) const;
+ int addTo(TWindowData *dat, size_t iLen, int dwFlags);
+ int sendQueued(TWindowData *dat, const int iEntry);
+ size_t getSendLength(const int iEntry, const int sendMode);
+ void checkQueue(const TWindowData *dat) const;
+ void logError(const TWindowData *dat, int iSendJobIndex, const TCHAR *szErrMsg) const;
+ void recallFailed(const TWindowData *dat, int iEntry) const;
+ void showErrorControls(TWindowData *dat, const int showCmd) const;
+ int ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam);
+ int doSendLater(int iIndex, TWindowData *dat, MCONTACT hContact = 0, bool fIsSendLater = true);
/*
* static members
*/
@@ -104,8 +104,8 @@ public:
static void TSAPI EnableSending(const TWindowData *dat, const int iMode);
private:
- SendJob m_jobs[NR_SENDJOBS];
- int m_currentIndex;
+ SendJob m_jobs[NR_SENDJOBS];
+ int m_currentIndex;
};
extern SendQueue *sendQueue;
diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp
index 834cc122b5..2a7e5c583c 100644
--- a/plugins/TabSRMM/src/sidebar.cpp
+++ b/plugins/TabSRMM/src/sidebar.cpp
@@ -148,7 +148,7 @@ const SIZE& CSideBarButton::measureItem()
HFONT oldFont = reinterpret_cast<HFONT>(::SelectObject(dc, ::GetStockObject(DEFAULT_GUI_FONT)));
mir_sntprintf(tszLabel, 255, _T("%s"), m_dat->newtitle);
- ::GetTextExtentPoint32(dc, tszLabel, mir_tstrlen(tszLabel), &sz);
+ ::GetTextExtentPoint32(dc, tszLabel, (int)mir_tstrlen(tszLabel), &sz);
sz.cx += 28;
if (m_dat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON)
@@ -1180,9 +1180,9 @@ const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item)
HDC dc = ::GetDC(dat->hwnd);
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(dc, dat->cache->getNick(), mir_tstrlen(dat->cache->getNick()), &szFirstLine);
+ ::GetTextExtentPoint32(dc, dat->cache->getNick(), (int)mir_tstrlen(dat->cache->getNick()), &szFirstLine);
::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
- ::GetTextExtentPoint32(dc, dat->szStatus, mir_tstrlen(dat->szStatus), &szSecondLine);
+ ::GetTextExtentPoint32(dc, dat->szStatus, (int)mir_tstrlen(dat->szStatus), &szSecondLine);
::SelectObject(dc, hOldFont);
ReleaseDC(dat->hwnd, dc);
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp
index 51ed8267fb..4a2dd5e131 100644
--- a/plugins/TabSRMM/src/trayicon.cpp
+++ b/plugins/TabSRMM/src/trayicon.cpp
@@ -308,7 +308,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, con
if (!mode) {
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = mir_tstrlen(szMenuEntry) + 1;
+ mii.cch = (int)mir_tstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
mii.dwItemData = (ULONG_PTR)hIcon;
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp
index 48a3ec64df..a11b005dd3 100644
--- a/plugins/TabSRMM/src/utils.cpp
+++ b/plugins/TabSRMM/src/utils.cpp
@@ -852,7 +852,7 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO& mii, HICON hIcon, const TC
mii.wID = uID;
mii.dwItemData = (ULONG_PTR)hIcon;
mii.dwTypeData = const_cast<TCHAR *>(szText);
- mii.cch = mir_tstrlen(mii.dwTypeData) + 1;
+ mii.cch = (int)mir_tstrlen(mii.dwTypeData) + 1;
::InsertMenuItem(m, pos, TRUE, &mii);
}