diff options
author | George Hazan <ghazan@miranda.im> | 2019-07-26 20:02:16 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-07-26 20:02:22 +0300 |
commit | 9374c8e701dcb61a46c89a854235d91a23bf672e (patch) | |
tree | ad366bc7f47da578fb33a57c32912689f5aadecb | |
parent | 3c5923d11431c515db57e4e972d53bf0443f1bcb (diff) |
warning fixes
48 files changed, 194 insertions, 223 deletions
diff --git a/include/m_gui.h b/include/m_gui.h index d611778a74..2636ccd0aa 100644 --- a/include/m_gui.h +++ b/include/m_gui.h @@ -1479,7 +1479,7 @@ public: protected:
PROTO_INTERFACE *m_proto_interface;
- HWND m_hwndStatus;
+ HWND m_hwndStatus = nullptr;
INT_PTR DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) override;
diff --git a/include/m_netlib.h b/include/m_netlib.h index 046f502706..5225186f85 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -538,7 +538,7 @@ struct MIR_APP_EXPORT MHttpRequest : public NETLIBHTTPREQUEST, public MZeroedObj CMStringA m_szUrl;
CMStringA m_szParam;
- void *pUserInfo;
+ void *pUserInfo = nullptr;
void AddHeader(const char *szName, const char *szValue);
};
diff --git a/include/m_protoint.h b/include/m_protoint.h index 5a7df174cf..53a87d8f2b 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -67,7 +67,7 @@ struct MIR_APP_EXPORT PROTO_INTERFACE : public MZeroedObject {
protected:
- MWindowList m_hWindowList; // list of all windows which belong to this protocol's instance
+ MWindowList m_hWindowList = 0; // list of all windows which belong to this protocol's instance
public:
int m_iStatus; // current protocol status
@@ -76,9 +76,9 @@ public: int m_iVersion; // version 2 or higher designate support of Unicode services
wchar_t* m_tszUserName; // human readable protocol's name
char* m_szModuleName; // internal protocol name, also its database module name
- HANDLE m_hProtoIcon; // icon to be displayed in the account manager
- HNETLIBUSER m_hNetlibUser; // network agent
- HGENMENU m_hmiMainMenu; // if protocol menus are displayed in the main menu, this is the root
+ HANDLE m_hProtoIcon = 0; // icon to be displayed in the account manager
+ HNETLIBUSER m_hNetlibUser = 0; // network agent
+ HGENMENU m_hmiMainMenu = 0; // if protocol menus are displayed in the main menu, this is the root
HGENMENU m_hmiReqAuth; // a menu item for /RequestAuth service
HGENMENU m_hmiGrantAuth; // a menu item for /GrantAuth service
HGENMENU m_hmiRevokeAuth; // a menu item for /RevokeAuth service
diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index eb0199eb25..b2479bd540 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -99,8 +99,8 @@ struct protoPicCacheEntry : public AVATARCACHEENTRY, public MZeroedObject void clear();
- char* szProtoname;
- int cacheType = 0;
+ char *szProtoname = nullptr;
+ int cacheType = 0;
union {
PROTOCOLDESCRIPTOR *pd;
PROTOACCOUNT *pa;
diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index ad2fe35a51..e59f10c3fe 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -284,9 +284,9 @@ static bool clcItemNotHiddenOffline(ClcGroup *group, ClcContact *contact) return false;
}
-static LRESULT clcOnCreate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT clcOnCreate(ClcData*, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- dat = new ClcData();
+ ClcData *dat = new ClcData();
SetWindowLongPtr(hwnd, 0, (LONG_PTR)dat);
dat->hCheckBoxTheme = xpt_AddThemeHandle(hwnd, L"BUTTON");
dat->m_paintCouter = 0;
@@ -551,25 +551,27 @@ static LRESULT clcOnKeyDown(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPARAM dat->selection = cliGetRowsPriorTo(&dat->list, group, -1);
selMoved = 1;
}
- else {
- if (contact->type == CLCIT_GROUP) {
- if (changeGroupExpand == 1) {
- if (!contact->group->expanded) {
- dat->selection--;
- selMoved = 1;
- }
- else g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, 0);
- }
- else if (changeGroupExpand == 2) {
- g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, 1);
- dat->selection++;
+ else if (contact->type == CLCIT_GROUP) {
+ if (changeGroupExpand == 1) {
+ if (!contact->group->expanded) {
+ dat->selection--;
selMoved = 1;
}
- else { SetCapture(hwnd); return 0; }
+ else g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, 0);
+ }
+ else if (changeGroupExpand == 2) {
+ g_clistApi.pfnSetGroupExpand(hwnd, dat, contact->group, 1);
+ dat->selection++;
+ selMoved = 1;
+ }
+ else {
+ SetCapture(hwnd);
+ return 0;
}
}
}
}
+
if (selMoved) {
if (dat->selection >= g_clistApi.pfnGetGroupContentsCount(&dat->list, 1))
dat->selection = g_clistApi.pfnGetGroupContentsCount(&dat->list, 1) - 1;
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 5274ffa3f3..ed679ef10a 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -1223,7 +1223,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) GetSystemTime(&cfg::dat.st);
SystemTimeToFileTime(&cfg::dat.st, &cfg::dat.ft);
- cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients && (GdiGradientFill != nullptr);
+ cfg::dat.bUseFastGradients = cfg::dat.bWantFastGradients;
av_left = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSLEFT);
av_right = (cfg::dat.dwFlags & CLUI_FRAME_AVATARSRIGHT);
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index eecf002363..544fe91482 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -946,9 +946,9 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l GetWindowRect(hwnd, &rcWin); BitBlt(hdc, 0, 0, rcClient.right, rcClient.bottom, dc, rcWin.left, rcWin.top, SRCCOPY); + ReleaseDC(nullptr, dc); } - else - FillRect(hdc, &rcClient, g_CLUISkinnedBkColor); + else FillRect(hdc, &rcClient, g_CLUISkinnedBkColor); } if (cfg::dat.bClipBorder != 0 || cfg::dat.dwFlags & CLUI_FRAME_ROUNDEDFRAME) { diff --git a/plugins/Clist_nicer/src/coolscroll.cpp b/plugins/Clist_nicer/src/coolscroll.cpp index f27fcf6e9c..5a8828a312 100644 --- a/plugins/Clist_nicer/src/coolscroll.cpp +++ b/plugins/Clist_nicer/src/coolscroll.cpp @@ -1631,7 +1631,6 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) }
RotateRect0(sbar, &rc2);
- ReleaseDC(hwnd, hdc);
//post a SB_TRACKPOS message!!!
siMaxMin = si->nMax - si->nMin;
@@ -1649,10 +1648,8 @@ static LRESULT ThumbTrackHorz(SCROLLBAR *sbar, HWND hwnd, int x, int y) nLastPos = pos;
-//#ifdef CUSTOM_DRAW
PostCustomPrePostPaint(hwnd, hdc, sbar, CDDS_POSTPAINT);
-//#endif
-
+ ReleaseDC(hwnd, hdc);
return 0;
}
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 8241c13ed5..956e317ccb 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -341,7 +341,7 @@ void importSettings(MCONTACT hContact, char *utf8) deleteModule(hContact, module, 0);
}
}
- else if (strstr(&importstring[i], "=") && module[0]) { // get the setting
+ else if (strchr(&importstring[i], '=') && module[0]) { // get the setting
if (end = strpbrk(&importstring[i + 1], "=")) {
*end = '\0';
mir_strcpy(setting, &importstring[i]);
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 28b19a3562..260b9b007d 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -1122,7 +1122,7 @@ void IEView::saveDocument() VARIANT vValue;
vValue.vt = VT_BOOL;
- vValue.boolVal = TRUE;
+ vValue.boolVal = VARIANT_TRUE;
VARIANT_BOOL vb;
document->execCommand(BSTR_PTR(L"SaveAs"), VARIANT_FALSE, vValue, &vb);
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index f7885430c1..b2bd3968f4 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -199,7 +199,7 @@ void MUCCHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event) str.AppendFormat("<div class=\"%s\">", isSent ? "divOut" : "divIn");
if (dwData & IEEDD_MUCC_SHOW_TIME || dwData & IEEDD_MUCC_SHOW_DATE)
- str.AppendFormat("<span class=\"%s\">%s </span>", isSent ? "timestamp" : "timestamp", timestampToString(dwData, eventData->time));
+ str.AppendFormat("<span class=\"%s\">%s </span>", "timestamp", timestampToString(dwData, eventData->time));
if (dwData & IEEDD_MUCC_SHOW_NICK)
str.AppendFormat("<span class=\"%s\">%s: </span>", isSent ? "nameOut" : "nameIn", szName.get());
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index bcb7096ba5..7086f35447 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -302,15 +302,15 @@ void ScriverHTMLBuilder::appendEventNonTemplate(IEView *view, IEVIEWEVENT *event /* Scriver-specific formatting */
if ((dwFlags & SMF_LOG_DRAWLINES) && isGroupBreak && getLastEventType() != -1) {
if (eventData->iType == IEED_EVENT_MESSAGE)
- className = isRTL ? isSent ? "divOutGridRTL" : "divInGridRTL" : isSent ? "divOutGrid" : "divInGrid";
+ className = isRTL ? (isSent ? "divOutGridRTL" : "divInGridRTL") : (isSent ? "divOutGrid" : "divInGrid");
else
- className = isRTL ? isSent ? "divNoticeGridRTL" : "divNoticeGridRTL" : isSent ? "divNoticeGrid" : "divNoticeGrid";
+ className = isRTL ? "divNoticeGridRTL" : "divNoticeGrid";
}
else {
if (eventData->iType == IEED_EVENT_MESSAGE)
className = isRTL ? (isSent ? "divOutRTL" : "divInRTL") : (isSent ? "divOut" : "divIn");
else
- className = isRTL ? "divNoticeRTL" : (isSent ? "divNotice" : "divNotice");
+ className = isRTL ? "divNoticeRTL" : "divNotice";
}
CMStringA str;
diff --git a/plugins/IEView/src/TextToken.cpp b/plugins/IEView/src/TextToken.cpp index aebc99d09f..0e322d00ec 100644 --- a/plugins/IEView/src/TextToken.cpp +++ b/plugins/IEView/src/TextToken.cpp @@ -23,26 +23,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. TextToken::TextToken(int _type, const char *_text, int _len)
{
- next = nullptr;
- tag = 0;
- end = false;
type = _type;
text = mir_strndup(_text, _len);
wtext = mir_a2u(text);
- link = nullptr;
- wlink = nullptr;
}
TextToken::TextToken(int _type, const wchar_t *_wtext, int _len)
{
- next = nullptr;
- tag = 0;
- end = false;
type = _type;
wtext = mir_wstrndup(_wtext, _len);
text = mir_u2a(wtext);
- link = nullptr;
- wlink = nullptr;
}
TextToken::~TextToken()
@@ -520,7 +510,7 @@ void TextToken::toString(CMStringW &str) match = wcsstr(match + 11, L"v=");
if (match != nullptr) {
match += 2;
- wchar_t *match2 = wcsstr(match, L"&");
+ wchar_t *match2 = wcschr(match, '&');
int len = match2 != nullptr ? match2 - match : (int)mir_wstrlen(match);
match = mir_wstrdup(match);
match[len] = 0;
diff --git a/plugins/IEView/src/TextToken.h b/plugins/IEView/src/TextToken.h index 7e5ef3260c..8cc048e18a 100644 --- a/plugins/IEView/src/TextToken.h +++ b/plugins/IEView/src/TextToken.h @@ -25,15 +25,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class TextToken {
private:
int type;
- bool end;
- int tag;
- DWORD value;
+ bool end = false;
+ int tag = 0;
+ DWORD value = 0;
wchar_t *wtext;
char *text;
- wchar_t *wlink;
- char *link;
- TextToken *next;
- static TextToken* tokenizeBBCodes(const wchar_t *text, int len);
+ wchar_t *wlink = nullptr;
+ char *link = nullptr;
+ TextToken *next = nullptr;
+ static TextToken* tokenizeBBCodes(const wchar_t *text, int len);
public:
enum TOKENS {
END = 0,
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 448336e3c9..fdc621b4db 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -1495,10 +1495,10 @@ bool CIrcProto::OnIrc_LIST(const CIrcMessage *pmsg) wchar_t* temp = mir_wstrdup(pmsg->parameters[pmsg->parameters.getCount() - 1]);
wchar_t* find = wcsstr(temp, L"[+");
- wchar_t* find2 = wcsstr(temp, L"]");
+ wchar_t* find2 = wcschr(temp, ']');
wchar_t* save = temp;
if (find == temp && find2 != nullptr && find + 8 >= find2) {
- temp = wcsstr(temp, L"]");
+ temp = wcschr(temp, ']');
if (mir_wstrlen(temp) > 1) {
temp++;
temp[0] = 0;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp index d0758f3faf..ad8ffecd66 100644 --- a/protocols/JabberG/src/jabber_groupchat.cpp +++ b/protocols/JabberG/src/jabber_groupchat.cpp @@ -822,7 +822,7 @@ void CJabberProto::GroupchatProcessPresence(const TiXmlElement *node) if (auto *n = XmlGetChildByTag(node, "nick", "xmlns", JABBER_FEAT_NICK))
cnick = n->GetText();
- const char *nick = cnick ? cnick : (r && r->m_szNick ? r->m_szNick : resource);
+ const char *nick = cnick ? cnick : (r && r->m_szNick ? r->m_szNick.get() : resource);
const TiXmlElement *itemNode = nullptr;
auto *xNode = XmlGetChildByTag(node, "x", "xmlns", JABBER_FEAT_MUC_USER);
@@ -1087,7 +1087,7 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node) if (resource != nullptr) {
pResourceStatus r(item->findResource(resource));
- nick = (r && r->m_szNick) ? r->m_szNick : resource;
+ nick = (r && r->m_szNick) ? r->m_szNick.get() : resource;
}
else nick = nullptr;
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index e2a35eb5c0..31392c3549 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -948,7 +948,7 @@ int CJabberProto::OnProcessSrmmIconClick(WPARAM hContact, LPARAM lParam) wchar_t buf[256];
mir_snwprintf(buf, TranslateT("Last active (%s)"),
- LI->m_pLastSeenResource ? Utf2T(LI->m_pLastSeenResource->m_szResourceName.get()) : TranslateT("No activity yet, use server's choice"));
+ LI->m_pLastSeenResource ? Utf2T(LI->m_pLastSeenResource->m_szResourceName).get() : TranslateT("No activity yet, use server's choice"));
AppendMenu(hMenu, MF_STRING, MENUITEM_LASTSEEN, buf);
AppendMenu(hMenu, MF_STRING, MENUITEM_SERVER, TranslateT("Highest priority (server's choice)"));
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index ff84776acf..752ae2cda8 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -739,7 +739,7 @@ HANDLE CJabberProto::SearchByEmail(const wchar_t *email) ptrA szServerName(getStringA("Jud"));
- LPCSTR jid = szServerName == 0 ? "users.jabber.org" : szServerName;
+ LPCSTR jid = szServerName == 0 ? "users.jabber.org" : szServerName.get();
CJabberIqInfo *pInfo = AddIQ(&CJabberProto::OnIqResultSetSearch, JABBER_IQ_TYPE_SET, jid);
m_ThreadInfo->send(XmlNodeIq(pInfo) << XQUERY("jabber:iq:search") << XCHILD("email", T2Utf(email)));
return (HANDLE)pInfo->GetIqId();
diff --git a/protocols/JabberG/src/jabber_search.cpp b/protocols/JabberG/src/jabber_search.cpp index ee0e59b825..39c01b5af0 100644 --- a/protocols/JabberG/src/jabber_search.cpp +++ b/protocols/JabberG/src/jabber_search.cpp @@ -530,7 +530,7 @@ static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPAR /* Server Combo box */ ptrA jud(dat->ppro->getStringA("Jud")); - char *szServerName = (jud == nullptr) ? "users.jabber.org" : jud; + char *szServerName = (jud == nullptr) ? "users.jabber.org" : jud.get(); SetDlgItemTextA(hwndDlg, IDC_SERVER, szServerName); SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)szServerName); //TO DO: Add Transports here diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 2631783213..82f27729bb 100755 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -821,7 +821,7 @@ BOOL CJabberProto::EnterString(CMStringW &result, const wchar_t *caption, int ty param.recentCount = recentCount;
param.timeout = timeout;
param.ptszInitVal = result;
- BOOL res = ::EnterString(¶m);
+ INT_PTR res = ::EnterString(¶m);
if (res) {
result = param.ptszResult;
mir_free(param.ptszResult);
diff --git a/protocols/NewsAggregator/Src/Utils.cpp b/protocols/NewsAggregator/Src/Utils.cpp index 29c2017b66..00144af250 100644 --- a/protocols/NewsAggregator/Src/Utils.cpp +++ b/protocols/NewsAggregator/Src/Utils.cpp @@ -87,7 +87,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, CFeedEditor if (nlhrReply->resultCode == 200 && nlhrReply->dataLength > 0) { Netlib_LogfW(hNetlibUser, L"Code 200: Succeeded getting feed data %s.", tszUrl); // allocate memory and save the retrieved data - *szData = (char *)mir_alloc((size_t)(nlhrReply->dataLength + 2)); + *szData = (char *)mir_alloc((size_t)nlhrReply->dataLength + 2); memcpy(*szData, nlhrReply->pData, (size_t)nlhrReply->dataLength); (*szData)[nlhrReply->dataLength] = 0; } @@ -132,7 +132,7 @@ time_t DateToUnixTime(const char *stamp, bool FeedType) if (strchr(p, ',')) { strtok(p, ","); p = strtok(nullptr, ","); - sscanf(p + 1, "%d %3s %d %d:%d:%d %1s%02d%02d", &day, &monthstr, &year, &hour, &min, &sec, &timezonesign, &timezoneh, &timezonem); + sscanf(p + 1, "%d %3s %d %d:%d:%d %1s%02d%02d", &day, monthstr, &year, &hour, &min, &sec, timezonesign, &timezoneh, &timezonem); if (!mir_strcmpi(monthstr, "Jan")) month = 1; if (!mir_strcmpi(monthstr, "Feb")) diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 2b046799dd..eaeec9c62c 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -141,7 +141,7 @@ void CSkypeProto::TRouterThread(void*) errors = 0;
if (response->pData) {
- char *json = strstr(response->pData, "{");
+ char *json = strchr(response->pData, '{');
if (json != NULL) {
JSONNode root = JSONNode::parse(json);
std::string szBody = root["body"].as_string();
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 66f68b297f..15bbc2853a 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -349,7 +349,7 @@ char *CSkypeProto::RemoveHtml(const char *text) for (std::string::size_type i = 0; i < data.length(); i++) { if (data.at(i) == '<') { - i = data.find(">", i); + i = data.find('>', i); if (i == std::string::npos) break; @@ -358,7 +358,7 @@ char *CSkypeProto::RemoveHtml(const char *text) if (data.at(i) == '&') { std::string::size_type begin = i; - i = data.find(";", i); + i = data.find(';', i); if (i == std::string::npos) { i = begin; } diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index cd576ac374..8eeb7c6eb3 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -458,7 +458,7 @@ void CSteamProto::OnGotBlockList(const JSONNode &root, void *) return; for (auto &_friend : root["friends"]) { - json_string steamId = _friend["steamid"].as_string(); + // json_string steamId = _friend["steamid"].as_string(); json_string relationship = _friend["relationship"].as_string(); if (!mir_strcmp(relationship.c_str(), "ignoredfriend")) { diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp index c89f28fb82..b4c7f62c4d 100644 --- a/protocols/Tox/src/tox_accounts.cpp +++ b/protocols/Tox/src/tox_accounts.cpp @@ -8,7 +8,7 @@ int CToxProto::OnAccountRenamed(WPARAM wParam, LPARAM lParam) ptrW newPath(GetToxProfilePath());
wchar_t oldPath[MAX_PATH];
- mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%").get(), m_accountName);
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARSW(L"%miranda_userdata%").get(), m_accountName.get());
_wrename(oldPath, newPath);
m_accountName = mir_wstrdup(m_tszUserName);
}
diff --git a/protocols/Tox/src/tox_address.h b/protocols/Tox/src/tox_address.h index 9ef57caba2..402dc59434 100644 --- a/protocols/Tox/src/tox_address.h +++ b/protocols/Tox/src/tox_address.h @@ -19,8 +19,7 @@ private: {
hexSize = size * 2;
hexData = (char*)mir_calloc(hexSize + 1);
- char *p = bin2hex(bin, size, hexData);
- while (*p++ = toupper(*p));
+ strupr(bin2hex(bin, size, hexData));
}
public:
ToxHexAddress(const char *hex, size_t size = TOX_ADDRESS_SIZE * 2) { Init(hex, size); }
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index ebbddf2ad8..83e4b883cb 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -91,8 +91,6 @@ HWND CToxProto::OnSearchAdvanced(HWND owner) const std::string query = T2Utf(text).str();
if (std::regex_search(query, match, regex)) {
- std::string address = match[1];
-
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
psr.id.a = mir_strdup(query.c_str());
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 251d901cf5..8ec1d5bc9a 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -307,21 +307,15 @@ void TwitterProto::MessageLoop(void*) if (m_iStatus != ID_STATUS_ONLINE)
break;
- // if(i%10 == 0)
- // UpdateFriends();
-
- if (m_iStatus != ID_STATUS_ONLINE)
- break;
+
UpdateStatuses(new_account, popups, tweetToMsg);
-
if (m_iStatus != ID_STATUS_ONLINE)
break;
if (i % 10 == 0)
UpdateMessages(new_account);
- if (new_account) // Not anymore!
- {
+ if (new_account) { // Not anymore!
new_account = false;
setByte(TWITTER_KEY_NEW, 0);
}
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp index afdb23413a..e7ff001450 100644 --- a/protocols/Twitter/src/oauth.cpp +++ b/protocols/Twitter/src/oauth.cpp @@ -172,7 +172,7 @@ wstring mir_twitter::OAuthConcatenateRequestElements(const wstring& httpMethod, map<wstring, wstring> mir_twitter::CrackURL(wstring url)
{
wstring scheme1, domain1, port1, path1, extraInfo, explicitPort;
- vector<wstring> urlToks, urlToks2, extraInfoToks;
+ vector<wstring> urlToks, urlToks2;
Split(url, urlToks, L':', false);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index 3001173ee1..460ef0df3b 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -67,7 +67,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu auth = OAuthWebRequestSubmit(url_WSTR, L"GET", nullptr, consumerKey_, consumerSecret_,
oauthAccessToken_, oauthAccessTokenSecret_, pin_);
}
- else if (meth == http::post) {
+ else {
// OAuthParameters postParams;
if (url_WSTR.size() > 0) { ppro_->debugLogW(L"**SLURP::POST - we have a URL: %s", url_WSTR.c_str()); }
if (consumerKey_.size() > 0) { ppro_->debugLogA("**SLURP::POST - we have a consumerKey"); }
@@ -82,7 +82,6 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu auth = OAuthWebRequestSubmit(url_WSTR, L"POST", &postParams, consumerKey_, consumerSecret_, oauthAccessToken_, oauthAccessTokenSecret_);
}
- else ppro_->debugLogA("**SLURP - There is something really wrong.. the http method was neither get or post.. WHY??");
std::string auth_STR = WideToUTF8(auth);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 638d5e2e37..ecae89cdd5 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -193,7 +193,7 @@ void CVkProto::OnLoggedOut() /////////////////////////////////////////////////////////////////////////////////////////
-void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
+void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest*)
{
debugLogA("CVkProto::OnOAuthAuthorize %d", reply->resultCode);
GrabCookies(reply);
@@ -275,7 +275,7 @@ void CVkProto::OnOAuthAuthorize(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq m_prevError = true;
}
- pReq = new AsyncHttpRequest();
+ AsyncHttpRequest *pReq = new AsyncHttpRequest();
pReq->requestType = REQUEST_POST;
pReq->flags = NLHRF_DUMPASTEXT | NLHRF_HTTP11;
pReq->m_szParam = szBody;
diff --git a/protocols/Weather/src/weather_contacts.cpp b/protocols/Weather/src/weather_contacts.cpp index f572b29564..b22f8a2222 100644 --- a/protocols/Weather/src/weather_contacts.cpp +++ b/protocols/Weather/src/weather_contacts.cpp @@ -205,7 +205,7 @@ static INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPA // check if there are 2 parts in the ID (svc/id) seperated by "/" // if not, don't let user change the setting GetDlgItemText(hwndDlg, IDC_ID, str, _countof(str)); - chop = wcsstr(str, L"/"); + chop = wcschr(str, '/'); if (chop == nullptr) EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE); else diff --git a/protocols/Weather/src/weather_conv.cpp b/protocols/Weather/src/weather_conv.cpp index 9ce8a16ad3..60577e99aa 100644 --- a/protocols/Weather/src/weather_conv.cpp +++ b/protocols/Weather/src/weather_conv.cpp @@ -543,9 +543,11 @@ INT_PTR GetDisplaySvcFunc(WPARAM wParam, LPARAM lParam) // pszID = original 2-part id, return the service internal name void GetSvc(wchar_t *pszID) { - wchar_t *chop = wcsstr(pszID, L"/"); - if (chop != nullptr) *chop = '\0'; - else pszID[0] = 0; + wchar_t *chop = wcschr(pszID, '/'); + if (chop != nullptr) + *chop = '\0'; + else + pszID[0] = 0; } // get the id use for update without the service internal name @@ -553,9 +555,11 @@ void GetSvc(wchar_t *pszID) // pszID = original 2-part id, return the single part id void GetID(wchar_t *pszID) { - wchar_t *chop = wcsstr(pszID, L"/"); - if (chop != nullptr) mir_wstrcpy(pszID, chop + 1); - else pszID[0] = 0; + wchar_t *chop = wcschr(pszID, '/'); + if (chop != nullptr) + mir_wstrcpy(pszID, chop + 1); + else + pszID[0] = 0; } //============ WEATHER ERROR CODE ============ diff --git a/protocols/Weather/src/weather_data.cpp b/protocols/Weather/src/weather_data.cpp index e36ae9dc5b..c6d88e4f1f 100644 --- a/protocols/Weather/src/weather_data.cpp +++ b/protocols/Weather/src/weather_data.cpp @@ -270,7 +270,7 @@ void GetDataValue(WIDATAITEM *UpdateData, wchar_t *Data, wchar_t** szData) if (UpdateData->End[0] != 0) end = wcsstr(szInfo, UpdateData->End); else - end = wcsstr(szInfo, L" "); + end = wcschr(szInfo, ' '); if (end != nullptr) { // set the ending location diff --git a/protocols/Weather/src/weather_ini.cpp b/protocols/Weather/src/weather_ini.cpp index bd60fcaaa0..81a2831736 100644 --- a/protocols/Weather/src/weather_ini.cpp +++ b/protocols/Weather/src/weather_ini.cpp @@ -371,7 +371,7 @@ static void LoadStationData(wchar_t *pszFile, wchar_t *pszShortFile, WIDATA *Dat } } // ignore comments and all lines without an '=' - Value = strstr(Line, "="); + Value = strchr(Line, '='); if (Value == nullptr) continue; // get the string before '=' (ValName) and after '=' (Value) diff --git a/protocols/YAMN/src/proto/netclient.h b/protocols/YAMN/src/proto/netclient.h index 99ec0888f1..dff43ae0f1 100644 --- a/protocols/YAMN/src/proto/netclient.h +++ b/protocols/YAMN/src/proto/netclient.h @@ -5,6 +5,8 @@ class CNetClient { public: CNetClient(): Stopped(FALSE) {} + virtual ~CNetClient() {} + virtual void Connect(const char* servername, const int port)=0; virtual void Send(const char *query)=0; virtual char* Recv(char *buf= nullptr, int buflen=65536)=0; diff --git a/protocols/YAMN/src/proto/netlib.h b/protocols/YAMN/src/proto/netlib.h index 778d6497ed..dfa3d93508 100644 --- a/protocols/YAMN/src/proto/netlib.h +++ b/protocols/YAMN/src/proto/netlib.h @@ -4,7 +4,7 @@ class CNLClient: public CNetClient { public: - CNLClient(): hConnection(nullptr) {} + CNLClient() {} void Connect(const char* servername, const int port) throw(DWORD); void Send(const char *query) throw(DWORD); char* Recv(char *buf= nullptr, int buflen = 65536) throw(DWORD); @@ -14,8 +14,8 @@ public: inline BOOL Connected() {return hConnection != nullptr;} protected: - HNETLIBCONN hConnection; - BOOL isTLSed; + HNETLIBCONN hConnection = nullptr; + BOOL isTLSed = false; int LocalNetlib_Send(HNETLIBCONN hConn, const char *buf, int len, int flags); int LocalNetlib_Recv(HNETLIBCONN hConn, char *buf, int len, int flags); }; diff --git a/protocols/YAMN/src/proto/pop3/pop3.cpp b/protocols/YAMN/src/proto/pop3/pop3.cpp index d47fac4836..d263d332e4 100644 --- a/protocols/YAMN/src/proto/pop3/pop3.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3.cpp @@ -34,51 +34,48 @@ //sets AckFlag char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BOOL NoTLS) { - char *temp = nullptr; - if (Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; - if (NetClient != nullptr) - delete NetClient; - SSL=UseSSL; - NetClient=new CNLClient; + delete NetClient; + SSL = UseSSL; + NetClient = new CNLClient; #ifdef DEBUG_DECODE - DebugLog(DecodeFile,"Connect:servername: %s port:%d\n",servername,port); + DebugLog(DecodeFile, "Connect:servername: %s port:%d\n", servername, port); #endif - POP3Error=EPOP3_CONNECT; - NetClient->Connect(servername,port); - POP3Error=0; - - if (SSL) - { - try { NetClient->SSLify(); } - catch (...) - { + POP3Error = EPOP3_CONNECT; + NetClient->Connect(servername, port); + POP3Error = 0; + + if (SSL) { + try { + NetClient->SSLify(); + } + catch (...) { NetClient->Disconnect(); return nullptr; } } - temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK); + char *temp = RecvRest(NetClient->Recv(), POP3_SEARCHACK); extern BOOL SSLLoaded; if (!NoTLS & !(SSL)) { if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + throw POP3Error = (DWORD)EPOP3_STOPPED; NetClient->Send("STLS\r\n"); free(temp); - temp=RecvRest(NetClient->Recv(),POP3_SEARCHACK); - if (AckFlag==POP3_FOK) { // Ok, we are going to tls + temp = RecvRest(NetClient->Recv(), POP3_SEARCHACK); + if (AckFlag == POP3_FOK) { // Ok, we are going to tls try { NetClient->SSLify(); - } catch (...) { + } + catch (...) { NetClient->Disconnect(); return nullptr; } -// temp = RecvRest(NetClient->Recv(),POP3_SEARCHACK); } - } -// SSL_DebugLog("Received: %s",temp); + } return temp; } @@ -91,6 +88,7 @@ char *CPop3Client::Connect(const char* servername,const int port,BOOL UseSSL, BO // new memory. New allocated memory has allocated size more bytes // This value can be selectable: if you think it is better to reallocate by 1kB size, select size to 1024, // default is 128. You do not need to use this parameter + char* CPop3Client::RecvRest(char* prev,int mode,int size) { int SizeRead=0; @@ -134,18 +132,17 @@ char* CPop3Client::RecvRest(char* prev,int mode,int size) // if you need to add condition for mode, insert it into switch statement BOOL CPop3Client::SearchFromEnd(char *end,int bs,int mode) { - while(bs>=0) - { - switch(mode) - { - case POP3_SEARCHDOT: - if (DOTLINE(end)) - return 1; - break; - case POP3_SEARCHNL: - if (ENDLINE(end)) - return 1; - break; + while (bs >= 0) { + switch (mode) { + case POP3_SEARCHDOT: + if (DOTLINE(end)) + return 1; + break; + + case POP3_SEARCHNL: + if (ENDLINE(end)) + return 1; + break; } end--; bs--; @@ -159,31 +156,26 @@ BOOL CPop3Client::SearchFromEnd(char *end,int bs,int mode) //if you need to add condition for mode, insert it into switch statement BOOL CPop3Client::SearchFromStart(char *start,int bs,int mode) { - while(bs>=0) - { - switch(mode) - { - case POP3_SEARCHOK: - if (OKLINE(start)) - { - AckFlag=POP3_FOK; - return 1; - } - break; - case POP3_SEARCHERR: - if (ERRLINE(start)) - { - AckFlag=POP3_FERR; - return 1; - } - break; - case POP3_SEARCHACK: - if (ACKLINE(start)) - { - OKLINE(start) ? AckFlag=POP3_FOK : AckFlag=POP3_FERR; - return 1; - } - break; + while (bs >= 0) { + switch (mode) { + case POP3_SEARCHOK: + if (OKLINE(start)) { + AckFlag = POP3_FOK; + return 1; + } + break; + case POP3_SEARCHERR: + if (ERRLINE(start)) { + AckFlag = POP3_FERR; + return 1; + } + break; + case POP3_SEARCHACK: + if (ACKLINE(start)) { + OKLINE(start) ? AckFlag = POP3_FOK : AckFlag = POP3_FERR; + return 1; + } + break; } start++; bs--; @@ -195,18 +187,18 @@ BOOL CPop3Client::SearchFromStart(char *start,int bs,int mode) //sets AckFlag char* CPop3Client::User(char* name) { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[128]; char *Result; mir_snprintf(query, "USER %s\r\n", name); NetClient->Send(query); - Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); - if (AckFlag==POP3_FERR) - throw POP3Error=(DWORD)EPOP3_BADUSER; - POP3Error=0; + Result = RecvRest(NetClient->Recv(), POP3_SEARCHACK); + if (AckFlag == POP3_FERR) + throw POP3Error = (DWORD)EPOP3_BADUSER; + POP3Error = 0; return Result; } @@ -215,16 +207,15 @@ char* CPop3Client::User(char* name) char* CPop3Client::Pass(char* pw) { if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[128]; - char *Result; - mir_snprintf(query, "PASS %s\r\n", pw); NetClient->Send(query); - Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); - if (AckFlag==POP3_FERR) - throw POP3Error=(DWORD)EPOP3_BADPASS; + + char *Result = RecvRest(NetClient->Recv(), POP3_SEARCHACK); + if (AckFlag == POP3_FERR) + throw POP3Error = (DWORD)EPOP3_BADPASS; return Result; } @@ -232,28 +223,28 @@ char* CPop3Client::Pass(char* pw) //sets AckFlag char* CPop3Client::APOP(char* name, char* pw, char* timestamp) { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[512]; char *Result; unsigned char digest[16]; - if (timestamp==nullptr) - throw POP3Error=(DWORD)EPOP3_APOP; + if (timestamp == nullptr) + throw POP3Error = (DWORD)EPOP3_APOP; mir_md5_state_s ctx; mir_md5_init(&ctx); - mir_md5_append(&ctx,(const unsigned char *)timestamp,(unsigned int)mir_strlen(timestamp)); - mir_md5_append(&ctx,(const unsigned char *)pw,(unsigned int)mir_strlen(pw)); + mir_md5_append(&ctx, (const unsigned char *)timestamp, (unsigned int)mir_strlen(timestamp)); + mir_md5_append(&ctx, (const unsigned char *)pw, (unsigned int)mir_strlen(pw)); mir_md5_finish(&ctx, digest); char hexdigest[40]; mir_snprintf(query, "APOP %s %s\r\n", name, bin2hex(digest, sizeof(digest), hexdigest)); NetClient->Send(query); - Result=RecvRest(NetClient->Recv(),POP3_SEARCHACK); - if (AckFlag==POP3_FERR) - throw POP3Error=(DWORD)EPOP3_BADUSER; + Result = RecvRest(NetClient->Recv(), POP3_SEARCHACK); + if (AckFlag == POP3_FERR) + throw POP3Error = (DWORD)EPOP3_BADUSER; return Result; } @@ -271,33 +262,32 @@ char* CPop3Client::Quit() //sets AckFlag char* CPop3Client::Stat() { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; - - char query[]="STAT\r\n"; + if (NetClient->Stopped) //check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; + char query[] = "STAT\r\n"; NetClient->Send(query); - return RecvRest(NetClient->Recv(),POP3_SEARCHACK); + return RecvRest(NetClient->Recv(), POP3_SEARCHACK); } //Performs "LIST" pop query and returns server response //sets AckFlag char* CPop3Client::List() { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; - char query[]="LIST\r\n"; + char query[] = "LIST\r\n"; NetClient->Send(query); - return RecvRest(NetClient->Recv(),POP3_SEARCHDOT); + return RecvRest(NetClient->Recv(), POP3_SEARCHDOT); } //Performs "TOP" pop query and returns server response //sets AckFlag char* CPop3Client::Top(int nr, int lines) { - if (NetClient->Stopped) //check if we can work with this POP3 client session + if (NetClient->Stopped) // check if we can work with this POP3 client session throw POP3Error=(DWORD)EPOP3_STOPPED; char query[128]; @@ -311,46 +301,45 @@ char* CPop3Client::Top(int nr, int lines) //sets AckFlag char* CPop3Client::Uidl(int nr) { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[128]; - - if (nr) - { + if (nr) { mir_snprintf(query, "UIDL %d\r\n", nr); NetClient->Send(query); - return RecvRest(NetClient->Recv(),POP3_SEARCHACK); + return RecvRest(NetClient->Recv(), POP3_SEARCHACK); } mir_snprintf(query, "UIDL\r\n"); NetClient->Send(query); - return RecvRest(NetClient->Recv(),POP3_SEARCHDOT); + return RecvRest(NetClient->Recv(), POP3_SEARCHDOT); } //Performs "DELE" pop query and returns server response //sets AckFlag char* CPop3Client::Dele(int nr) { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[128]; mir_snprintf(query, "DELE %d\r\n", nr); NetClient->Send(query); - return RecvRest(NetClient->Recv(),POP3_SEARCHACK); + return RecvRest(NetClient->Recv(), POP3_SEARCHACK); } + //Performs "RETR" pop query and returns server response //sets AckFlag char* CPop3Client::Retr(int nr) { - if (NetClient->Stopped) //check if we can work with this POP3 client session - throw POP3Error=(DWORD)EPOP3_STOPPED; + if (NetClient->Stopped) // check if we can work with this POP3 client session + throw POP3Error = (DWORD)EPOP3_STOPPED; char query[128]; - mir_snprintf(query, "RETR %d\r\n", nr); NetClient->Send(query); - RecvRest(NetClient->Recv(),POP3_SEARCHACK); + + RecvRest(NetClient->Recv(), POP3_SEARCHACK); return NetClient->Recv(); -}
\ No newline at end of file +} diff --git a/protocols/YAMN/src/proto/pop3/pop3.h b/protocols/YAMN/src/proto/pop3/pop3.h index 1fd7994bed..1005f3a47b 100644 --- a/protocols/YAMN/src/proto/pop3/pop3.h +++ b/protocols/YAMN/src/proto/pop3/pop3.h @@ -20,7 +20,7 @@ class CPop3Client { public: CPop3Client(): NetClient(nullptr), Stopped(FALSE) {} - ~CPop3Client() {if (NetClient != nullptr) delete NetClient;} + ~CPop3Client() { delete NetClient; } char* Connect(const char* servername,const int port=110,BOOL UseSSL=FALSE, BOOL NoTLS=FALSE); char* RecvRest(char* prev,int mode,int size=65536); diff --git a/protocols/YAMN/src/proto/pop3/pop3comm.cpp b/protocols/YAMN/src/proto/pop3/pop3comm.cpp index 4d85a94f0c..93f7885135 100644 --- a/protocols/YAMN/src/proto/pop3/pop3comm.cpp +++ b/protocols/YAMN/src/proto/pop3/pop3comm.cpp @@ -1488,7 +1488,7 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) while (!WS(finder)) finder++; //jump characters while (WS(finder)) finder++; //jump whitespace finderend = finder + 1; - if (1 != sscanf(finder, "%d", &queueptr->MailData->Size)) + if (1 != sscanf(finder, "%u", &queueptr->MailData->Size)) throw (DWORD)EPOP3_LIST; #ifdef DEBUG_DECODE DebugLog(DecodeFile,"<Nr>%d</Nr>\n",queueptr->MailData->Size); diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 50c98f7a98..3647e86176 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -168,7 +168,7 @@ INT_PTR SendMessageCmd(MCONTACT hContact, wchar_t *pwszInitialText) {
/* does the MCONTACT's protocol support IM messages? */
char *szProto = GetContactProto(hContact);
- if (!szProto || (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
+ if (!szProto || !(CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
return 1;
hContact = db_mc_tryMeta(hContact);
diff --git a/src/core/stdmsg/src/stdafx.h b/src/core/stdmsg/src/stdafx.h index b24778cf89..2d1a4e18e6 100644 --- a/src/core/stdmsg/src/stdafx.h +++ b/src/core/stdmsg/src/stdafx.h @@ -153,7 +153,7 @@ class CTabbedWindow : public CDlgBase public:
CCtrlPages m_tab;
- HWND m_hwndStatus;
+ HWND m_hwndStatus = nullptr;
CMsgDialog *m_pEmbed = nullptr;
CTabbedWindow();
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index 2ba762e39a..cd26b13f54 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -422,7 +422,7 @@ MIR_APP_DLL(void) Clist_EndRename(ClcData *dat, int save) ClcContact *contact;
if (g_clistApi.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr) != -1) {
- if (mir_wstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
+ if (mir_wstrcmp(contact->szText, text) && !wcschr(text, '\\')) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
wchar_t szFullName[256];
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index 6ed91bddda..0909e2cbad 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -49,7 +49,7 @@ class CColorChooserDlg : public CDlgBase int m_xPosition, m_yPosition;
int iCurrentHotTrack, iRows, iColumns;
- HWND m_hwndTarget, m_hwndChooser, hwndPreviousActiveWindow;
+ HWND m_hwndTarget, m_hwndChooser;
BOOL m_bForeground, bChoosing;
int CalculateCoordinatesToButton(POINT pt)
@@ -103,15 +103,14 @@ public: m_hwndParent = hwndDlg;
m_xPosition = rc.left + 3;
m_yPosition = IsWindowVisible(hwndChooser) ? rc.top - 1 : rc.top + 20;
- }
- bool OnInitDialog() override
- {
int iSquareRoot = (int)sqrt(static_cast<float>(16));
-
iColumns = iSquareRoot * iSquareRoot == 16 ? iSquareRoot : iSquareRoot + 1;
iRows = iSquareRoot;
+ }
+ bool OnInitDialog() override
+ {
RECT rc;
rc.top = rc.left = 100;
rc.right = 100 + iColumns * 25 + 1;
@@ -180,8 +179,6 @@ public: case WM_ACTIVATE:
if (wParam == WA_INACTIVE)
Close();
- else if ((wParam == WA_ACTIVE) || (wParam == WA_CLICKACTIVE))
- hwndPreviousActiveWindow = (HWND)lParam;
break;
case WM_MOUSEMOVE:
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 06b775cf7a..16071e63b4 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -164,8 +164,6 @@ PROTO_INTERFACE::PROTO_INTERFACE(const char *pszModuleName, const wchar_t *ptszU m_hmiReqAuth = hReqAuth;
m_hmiGrantAuth = hGrantAuth;
m_hmiRevokeAuth = hRevokeAuth;
-
- m_hWindowList = nullptr;
}
PROTO_INTERFACE::~PROTO_INTERFACE()
diff --git a/src/mir_core/src/CCtrlTreeView.cpp b/src/mir_core/src/CCtrlTreeView.cpp index eeb0eba76e..8463f4d16e 100644 --- a/src/mir_core/src/CCtrlTreeView.cpp +++ b/src/mir_core/src/CCtrlTreeView.cpp @@ -35,7 +35,8 @@ int ImageList_AddIcon_IconLibLoaded(HIMAGELIST hIml, int iconId) CCtrlTreeView::CCtrlTreeView(CDlgBase *dlg, int ctrlId) : CCtrlBase(dlg, ctrlId), - m_dwFlags(0) + m_dwFlags(0), + m_hDragItem(nullptr) {} void CCtrlTreeView::SetFlags(uint32_t dwFlags) diff --git a/src/mir_core/src/CDbLink.cpp b/src/mir_core/src/CDbLink.cpp index 48bbfb9a6c..13451f18ff 100644 --- a/src/mir_core/src/CDbLink.cpp +++ b/src/mir_core/src/CDbLink.cpp @@ -36,7 +36,8 @@ CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, DWORD i }
CDbLink::CDbLink(const char *szModule, const char *szSetting, BYTE type, wchar_t *szValue)
- : CDataLink(type)
+ : CDataLink(type),
+ m_iDefault(0)
{
m_szModule = mir_strdup(szModule);
m_szSetting = mir_strdup(szSetting);
diff --git a/tools/checksum/checksum.cpp b/tools/checksum/checksum.cpp index da062f4148..9a7c04aa04 100644 --- a/tools/checksum/checksum.cpp +++ b/tools/checksum/checksum.cpp @@ -408,7 +408,7 @@ int _tmain(int argc, wchar_t *argv[]) for (i = 1; i < argc; i++) {
if (!wcscmp(argv[i], L"/stdin") || !wcscmp(argv[i], L"/STDIN")) {
- while (fgetws(buf, sizeof(buf), stdin) != NULL) {
+ while (fgetws(buf, _countof(buf), stdin) != NULL) {
trtrim(buf);
res = process(buf);
cnt++;
|