diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-12 21:04:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-12 21:04:51 +0000 |
commit | d4c37690295db5515f19a8b1cd221b4222f16eeb (patch) | |
tree | bd098d252fcedd637febbddfa1dbf88eef68dc88 /plugins | |
parent | 5fea557d4846a9260c8b76f4157f3e722f7ddd2e (diff) |
warning fixes
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14932 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/AdvaImg/src/FreeImage/PluginGIF.cpp | 9 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/stopspam.cpp | 198 | ||||
-rwxr-xr-x | plugins/StopSpamMod/src/utilities.cpp | 4 | ||||
-rw-r--r-- | plugins/TrafficCounter/src/TrafficCounter.cpp | 69 | ||||
-rw-r--r-- | plugins/TrafficCounter/src/misc.cpp | 2 | ||||
-rw-r--r-- | plugins/TrafficCounter/src/statistics.cpp | 2 |
6 files changed, 119 insertions, 165 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp b/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp index 0153959ab8..ba67bc960b 100644 --- a/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp +++ b/plugins/AdvaImg/src/FreeImage/PluginGIF.cpp @@ -42,7 +42,6 @@ // Constant/Typedef declarations // ========================================================== - struct GIFinfo { BOOL read; //only really used when reading @@ -1015,19 +1014,19 @@ Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { } FreeImage_SetMetadataEx(FIMD_ANIMATION, dib, "Loop", ANIMTAG_LOOP, FIDT_LONG, 1, 4, &loop); - //Comment Extension - for( idx = 0; idx < info->comment_extension_offsets.size(); idx++ ) { + // Comment Extension + for (idx = 0; idx < info->comment_extension_offsets.size(); idx++) { io->seek_proc(handle, (long)info->comment_extension_offsets[idx], SEEK_SET); std::string comment; char buf[255]; io->read_proc(&b, 1, 1, handle); - while( b ) { + while (b) { io->read_proc(buf, b, 1, handle); comment.append(buf, b); io->read_proc(&b, 1, 1, handle); } comment.append(1, '\0'); - sprintf(buf, "Comment%d", idx); + sprintf(buf, "Comment%d", (int)idx); DWORD comment_size = (DWORD)comment.size(); FreeImage_SetMetadataEx(FIMD_COMMENTS, dib, buf, 1, FIDT_ASCII, comment_size, comment_size, comment.c_str()); } diff --git a/plugins/StopSpamMod/src/stopspam.cpp b/plugins/StopSpamMod/src/stopspam.cpp index e193ba91fc..e70a584b09 100755 --- a/plugins/StopSpamMod/src/stopspam.cpp +++ b/plugins/StopSpamMod/src/stopspam.cpp @@ -15,57 +15,51 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - #include "stdafx.h" -MIRANDA_HOOK_EVENT(ME_DB_CONTACT_ADDED, w, l) -{ - return 0; -} - MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, hContact, hDbEvent) { DBEVENTINFO dbei = { sizeof(dbei) }; dbei.cbBlob = db_event_getBlobSize(hDbEvent); if (dbei.cbBlob == -1) return 0; - + dbei.pBlob = (BYTE*)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); // if event is in protocol that is not despammed - if(!ProtoInList(dbei.szModule)) + if (!ProtoInList(dbei.szModule)) return 0; // event is an auth request - if(gbHandleAuthReq) { - if(!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { + if (gbHandleAuthReq) { + if (!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { MCONTACT hcntct = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact int a = db_get_b(hcntct, "CList", "NotOnList", 0); int b = !db_get_b(hcntct, pluginName, "Answered", 0); - - if(a && b) { + + if (a && b) { // ...send message - if(gbHideContacts) + if (gbHideContacts) db_set_b(hcntct, "CList", "Hidden", 1); - if(gbSpecialGroup) + if (gbSpecialGroup) db_set_ws(hcntct, "CList", "Group", gbSpammersGroup.c_str()); BYTE msg = 1; - if(gbIgnoreURL){ + if (gbIgnoreURL) { TCHAR* EventText = ReqGetText(&dbei); //else return NULL - msg=!IsUrlContains(EventText); + msg = !IsUrlContains(EventText); mir_free(EventText); } - if(gbInvisDisable) { - if(CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) + if (gbInvisDisable) { + if (CallProtoService(dbei.szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) msg = 0; - else if(db_get_w(hContact,dbei.szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) + else if (db_get_w(hContact, dbei.szModule, "ApparentMode", 0) == ID_STATUS_OFFLINE) msg = 0; //is it useful ? } - if(msg) { + if (msg) { ptrA buff(mir_utf8encodeW(variables_parse(gbAuthRepl, hcntct).c_str())); CallContactService(hcntct, PSS_MESSAGE, 0, (LPARAM)buff); } @@ -79,53 +73,49 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_ADDED, hContact, hDbEvent) MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) { MCONTACT hContact = (MCONTACT)w; - if(!l) //fix potential DEP crash + if (!l) //fix potential DEP crash return 0; DBEVENTINFO * dbei = (DBEVENTINFO*)l; - + // if event is in protocol that is not despammed - if(!ProtoInList(dbei->szModule)) - { + if (!ProtoInList(dbei->szModule)) { // ...let the event go its way return 0; } //do not check excluded contact - if(db_get_b(hContact, pluginName, "Answered", 0)) + if (db_get_b(hContact, pluginName, "Answered", 0)) return 0; - if(db_get_b(hContact, pluginName, "Excluded", 0)) - { - if(!db_get_b(hContact, "CList", "NotOnList", 0)) + if (db_get_b(hContact, pluginName, "Excluded", 0)) { + if (!db_get_b(hContact, "CList", "NotOnList", 0)) db_unset(hContact, pluginName, "Excluded"); return 0; } //we want block not only messages, i seen many types other eventtype flood - if(dbei->flags & DBEF_READ) + if (dbei->flags & DBEF_READ) // ...let the event go its way return 0; //mark contact which we trying to contact for exclude from check - if((dbei->flags & DBEF_SENT) && db_get_b(hContact, "CList", "NotOnList", 0) - && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && gbExclude) - { + if ((dbei->flags & DBEF_SENT) && db_get_b(hContact, "CList", "NotOnList", 0) + && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount) && gbExclude) { db_set_b(hContact, pluginName, "Excluded", 1); return 0; } // if message is from known or marked Answered contact - if(!db_get_b(hContact, "CList", "NotOnList", 0)) + if (!db_get_b(hContact, "CList", "NotOnList", 0)) // ...let the event go its way return 0; // if message is corrupted or empty it cannot be an answer. - if(!dbei->cbBlob || !dbei->pBlob) + if (!dbei->cbBlob || !dbei->pBlob) // reject processing of the event return 1; tstring message; - - if(dbei->flags & DBEF_UTF) - { + + if (dbei->flags & DBEF_UTF) { wchar_t* msg_u; - char* msg_a = mir_strdup(( char* )dbei->pBlob ); - mir_utf8decode( msg_a, &msg_u ); + char* msg_a = mir_strdup((char*)dbei->pBlob); + mir_utf8decode(msg_a, &msg_u); message = msg_u; } else @@ -135,47 +125,40 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) boost::algorithm::erase_all(message, "\r"); boost::algorithm::erase_all(message, "\n"); - - BYTE msg = 1; - if(gbInvisDisable) - { - if(CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) - msg = 0; - else if(db_get_w(hContact,dbei->szModule,"ApparentMode",0) == ID_STATUS_OFFLINE) - msg = 0; //is it useful ? + + bool bSendMsg = true; + if (gbInvisDisable) { + if (CallProtoService(dbei->szModule, PS_GETSTATUS, 0, 0) == ID_STATUS_INVISIBLE) + bSendMsg = false; + else if (db_get_w(hContact, dbei->szModule, "ApparentMode", 0) == ID_STATUS_OFFLINE) + bSendMsg = false; //is it useful ? } bool answered = false; - if(gbMathExpression) - { - if(boost::algorithm::all(message, boost::is_digit())) - { - int msg = _ttoi(message.c_str()); + if (gbMathExpression) { + if (boost::algorithm::all(message, boost::is_digit())) { + int num = _ttoi(message.c_str()); int math_answer = db_get_dw(hContact, pluginName, "MathAnswer", 0); - if(msg && math_answer) - answered = (msg == math_answer); + if (num && math_answer) + answered = (num == math_answer); } } - else if(!gbRegexMatch) - answered = gbCaseInsensitive?(!Stricmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))):( !mir_tstrcmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))); - else - { - if(gbCaseInsensitive) - { + else if (!gbRegexMatch) + answered = gbCaseInsensitive ? (!Stricmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))) : (!mir_tstrcmp(message.c_str(), (variables_parse(gbAnswer, hContact).c_str()))); + else { + if (gbCaseInsensitive) { std::string check(toUTF8(variables_parse(gbAnswer, hContact))), msg(toUTF8(message)); boost::algorithm::to_upper(check); boost::algorithm::to_upper(msg); boost::regex expr(check); answered = boost::regex_search(msg.begin(), msg.end(), expr); } - else - { + else { std::string check(toUTF8(variables_parse(gbAnswer, hContact))), msg(toUTF8(message)); boost::regex expr(check); answered = boost::regex_search(msg.begin(), msg.end(), expr); } } - if(answered) - { + if (answered) { // unhide contact db_unset(hContact, "CList", "Hidden"); @@ -185,82 +168,72 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) db_set_b(hContact, pluginName, "Answered", 1); //add contact permanently - if(gbAddPermanent) //do not use this ) + if (gbAddPermanent) //do not use this ) db_unset(hContact, "CList", "NotOnList"); // send congratulation - if(msg) - { - tstring prot=DBGetContactSettingStringPAN(NULL,dbei->szModule,"AM_BaseProto", _T("")); + if (bSendMsg) { + tstring prot = DBGetContactSettingStringPAN(NULL, dbei->szModule, "AM_BaseProto", _T("")); // for notICQ protocols or disable auto auth. reqwest - if((Stricmp(_T("ICQ"),prot.c_str()))||(!gbAutoReqAuth)) - { - char * buf=mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str()); + if ((Stricmp(_T("ICQ"), prot.c_str())) || (!gbAutoReqAuth)) { + char * buf = mir_utf8encodeW(variables_parse(gbCongratulation, hContact).c_str()); CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)buf); mir_free(buf); } // Note: For ANSI can be not work - if(!Stricmp(_T("ICQ"),prot.c_str())){ + if (!Stricmp(_T("ICQ"), prot.c_str())) { // grand auth. - if(gbAutoAuth) - CallProtoService(dbei->szModule, "/GrantAuth", w, 0); - // add contact to server list and local group - if(gbAutoAddToServerList) - { + if (gbAutoAuth) + CallProtoService(dbei->szModule, "/GrantAuth", w, 0); + // add contact to server list and local group + if (gbAutoAddToServerList) { db_set_ws(hContact, "CList", "Group", gbAutoAuthGroup.c_str()); CallProtoService(dbei->szModule, "/AddServerContact", w, 0); db_unset(hContact, "CList", "NotOnList"); }; // auto auth. reqwest with send congratulation - if(gbAutoReqAuth) - CallContactService(hContact,PSS_AUTHREQUEST,0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str()); + if (gbAutoReqAuth) + CallContactService(hContact, PSS_AUTHREQUEST, 0, (LPARAM)variables_parse(gbCongratulation, hContact).c_str()); } } return 0; } // URL contains check - msg=(msg&&gbIgnoreURL)?(!IsUrlContains((TCHAR *) message.c_str())):msg; + bSendMsg = (bSendMsg && gbIgnoreURL) ? (!IsUrlContains((TCHAR *)message.c_str())) : bSendMsg; // if message message does not contain infintite talk protection prefix // and question count for this contact is less then maximum - if(msg) - { - if((!gbInfTalkProtection || tstring::npos==message.find(_T("StopSpam automatic message:\r\n"))) - && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount)) - { + if (bSendMsg) { + if ((!gbInfTalkProtection || tstring::npos == message.find(_T("StopSpam automatic message:\r\n"))) + && (!gbMaxQuestCount || db_get_dw(hContact, pluginName, "QuestionCount", 0) < gbMaxQuestCount)) { // send question tstring q; - if(gbInfTalkProtection) + if (gbInfTalkProtection) q += _T("StopSpam automatic message:\r\n"); - if(gbMathExpression) - { //parse math expression in question + if (gbMathExpression) { //parse math expression in question tstring tmp_question = gbQuestion; std::list<int> args; std::list<TCHAR> actions; tstring::size_type p1 = gbQuestion.find(_T("X")), p2 = 0; const tstring expr_chars = _T("X+-/*"), expr_acts = _T("+-/*"); - while(p1 < gbQuestion.length() && p1 != tstring::npos && expr_chars.find(gbQuestion[p1]) != tstring::npos) - { + while (p1 < gbQuestion.length() && p1 != tstring::npos && expr_chars.find(gbQuestion[p1]) != tstring::npos) { std::string arg; p2 = p1; - for(p1 = gbQuestion.find(_T("X"), p1); (p1 < gbQuestion.length()) && (gbQuestion[p1] == L'X'); ++p1) + for (p1 = gbQuestion.find(_T("X"), p1); (p1 < gbQuestion.length()) && (gbQuestion[p1] == L'X'); ++p1) arg += get_random_num(1); tmp_question.replace(p2, arg.size(), toUTF16(arg)); args.push_back(atoi(arg.c_str())); - if((p1 < gbQuestion.length()) && (p1 != tstring::npos) && (expr_acts.find(gbQuestion[p1]) != tstring::npos)) + if ((p1 < gbQuestion.length()) && (p1 != tstring::npos) && (expr_acts.find(gbQuestion[p1]) != tstring::npos)) actions.push_back(gbQuestion[p1]); ++p1; } int math_answer = 0; math_answer = args.front(); args.pop_front(); - while(!args.empty()) - { - if(!actions.empty()) - { - switch(actions.front()) - { + while (!args.empty()) { + if (!actions.empty()) { + switch (actions.front()) { case _T('+'): { math_answer += args.front(); @@ -303,31 +276,19 @@ MIRANDA_HOOK_EVENT(ME_DB_EVENT_FILTER_ADD, w, l) DWORD questCount = db_get_dw(hContact, pluginName, "QuestionCount", 0); db_set_dw(hContact, pluginName, "QuestionCount", questCount + 1); } - else - { -/* if (gbDosServiceExist) - { - if(gbDosServiceIntegration) - { - int i; - i = rand()%255*13; - CallService(MS_DOS_SERVICE, hContact, (LPARAM)i); - } - } */ - if(gbIgnoreContacts) - { + else { + if (gbIgnoreContacts) db_set_dw(hContact, "Ignore", "Mask1", 0x0000007F); - } } } - if(gbHideContacts) + if (gbHideContacts) db_set_b(hContact, "CList", "Hidden", 1); - if(gbSpecialGroup) + if (gbSpecialGroup) db_set_ws(hContact, "CList", "Group", gbSpammersGroup.c_str()); db_set_b(hContact, "CList", "NotOnList", 1); // save first message from contact - if (db_get_dw(hContact, pluginName, "QuestionCount", 0)<2){ + if (db_get_dw(hContact, pluginName, "QuestionCount", 0) < 2) { dbei->flags |= DBEF_READ; db_event_add(hContact, dbei); }; @@ -342,12 +303,11 @@ MIRANDA_HOOK_EVENT(ME_DB_CONTACT_SETTINGCHANGED, w, l) DBCONTACTWRITESETTING * cws = (DBCONTACTWRITESETTING*)l; // if CList/NotOnList is being deleted then remove answeredSetting - if(mir_strcmp(cws->szModule, "CList")) + if (mir_strcmp(cws->szModule, "CList")) return 0; - if(mir_strcmp(cws->szSetting, "NotOnList")) + if (mir_strcmp(cws->szSetting, "NotOnList")) return 0; - if(!cws->value.type) - { + if (!cws->value.type) { db_unset(hContact, pluginName, "Answered"); db_unset(hContact, pluginName, "QuestionCount"); } diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 84003bde49..bbbc910ed0 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -352,9 +352,9 @@ void CleanThread() for(std::list<std::string>::iterator i = protocols.begin(); i != end; ++i)
{
if(gbDelAllTempory)
- boost::thread *thr = new boost::thread(boost::bind(&CleanProtocolTmpThread, *i));
+ new boost::thread(boost::bind(&CleanProtocolTmpThread, *i));
if(gbDelExcluded)
- boost::thread *thr = new boost::thread(boost::bind(&CleanProtocolExclThread, *i));
+ new boost::thread(boost::bind(&CleanProtocolExclThread, *i));
}
}
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 9a61516f8c..788bf0b63e 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -1,5 +1,5 @@ /*
-Traffic Counter plugin for Miranda IM
+Traffic Counter plugin for Miranda IM
Copyright 2007-2012 Mironych.
This program is free software; you can redistribute it and/or
@@ -52,7 +52,7 @@ WORD notify_send_size = 0; WORD notify_recv_size = 0;
//
// Цвет шрифта и фона
-COLORREF Traffic_BkColor,Traffic_FontColor;
+COLORREF Traffic_BkColor, Traffic_FontColor;
//notify
int Traffic_PopupBkColor;
@@ -99,7 +99,7 @@ COLORREF KeyColor; //---------------------------------------------------------------------------------------------
-PLUGININFOEX pluginInfoEx =
+PLUGININFOEX pluginInfoEx =
{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
@@ -116,7 +116,7 @@ PLUGININFOEX pluginInfoEx = extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
- return &pluginInfoEx;
+ return &pluginInfoEx;
}
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
@@ -890,16 +890,16 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP // Значения для выбранного периода.
ProtoList[i].TotalRecvTraffic =
Stat_GetItemValue(1 << i,
- unOptions.PeriodForShow + 1,
- Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 1);
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 1);
ProtoList[i].TotalSentTraffic =
Stat_GetItemValue(1 << i,
- unOptions.PeriodForShow + 1,
- Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 2);
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 2);
ProtoList[i].Total.Timer =
Stat_GetItemValue(1 << i,
- unOptions.PeriodForShow + 1,
- Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 4);
+ unOptions.PeriodForShow + 1,
+ Stat_GetRecordsNumber(i, unOptions.PeriodForShow + 1) - 1, 4);
OverallInfo.TotalRecvTraffic += ProtoList[i].TotalRecvTraffic;
OverallInfo.TotalSentTraffic += ProtoList[i].TotalSentTraffic;
}
@@ -924,21 +924,21 @@ LRESULT CALLBACK TrafficCounterWndProc_MW(HWND hwnd, UINT msg, WPARAM wParam, LP && stNow.wMinute == 0
&& stNow.wSecond == 0)
|| (unOptions.PeriodForShow == 1
- && DayOfWeek(stNow.wDay, stNow.wMonth, stNow.wYear) == 1
- && stNow.wHour == 0
- && stNow.wMinute == 0
- && stNow.wSecond == 0)
+ && DayOfWeek(stNow.wDay, stNow.wMonth, stNow.wYear) == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0)
|| (unOptions.PeriodForShow == 2
- && stNow.wDay == 1
- && stNow.wHour == 0
- && stNow.wMinute == 0
- && stNow.wSecond == 0)
+ && stNow.wDay == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0)
|| (unOptions.PeriodForShow == 3
- && stNow.wMonth == 1
- && stNow.wDay == 1
- && stNow.wHour == 0
- && stNow.wMinute == 0
- && stNow.wSecond == 0))
+ && stNow.wMonth == 1
+ && stNow.wDay == 1
+ && stNow.wHour == 0
+ && stNow.wMinute == 0
+ && stNow.wSecond == 0))
OverallInfo.Total.TimeAtStart = CurrentTimeMs;
if (online_count > 0) {
@@ -1152,12 +1152,11 @@ void DestroyProtocolList(void) int ProtocolAckHook(WPARAM, LPARAM lParam)
{
- ACKDATA* pAck = (ACKDATA*)lParam;
- WORD i;
+ ACKDATA *pAck = (ACKDATA*)lParam;
if (ACKTYPE_STATUS == pAck->type) {
if (ID_STATUS_OFFLINE == pAck->lParam) {
- for (i = 0; i < NumberOfAccounts; i++) {
+ for (int i = 0; i < NumberOfAccounts; i++) {
if (!ProtoList[i].name) continue;
if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
ProtocolIsOffLine(i);
@@ -1167,7 +1166,7 @@ int ProtocolAckHook(WPARAM, LPARAM lParam) }
else {
if ((pAck->lParam >= ID_STATUS_ONLINE) && (pAck->lParam <= ID_STATUS_OUTTOLUNCH)) {
- for (i = 0; i < NumberOfAccounts; i++)
+ for (int i = 0; i < NumberOfAccounts; i++)
if (!mir_strcmp(ProtoList[i].name, pAck->szModule)) {
ProtocolIsOnLine(i);
break;
@@ -1201,33 +1200,28 @@ int UpdateFonts(WPARAM, LPARAM) void UpdateTrafficWindowSize(void)
{
- if (Traffic_FrameID != NULL) {
+ if (Traffic_FrameID != NULL)
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, Traffic_FrameID), TrafficWindowHeight());
- }
}
unsigned short int TrafficWindowHeight(void)
{
- int ActProto, MaxWndHeight;
+ int ActProto = unOptions.ShowOverall + unOptions.ShowSummary;
- for (int i = 0, ActProto = unOptions.ShowOverall + unOptions.ShowSummary; i < NumberOfAccounts; i++)
+ for (int i = 0; i < NumberOfAccounts; i++)
ActProto += ProtoList[i].Visible && ProtoList[i].Enabled;
// Высота строки минимум 16 пикселей (для иконки).
Traffic_LineHeight = TrafficFontHeight > 16 ? TrafficFontHeight : 16;
// Высота фрейма равна количеству строк.
- MaxWndHeight = ActProto * Traffic_LineHeight
- + Traffic_AdditionSpace * (ActProto - 1)
- + 4;
-
+ int MaxWndHeight = ActProto * Traffic_LineHeight + Traffic_AdditionSpace * (ActProto - 1) + 4;
return (MaxWndHeight < TrafficFontHeight) ? 0 : MaxWndHeight;
}
// Функция вносит изменения в ProtoList при коммутации аккаунтов
int OnAccountsListChange(WPARAM wParam, LPARAM lParam)
{
- BYTE i;
PROTOACCOUNT *acc = (PROTOACCOUNT*)lParam;
switch (wParam) {
@@ -1236,9 +1230,10 @@ int OnAccountsListChange(WPARAM wParam, LPARAM lParam) DestroyProtocolList();
CreateProtocolList();
break;
+
case PRAC_CHANGED:
case PRAC_CHECKED:
- for (i = 0; i < NumberOfAccounts; i++)
+ for (int i = 0; i < NumberOfAccounts; i++)
if (!mir_strcmp(acc->szModuleName, ProtoList[i].name))
ProtoList[i].Enabled = acc->bIsEnabled;
break;
diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index c798f14add..c4e43379dc 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -47,7 +47,7 @@ WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) *RowItemsList = (RowItemInfo*)mir_realloc(*RowItemsList, sizeof(RowItemInfo) * (c + 1));
// Разбираем тег.
- _stscanf(begin + 1, _T("%c%d"),
+ _stscanf(begin + 1, _T("%c%hd"),
&((*RowItemsList)[c].Alignment),
&((*RowItemsList)[c].Interval));
diff --git a/plugins/TrafficCounter/src/statistics.cpp b/plugins/TrafficCounter/src/statistics.cpp index 511b6344b5..4f40588061 100644 --- a/plugins/TrafficCounter/src/statistics.cpp +++ b/plugins/TrafficCounter/src/statistics.cpp @@ -240,7 +240,7 @@ INT_PTR CALLBACK DlgProcOptStatistics(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case NM_CLICK:
case LVN_ITEMCHANGED:
{
- DWORD i, j = -1, dwTotalIncoming = 0, dwTotalOutgoing = 0;
+ DWORD j = -1, dwTotalIncoming = 0, dwTotalOutgoing = 0;
i = SendDlgItemMessage(hwndDlg, IDC_LIST_DATA, LVM_GETSELECTEDCOUNT, 0, 0);
for (; i--;) {
|