summaryrefslogtreecommitdiff
path: root/protocols/JabberG
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-02 21:55:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-02 21:55:57 +0000
commit0ca0de7698b523effaaf6cc9c608e936fa5aaf86 (patch)
tree1e6ce038dc27a1ccddb5e3f863607c83eece2e98 /protocols/JabberG
parentaeae01dc50a5adea8fe003c8195540b1f2b2169f (diff)
useless calls of mir_*strlen in DrawText replaced with -1
git-svn-id: http://svn.miranda-ng.org/main/trunk@11223 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/JabberG')
-rw-r--r--protocols/JabberG/src/jabber_api.cpp2
-rw-r--r--protocols/JabberG/src/jabber_console.cpp2
-rw-r--r--protocols/JabberG/src/jabber_file.cpp2
-rw-r--r--protocols/JabberG/src/jabber_form.cpp7
-rw-r--r--protocols/JabberG/src/jabber_frame.cpp4
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_privacy.cpp2
7 files changed, 12 insertions, 11 deletions
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp
index 9379e767b5..f23bdb1d6c 100644
--- a/protocols/JabberG/src/jabber_api.cpp
+++ b/protocols/JabberG/src/jabber_api.cpp
@@ -331,7 +331,7 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid)
mir_cslockfull lck(m_csLists);
int i;
- int iLen = 1; // 1 for extra zero terminator at the end of the string
+ size_t iLen = 1; // 1 for extra zero terminator at the end of the string
// calculate total necessary string length
for (i=0; g_JabberFeatCapPairs[i].szFeature; i++)
if (jcb & g_JabberFeatCapPairs[i].jcbCap)
diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp
index 11aae68660..97b027f82a 100644
--- a/protocols/JabberG/src/jabber_console.cpp
+++ b/protocols/JabberG/src/jabber_console.cpp
@@ -154,7 +154,7 @@ static void sttAppendBufRaw(StringBuf *buf, const char *str)
{
if (!str) return;
- int length = mir_strlen(str);
+ size_t length = mir_strlen(str);
if (buf->size - buf->offset < length + 1) {
buf->size += (length + STRINGBUF_INCREMENT);
buf->buf = (char *)mir_realloc(buf->buf, buf->size);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index f22ea22984..1db2348c6e 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -298,7 +298,7 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
mir_free(pFileName);
- int len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
+ size_t len = mir_tstrlen(ptszResource) + mir_tstrlen(ft->jid) + 2;
TCHAR *fulljid = (TCHAR *)alloca(sizeof(TCHAR) * len);
mir_sntprintf(fulljid, len, _T("%s/%s"), ft->jid, ptszResource);
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 86dae77ec8..7afa2152b4 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -116,11 +116,12 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
{
if (!text) text = _T("");
- int len = mir_tstrlen(text);
- int fixedLen = len;
+ size_t len = mir_tstrlen(text);
+ size_t fixedLen = len;
for (int i = 1; i < len; i++)
if ((text[i - 1] == _T('\n')) && (text[i] != _T('\r')))
++fixedLen;
+
TCHAR *fixedText = NULL;
if (fixedLen != len) {
fixedText = (TCHAR *)mir_alloc(sizeof(TCHAR) * (fixedLen+1));
@@ -147,7 +148,7 @@ void JabberFormSetInstruction(HWND hwndForm, const TCHAR *text)
SetRect(&rcText, 0, 0, rcText.right-rcText.left, 0);
HDC hdcEdit = GetDC(GetDlgItem(hwndForm, IDC_INSTRUCTION));
HFONT hfntSave = (HFONT)SelectObject(hdcEdit, (HFONT)SendDlgItemMessage(hwndForm, IDC_INSTRUCTION, WM_GETFONT, 0, 0));
- DrawTextEx(hdcEdit, (TCHAR *)text, mir_tstrlen(text), &rcText,
+ DrawTextEx(hdcEdit, (TCHAR *)text, (int)mir_tstrlen(text), &rcText,
DT_CALCRECT|DT_EDITCONTROL|DT_TOP|DT_WORDBREAK, NULL);
SelectObject(hdcEdit, hfntSave);
ReleaseDC(GetDlgItem(hwndForm, IDC_INSTRUCTION), hdcEdit);
diff --git a/protocols/JabberG/src/jabber_frame.cpp b/protocols/JabberG/src/jabber_frame.cpp
index 57f88a79e1..5e0e19cb18 100644
--- a/protocols/JabberG/src/jabber_frame.cpp
+++ b/protocols/JabberG/src/jabber_frame.cpp
@@ -370,7 +370,7 @@ void CJabberInfoFrame::PaintCompact(HDC hdc)
}
RECT rcText; SetRect(&rcText, cx_icon + SZ_FRAMEPADDING + SZ_ICONSPACING, 0, rc.right - SZ_FRAMEPADDING, rc.bottom);
- DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_END_ELLIPSIS);
}
else {
if (item.m_hIcolibIcon) {
@@ -433,7 +433,7 @@ void CJabberInfoFrame::PaintNormal(HDC hdc)
SetTextColor(hdc, depth ? m_clText : m_clTitle);
RECT rcText; SetRect(&rcText, cx, cy, rc.right - SZ_FRAMEPADDING, cy + line_height);
- DrawText(hdc, item.m_pszText, mir_tstrlen(item.m_pszText), &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
+ DrawText(hdc, item.m_pszText, -1, &rcText, DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_END_ELLIPSIS);
RemoveTooltip(item.m_tooltipId);
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 3bdb6ee215..673332e484 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -546,13 +546,13 @@ INT_PTR CJabberDlgGcJoin::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
rc.bottom -= (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine1);
- DrawText(lpdis->hDC, info->line1, mir_tstrlen(info->line1), &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line1, -1, &rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
rc = lpdis->rcItem;
rc.top += (rc.bottom - rc.top) / 2;
rc.left += 20;
SetTextColor(lpdis->hDC, clLine2);
- DrawText(lpdis->hDC, info->line2, mir_tstrlen(info->line2), &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
+ DrawText(lpdis->hDC, info->line2, -1, &rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
DrawIconEx(lpdis->hDC, lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, m_proto->LoadIconEx("group"), 16, 16, 0, NULL, DI_NORMAL);
switch (info->overlay) {
diff --git a/protocols/JabberG/src/jabber_privacy.cpp b/protocols/JabberG/src/jabber_privacy.cpp
index d8dfb66fb3..2d0cdc792f 100644
--- a/protocols/JabberG/src/jabber_privacy.cpp
+++ b/protocols/JabberG/src/jabber_privacy.cpp
@@ -1049,7 +1049,7 @@ void CJabberDlgPrivacyLists::ShowAdvancedList(CPrivacyList *pList)
void CJabberDlgPrivacyLists::DrawNextRulePart(HDC hdc, COLORREF color, const TCHAR *text, RECT *rc)
{
SetTextColor(hdc, color);
- DrawText(hdc, text, mir_tstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
+ DrawText(hdc, text, -1, rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS);
SIZE sz;
GetTextExtentPoint32(hdc, text, mir_tstrlen(text), &sz);