From dd802db0d3cb38f4590d15aebaa301eb4608157c Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Tue, 27 Jan 2015 20:11:07 +0000 Subject: Minor bugfixes git-svn-id: http://svn.miranda-ng.org/main/trunk@11929 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/JabberG/src/jabber_console.cpp | 24 +++++++++++------------- src/core/modules.cpp | 2 +- src/mir_core/src/langpack.cpp | 2 +- src/modules/xml/xmlParser.cpp | 11 ++++++----- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/protocols/JabberG/src/jabber_console.cpp b/protocols/JabberG/src/jabber_console.cpp index 5d7feb0bf9..ccc4844a5e 100644 --- a/protocols/JabberG/src/jabber_console.cpp +++ b/protocols/JabberG/src/jabber_console.cpp @@ -103,13 +103,11 @@ void CJabberProto::OnConsoleProcessXml(HXML node, DWORD flags) bool CJabberProto::RecursiveCheckFilter(HXML node, DWORD flags) { - int i; - - for (i = 0; i < xmlGetAttrCount(node); i++) + for (int i = 0; i < xmlGetAttrCount(node); i++) if (JabberStrIStr(xmlGetAttr(node, i), m_filterInfo.pattern)) return true; - for (i = 0; i < xmlGetChildCount(node); i++) + for (int i = 0; i < xmlGetChildCount(node); i++) if (RecursiveCheckFilter(xmlGetChild(node, i), flags)) return true; @@ -273,7 +271,6 @@ DWORD CALLBACK sttStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, L static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) { - int i; JABBER_LIST_ITEM *item = NULL; int len = GetWindowTextLength(hwndCombo) + 1; @@ -282,15 +279,15 @@ static void sttJabberConsoleRebuildStrings(CJabberProto *ppro, HWND hwndCombo) SendMessage(hwndCombo, CB_RESETCONTENT, 0, 0); - for (i=0; g_JabberFeatCapPairs[i].szFeature; i++) + for (int i=0; g_JabberFeatCapPairs[i].szFeature; i++) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairs[i].szFeature); - for (i=0; g_JabberFeatCapPairsExt[i].szFeature; i++) + for (int i=0; g_JabberFeatCapPairsExt[i].szFeature; i++) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)g_JabberFeatCapPairsExt[i].szFeature); - LISTFOREACH_NODEF(i, ppro, LIST_ROSTER) + LISTFOREACH(i, ppro, LIST_ROSTER) if (item = ppro->ListGetItemPtrFromIndex(i)) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)item->jid); - LISTFOREACH_NODEF(i, ppro, LIST_CHATROOM) + LISTFOREACH(i, ppro, LIST_CHATROOM) if (item = ppro->ListGetItemPtrFromIndex(i)) SendMessage(hwndCombo, CB_ADDSTRING, 0, (LPARAM)item->jid); @@ -373,8 +370,7 @@ void CJabberDlgConsole::OnInitDialog() { IDC_BTN_FILTER_REFRESH, "Refresh list", "sd_nav_refresh", false, FALSE}, }; - int i; - for (i=0; i < SIZEOF(buttons); i++) { + for (int i=0; i < SIZEOF(buttons); i++) { SendDlgItemMessage(m_hwnd, buttons[i].idc, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(buttons[i].icon)); SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(m_hwnd, buttons[i].idc, BUTTONADDTOOLTIP, (WPARAM)buttons[i].title, 0); @@ -382,7 +378,7 @@ void CJabberDlgConsole::OnInitDialog() if (buttons[i].pushed) CheckDlgButton(m_hwnd, buttons[i].idc, BST_CHECKED); } - for (i=0; i < SIZEOF(filter_modes); i++) + for (int i=0; i < SIZEOF(filter_modes); i++) if (filter_modes[i].type == m_proto->m_filterInfo.type) { g_ReleaseIcon((HICON)SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon))); SendDlgItemMessage(m_hwnd, IDC_BTN_FILTER, BM_SETIMAGE, IMAGE_ICON, (LPARAM)m_proto->LoadIconEx(filter_modes[i].icon)); @@ -614,9 +610,10 @@ void __cdecl CJabberProto::ConsoleThread(void*) m_dwConsoleThreadId = 0; } +HMODULE hMsftedit; void CJabberProto::ConsoleInit() { - LoadLibraryA("Msftedit.dll"); + hMsftedit = LoadLibrary(_T("Msftedit.dll")); m_hThreadConsole = ForkThreadEx(&CJabberProto::ConsoleThread, 0, &m_dwConsoleThreadId); } @@ -633,6 +630,7 @@ void CJabberProto::ConsoleUninit() m_filterInfo.iq = m_filterInfo.msg = m_filterInfo.presence = FALSE; m_filterInfo.type = TFilterInfo::T_OFF; + FreeLibrary(hMsftedit); } INT_PTR __cdecl CJabberProto::OnMenuHandleConsole(WPARAM, LPARAM) diff --git a/src/core/modules.cpp b/src/core/modules.cpp index e69a0b719f..21824566ed 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../modules/langpack/langpack.h" #include "../modules/chat/chat.h" -int CheckRestart(); // core: IDD_WAITRESTART +INT_PTR CheckRestart(); // core: IDD_WAITRESTART int LoadSystemModule(void); // core: m_system.h services int LoadNewPluginsModuleInfos(void); // core: preloading plugins diff --git a/src/mir_core/src/langpack.cpp b/src/mir_core/src/langpack.cpp index 3c78d112f3..aa6d9f9d86 100644 --- a/src/mir_core/src/langpack.cpp +++ b/src/mir_core/src/langpack.cpp @@ -362,7 +362,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start MultiByteToWideChar(lpinfo.codepage, 0, szLanguage, -1, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage)); - if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, sizeof(lpinfo.tszLanguage))) { + if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, SIZEOF(lpinfo.tszLanguage))) { TCHAR *p = _tcschr(lpinfo.tszFileName, '_'); _tcsncpy_s(lpinfo.tszLanguage, ((p != NULL) ? (p + 1) : lpinfo.tszFileName), _TRUNCATE); p = _tcsrchr(lpinfo.tszLanguage, _T('.')); diff --git a/src/modules/xml/xmlParser.cpp b/src/modules/xml/xmlParser.cpp index 21cf0a0548..069cec6678 100644 --- a/src/modules/xml/xmlParser.cpp +++ b/src/modules/xml/xmlParser.cpp @@ -1305,7 +1305,8 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) { // if the previous insertion was a comment () AND // if the previous previous insertion was a text then, delete the comment and append the text - int n = d->nChild+d->nText+d->nClear-1, *o = d->pOrder; + size_t n = d->nChild+d->nText+d->nClear-1; + int *o = d->pOrder; if (((o[n]&3) == eNodeClear)&&((o[n-1]&3) == eNodeText)) { int i = o[n]>>2; @@ -1314,7 +1315,7 @@ char XMLNode::maybeAddTxT(void *pa, XMLCSTR tokenPStr) deleteClear(i); i = o[n-1]>>2; n = xstrlen(d->pText[i]); - int n2 = xstrlen(lpt)+1; + size_t n2 = xstrlen(lpt)+1; d->pText[i] = (XMLSTR)realloc((void*)d->pText[i], (n+n2)*sizeof(XMLCHAR)); if (!d->pText[i]) return 1; memcpy((void*)(d->pText[i]+n), lpt, n2*sizeof(XMLCHAR)); @@ -2706,8 +2707,8 @@ XMLCSTR XMLNode::getInnerText() const if (d->pInnerText) return d->pInnerText; int count = nElement(); - int i, length = 1; - for (i=0; i < count; i++) + size_t length = 1; + for (int i=0; i < count; i++) { XMLNodeContents c = enumContents(i); switch (c.etype) @@ -2722,7 +2723,7 @@ XMLCSTR XMLNode::getInnerText() const } XMLCHAR *buf = (XMLCHAR *)malloc(sizeof(XMLCHAR) * length); XMLCHAR *pos = buf; - for (i=0; i < count; i++) + for (int i=0; i < count; i++) { XMLNodeContents c = enumContents(i); switch (c.etype) -- cgit v1.2.3