summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-30 22:12:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-30 22:12:34 +0000
commit6be364a555dce699d093f9d49cd14a9b0c174893 (patch)
treeac10770856206fb50d2e83acde528413f5f22009 /src
parentd9c98bcdfca6da51a1a82dc6c0dc5996b3b6cd6d (diff)
warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@11181 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdchat/src/log.cpp2
-rw-r--r--src/core/stdclist/src/clcpaint.cpp18
-rw-r--r--src/core/stdfile/filesenddlg.cpp5
-rw-r--r--src/core/stdfile/filexferdlg.cpp2
-rw-r--r--src/core/stduserinfo/contactinfo.cpp2
-rw-r--r--src/modules/button/button.cpp2
-rw-r--r--src/modules/chat/log.cpp2
-rw-r--r--src/modules/chat/manager.cpp8
-rw-r--r--src/modules/chat/tools.cpp4
-rw-r--r--src/modules/clist/clc.cpp4
-rw-r--r--src/modules/clist/clcitems.cpp6
-rw-r--r--src/modules/clist/clcutils.cpp6
-rw-r--r--src/modules/clist/clui.cpp8
-rw-r--r--src/modules/clist/cluiservices.cpp4
-rw-r--r--src/modules/clist/genmenuopt.cpp4
-rw-r--r--src/modules/clist/groups.cpp10
-rw-r--r--src/modules/database/dbini.cpp4
-rw-r--r--src/modules/findadd/findadd.cpp6
-rw-r--r--src/modules/fonts/FontOptions.cpp2
-rw-r--r--src/modules/icolib/skin2opts.cpp2
-rw-r--r--src/modules/netlib/netlibopenconn.cpp78
-rw-r--r--src/modules/netlib/netlibsecurity.cpp16
-rw-r--r--src/modules/options/descbutton.cpp4
-rw-r--r--src/modules/protocols/protoopts.cpp4
-rw-r--r--src/modules/skin/hotkey_opts.cpp6
-rw-r--r--src/modules/utils/bmpfilter.cpp78
-rw-r--r--src/modules/utils/hyperlink.cpp2
27 files changed, 139 insertions, 150 deletions
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp
index 458183baf6..94c59430c6 100644
--- a/src/core/stdchat/src/log.cpp
+++ b/src/core/stdchat/src/log.cpp
@@ -31,7 +31,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG
if (lstrdat->buffer == NULL) {
lstrdat->bufferOffset = 0;
lstrdat->buffer = pci->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/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp
index 49be0fca84..649c8123f7 100644
--- a/src/core/stdclist/src/clcpaint.cpp
+++ b/src/core/stdclist/src/clcpaint.cpp
@@ -320,14 +320,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, mir_tstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
width = textSize.cx;
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
szCounts = pcli->pfnGetGroupCountsText(dat, group->cl.items[group->scanIndex]);
if (szCounts[0]) {
GetTextExtentPoint32A(hdcMem, " ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32A(hdcMem, szCounts, mir_strlen(szCounts), &countsSize);
+ GetTextExtentPoint32A(hdcMem, szCounts, (int)mir_strlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -424,7 +424,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- mir_tstrlen(group->cl.items[group->scanIndex]->szText));
+ (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -440,7 +440,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, mir_strlen(szCounts));
+ TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, (int)mir_strlen(szCounts));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
@@ -448,12 +448,12 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, group->cl.items[group->scanIndex]->szText,
- mir_tstrlen(group->cl.items[group->scanIndex]->szText), NULL);
+ (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText), NULL);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
- y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- mir_tstrlen(group->cl.items[group->scanIndex]->szText));
+ y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
+ (int)mir_tstrlen(group->cl.items[group->scanIndex]->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
@@ -470,14 +470,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint)
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
rc.right = (clRect.right - clRect.left);
rc.bottom = rc.top;
- DrawText(hdcMem, szText, mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
+ DrawText(hdcMem, szText, (int)mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
TCHAR *szText = group->cl.items[group->scanIndex]->szText;
RECT rc;
- int qlen = mir_tstrlen(dat->szQuickSearch);
+ size_t qlen = mir_tstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp
index c207cb9ff0..f9be264353 100644
--- a/src/core/stdfile/filesenddlg.cpp
+++ b/src/core/stdfile/filesenddlg.cpp
@@ -82,13 +82,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
const TCHAR *pBuf;
int nNumberOfFiles = 0;
int nTemp;
- int fileOffset;
// :NOTE: The first string in the buffer is the directory, followed by a
// NULL separated list of all files
// fileOffset is the offset to the first file.
- fileOffset = mir_tstrlen(buf) + 1;
+ size_t fileOffset = mir_tstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
@@ -106,7 +105,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf)
nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- int cbFileNameLen = mir_tstrlen(pBuf);
+ size_t cbFileNameLen = mir_tstrlen(pBuf);
dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp
index f5eeeec531..962283e9b0 100644
--- a/src/core/stdfile/filexferdlg.cpp
+++ b/src/core/stdfile/filexferdlg.cpp
@@ -85,7 +85,7 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei)
char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg);
dbei.flags |= DBEF_UTF;
- dbei.cbBlob = sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2;
+ dbei.cbBlob = int(sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2);
dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
*(PDWORD)dbei.pBlob = 0;
mir_strcpy((char*)dbei.pBlob + sizeof(DWORD), szFileNames);
diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp
index 06a9a6c2e7..dd3984b1c8 100644
--- a/src/core/stduserinfo/contactinfo.cpp
+++ b/src/core/stduserinfo/contactinfo.cpp
@@ -196,7 +196,7 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail)
SelectObject(hdc, hEmailFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, szText, mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
ReleaseDC(hwndEmails, hdc);
if (hti.pt.x < rc.left+textSize.cx) {
if (szEmail && cchEmail)
diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp
index 61bd2d41bc..7d565753f7 100644
--- a/src/modules/button/button.cpp
+++ b/src/modules/button/button.cpp
@@ -209,7 +209,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
SIZE sz;
TCHAR szText[MAX_PATH];
GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
- GetTextExtentPoint32(hdcMem, szText, mir_tstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
int xOffset = (rcClient.right - rcClient.left - sz.cx)/2;
int yOffset = (rcClient.bottom - rcClient.top - sz.cy)/2;
diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp
index e628a7c447..11e990b27f 100644
--- a/src/modules/chat/log.cpp
+++ b/src/modules/chat/log.cpp
@@ -198,7 +198,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;
}
diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp
index 85899ca1b8..628b5307e3 100644
--- a/src/modules/chat/manager.cpp
+++ b/src/modules/chat/manager.cpp
@@ -750,7 +750,7 @@ static char* SM_GetUsers(SESSION_INFO *si)
SESSION_INFO *pTemp = ci.wndList;
USERINFO *utemp = NULL;
char* p = NULL;
- int alloced = 0;
+ size_t alloced = 0;
if (si == NULL)
return NULL;
@@ -766,11 +766,11 @@ static char* SM_GetUsers(SESSION_INFO *si)
}
do {
- int pLen = mir_strlen(p), nameLen = mir_tstrlen(utemp->pszUID);
+ size_t pLen = mir_strlen(p), nameLen = mir_tstrlen(utemp->pszUID);
if (pLen + nameLen + 2 > alloced)
p = (char*)mir_realloc(p, alloced += 4096);
- WideCharToMultiByte(CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen + 1, 0, 0);
+ WideCharToMultiByte(CP_ACP, 0, utemp->pszUID, -1, p + pLen, (int)nameLen + 1, 0, 0);
mir_strcpy(p + pLen + nameLen, " ");
utemp = utemp->next;
}
@@ -1184,7 +1184,7 @@ static BOOL UM_SetStatusEx(USERINFO* pUserList, const TCHAR* pszText, int flags)
if (s) {
pTemp->iStatusEx = 0;
if (s == pszText || s[-1] == cDelimiter) {
- int len = mir_tstrlen(pTemp->pszUID);
+ size_t len = mir_tstrlen(pTemp->pszUID);
if (s[len] == cDelimiter || s[len] == '\0')
pTemp->iStatusEx = (!bOnlyMe || bSetStatus) ? 1 : 0;
}
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp
index 160c3157b4..aabd4535fb 100644
--- a/src/modules/chat/tools.cpp
+++ b/src/modules/chat/tools.cpp
@@ -42,11 +42,11 @@ TCHAR* RemoveFormatting(const TCHAR *pszWord)
return NULL;
TCHAR *d = szTemp;
- int cbLen = mir_tstrlen(pszWord);
+ size_t cbLen = mir_tstrlen(pszWord);
if (cbLen > SIZEOF(szTemp))
cbLen = SIZEOF(szTemp)-1;
- for (int i = 0; i < cbLen; ) {
+ for (size_t i = 0; i < cbLen;) {
if (pszWord[i] == '%') {
switch (pszWord[i+1]) {
case '%':
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 788ae8604b..6840565c30 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -407,7 +407,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
if (dbcws->value.type == DBVT_ASCIIZ || dbcws->value.type == DBVT_UTF8) {
int groupId = atoi(dbcws->szSetting) + 1;
TCHAR szFullName[512];
- int i, nameLen, eq;
+ int i, eq;
//check name of group and ignore message if just being expanded/collapsed
if (cli.pfnFindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) {
mir_tstrcpy(szFullName, contact->szText);
@@ -420,7 +420,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam,
break;
}
group = group->parent;
- nameLen = mir_tstrlen(group->cl.items[i]->szText);
+ size_t nameLen = mir_tstrlen(group->cl.items[i]->szText);
if (mir_tstrlen(szFullName) + 1 + nameLen > SIZEOF(szFullName)) {
szFullName[0] = '\0';
break;
diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp
index 36650d19be..252fb16320 100644
--- a/src/modules/clist/clcitems.cpp
+++ b/src/modules/clist/clcitems.cpp
@@ -234,7 +234,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, MCONTACT hContact, int u
else {
group = cli.pfnAddGroup(hwnd, dat, dbv.ptszVal, (DWORD) - 1, 0, 0);
if (group == NULL) {
- int i, len;
+ int i;
DWORD groupFlags;
TCHAR *szGroupName;
if (!(style & CLS_HIDEEMPTYGROUPS)) {
@@ -264,7 +264,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, MCONTACT hContact, int u
}
if (!mir_tstrcmp(szGroupName, dbv.ptszVal))
break;
- len = mir_tstrlen(szGroupName);
+ size_t len = mir_tstrlen(szGroupName);
if (!_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\')
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
@@ -333,7 +333,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem)
if (group->scanIndex == group->cl.count)
break;
if (group->cl.items[i]->type == CLCIT_GROUP) {
- int len = mir_tstrlen(group->cl.items[i]->szText);
+ size_t len = mir_tstrlen(group->cl.items[i]->szText);
if (!_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) &&
(dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) {
group->totalMembers--;
diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp
index 1f6b07e04c..2755f633e7 100644
--- a/src/modules/clist/clcutils.cpp
+++ b/src/modules/clist/clcutils.cpp
@@ -165,7 +165,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *
HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, hitcontact->szText, mir_tstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
int width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
char *szCounts;
@@ -174,7 +174,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact *
GetTextExtentPoint32A(hdc, " ", 1, &textSize);
width += textSize.cx;
SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, mir_strlen(szCounts), &textSize);
+ GetTextExtentPoint32A(hdc, szCounts, (int)mir_strlen(szCounts), &textSize);
width += textSize.cx;
}
}
@@ -354,7 +354,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat)
int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk)
{
ClcGroup *group = &dat->list;
- int testlen = mir_tstrlen(text);
+ size_t testlen = mir_tstrlen(text);
group->scanIndex = 0;
for (;;) {
diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp
index eacb1ec87b..fb7fc61e47 100644
--- a/src/modules/clist/clui.cpp
+++ b/src/modules/clist/clui.cpp
@@ -1009,16 +1009,16 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
else
tszName[0] = 0;
- GetTextExtentPoint32(dis->hDC, tszName, mir_tstrlen(tszName), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, mir_tstrlen(tszName));
+ GetTextExtentPoint32(dis->hDC, tszName, (int)mir_tstrlen(tszName), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, (int)mir_tstrlen(tszName));
x += textSize.cx;
}
if (showOpts & 4) {
TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = _T("");
- GetTextExtentPoint32(dis->hDC, szStatus, mir_tstrlen(szStatus), &textSize);
- TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, mir_tstrlen(szStatus));
+ GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_tstrlen(szStatus), &textSize);
+ TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, (int)mir_tstrlen(szStatus));
}
}
else if (dis->CtlType == ODT_MENU) {
diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp
index 8695adcb42..86ac9e7036 100644
--- a/src/modules/clist/cluiservices.cpp
+++ b/src/modules/clist/cluiservices.cpp
@@ -184,13 +184,13 @@ void fnCluiProtocolStatusChanged(int, const char*)
if (showOpts & 4 && mir_tstrlen(tszName) < SIZEOF(tszName)-1)
mir_tstrcat(tszName, _T(" "));
- GetTextExtentPoint32(hdc, tszName, mir_tstrlen(tszName), &textSize);
+ GetTextExtentPoint32(hdc, tszName, (int)mir_tstrlen(tszName), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
- GetTextExtentPoint32(hdc, modeDescr, mir_tstrlen(modeDescr), &textSize);
+ GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp
index 723bc73878..c20f92a82c 100644
--- a/src/modules/clist/genmenuopt.cpp
+++ b/src/modules/clist/genmenuopt.cpp
@@ -454,7 +454,7 @@ static int handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)
int retVal = CDRF_NEWFONT;
if (tvi.iImage == -1) {
SIZE sz;
- GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, mir_tstrlen(tvi.pszText), &sz);
+ GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, (int)mir_tstrlen(tvi.pszText), &sz);
RECT rc;
if (sz.cx+3 > pNMTVCD->nmcd.rc.right - pNMTVCD->nmcd.rc.left)
@@ -467,7 +467,7 @@ static int handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD)
SetBkColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrTextBk);
FillRect(pNMTVCD->nmcd.hdc, &rc, br);
DeleteObject(br);
- DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, mir_tstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT|DT_VCENTER|DT_NOPREFIX);
+ DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, (int)mir_tstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT | DT_VCENTER | DT_NOPREFIX);
retVal |= CDRF_SKIPDEFAULT;
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp
index 716f9418ac..a7c1791bc0 100644
--- a/src/modules/clist/groups.cpp
+++ b/src/modules/clist/groups.cpp
@@ -243,9 +243,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM)
//rename subgroups
{
TCHAR szNewName[256];
- int len;
-
- len = mir_tstrlen(name);
+ size_t len = mir_tstrlen(name);
for (i=0;; i++) {
_itoa(i, str, 10);
if (db_get_ts(NULL, "CListGroups", str, &dbv))
@@ -305,10 +303,8 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
//rename subgroups
{
TCHAR szNewName[256];
- int len, i;
-
- len = mir_tstrlen(oldName);
- for (i=0;; i++) {
+ size_t len = mir_tstrlen(oldName);
+ for (int i=0;; i++) {
if (i == groupId)
continue;
_itoa(i, idstr, 10);
diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp
index 7f5e59f454..1bf4eac286 100644
--- a/src/modules/database/dbini.cpp
+++ b/src/modules/database/dbini.cpp
@@ -74,7 +74,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
static bool IsInSpaceSeparatedList(const char *szWord, const char *szList)
{
const char *szItem, *szEnd;
- int wordLen = mir_strlen(szWord);
+ size_t wordLen = mir_strlen(szWord);
for (szItem = szList;;) {
szEnd = strchr(szItem, ' ');
@@ -229,7 +229,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf
if (fgets(szLine, sizeof(szLine), fp) == NULL)
break;
LBL_NewLine:
- int lineLength = mir_strlen(szLine);
+ size_t lineLength = mir_strlen(szLine);
while (lineLength && (BYTE)(szLine[lineLength - 1]) <= ' ')
szLine[--lineLength] = '\0';
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 44a0748da1..67d0c46d9d 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, TranslateT("Searching"), mir_tstrlen(TranslateT("Searching")), &textSize);
+ GetTextExtentPoint32(hdc, TranslateT("Searching"), (int)mir_tstrlen(TranslateT("Searching")), &textSize);
int partWidth[3];
partWidth[0] = textSize.cx;
@@ -380,7 +380,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0));
if (netProtoCount > 1) {
cbei.pszText = TranslateT("All networks");
- GetTextExtentPoint32(hdc, cbei.pszText, mir_tstrlen(cbei.pszText), &textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbwidth)
cbwidth = textSize.cx;
cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL);
@@ -399,7 +399,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
continue;
cbei.pszText = pa->tszAccountName;
- GetTextExtentPoint32(hdc, cbei.pszText, mir_tstrlen(cbei.pszText), &textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, (int)mir_tstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbwidth)
cbwidth = textSize.cx;
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp
index ba90edb38a..e2bd710ecc 100644
--- a/src/modules/fonts/FontOptions.cpp
+++ b/src/modules/fonts/FontOptions.cpp
@@ -751,7 +751,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
hoFont = (HFONT) SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0));
SIZE fontSize;
- GetTextExtentPoint32(hdc, itemName, mir_tstrlen(itemName), &fontSize);
+ GetTextExtentPoint32(hdc, itemName, (int)mir_tstrlen(itemName), &fontSize);
if (hoFont) SelectObject(hdc, hoFont);
if (hFont) DeleteObject(hFont);
ReleaseDC( GetDlgItem(hwndDlg, mis->CtlID), hdc);
diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp
index e8c5ac9f34..ad87d7d418 100644
--- a/src/modules/icolib/skin2opts.cpp
+++ b/src/modules/icolib/skin2opts.cpp
@@ -150,7 +150,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
{
TCHAR path[ MAX_PATH ];
mir_sntprintf(path, SIZEOF(path), _T("%s,"), filename);
- int suffIndx = mir_tstrlen(path);
+ size_t suffIndx = mir_tstrlen(path);
mir_cslock lck(csIconList);
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 100b7341c0..6286c5c783 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -182,18 +182,15 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
}
if (buf[1] == 2) { //rfc1929
- int nUserLen, nPassLen;
- PBYTE pAuthBuf;
-
- nUserLen = mir_strlen(nlu->settings.szProxyAuthUser);
- nPassLen = mir_strlen(nlu->settings.szProxyAuthPassword);
- pAuthBuf = (PBYTE)mir_alloc(3+nUserLen+nPassLen);
+ size_t nUserLen = mir_strlen(nlu->settings.szProxyAuthUser);
+ size_t nPassLen = mir_strlen(nlu->settings.szProxyAuthPassword);
+ PBYTE pAuthBuf = (PBYTE)mir_alloc(3 + nUserLen + nPassLen);
pAuthBuf[0] = 1; //auth version
- pAuthBuf[1] = nUserLen;
- memcpy(pAuthBuf+2, nlu->settings.szProxyAuthUser, nUserLen);
- pAuthBuf[2+nUserLen] = nPassLen;
- memcpy(pAuthBuf+3+nUserLen, nlu->settings.szProxyAuthPassword, nPassLen);
- if (NLSend(nlc, (char*)pAuthBuf, 3+nUserLen+nPassLen, MSG_DUMPPROXY) == SOCKET_ERROR) {
+ pAuthBuf[1] = (BYTE)nUserLen;
+ memcpy(pAuthBuf + 2, nlu->settings.szProxyAuthUser, nUserLen);
+ pAuthBuf[2 + nUserLen] = (BYTE)nPassLen;
+ memcpy(pAuthBuf + 3 + nUserLen, nlu->settings.szProxyAuthPassword, nPassLen);
+ if (NLSend(nlc, (char*)pAuthBuf, int(3 + nUserLen + nPassLen), MSG_DUMPPROXY) == SOCKET_ERROR) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
mir_free(pAuthBuf);
return 0;
@@ -212,14 +209,12 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
}
PBYTE pInit;
- int nHostLen;
+ size_t nHostLen;
DWORD hostIP;
if (nlc->dnsThroughProxy) {
hostIP = inet_addr(nloc->szHost);
- if (hostIP == INADDR_NONE)
- nHostLen = mir_strlen(nloc->szHost)+1;
- else nHostLen = 4;
+ nHostLen = (hostIP == INADDR_NONE) ? mir_strlen(nloc->szHost) + 1 : 4;
}
else {
hostIP = DnsLookup(nlu, nloc->szHost);
@@ -227,21 +222,21 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
return 0;
nHostLen = 4;
}
- pInit = (PBYTE)mir_alloc(6+nHostLen);
+ pInit = (PBYTE)mir_alloc(6 + nHostLen);
pInit[0] = 5; //SOCKS5
pInit[1] = nloc->flags & NLOCF_UDP ? 3 : 1; //connect or UDP
pInit[2] = 0; //reserved
if (hostIP == INADDR_NONE) { //DNS lookup through proxy
pInit[3] = 3;
- pInit[4] = nHostLen-1;
- memcpy(pInit+5, nloc->szHost, nHostLen-1);
+ pInit[4] = BYTE(nHostLen - 1);
+ memcpy(pInit + 5, nloc->szHost, nHostLen - 1);
}
else {
pInit[3] = 1;
- *(PDWORD)(pInit+4) = hostIP;
+ *(PDWORD)(pInit + 4) = hostIP;
}
- *(PWORD)(pInit+4+nHostLen) = htons(nloc->wPort);
- if (NLSend(nlc, (char*)pInit, 6+nHostLen, MSG_DUMPPROXY) == SOCKET_ERROR) {
+ *(PWORD)(pInit + 4 + nHostLen) = htons(nloc->wPort);
+ if (NLSend(nlc, (char*)pInit, int(6 + nHostLen), MSG_DUMPPROXY) == SOCKET_ERROR) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "NLSend", GetLastError());
mir_free(pInit);
return 0;
@@ -258,16 +253,16 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
if (buf[0] != 5)
SetLastError(ERROR_BAD_FORMAT);
else {
- switch(buf[1]) {
- case 1: SetLastError(ERROR_GEN_FAILURE); err = "General failure"; break;
- case 2: SetLastError(ERROR_ACCESS_DENIED); err = "Connection not allowed by ruleset"; break;
- case 3: SetLastError(WSAENETUNREACH); err = "Network unreachable"; break;
- case 4: SetLastError(WSAEHOSTUNREACH); err = "Host unreachable"; break;
- case 5: SetLastError(WSAECONNREFUSED); err = "Connection refused by destination host"; break;
- case 6: SetLastError(WSAETIMEDOUT); err = "TTL expired"; break;
- case 7: SetLastError(ERROR_CALL_NOT_IMPLEMENTED); err = "Command not supported / protocol error"; break;
- case 8: SetLastError(ERROR_INVALID_ADDRESS); err = "Address type not supported"; break;
- default: SetLastError(ERROR_INVALID_DATA); break;
+ switch (buf[1]) {
+ case 1: SetLastError(ERROR_GEN_FAILURE); err = "General failure"; break;
+ case 2: SetLastError(ERROR_ACCESS_DENIED); err = "Connection not allowed by ruleset"; break;
+ case 3: SetLastError(WSAENETUNREACH); err = "Network unreachable"; break;
+ case 4: SetLastError(WSAEHOSTUNREACH); err = "Host unreachable"; break;
+ case 5: SetLastError(WSAECONNREFUSED); err = "Connection refused by destination host"; break;
+ case 6: SetLastError(WSAETIMEDOUT); err = "TTL expired"; break;
+ case 7: SetLastError(ERROR_CALL_NOT_IMPLEMENTED); err = "Command not supported / protocol error"; break;
+ case 8: SetLastError(ERROR_INVALID_ADDRESS); err = "Address type not supported"; break;
+ default: SetLastError(ERROR_INVALID_DATA); break;
}
}
NetlibLogf(nlu, "%s %d: Proxy conection failed. %s.", __FILE__, __LINE__, err);
@@ -275,7 +270,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
}
int nRecvSize = 0;
- switch(buf[3]) {
+ switch (buf[3]) {
case 1:// ipv4 addr
nRecvSize = 5;
break;
@@ -301,7 +296,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
//rfc2817
- NETLIBHTTPREQUEST nlhrSend = {0}, *nlhrReply;
+ NETLIBHTTPREQUEST nlhrSend = { 0 }, *nlhrReply;
char szUrl[512];
nlhrSend.cbSize = sizeof(nlhrSend);
@@ -336,7 +331,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NE
}
NetlibHttpSetLastErrorUsingHttpResult(nlhrReply->resultCode);
- NetlibLogf(nlu, "%s %d: %s request failed (%u %s)", __FILE__, __LINE__, nlu->settings.proxyType == PROXYTYPE_HTTP?"HTTP":"HTTPS", nlhrReply->resultCode, nlhrReply->szResultDescr);
+ NetlibLogf(nlu, "%s %d: %s request failed (%u %s)", __FILE__, __LINE__, nlu->settings.proxyType == PROXYTYPE_HTTP ? "HTTP" : "HTTPS", nlhrReply->resultCode, nlhrReply->szResultDescr);
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return 0;
}
@@ -386,7 +381,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
}
PHOSTENT he;
- SOCKADDR_IN sin = {0};
+ SOCKADDR_IN sin = { 0 };
sin.sin_family = AF_INET;
if (nlc->proxyType) {
@@ -453,7 +448,7 @@ retry:
break;
if (rc > 0) {
- if (FD_ISSET(nlc->s, &w)){
+ if (FD_ISSET(nlc->s, &w)) {
// connection was successful
rc = 0;
}
@@ -529,7 +524,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
}
char szPort[6];
- addrinfo *air = NULL, *ai, hints = {0};
+ addrinfo *air = NULL, *ai, hints = { 0 };
hints.ai_family = AF_UNSPEC;
@@ -569,7 +564,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
}
for (ai = air; ai && !Miranda_Terminated(); ai = ai->ai_next) {
- NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, ptrA( NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr)));
+ NetlibLogf(nlc->nlu, "(%p) Connecting to ip %s ....", nlc, ptrA(NetlibAddressToString((SOCKADDR_INET_M*)ai->ai_addr)));
retry:
nlc->s = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (nlc->s == INVALID_SOCKET)
@@ -610,7 +605,7 @@ retry:
break;
if (rc > 0) {
- if (FD_ISSET(nlc->s, &w)){
+ if (FD_ISSET(nlc->s, &w)) {
// connection was successful
rc = 0;
lasterr = 0;
@@ -625,8 +620,7 @@ retry:
int len = sizeof(lasterr);
rc = SOCKET_ERROR;
getsockopt(nlc->s, SOL_SOCKET, SO_ERROR, (char*)&lasterr, &len);
- if (lasterr == WSAEADDRINUSE && ++retrycnt <= 2)
- {
+ if (lasterr == WSAEADDRINUSE && ++retrycnt <= 2) {
closesocket(nlc->s);
nlc->s = INVALID_SOCKET;
goto retry;
@@ -713,7 +707,7 @@ bool NetlibDoConnect(NetlibConnection *nlc)
if (usingProxy && (nlc->proxyType == PROXYTYPE_HTTPS || nlc->proxyType == PROXYTYPE_HTTP)) {
usingProxy = false;
nlc->proxyType = 0;
- NetlibLogf(nlu,"Fallback to direct connection");
+ NetlibLogf(nlu, "Fallback to direct connection");
continue;
}
if (nlu->settings.useProxy && !usingProxy && nlu->settings.proxyType == PROXYTYPE_IE && !forceHttps) {
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp
index 46fb1d0e06..395d7f8dd1 100644
--- a/src/modules/netlib/netlibsecurity.cpp
+++ b/src/modules/netlib/netlibsecurity.cpp
@@ -330,28 +330,26 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
const TCHAR* loginName = login;
const TCHAR* domainName = _tcschr(login, '\\');
- int domainLen = 0;
- int loginLen = mir_tstrlen(loginName);
- if (domainName != NULL)
- {
+ size_t domainLen = 0;
+ size_t loginLen = mir_tstrlen(loginName);
+ if (domainName != NULL) {
loginName = domainName + 1;
loginLen = mir_tstrlen(loginName);
domainLen = domainName - login;
domainName = login;
}
- else if ((domainName = _tcschr(login, '@')) != NULL)
- {
+ else if ((domainName = _tcschr(login, '@')) != NULL) {
loginName = login;
loginLen = domainName - login;
domainLen = mir_tstrlen(++domainName);
}
auth.User = (PWORD)loginName;
- auth.UserLength = loginLen;
+ auth.UserLength = (ULONG)loginLen;
auth.Password = (PWORD)psw;
- auth.PasswordLength = mir_tstrlen(psw);
+ auth.PasswordLength = (ULONG)mir_tstrlen(psw);
auth.Domain = (PWORD)domainName;
- auth.DomainLength = domainLen;
+ auth.DomainLength = (ULONG)domainLen;
auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE;
hNtlm->hasDomain = domainLen != 0;
diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp
index d50f634d52..6bd00348aa 100644
--- a/src/modules/options/descbutton.cpp
+++ b/src/modules/options/descbutton.cpp
@@ -194,7 +194,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg
textRect.top = DBC_BORDER_SIZE;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzTitle, -1, &textRect, DT_TOP|DT_LEFT|DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
DeleteObject(SelectObject(tempDC, hfntSave));
}
@@ -206,7 +206,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg
textRect.top = DBC_BORDER_SIZE + titleSize.cy ? titleSize.cy + DBC_HSPACING : 0;
textRect.bottom = dat->height - DBC_BORDER_SIZE;
DrawText(tempDC, dat->lpzDescription, -1, &textRect, DT_TOP|DT_LEFT|DT_WORDBREAK|DT_END_ELLIPSIS);
- GetTextExtentPoint32(tempDC, dat->lpzTitle, mir_tstrlen(dat->lpzTitle), &titleSize);
+ GetTextExtentPoint32(tempDC, dat->lpzTitle, (int)mir_tstrlen(dat->lpzTitle), &titleSize);
}
SelectObject(tempDC, hfntSave);
diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp
index 1024e945df..ced3b45b54 100644
--- a/src/modules/protocols/protoopts.cpp
+++ b/src/modules/protocols/protoopts.cpp
@@ -620,7 +620,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
if (lps->itemID == (unsigned)dat->iSelected) {
SelectObject(lps->hDC, dat->hfntText);
mir_sntprintf(text, size, _T("%s: %S"), TranslateT("Protocol"), acc->szProtoName);
- length = mir_tstrlen(text);
+ length = (int)mir_tstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
@@ -653,7 +653,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
}
else mir_sntprintf(text, size, TranslateT("Protocol is not loaded."));
- length = mir_tstrlen(text);
+ length = (int)mir_tstrlen(text);
DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS);
GetTextExtentPoint32(lps->hDC, text, length, &sz);
lps->rcItem.top += sz.cy + 2;
diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp
index 909f02b885..baea80298e 100644
--- a/src/modules/skin/hotkey_opts.cpp
+++ b/src/modules/skin/hotkey_opts.cpp
@@ -413,9 +413,11 @@ static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey)
static void sttOptionsDrawTextChunk(HDC hdc, TCHAR *text, RECT *rc)
{
+ int len = (int)mir_tstrlen(text);
+ DrawText(hdc, text, len, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
+
SIZE sz;
- DrawText(hdc, text, mir_tstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
- GetTextExtentPoint32(hdc, text, mir_tstrlen(text), &sz);
+ GetTextExtentPoint32(hdc, text, len, &sz);
rc->left += sz.cx;
}
diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp
index f26a708049..9e7c28caba 100644
--- a/src/modules/utils/bmpfilter.cpp
+++ b/src/modules/utils/bmpfilter.cpp
@@ -41,7 +41,7 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName)
if (!PathToAbsoluteT(ptszFileName, szFilename))
mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName);
- int filenameLen = mir_tstrlen(szFilename);
+ size_t filenameLen = mir_tstrlen(szFilename);
if (filenameLen > 4) {
TCHAR* pszExt = szFilename + filenameLen - 4;
@@ -140,44 +140,44 @@ static INT_PTR BmpFilterLoadBitmapW(WPARAM, LPARAM lParam)
static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam)
{
- int bytesLeft = wParam;
+ size_t bytesLeft = wParam;
char *filter = (char*)lParam, *pfilter;
- mir_strncpy(filter, Translate("All bitmaps"), bytesLeft); bytesLeft-=mir_strlen(filter);
+ mir_strncpy(filter, Translate("All bitmaps"), bytesLeft); bytesLeft -= mir_strlen(filter);
strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft);
- pfilter = filter+mir_strlen(filter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter = filter + mir_strlen(filter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_strncpy(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter);
+ mir_strncpy(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
strncat(pfilter, " (*.bmp;*.rle)", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*.BMP;*.RLE", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_strncpy(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter);
+ mir_strncpy(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*.JPG;*.JPEG", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_strncpy(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter);
+ mir_strncpy(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
strncat(pfilter, " (*.gif)", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*.GIF", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_strncpy(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter);
+ mir_strncpy(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
strncat(pfilter, " (*.png)", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*.PNG", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_strncpy(pfilter, Translate("All files"), bytesLeft); bytesLeft-=mir_strlen(pfilter);
+ mir_strncpy(pfilter, Translate("All files"), bytesLeft); bytesLeft -= mir_strlen(pfilter);
strncat(pfilter, " (*)", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_strncpy(pfilter, "*", bytesLeft);
- pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_strlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
if (bytesLeft) *pfilter = '\0';
return 0;
@@ -185,44 +185,44 @@ static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam)
static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam)
{
- int bytesLeft = wParam;
+ size_t bytesLeft = wParam;
TCHAR *filter = (TCHAR*)lParam, *pfilter;
- mir_tstrncpy(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(filter);
+ mir_tstrncpy(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(filter);
_tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft);
- pfilter = filter+mir_tstrlen(filter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter = filter + mir_tstrlen(filter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_tstrncpy(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter);
+ mir_tstrncpy(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*.BMP;*.RLE"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_tstrncpy(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter);
+ mir_tstrncpy(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*.JPG;*.JPEG"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_tstrncpy(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter);
+ mir_tstrncpy(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.gif)"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*.GIF"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_tstrncpy(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter);
+ mir_tstrncpy(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
_tcsncat(pfilter, _T(" (*.png)"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*.PNG"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
- mir_tstrncpy(pfilter, TranslateT("All files"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter);
+ mir_tstrncpy(pfilter, TranslateT("All files"), bytesLeft); bytesLeft -= mir_tstrlen(pfilter);
_tcsncat(pfilter, _T(" (*)"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
mir_tstrncpy(pfilter, _T("*"), bytesLeft);
- pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter);
+ pfilter += mir_tstrlen(pfilter) + 1; bytesLeft = wParam - (pfilter - filter);
if (bytesLeft) *pfilter = '\0';
return 0;
diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp
index 9f075a7514..0ca712f79d 100644
--- a/src/modules/utils/hyperlink.cpp
+++ b/src/modules/utils/hyperlink.cpp
@@ -165,7 +165,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
if (hdc == NULL) return 0; /* text change failed */
if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont);
if (dat->hEnableFont == NULL || hPrevFont != NULL) /* select failed? */
- if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, mir_tstrlen((TCHAR*)lParam), &textSize))
+ if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, (int)mir_tstrlen((TCHAR*)lParam), &textSize))
if (GetClientRect(hwnd, &rc)) {
dat->rcText.top = 0;
dat->rcText.bottom = dat->rcText.top+textSize.cy;