From 4a6b3a2acf91421a958b9946e15a149cac29e7b5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 17 Aug 2015 19:39:01 +0000 Subject: warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@14980 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/src/Engine/Mind.cpp | 188 ++++++++---------- plugins/Boltun/src/Engine/TalkEngine.cpp | 212 +++++++++----------- plugins/Boltun/src/boltun.cpp | 70 +++---- plugins/Boltun/src/stdafx.h | 1 + plugins/Clist_modern/src/modern_aniavatars.cpp | 2 +- plugins/Clist_modern/src/modern_awaymsg.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 5 +- plugins/Clist_modern/src/modern_clcitems.cpp | 2 +- plugins/Clist_modern/src/modern_clcpaint.cpp | 110 +++++------ plugins/Clist_modern/src/modern_clcutils.cpp | 6 +- plugins/Clist_modern/src/modern_gdiplus.cpp | 8 +- plugins/Clist_modern/src/modern_skinbutton.cpp | 150 ++++++--------- plugins/Clist_modern/src/modern_skinengine.cpp | 47 +++-- plugins/Clist_modern/src/modern_skinopt.cpp | 28 +-- plugins/Clist_modern/src/modern_statusbar.cpp | 50 ++--- plugins/Clist_modern/src/modern_viewmodebar.cpp | 45 ++--- plugins/Clist_nicer/src/clc.cpp | 1 - plugins/Clist_nicer/src/clcpaint.cpp | 245 ++++++++++++------------ plugins/Db3x_mmap/src/dbcrypt.cpp | 6 +- plugins/Db3x_mmap/src/dbsettings.cpp | 2 +- plugins/DbEditorPP/src/copymodule.cpp | 53 +++-- plugins/DbEditorPP/src/exportimport.cpp | 42 ++-- plugins/DbEditorPP/src/renamemodule.cpp | 10 +- plugins/FTPFileYM/src/ftpfile.cpp | 140 ++++++-------- plugins/FloatingContacts/src/thumbs.cpp | 8 +- plugins/IEView/src/Options.cpp | 4 +- plugins/IEView/src/Template.cpp | 126 +++++------- plugins/IEView/src/Template.h | 56 +++--- protocols/FacebookRM/src/communication.cpp | 64 +++---- 29 files changed, 731 insertions(+), 952 deletions(-) diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index 5158a459e6..11e636cd81 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -80,8 +80,7 @@ vector Mind::Parse(tstring s) return res; s.resize(len); int it = 0; - while (it != len) - { + while (it != len) { while (it != len && _istspace(s[it])) it++; if (it == len) @@ -110,19 +109,15 @@ void Mind::Load(tstring filename) bool start = true; - try - { - while (file.good()) - { + try { + while (file.good()) { getline(file, st); if (st.empty()) break; line++; - if (start) - { - if (st[0] == 65279) - { + if (start) { + if (st[0] == 65279) { st.erase(0, 1); fileTypeMark = true; } @@ -136,16 +131,13 @@ void Mind::Load(tstring filename) c = co = new TCHAR[count + 1]; mir_tstrcpy(c, st.c_str()); size_t pos = 0; - while (pos < count && _istspace(*c)) - { + while (pos < count && _istspace(*c)) { ++pos; ++c; } count -= pos; - if (count > 2) - { - switch (*c) - { + if (count > 2) { + switch (*c) { case '(': if (c[count - 1] != ')') abort(); @@ -160,13 +152,15 @@ void Mind::Load(tstring filename) toLowerStr(c); { WordsList l(c); - if (!l.IsEmpty()) + if (!l.IsEmpty()) { if (l.IsQuestion()) data->qkeywords.insert(make_pair(l, s1)); else data->keywords.insert(make_pair(l, s1)); + } } break; + case '{': if (c[count - 1] != '}') abort(); @@ -188,6 +182,7 @@ void Mind::Load(tstring filename) data->specialEscapes.insert(make_pair(l, s1)); } break; + case '[': if (c[count - 1] != ']') throw error; @@ -202,6 +197,7 @@ void Mind::Load(tstring filename) toLowerStr(c); data->widelyUsed.insert(make_pair(c, s1)); break; + case '<': if (c[count - 1] != '>') throw error; @@ -213,62 +209,56 @@ void Mind::Load(tstring filename) ++c; count -= 2; c[count] = '\0'; - if (mir_tstrcmp(c, _T("QUESTION")) == 0) - { + if (mir_tstrcmp(c, _T("QUESTION")) == 0) { toLowerStr(c); data->question.insert(s1); } - else - if (mir_tstrcmp(c, _T("IGNORED")) == 0) - { - toLowerStr(c); - data->special.insert(s1); - } - else - if (mir_tstrcmp(c, _T("ESCAPE")) == 0) - { - data->escape.push_back(s1); - } - else - if (mir_tstrcmp(c, _T("FAILURE")) == 0) - { - data->failure.push_back(s1); - } - else - if (mir_tstrcmp(c, _T("REPEAT")) == 0) - { - data->repeats.push_back(s1); - } - else - { - if (mir_tstrcmp(c, _T("INITIAL")) != 0) - throw error; - data->initial.push_back(s1); - } + else if (mir_tstrcmp(c, _T("IGNORED")) == 0) { + toLowerStr(c); + data->special.insert(s1); + } + else if (mir_tstrcmp(c, _T("ESCAPE")) == 0) { + data->escape.push_back(s1); + } + else if (mir_tstrcmp(c, _T("FAILURE")) == 0) { + data->failure.push_back(s1); + } + else if (mir_tstrcmp(c, _T("REPEAT")) == 0) { + data->repeats.push_back(s1); + } + else { + if (mir_tstrcmp(c, _T("INITIAL")) != 0) + throw error; + data->initial.push_back(s1); + } break; + case '@': - { if (file.eof()) throw error; + getline(file, s1); line++; format(s1); ++c; count -= 1; toLowerStr(c); - tstring sc(c); - int count1 = (int)s1.length(); - TCHAR *c = new TCHAR[count1 + 1]; - mir_tstrcpy(c, s1.c_str()); - CharLower(c); - s1 = c; - delete c; - vector strs = Parse(s1); - data->raliases.insert(make_pair(sc, strs)); - for (vector::const_iterator it = strs.begin(); it != strs.end(); ++it) - data->aliases.insert(make_pair(*it, sc)); - } - break; + { + std::transform(s1.begin(), s1.end(), s1.begin(), ::tolower); + int count1 = (int)s1.length(); + TCHAR *c = new TCHAR[count1 + 1]; + mir_tstrcpy(c, s1.c_str()); + CharLower(c); + s1 = c; + delete c; + vector strs = Parse(s1); + tstring sc(c); + data->raliases.insert(make_pair(sc, strs)); + for (vector::const_iterator it = strs.begin(); it != strs.end(); ++it) + data->aliases.insert(make_pair(*it, sc)); + } + break; + default: if (file.eof()) throw error; @@ -279,25 +269,21 @@ void Mind::Load(tstring filename) data->study.insert(make_pair(c, s1)); } } - else - if (count) - { - if (file.eof()) - throw error; - getline(file, s1); - line++; - format(s1); - data->study.insert(make_pair(c, s1)); - } + else if (count) { + if (file.eof()) + throw error; + getline(file, s1); + line++; + format(s1); + data->study.insert(make_pair(c, s1)); + } } if (!file.eof()) - { throw error; - } + delete co; } - catch (...) - { + catch (...) { throw CorruptedMind(line); delete co; } @@ -315,80 +301,64 @@ void Mind::Save(tstring filename) const if (fileTypeMark) file << TCHAR(65279); - for (string_mmap::iterator it = data->study.begin(); it != data->study.end(); ++it) - { + for (string_mmap::iterator it = data->study.begin(); it != data->study.end(); ++it) { file << (*it).first << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (multimap::iterator it = data->keywords.begin(); it != data->keywords.end(); ++it) - { + for (multimap::iterator it = data->keywords.begin(); it != data->keywords.end(); ++it) { file << _T(" (") << (tstring)(*it).first << _T(")") << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (multimap::iterator it = data->qkeywords.begin(); it != data->qkeywords.end(); ++it) - { + for (multimap::iterator it = data->qkeywords.begin(); it != data->qkeywords.end(); ++it) { file << _T(" (") << (tstring)(*it).first << _T(")") << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (multimap::iterator it = data->specialEscapes.begin(); it != data->specialEscapes.end(); ++it) - { + for (multimap::iterator it = data->specialEscapes.begin(); it != data->specialEscapes.end(); ++it) { file << _T(" {") << (tstring)(*it).first << _T("}") << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (multimap::iterator it = data->qspecialEscapes.begin(); it != data->qspecialEscapes.end(); ++it) - { + for (multimap::iterator it = data->qspecialEscapes.begin(); it != data->qspecialEscapes.end(); ++it) { file << _T(" {") << (tstring)(*it).first << _T("}") << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (string_mmap::iterator it = data->widelyUsed.begin(); it != data->widelyUsed.end(); ++it) - { + for (string_mmap::iterator it = data->widelyUsed.begin(); it != data->widelyUsed.end(); ++it) { file << _T(" [") << (*it).first << _T("]") << _T('\r') << endl; file << (*it).second << _T('\r') << endl; } - for (set::iterator it = data->question.begin(); it != data->question.end(); ++it) - { + for (set::iterator it = data->question.begin(); it != data->question.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (set::iterator it = data->special.begin(); it != data->special.end(); ++it) - { + for (set::iterator it = data->special.begin(); it != data->special.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (string_vec::iterator it = data->escape.begin(); it != data->escape.end(); ++it) - { + for (string_vec::iterator it = data->escape.begin(); it != data->escape.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (string_vec::iterator it = data->initial.begin(); it != data->initial.end(); ++it) - { + for (string_vec::iterator it = data->initial.begin(); it != data->initial.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (string_vec::iterator it = data->failure.begin(); it != data->failure.end(); ++it) - { + for (string_vec::iterator it = data->failure.begin(); it != data->failure.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (string_vec::iterator it = data->repeats.begin(); it != data->repeats.end(); ++it) - { + for (string_vec::iterator it = data->repeats.begin(); it != data->repeats.end(); ++it) { file << _T(" ") << _T('\r') << endl; file << (*it) << _T('\r') << endl; } - for (map>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it) - { + for (map>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it) { tstring s; const vector& v = (*it).second; bool first = true; - for (vector::const_iterator it1 = v.begin(); it1 != v.end(); ++it1) - { - if (first) - { + for (vector::const_iterator it1 = v.begin(); it1 != v.end(); ++it1) { + if (first) { first = false; s = *it1; } - else - { + else { s += _T(" ") + *it1; } } @@ -404,8 +374,7 @@ void Mind::LoadSmiles(tstring filename) data->smiles.clear(); tstring s; unsigned int l = 0; - while (!file.eof()) - { + while (!file.eof()) { getline(file, s); if (s.length() > l) l = (int)s.length(); @@ -420,8 +389,7 @@ void Mind::LoadSmiles(void *smiles, size_t size) TCHAR* buf = (TCHAR*)smiles; unsigned l = 0; TCHAR* end = buf + size; - while (buf != end) - { + while (buf != end) { TCHAR *lend = buf; while (lend != end && *lend != _T('\r')) lend++; diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp index 1c4465402b..ffee42b7c7 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.cpp +++ b/plugins/Boltun/src/Engine/TalkEngine.cpp @@ -43,28 +43,23 @@ void TalkBot::UpdateStartChar(tstring& str) if (!makeLowercase) return; size_t l = str.length(); - if (l) - { + if (l) { //Answers starting with ' ' must remain unchanged. - if (str[0] == _T(' ')) - { + if (str[0] == _T(' ')) { str = str.substr(1); return; } - for (size_t i = 0; i < l; i++) - { + for (size_t i = 0; i < l; i++) { TCHAR cl = (TCHAR)CharLower((LPTSTR)(void*)(long)str[i]); TCHAR cu = (TCHAR)CharUpper((LPTSTR)(void*)(long)str[i]); - if (i != l - 1) - { + if (i != l - 1) { //Do not react to BLONDE ANSWERS TCHAR ncl = (TCHAR)CharLower((LPTSTR)(void*)(long)str[i + 1]); TCHAR ncu = (TCHAR)CharUpper((LPTSTR)(void*)(long)str[i + 1]); if (ncl != ncu && str[i + 1] == ncu) break; } - if (cl != cu) - { + if (cl != cu) { str[i] = cl; break; } @@ -99,16 +94,13 @@ tstring TalkBot::ReplaceAliases(const tstring &message) tstring result; map sm; //Find smiles - for (size_t i = 0; i < sentence.length() - 1; i++) - { + for (size_t i = 0; i < sentence.length() - 1; i++) { unsigned max = (int)(sentence.length() - i); if (max > mind.GetData()->maxSmileLen) max = mind.GetData()->maxSmileLen; - for (unsigned j = max; j > 0; j--) - { + for (unsigned j = max; j > 0; j--) { tstring item = sentence.substr(i, j); - if (mind.GetData()->smiles.find(item) != mind.GetData()->smiles.end()) - { + if (mind.GetData()->smiles.find(item) != mind.GetData()->smiles.end()) { sm[i] = item; sentence.replace(i, j, _T("\1")); break; @@ -118,15 +110,12 @@ tstring TalkBot::ReplaceAliases(const tstring &message) int len = (int)sentence.length(); bool hadQuestionSigns = false; int it = 0; - while (it != len) - { - while (it != len && _tcschr(dividers, sentence[it])) - { + while (it != len) { + while (it != len && _tcschr(dividers, sentence[it])) { if (sentence[it] == _T('?')) hadQuestionSigns = true; map::iterator smit; - if (sentence[it] == '\1') - { + if (sentence[it] == '\1') { smit = sm.find(it); result.append((*smit).second); } @@ -137,8 +126,7 @@ tstring TalkBot::ReplaceAliases(const tstring &message) if (it == len) break; int start = it; - while (true) - { + while (true) { while (it != len && !_tcschr(dividers, sentence[it])) it++; if (it == len || sentence[it] != _T('-')) @@ -169,38 +157,37 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact //Part 2 if (FindExact(contactData, incomingMessage, mind.GetData()->study, res)) //study { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(LOOKSLIKE, _T("(study_all) ")+res)); -#else + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(LOOKSLIKE, _T("(study_all) ") + res)); + #else mm.insert(make_pair(LOOKSLIKE, res)); -#endif + #endif maxValue = LOOKSLIKE; } //Part 3 vector sentences; SplitSectences(incomingMessage, sentences); ValueChooser<> ch(sentences, true); //Using random order of sentences. - while ((res = ch.GetString()) != _T("")) - { + while ((res = ch.GetString()) != _T("")) { //Part 4 if (FindExact(contactData, res, mind.GetData()->widelyUsed, res)) //widelyUsed { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(BEST, _T("(widelyused_sent) ")+res)); -#else + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(BEST, _T("(widelyused_sent) ") + res)); + #else mm.insert(make_pair(BEST, res)); -#endif + #endif if (maxValue > BEST) maxValue = BEST; } //Part 5 if (FindExact(contactData, res, mind.GetData()->study, res)) //study { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(LOOKSLIKE, _T("(study_sent) ")+res)); -#else + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(LOOKSLIKE, _T("(study_sent) ") + res)); + #else mm.insert(make_pair(LOOKSLIKE, res)); -#endif + #endif if (maxValue > LOOKSLIKE) maxValue = LOOKSLIKE; } @@ -211,13 +198,12 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact //Part 7, 8 res = _T(""); FindByKeywords(contactData, keywords, res/*, ures*/, isQuestion); //keywords - if (res != _T("")) - { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(LOOKSLIKE, _T("(keywords) ")+res)); -#else + if (res != _T("")) { + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(LOOKSLIKE, _T("(keywords) ") + res)); + #else mm.insert(make_pair(LOOKSLIKE, res)); -#endif + #endif if (maxValue > LOOKSLIKE) maxValue = LOOKSLIKE; } @@ -231,39 +217,38 @@ tstring TalkBot::AllReplies(const tstring &incomingMessage, ContactData *contact if (maxValue > LOOKSLIKE2) maxValue = LOOKSLIKE2; }*/ - //Part 9 + //Part 9 if (FindByOthers(contactData, otherwords, res, isQuestion)) //specialEscapes { -#ifdef DEBUG_PREFIXES - mm.insert(make_pair(BAD, _T("(otherwords) ")+res)); -#else + #ifdef DEBUG_PREFIXES + mm.insert(make_pair(BAD, _T("(otherwords) ") + res)); + #else mm.insert(make_pair(BAD, res)); -#endif + #endif if (maxValue > BAD) maxValue = BAD; } } - if (!beSilent) - { + if (!beSilent) { //Part 10 if (FindAny(contactData->escape, res)) //escape { -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES mm.insert(make_pair(FAIL, _T("(escape) ") + res)); -#else + #else mm.insert(make_pair(FAIL, res)); -#endif + #endif if (maxValue > FAIL) maxValue = FAIL; } //Part 11 if (!understandAlways && FindAny(contactData->failure, res)) //failure { -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES mm.insert(make_pair(FAIL, _T("(failure) ") + res)); -#else + #else mm.insert(make_pair(FAIL, res)); -#endif + #endif if (maxValue > FAIL) maxValue = FAIL; } @@ -280,26 +265,24 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage, delete[] str; ContactData *contactData = contactDatas->GetData(contact); - if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30 * 60 * 1000) - { + if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30 * 60 * 1000) { MessageInfo *info; //only 2-3 repeats - if (contactData->repeatCount < 2 || contactData->repeatCount == 2 && (rand() % 2)) - { + if (contactData->repeatCount < 2 || contactData->repeatCount == 2 && (rand() % 2)) { const vector& v = mind.GetData()->repeats; tstring res = v[rand() % v.size()]; -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES info = new MessageInfo(incomingMessage, _T("(repeat_norm) ") + res); -#else + #else info = new MessageInfo(incomingMessage, res); -#endif + #endif } else -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES info = new MessageInfo(incomingMessage, _T("(repeat_silence)")); -#else + #else info = new MessageInfo(incomingMessage, _T("")); -#endif + #endif if (saveChoice) RecordAnswer(contactData, *info); contactDatas->PutData(contact); @@ -310,14 +293,13 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage, Level maxValue = NOTHING; tstring res = AllReplies(incomingMessage, contactData, maxValue, mm); - if (!res.empty()) - { + if (!res.empty()) { UpdateStartChar(res); -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES MessageInfo *info = new MessageInfo(incomingMessage, _T("(widelyused_all) ") + res); -#else + #else MessageInfo *info = new MessageInfo(incomingMessage, res); -#endif + #endif if (saveChoice) RecordAnswer(contactData, *info); contactDatas->PutData(contact); @@ -327,14 +309,13 @@ TalkBot::MessageInfo* TalkBot::Reply(MCONTACT contact, tstring incomingMessage, incomingMessage = ReplaceAliases(incomingMessage); res = AllReplies(incomingMessage, contactData, maxValue, mm); - if (!res.empty()) - { + if (!res.empty()) { UpdateStartChar(res); -#ifdef DEBUG_PREFIXES + #ifdef DEBUG_PREFIXES MessageInfo *info = new MessageInfo(incomingMessage, _T("(widelyused_all) ") + res); -#else + #else MessageInfo *info = new MessageInfo(incomingMessage, res); -#endif + #endif if (saveChoice) RecordAnswer(contactData, *info); contactDatas->PutData(contact); @@ -355,8 +336,7 @@ bool TalkBot::FindExact(ContactData *contactData, const tstring &incomingMessage const multimap& map, tstring& res) { int max = (int)map.count(incomingMessage); - if (!max) - { + if (!max) { TCHAR c = incomingMessage[incomingMessage.length() - 1]; if (c != _T('?') && c != _T('.') && c != _T('!')) return FindExact(contactData, incomingMessage + _T('.'), map, res); @@ -400,15 +380,12 @@ void TalkBot::SplitSectences(const tstring &incomingMessage, vector& ve //FIXME: (THINK ABOUT IT:-))these chars not always mark the end of sentence. const TCHAR symbols[] = _T(".?!"); int it = 0, len = (int)incomingMessage.length(); - while (it != len) - { + while (it != len) { while (it != len && _istspace(incomingMessage[it])) it++; int start = it; - while (it != len) - { - if (_tcschr(symbols, incomingMessage[it++])) - { + while (it != len) { + if (_tcschr(symbols, incomingMessage[it++])) { //Test for a :-! smile if (it > 2 && incomingMessage[it - 1] == _T('!') && incomingMessage[it - 2] == _T('-') @@ -427,8 +404,7 @@ void TalkBot::SplitSectences(const tstring &incomingMessage, vector& ve tstring LevelToStr(TalkBot::Level target) { tstring lev; - switch (target) - { + switch (target) { case TalkBot::BEST: lev = _T("BEST(0)"); break; case TalkBot::LOOKSLIKE: lev = _T("LOOKSLIKE(1)"); break; case TalkBot::BAD: lev = _T("BAD(2)"); break; @@ -441,12 +417,12 @@ tstring LevelToStr(TalkBot::Level target) tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const multimap &mm) { -#ifdef DEBUG_SHOW_VARIANTS + #ifdef DEBUG_SHOW_VARIANTS AddBotMessage(_T(">>Availabe:")); for (multimap::iterator it = mm.begin(); it != mm.end(); it++) AddBotMessage(LevelToStr((*it).first) + _T(": ") + (*it).second); AddBotMessage(_T(">>Result:")); -#endif + #endif if (maxValue == NOTHING) return _T(""); Level target = maxValue; @@ -454,30 +430,29 @@ tstring TalkBot::ChooseResult(ContactData *contactData, Level maxValue, const mu pair range = mm.equal_range(target); for (lt_cit it = range.first; it != range.second; ++it) contactData->chooser.AddChoice((*it).second); -#ifdef DEBUG_SHOW_LEVEL + #ifdef DEBUG_SHOW_LEVEL tstring lev = LevelToStr(target); return lev + _T(": ") + contactData->chooser.Choose(); -#else + #else return contactData->chooser.Choose(); -#endif + #endif } -void TalkBot::FindByKeywords(ContactData *contactData, const vector &keywords, tstring& res/*, tstring& ures*/, +void TalkBot::FindByKeywords(ContactData *contactData, const vector &keywords, tstring& res/*, tstring& ures*/, bool isQuestion) { if (keywords.size() == 0) return; const multimap &keys = isQuestion ? mind.GetData()->qkeywords : mind.GetData()->keywords; - for (multimap::const_iterator it = keys.begin(); it != keys.end(); ++it) - { + for (multimap::const_iterator it = keys.begin(); it != keys.end(); ++it) { float prio; if ((*it).first.MatchesAll(keywords/*, strict*/, prio)) -#ifdef DEBUG_SHOW_SOLUTION_REASON + #ifdef DEBUG_SHOW_SOLUTION_REASON contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second, prio); -#else + #else contactData->chooser.AddChoice((*it).second, prio); -#endif + #endif } res = contactData->chooser.Choose(); } @@ -488,14 +463,13 @@ bool TalkBot::FindByOthers(ContactData *contactData, const vector &othe const multimap &specs = isQuestion ? mind.GetData()->qspecialEscapes : mind.GetData()->specialEscapes; for (multimap::const_iterator it = specs.begin(); - it != specs.end(); ++it) - if ((*it).first.MatchesAny(otherwords)) - { -#ifdef DEBUG_SHOW_SOLUTION_REASON + it != specs.end(); ++it) + if ((*it).first.MatchesAny(otherwords)) { + #ifdef DEBUG_SHOW_SOLUTION_REASON contactData->chooser.AddChoice((tstring)(*it).first + _T(": - ") + (*it).second); -#else + #else contactData->chooser.AddChoice((*it).second); -#endif + #endif } res = contactData->chooser.Choose(); if (res.empty()) @@ -516,17 +490,14 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, vector words; map sm; //Find smiles - for (size_t i = 0; i < sentence.length() - 1; i++) - { + for (size_t i = 0; i < sentence.length() - 1; i++) { unsigned max = (int)(sentence.length() - i); if (max > mind.GetData()->maxSmileLen) max = mind.GetData()->maxSmileLen; - for (unsigned j = max; j > 0; j--) - { + for (unsigned j = max; j > 0; j--) { tstring item = sentence.substr(i, j); if (mind.GetData()->smiles.find(item) - != mind.GetData()->smiles.end()) - { + != mind.GetData()->smiles.end()) { sm[i] = item; sentence.replace(i, j, _T(" ")); break; @@ -536,10 +507,8 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, len = (int)sentence.length(); bool hadQuestionSigns = false; int it = 0; - while (it != len) - { - while (it != len && _tcschr(dividers, sentence[it])) - { + while (it != len) { + while (it != len && _tcschr(dividers, sentence[it])) { if (sentence[it] == _T('?')) hadQuestionSigns = true; map::iterator smit; @@ -551,8 +520,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, break; hadQuestionSigns = false; int start = it; - while (true) - { + while (true) { while (it != len && !_tcschr(dividers, sentence[it])) it++; if (it == len || sentence[it] != _T('-')) @@ -566,18 +534,16 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, words.push_back(str); } isQuestion = hadQuestionSigns; - for (vector::iterator it = words.begin(); it != words.end(); ++it) - { - if (!isQuestion) - { + for (vector::iterator it = words.begin(); it != words.end(); ++it) { + if (!isQuestion) { if (mind.GetData()->question.find(*it) != mind.GetData()->question.end()) isQuestion = true; } if (mind.GetData()->special.find(*it) != mind.GetData()->special.end()) otherwords.push_back(*it); -#ifdef EXCLUDE_SPECIAL_WORDS + #ifdef EXCLUDE_SPECIAL_WORDS else -#endif + #endif keywords.push_back(*it); } } @@ -595,4 +561,4 @@ void TalkBot::SetLowercase(const bool isLowercase) void TalkBot::SetUnderstandAlways(const bool understandAlways) { this->understandAlways = understandAlways; -} \ No newline at end of file +} diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index c9352c3a33..154885f92f 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -24,7 +24,6 @@ int hLangpack; TalkBot* bot = NULL; - #define MAX_WARN_TEXT 1024 #define MAX_MIND_FILE 1024 @@ -350,11 +349,12 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP UpdateUnderstandAlwaysCheckbox(hwndDlg); loading = false; return TRUE; + case WM_COMMAND: param = LOWORD(wParam); if (param == IDC_ENGINE_SILENT && HIWORD(wParam) == BN_CLICKED) UpdateUnderstandAlwaysCheckbox(hwndDlg); - OPENFILENAME ofn; + switch (param) { case IDC_BTNPATH: { @@ -365,34 +365,28 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP if (fullname != Config.MindFileName) delete[] fullname; - memset(&ofn, 0, sizeof(ofn)); + OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = GetParent(hwndDlg); - TCHAR* mind = TranslateTS(MIND_FILE_DESC); - TCHAR* anyfile = TranslateTS(ALL_FILES_DESC); - size_t l = mir_tstrlen(MIND_DIALOG_FILTER) - + mir_tstrlen(mind) + mir_tstrlen(anyfile); - TCHAR *filt = new TCHAR[l]; - mir_sntprintf(filt, l, MIND_DIALOG_FILTER, mind, anyfile); - for (size_t i = 0; i < l; i++) - if (filt[i] == '\1') - filt[i] = '\0'; - ofn.lpstrFilter = filt; + TCHAR *mind = TranslateTS(MIND_FILE_DESC); + TCHAR *anyfile = TranslateTS(ALL_FILES_DESC); + CMString filt(FORMAT, MIND_DIALOG_FILTER, mind, anyfile); + filt.Replace('\1', '\0'); + ofn.lpstrFilter = filt; ofn.lpstrFile = filename; ofn.nMaxFile = fileNameSize; ofn.Flags = OFN_FILEMUSTEXIST; ofn.lpstrInitialDir = tszPath; if (!GetOpenFileName(&ofn)) { delete[] filename; - delete[] filt; break; } - delete[] filt; - TCHAR* origf = filename; - TCHAR* f = filename; - TCHAR* p = tszPath; + + TCHAR *origf = filename; + TCHAR *f = filename; + TCHAR *p = tszPath; while (*p && *f) { TCHAR p1 = (TCHAR)CharLower((TCHAR*)(long)*p++); TCHAR f1 = (TCHAR)CharLower((TCHAR*)(long)*f++); @@ -405,6 +399,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP SetDlgItemText(hwndDlg, IDC_MINDFILE, filename); delete[] origf; } + case IDC_BTNRELOAD: { const TCHAR *c = Config.MindFileName; @@ -415,8 +410,9 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP mir_sntprintf(message, _countof(message), TranslateTS(FAILED_TO_LOAD_BASE), line, c); MessageBox(NULL, message, TranslateTS(BOLTUN_ERROR), MB_ICONERROR | MB_TASKMODAL | MB_OK); } - break; } + break; + default: if (!loading) { if (param == IDC_MINDFILE/* && HIWORD(wParam) != EN_CHANGE*/) @@ -425,27 +421,23 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP } } break; + case WM_NOTIFY: - { - NMHDR* nmhdr = (NMHDR*)lParam; - switch (nmhdr->code) { - case PSN_APPLY: - case PSN_KILLACTIVE: - { - Config.EngineStaySilent = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_SILENT) == BST_CHECKED ? TRUE : FALSE; - Config.EngineMakeLowerCase = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_LOWERCASE) == BST_CHECKED ? TRUE : FALSE; - Config.EngineUnderstandAlways = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_UNDERSTAND_ALWAYS) == BST_CHECKED ? TRUE : FALSE; - UpdateEngine(); - TCHAR c[MAX_MIND_FILE]; - bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, _countof(c)); - if (bTranslated) - Config.MindFileName = c; - else - Config.MindFileName = DEFAULT_MIND_FILE; - } - return TRUE; - } - break; + NMHDR *nmhdr = (NMHDR*)lParam; + switch (nmhdr->code) { + case PSN_APPLY: + case PSN_KILLACTIVE: + Config.EngineStaySilent = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_SILENT) == BST_CHECKED ? TRUE : FALSE; + Config.EngineMakeLowerCase = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_LOWERCASE) == BST_CHECKED ? TRUE : FALSE; + Config.EngineUnderstandAlways = IsDlgButtonChecked(hwndDlg, IDC_ENGINE_UNDERSTAND_ALWAYS) == BST_CHECKED ? TRUE : FALSE; + UpdateEngine(); + TCHAR c[MAX_MIND_FILE]; + bTranslated = GetDlgItemText(hwndDlg, IDC_MINDFILE, c, _countof(c)); + if (bTranslated) + Config.MindFileName = c; + else + Config.MindFileName = DEFAULT_MIND_FILE; + return TRUE; } break; } diff --git a/plugins/Boltun/src/stdafx.h b/plugins/Boltun/src/stdafx.h index e75e59ffdd..635d36b2d0 100644 --- a/plugins/Boltun/src/stdafx.h +++ b/plugins/Boltun/src/stdafx.h @@ -26,6 +26,7 @@ #include #include +#include #include #include diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index 679f5283fa..7c15a343a6 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -491,7 +491,7 @@ static void _AniAva_RenderAvatar(ANIAVA_WINDOWINFO * dat, HDC hdcParent = NULL, if (dat->bPlaying && IsWindowVisible(dat->hWindow)) { POINT ptWnd = { 0 }; SIZE szWnd = { dat->rcPos.right - dat->rcPos.left, dat->rcPos.bottom - dat->rcPos.top }; - BLENDFUNCTION bf = { AC_SRC_OVER, 0, g_CluiData.bCurrentAlpha*dat->bAlpha / 256, AC_SRC_ALPHA }; + BLENDFUNCTION bf = { AC_SRC_OVER, 0, BYTE(g_CluiData.bCurrentAlpha * dat->bAlpha / 256), AC_SRC_ALPHA }; POINT pt_from = { 0, 0 }; HDC hDC_animation = GetDC(NULL); HDC copyFromDC; diff --git a/plugins/Clist_modern/src/modern_awaymsg.cpp b/plugins/Clist_modern/src/modern_awaymsg.cpp index f9a4510d83..1e6cff2dca 100644 --- a/plugins/Clist_modern/src/modern_awaymsg.cpp +++ b/plugins/Clist_modern/src/modern_awaymsg.cpp @@ -66,7 +66,7 @@ static MCONTACT amGetCurrentChain() if (amItems.getCount() == 0) return NULL; - MCONTACT res = (MCONTACT)amItems[0]; + MCONTACT res = (DWORD_PTR)amItems[0]; amItems.remove(0); return res; } diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index deadd91373..a465b90bd1 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -1070,7 +1070,6 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT, WPARAM wParam, LPAR ClcGroup *group = NULL; cliGetRowByIndex(dat, dat->iDragItem, NULL, &group); if (group && group->parent) { - ClcContact *contSour; cliGetRowByIndex(dat, dat->iDragItem, &contSour, NULL); if (!contSour->isSubcontact) hNewCursor = LoadCursor(g_hMirApp, MAKEINTRESOURCE(IDC_DROPUSER)); @@ -1389,7 +1388,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam if (!pcli->pfnFindItem(hwnd, dat, wParam, &contact, &group, NULL)) { if (shouldShow && CallService(MS_DB_CONTACT_IS, wParam, 0)) { if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); + hSelItem = (DWORD_PTR)pcli->pfnContactToHItem(selcontact); pcli->pfnAddContactToTree(hwnd, dat, wParam, (style & CLS_CONTACTLIST) == 0, 0); recalcScrollBar = 1; needRepaint = TRUE; @@ -1412,7 +1411,7 @@ static LRESULT clcOnIntmIconChanged(ClcData *dat, HWND hwnd, UINT, WPARAM wParam if (!shouldShow && !(style & CLS_NOHIDEOFFLINE) && ((style & CLS_HIDEOFFLINE) || group->hideOffline || g_CluiData.bFilterEffective)) { // CLVM changed if (dat->selection >= 0 && pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) != -1) - hSelItem = (MCONTACT)pcli->pfnContactToHItem(selcontact); + hSelItem = (DWORD_PTR)pcli->pfnContactToHItem(selcontact); pcli->pfnRemoveItemFromGroup(hwnd, group, contact, (style & CLS_CONTACTLIST) == 0); needRepaint = TRUE; recalcScrollBar = 1; diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 58843ea517..c4102c68a5 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -301,7 +301,7 @@ MCONTACT SaveSelection(ClcData *dat) if (pcli->pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) return NULL; - return (MCONTACT)pcli->pfnContactToHItem(selcontact); + return (DWORD_PTR)pcli->pfnContactToHItem(selcontact); } int RestoreSelection(ClcData *dat, MCONTACT hSelected) diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index bf337c1282..03552d3690 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -663,7 +663,6 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact // Let calc placeholder int minheight = dat->row_min_heigh; int mode2 = -1; - COLORREF colourFg = RGB(0, 0, 0); BOOL InClistWindow = (dat->hWnd == pcli->hwndContactTree); ClcCacheEntry *pdnce = NULL; int height = RowHeight_CalcRowHeight(dat, hwnd, Drawing, -1); @@ -779,7 +778,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact //3 draw text { SIZE text_size = { 0 }; - TCHAR * szCounts = NULL; + TCHAR *szCounts = NULL; RECT text_rect = fr_rc; RECT counts_rc = { 0 }; UINT uTextFormat = DT_LEFT | DT_VCENTER | (gl_TrimText ? DT_END_ELLIPSIS : 0) | DT_SINGLELINE; @@ -797,7 +796,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact RECT count_rc = { 0 }; SIZE count_size = { 0 }; int space_width = 0; - TCHAR * szCounts = pcli->pfnGetGroupCountsText(dat, Drawing); + szCounts = pcli->pfnGetGroupCountsText(dat, Drawing); // Has to draw the count? if (szCounts && mir_tstrlen(szCounts) > 0) { // calc width and height @@ -813,16 +812,16 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact } // modify text rect { - SIZE text_size = { 0 }; + SIZE grp_size = { 0 }; int wid = fr_rc.right - fr_rc.left; ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); - GetTextSize(&text_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); + GetTextSize(&grp_size, hdcMem, fr_rc, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); - if (wid - count_size.cx > text_size.cx) { + if (wid - count_size.cx > grp_size.cx) { if (dat->row_align_group_mode != 2) { //center or left - int x = (dat->row_align_group_mode == 1) ? (wid - (text_size.cx + count_size.cx)) >> 1 : 0; + int x = (dat->row_align_group_mode == 1) ? (wid - (grp_size.cx + count_size.cx)) >> 1 : 0; nameRect.left += x; - nameRect.right = nameRect.left + text_size.cx; + nameRect.right = nameRect.left + grp_size.cx; countRect.left = nameRect.right + space_width; countRect.right = countRect.left + count_size.cx - space_width; } @@ -830,7 +829,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact countRect.right = nameRect.right; countRect.left = countRect.right - ((count_size.cx > 0) ? (count_size.cx - space_width) : 0); nameRect.right = countRect.left - ((count_size.cx > 0) ? space_width : 0); - nameRect.left = nameRect.right - text_size.cx; + nameRect.left = nameRect.right - grp_size.cx; } } else { @@ -1042,16 +1041,16 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact } // modify text rect { - SIZE text_size = { 0 }; + SIZE grp_size = { 0 }; int wid = p_rect.right - p_rect.left; ChangeToFont(hdcMem, dat, Drawing->group->expanded ? FONTID_OPENGROUPS : FONTID_CLOSEDGROUPS, NULL); - GetTextSize(&text_size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); + GetTextSize(&grp_size, hdcMem, p_rect, Drawing->szText, Drawing->ssText.plText, 0, dat->text_resize_smileys ? 0 : Drawing->ssText.iMaxSmileyHeight); - if (wid - count_size.cx > text_size.cx) { + if (wid - count_size.cx > grp_size.cx) { if (dat->row_align_group_mode != 2) { //center or left - int x = (dat->row_align_group_mode == 1) ? (wid - (text_size.cx + count_size.cx)) >> 1 : 0; + int x = (dat->row_align_group_mode == 1) ? (wid - (grp_size.cx + count_size.cx)) >> 1 : 0; nameRect.left += x; - nameRect.right = nameRect.left + text_size.cx; + nameRect.right = nameRect.left + grp_size.cx; countRect.left = nameRect.right + space_width; countRect.right = countRect.left + count_size.cx - space_width; } @@ -1059,7 +1058,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact countRect.right = nameRect.right; countRect.left = countRect.right - ((count_size.cx > 0) ? (count_size.cx - space_width) : 0); nameRect.right = countRect.left - ((count_size.cx > 0) ? space_width : 0); - nameRect.left = nameRect.right - text_size.cx; + nameRect.left = nameRect.right - grp_size.cx; } } else { @@ -1235,13 +1234,12 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact } else { HRGN rgn = NULL; - HRGN oldrgn; int round_radius = 0; - int width = p_rect.right - p_rect.left; - int height = p_rect.bottom - p_rect.top; + int ava_width = p_rect.right - p_rect.left; + int ava_height = p_rect.bottom - p_rect.top; // Store pos Drawing->pos_avatar = p_rect; - oldrgn = CreateRectRgn(0, 0, 0, 0); + HRGN oldrgn = CreateRectRgn(0, 0, 0, 0); GetClipRgn(hdcMem, oldrgn); // Round corners @@ -1249,7 +1247,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact if (dat->avatars_use_custom_corner_size) round_radius = dat->avatars_custom_corner_size; else - round_radius = min(width, height) / 5; + round_radius = min(ava_width, ava_height) / 5; } else round_radius = 0; @@ -1336,11 +1334,10 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact (!Drawing->isSubcontact || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0)) { int BlendedInActiveState = dat->dbbBlendInActiveState; int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50; - int iImage; int count = 0; RECT rc; int x = 0; - for (iImage = 0; iImage < dat->extraColumnsCount; iImage++) { + for (int iImage = 0; iImage < dat->extraColumnsCount; iImage++) { COLORREF colourFg = dat->selBkColour; int mode = BlendedInActiveState ? BlendValue : ILD_NORMAL; if (Drawing->iExtraImage[iImage] == EMPTY_EXTRA_ICON) { @@ -1390,6 +1387,7 @@ void CLCPaint::_PaintRowItemsEx(HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact int eNum = gl_RowTabAccess[i]->type - TC_EXTRA1; if (eNum < dat->extraColumnsCount) { if (Drawing->iExtraImage[eNum] != EMPTY_EXTRA_ICON) { + COLORREF colourFg = RGB(0, 0, 0); int mode = 0; int BlendedInActiveState = dat->dbbBlendInActiveState; int BlendValue = dat->dbbBlend25 ? ILD_BLEND25 : ILD_BLEND50; @@ -2024,7 +2022,6 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT switch (dat->row_items[item]) { case ITEM_AVATAR: /////////////////////////////////////////////////////////////////////////////////////////////////// { - RECT rc; int max_width; int width; int height; @@ -2044,14 +2041,10 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Has to draw icon instead? if (dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && Drawing->iImage != -1) { - RECT rc; - // Make rectangle - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, dat->iconXSpace, max_width, ICON_HEIGHT, HORIZONTAL_SPACE); - + RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, dat->iconXSpace, max_width, ICON_HEIGHT, HORIZONTAL_SPACE); if (rc.left < rc.right) { - /* center icon in avatar place */ + // center icon in avatar place if (rc.right - rc.left > 16) rc.left += (((rc.right - rc.left) - 16) >> 1); if (rc.bottom - rc.top > 16) rc.top += (((rc.bottom - rc.top) - 16) >> 1); @@ -2063,8 +2056,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Has to keep the empty space?? if ((left && !dat->row_align_left_items_to_left) || (!left && !dat->row_align_right_items_to_right)) { // Make rectangle - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, max_width, max_width, dat->avatars_maxheight_size, HORIZONTAL_SPACE); + // RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, max_width, max_width, dat->avatars_maxheight_size, HORIZONTAL_SPACE); // Store position //StoreItemPos( Drawing, CIT_AVATAR, &rc ); @@ -2089,8 +2081,7 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT } // Make rectangle - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, width, max_width, height, HORIZONTAL_SPACE); + RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, width, max_width, height, HORIZONTAL_SPACE); rc.top = max(free_row_rc.top, rc.top); rc.bottom = min(free_row_rc.bottom, rc.bottom); @@ -2103,7 +2094,6 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT case ITEM_ICON: ///////////////////////////////////////////////////////////////////////////////////////////////////// { - RECT rc; int iImage = -1; BOOL has_avatar = Drawing->avatar_data != NULL && !CheckMiniMode(dat, selected); @@ -2114,13 +2104,9 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT && !Drawing->image_is_special) { // Don't have to draw, but has to keep the empty space? if ((left && !dat->row_align_left_items_to_left) || (!left && !dat->row_align_right_items_to_right)) { - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, dat->iconXSpace, dat->iconXSpace, ICON_HEIGHT, HORIZONTAL_SPACE); - - if (rc.left < rc.right) { - // Store position + RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, dat->iconXSpace, dat->iconXSpace, ICON_HEIGHT, HORIZONTAL_SPACE); + if (rc.left < rc.right) // Store position _StoreItemPos(Drawing, CIT_ICON, &rc); - } } break; } @@ -2128,10 +2114,10 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT && dat->icon_hide_on_avatar && dat->icon_draw_on_avatar_space && (!Drawing->image_is_special || !has_avatar || - (dat->avatars_draw_overlay - && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) - && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons) - && dat->avatars_overlay_type == SETTING_AVATAR_OVERLAY_TYPE_CONTACT))) { + (dat->avatars_draw_overlay + && dat->avatars_maxheight_size >= ICON_HEIGHT + (dat->avatars_draw_border ? 2 : 0) + && GetContactCachedStatus(Drawing->hContact) - ID_STATUS_OFFLINE < _countof(g_pAvatarOverlayIcons) + && dat->avatars_overlay_type == SETTING_AVATAR_OVERLAY_TYPE_CONTACT))) { // Don't have to draw and don't have to keep the empty space break; } @@ -2146,13 +2132,9 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT // Has image to draw? if (iImage != -1) { // Make rectangle - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, dat->iconXSpace, dat->iconXSpace, ICON_HEIGHT, HORIZONTAL_SPACE); - - if (rc.left < rc.right) { - // Store position + RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, dat->iconXSpace, dat->iconXSpace, ICON_HEIGHT, HORIZONTAL_SPACE); + if (rc.left < rc.right) // Store position _StoreItemPos(Drawing, CIT_ICON, &rc); - } } } break; @@ -2164,23 +2146,19 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT TCHAR szResult[80]; if (!TimeZone_PrintDateTime(pdnce->hTimeZone, _T("t"), szResult, _countof(szResult), 0)) { - SIZE text_size; - RECT rc; - // Select font ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL); // Get text size + RECT rc; + SIZE text_size; text_size.cy = ske_DrawText(hdcMem, szResult, (int)mir_tstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE); text_size.cy = min(text_size.cy, free_row_rc.bottom - free_row_rc.top); text_size.cx = rc.right - rc.left; // Get rc - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, - text_size.cx, text_size.cx, text_size.cy, HORIZONTAL_SPACE); - - if (rc.left < rc.right) { - // Store pos + rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, text_size.cx, text_size.cx, text_size.cy, HORIZONTAL_SPACE); + if (rc.left < rc.right) { // Store pos Drawing->pos_contact_time = rc; _StoreItemPos(Drawing, CIT_TIME, &rc); } @@ -2205,16 +2183,14 @@ void CLCPaint::_CalcItemsPos(HDC hdcMem, ClcData *dat, ClcContact *Drawing, RECT if (!Drawing->isSubcontact || dat->dbbMetaHideExtra == 0 && dat->extraColumnsCount > 0) { int iImage; int count = 0; - RECT rc; for (iImage = dat->extraColumnsCount - 1; iImage >= 0; iImage--) { if (Drawing->iExtraImage[iImage] != EMPTY_EXTRA_ICON || !dat->MetaIgnoreEmptyExtra) { - rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, - left, dat->extraColumnSpacing, dat->extraColumnSpacing, ICON_HEIGHT, 0); + RECT rc = _GetRectangle(dat, &row_rc, &free_row_rc, &left_pos, &right_pos, left, dat->extraColumnSpacing, dat->extraColumnSpacing, ICON_HEIGHT, 0); if (rc.left < rc.right) { // Store position _StoreItemPos(Drawing, CIT_EXTRA | (iImage & 0x3F), &rc); - //Drawing->pos_extra[iImage] = rc; + // Drawing->pos_extra[iImage] = rc; count++; } } @@ -2695,15 +2671,15 @@ void CLCPaint::_DrawContactAvatar(HDC hdcMem, ClcData *dat, ClcContact *Drawing, int item = pcli->pfnIconFromStatusMode(Drawing->proto, Drawing->proto == NULL ? ID_STATUS_OFFLINE : GetContactCachedStatus(Drawing->hContact), Drawing->hContact); if (item != -1) _DrawStatusIcon(Drawing, dat, item, hdcMem, - ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, - CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25); + ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, + CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25); } break; case SETTING_AVATAR_OVERLAY_TYPE_CONTACT: if (Drawing->iImage != -1) _DrawStatusIcon(Drawing, dat, Drawing->iImage, hdcMem, - ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, - CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25); + ptOverlay.x, ptOverlay.y, ICON_HEIGHT, ICON_HEIGHT, + CLR_NONE, CLR_NONE, (blendmode == 255) ? ILD_NORMAL : (blendmode == 128) ? ILD_BLEND50 : ILD_BLEND25); break; } } @@ -2845,7 +2821,7 @@ void CLCPaint::_DrawContactExtraIcon(HDC hdcMem, ClcData *dat, ClcContact *Drawi _GetBlendMode(dat, Drawing, selected, hottrack, GIM_EXTRAICON_AFFECT, &colourFg, &mode); if (Drawing->iExtraImage[iImage] != EMPTY_EXTRA_ICON) ske_ImageList_DrawEx(dat->himlExtraColumns, Drawing->iExtraImage[iImage], hdcMem, - rc->left, rc->top, 0, 0, CLR_NONE, colourFg, mode); + rc->left, rc->top, 0, 0, CLR_NONE, colourFg, mode); } } diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 8949cc7457..71c0ac597e 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -232,9 +232,9 @@ void cliRecalcScrollBar(HWND hwnd, ClcData *dat) } -static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + switch (uMsg) { case WM_KEYDOWN: switch (wParam) { case VK_RETURN: @@ -257,7 +257,7 @@ static LRESULT CALLBACK RenameEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPara SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); return 0; } - return mir_callNextSubclass(hwnd, RenameEditSubclassProc, msg, wParam, lParam); + return mir_callNextSubclass(hwnd, RenameEditSubclassProc, uMsg, wParam, lParam); } void cliBeginRenameSelection(HWND hwnd, ClcData *dat) diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index e514870b7d..e7d414125f 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -86,7 +86,7 @@ void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD heigh else bm = new Bitmap(hbmp, NULL); ImageAttributes attr; - ColorMatrix ClrMatrix = + ColorMatrix Matrix = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, @@ -94,7 +94,7 @@ void DrawAvatarImageWithGDIp(HDC hDestDC, int x, int y, DWORD width, DWORD heigh 0.0f, 0.0f, 0.0f, ((float)alpha) / 255, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; - attr.SetColorMatrix(&ClrMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap); + attr.SetColorMatrix(&Matrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap); g.SetInterpolationMode(InterpolationModeHighQualityBicubic); RectF rect((float)x, (float)y, (float)width, (float)height); g.DrawImage(bm, rect, (float)x1, (float)y1, (float)width1, (float)height1, UnitPixel, &attr, NULL, NULL); @@ -116,7 +116,7 @@ BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWi else bm = new Bitmap(hbmp, NULL); ImageAttributes attr; - ColorMatrix ClrMatrix = + ColorMatrix Matrix = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, @@ -124,7 +124,7 @@ BOOL GDIPlus_AlphaBlend(HDC hdcDest, int nXOriginDest, int nYOriginDest, int nWi 0.0f, 0.0f, 0.0f, ((float)bf->SourceConstantAlpha) / 255, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; - attr.SetColorMatrix(&ClrMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap); + attr.SetColorMatrix(&Matrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap); if (bf->BlendFlags & 128 && nWidthDest < nWidthSrc && nHeightDest < nHeightSrc) { g.SetInterpolationMode(InterpolationModeHighQualityBicubic); diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 6666b7e55f..8215b7e1fc 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -100,8 +100,7 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) if (!whdc && !g_CluiData.fLayered) InvalidateRect(hwnd, NULL, FALSE); if (whdc && g_CluiData.fLayered) hdc = whdc; - else - { + else { //sdc = GetWindowDC(GetParent(hwnd)); hdc = CreateCompatibleDC(NULL); } @@ -116,8 +115,7 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) //HBRUSH br = CreateSolidBrush(RGB(255,255,255)); char * Value = NULL; { - if (bct->ValueDBSection && bct->ValueTypeDef) - { + if (bct->ValueDBSection && bct->ValueTypeDef) { char * key; char * section; DWORD defval = 0; @@ -126,20 +124,18 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) section = key; if (bct->ValueTypeDef[0] != 's') defval = (DWORD)atol(bct->ValueTypeDef + 1); - do - { + do { if (key[0] == '/') { key[0] = '\0'; key++; break; } key++; } while (key[0] != '\0'); - switch (bct->ValueTypeDef[0]) - { + switch (bct->ValueTypeDef[0]) { case 's': - { - Value = db_get_sa(NULL, section, key); - if (!Value) - Value = mir_strdup(bct->ValueTypeDef + 1); - break; - } + { + Value = db_get_sa(NULL, section, key); + if (!Value) + Value = mir_strdup(bct->ValueTypeDef + 1); + break; + } case 'd': defval = db_get_dw(NULL, section, key, defval); Value = mir_strdup(_ltoa(defval, buf, _countof(buf))); @@ -171,23 +167,20 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) // DeleteObject(br); } - if (!whdc && g_CluiData.fLayered) - { + if (!whdc && g_CluiData.fLayered) { RECT r; SetRect(&r, bct->Left, bct->Top, bct->Right, bct->Bottom); ske_DrawImageAt(hdc, &r); //CallingService to immeadeately update window with new image. } - if (whdc && !g_CluiData.fLayered) - { + if (whdc && !g_CluiData.fLayered) { RECT r = { 0 }; GetClientRect(bct->hwnd, &r); BitBlt(whdc, 0, 0, r.right, r.bottom, hdc, 0, 0, SRCCOPY); } SelectObject(hdc, oldbmp); DeleteObject(bmp); - if (!whdc || !g_CluiData.fLayered) - { + if (!whdc || !g_CluiData.fLayered) { SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); DeleteDC(hdc); } @@ -198,8 +191,7 @@ static int ModernSkinButtonPaintWorker(HWND hwnd, HDC whdc) static int ModernSkinButtonToggleDBValue(char * ValueDBSection, char *ValueTypeDef) { - if (ValueDBSection && ValueTypeDef) - { + if (ValueDBSection && ValueTypeDef) { char * key; char * section; char * val; @@ -209,22 +201,19 @@ static int ModernSkinButtonToggleDBValue(char * ValueDBSection, char *ValueTypeD // char buf[20]; key = mir_strdup(ValueDBSection); section = key; - do - { + do { if (key[0] == '/') { key[0] = '\0'; key++; break; } key++; } while (key[0] != '\0'); val = mir_strdup(ValueTypeDef + 1); val2 = val; - do - { + do { if (val2[0] == '/') { val2[0] = '\0'; val2++; break; } val2++; } while (val2[0] != '\0'); - if (ValueTypeDef[0] != 's') - { + if (ValueTypeDef[0] != 's') { l1 = (DWORD)atol(val); l2 = (DWORD)atol(val2); } @@ -269,8 +258,7 @@ static char *_skipblank(char * str) //str will be modified; char * endstr = str + mir_strlen(str); while ((*str == ' ' || *str == '\t') && *str != '\0') str++; while ((*endstr == ' ' || *endstr == '\t') && *endstr != '\0' && endstr < str) endstr--; - if (*endstr != '\0') - { + if (*endstr != '\0') { endstr++; *endstr = '\0'; } @@ -290,8 +278,7 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) return 0; } char *param2 = strrchr(pszService, '%'); - if (param2) - { + if (param2) { paramCount++; *param2 = '\0'; param2++; _skipblank(param2); @@ -299,42 +286,35 @@ static int _CallServiceStrParams(IN char * toParce, OUT int *Return) param2 = NULL; } char *param1 = strrchr(pszService, '%'); - if (param1) - { + if (param1) { paramCount++; *param1 = '\0'; param1++; _skipblank(param1); if (mir_strlen(param1) == 0) param1 = NULL; } - if (param1 && *param1 == '\"') - { + if (param1 && *param1 == '\"') { param1++; *(param1 + mir_strlen(param1)) = '\0'; } - else if (param1) - { + else if (param1) { param1 = (char*)atoi(param1); } - if (param2 && *param2 == '\"') - { + if (param2 && *param2 == '\"') { param2++; *(param2 + mir_strlen(param2)) = '\0'; } else if (param2) param2 = (char*)atoi(param2); - if (paramCount == 1) - { + if (paramCount == 1) { param1 = param2; param2 = NULL; } - if (!ServiceExists(pszService)) - { + if (!ServiceExists(pszService)) { result = 0; } - else - { + else { result = 1; int ret = CallService(pszService, (WPARAM)param1, (WPARAM)param2); if (Return) *Return = ret; @@ -399,12 +379,12 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w break; // DONT! fall thru case WM_SETCURSOR: - { - HCURSOR hCurs1 = LoadCursor(NULL, IDC_ARROW); - if (hCurs1) SetCursor(hCurs1); - if (bct) SetToolTip(hwndDlg, bct->Hint); - } - return 1; + { + HCURSOR hCurs1 = LoadCursor(NULL, IDC_ARROW); + if (hCurs1) SetCursor(hCurs1); + if (bct) SetToolTip(hwndDlg, bct->Hint); + } + return 1; case WM_PRINT: if (IsWindowVisible(hwndDlg)) @@ -472,8 +452,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM w if (bct->CommandService && IsBadStringPtrA(bct->CommandService, 255)) bct->CommandService = NULL; if (bct->CommandService) - if (_CallServiceStrParams(bct->CommandService, NULL)) - { + if (_CallServiceStrParams(bct->CommandService, NULL)) { } else if (bct->ValueDBSection && bct->ValueTypeDef) ModernSkinButtonToggleDBValue(bct->ValueDBSection, bct->ValueTypeDef); @@ -611,20 +590,16 @@ static int ModernSkinButtonErase(int l, int t, int r, int b) if (!g_CluiData.fLayered) return 0; if (!g_pCachedWindow) return 0; if (!g_pCachedWindow->hImageDC || !g_pCachedWindow->hBackDC) return 0; - if (!(l || r || t || b)) - { - for (i = 0; i < ButtonsCount; i++) - { - if (pcli->hwndContactList && Buttons[i].hwnd != NULL) - { + if (!(l || r || t || b)) { + for (i = 0; i < ButtonsCount; i++) { + if (pcli->hwndContactList && Buttons[i].hwnd != NULL) { //TODO: Erase button BitBlt(g_pCachedWindow->hImageDC, Buttons[i].bct->Left, Buttons[i].bct->Top, Buttons[i].bct->Right - Buttons[i].bct->Left, Buttons[i].bct->Bottom - Buttons[i].bct->Top, g_pCachedWindow->hBackDC, Buttons[i].bct->Left, Buttons[i].bct->Top, SRCCOPY); } } } - else - { + else { BitBlt(g_pCachedWindow->hImageDC, l, t, r - l, b - t, g_pCachedWindow->hBackDC, l, t, SRCCOPY); } return 0; @@ -652,8 +627,7 @@ int ModernSkinButtonRedrawAll() DWORD i; if (!ModernSkinButtonModuleIsLoaded) return 0; g_mutex_bLockUpdating++; - for (i = 0; i < ButtonsCount; i++) - { + for (i = 0; i < ButtonsCount; i++) { if (pcli->hwndContactList && Buttons[i].hwnd == NULL) Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, pcli->hwndContactList); ModernSkinButtonPaintWorker(Buttons[i].hwnd, 0); @@ -676,23 +650,20 @@ int ModernSkinButtonDeleteAll() return 0; } -int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r) +int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *pRect) { - DWORD i; - RECT rc; - RECT clr; - RECT rd; + RECT rc, clr, rd; BOOL altDraw = FALSE; static SIZE oldWndSize = { 0 }; if (!ModernSkinButtonModuleIsLoaded) return 0; GetWindowRect(parent, &rd); GetClientRect(parent, &clr); - if (!r) + if (!pRect) GetWindowRect(parent, &rc); else - rc = *r; - if (g_CluiData.fLayered && (draw & SBRF_DO_ALT_DRAW)) - { + rc = *pRect; + + if (g_CluiData.fLayered && (draw & SBRF_DO_ALT_DRAW)) { int sx, sy; sx = rd.right - rd.left; sy = rd.bottom - rd.top; @@ -705,44 +676,39 @@ int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r) OffsetRect(&rc, -rc.left, -rc.top); rc.right = rc.left + (clr.right - clr.left); rc.bottom = rc.top + (clr.bottom - clr.top); - for (i = 0; i < ButtonsCount; i++) - { - int l, r, b, t; + for (DWORD i = 0; i < ButtonsCount; i++) { int sbFlags = Buttons[i].ConstrainPositionFrom; - if (parent && Buttons[i].hwnd == NULL) - { + if (parent && Buttons[i].hwnd == NULL) { Buttons[i].hwnd = ModernSkinButtonCreateWindow(Buttons[i].bct, parent); altDraw = FALSE; } - l = (sbFlags & SBF_ALIGN_TL_RIGHT) ? (rc.right + Buttons[i].OrL) : + int l = (sbFlags & SBF_ALIGN_TL_RIGHT) ? (rc.right + Buttons[i].OrL) : (sbFlags & SBF_ALIGN_TL_HCENTER) ? (_center_h(&rc) + Buttons[i].OrL) : (rc.left + Buttons[i].OrL); - t = (sbFlags & SBF_ALIGN_TL_BOTTOM) ? (rc.bottom + Buttons[i].OrT) : + int t = (sbFlags & SBF_ALIGN_TL_BOTTOM) ? (rc.bottom + Buttons[i].OrT) : (sbFlags & SBF_ALIGN_TL_VCENTER) ? (_center_v(&rc) + Buttons[i].OrT) : (rc.top + Buttons[i].OrT); - r = (sbFlags & SBF_ALIGN_BR_RIGHT) ? (rc.right + Buttons[i].OrR) : + int r = (sbFlags & SBF_ALIGN_BR_RIGHT) ? (rc.right + Buttons[i].OrR) : (sbFlags & SBF_ALIGN_BR_HCENTER) ? (_center_h(&rc) + Buttons[i].OrR) : (rc.left + Buttons[i].OrR); - b = (sbFlags & SBF_ALIGN_BR_BOTTOM) ? (rc.bottom + Buttons[i].OrB) : + int b = (sbFlags & SBF_ALIGN_BR_BOTTOM) ? (rc.bottom + Buttons[i].OrB) : (sbFlags & SBF_ALIGN_BR_VCENTER) ? (_center_v(&rc) + Buttons[i].OrB) : (rc.top + Buttons[i].OrB); SetWindowPos(Buttons[i].hwnd, HWND_TOP, l, t, r - l, b - t, 0); - if ((rc.right - rc.left < Buttons[i].minW /* && Buttons[i].minW != 0*/) - || (rc.bottom - rc.top < Buttons[i].minH /* && Buttons[i].minH != 0*/)) + if (rc.right - rc.left < Buttons[i].minW || rc.bottom - rc.top < Buttons[i].minH) CLUI_ShowWindowMod(Buttons[i].hwnd, SW_HIDE); else CLUI_ShowWindowMod(Buttons[i].hwnd, SW_SHOW); if ((1 || altDraw) && (Buttons[i].bct->Left != l || - Buttons[i].bct->Top != t || - Buttons[i].bct->Right != r || - Buttons[i].bct->Bottom != b)) - { + Buttons[i].bct->Top != t || + Buttons[i].bct->Right != r || + Buttons[i].bct->Bottom != b)) { //Need to erase in old location ModernSkinButtonErase(Buttons[i].bct->Left, Buttons[i].bct->Top, Buttons[i].bct->Right, Buttons[i].bct->Bottom); } @@ -751,9 +717,9 @@ int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT *r) Buttons[i].bct->Top = t; Buttons[i].bct->Right = r; Buttons[i].bct->Bottom = b; - - } - if (draw & SBRF_DO_REDRAW_ALL) ModernSkinButtonRedrawAll(); + + if (draw & SBRF_DO_REDRAW_ALL) + ModernSkinButtonRedrawAll(); return 0; -} \ No newline at end of file +} diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 22b8d32f59..2078d05f6f 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -115,7 +115,7 @@ static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam); static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam); static INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM lParam); -static MODERNEFFECT meCurrentEffect = { -1, { 0 }, 0, 0 }; +static MODERNEFFECT meCurrentEffect = { 0xFF, { 0 }, 0, 0 }; ////////////////////////////////////////////////////////////////////////// // Ini file parser @@ -713,21 +713,21 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { - BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + BLENDFUNCTION bf2 = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; int dy = (wr.top - rFill->top) % h; if (dy >= 0) { y = wr.top; int ht = (y + h - dy <= wr.bottom) ? (h - dy) : (wr.bottom - wr.top); - ske_AlphaBlend(hDest, wr.left, y, w, ht, mem2dc, 0, dy, w, ht, bf); + ske_AlphaBlend(hDest, wr.left, y, w, ht, mem2dc, 0, dy, w, ht, bf2); } y = wr.top + h - dy; while (y < wr.bottom - h) { - ske_AlphaBlend(hDest, wr.left, y, w, h, mem2dc, 0, 0, w, h, bf); + ske_AlphaBlend(hDest, wr.left, y, w, h, mem2dc, 0, 0, w, h, bf2); y += h; } if (y <= wr.bottom) - ske_AlphaBlend(hDest, wr.left, y, w, wr.bottom - y, mem2dc, 0, 0, w, wr.bottom - y, bf); + ske_AlphaBlend(hDest, wr.left, y, w, wr.bottom - y, mem2dc, 0, 0, w, wr.bottom - y, bf2); } } } @@ -787,21 +787,20 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { - BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + BLENDFUNCTION bf2 = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; int dx = (wr.left - rFill->left) % w; if (dx >= 0) { x = wr.left; int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); - ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf); + ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf2); } x = wr.left + w - dx; while (x < wr.right - w) { - ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf); + ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf2); x += w; } if (x <= wr.right) - ske_AlphaBlend(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, wr.right - x, h, bf); - + ske_AlphaBlend(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, wr.right - x, h, bf2); } } } @@ -867,24 +866,22 @@ static BOOL ske_SkinFillRectByGlyph(HDC hDest, HDC hSource, RECT *rFill, RECT *r } else { - BLENDFUNCTION bf = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; + BLENDFUNCTION bf2 = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA }; int dx = (wr.left - rFill->left) % w; if (dx >= 0) { x = wr.left; int wt = (x + w - dx <= wr.right) ? (w - dx) : (wr.right - wr.left); - ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf); + ske_AlphaBlend(hDest, x, wr.top, wt, h, mem2dc, dx, 0, wt, h, bf2); } x = wr.left + w - dx; while (x < wr.right - w) { - ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf); + ske_AlphaBlend(hDest, x, wr.top, w, h, mem2dc, 0, 0, w, h, bf2); x += w; } if (x <= wr.right) - ske_AlphaBlend(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, wr.right - x, h, bf); - + ske_AlphaBlend(hDest, x, wr.top, wr.right - x, h, mem2dc, 0, 0, wr.right - x, h, bf2); } } - } SelectObject(mem2dc, oldbmp); DeleteObject(mem2bmp); @@ -1251,7 +1248,7 @@ static int ske_DrawSkinObject(SKINDRAWREQUEST * preq, GLYPHOBJECT * pobj) if ((k > 0 || k == -1) && mode == 2) { { - BLENDFUNCTION bf = { AC_SRC_OVER, 0, /*(bm.bmBitsPixel == 32)?255:*/pobj->dwAlpha, (pobj->bmBitsPixel == 32 && pobj->Style != ST_BRUSH) ? AC_SRC_ALPHA : 0 }; + BLENDFUNCTION bf = { AC_SRC_OVER, 0, pobj->dwAlpha, BYTE(pobj->bmBitsPixel == 32 && pobj->Style != ST_BRUSH ? AC_SRC_ALPHA : 0) }; if (mode == 2) OffsetRect(&PRect, mode2offset.x, mode2offset.y); ske_AlphaBlend(preq->hDC, PRect.left, PRect.top, PRect.right - PRect.left, PRect.bottom - PRect.top, @@ -1604,12 +1601,12 @@ static HBITMAP ske_LoadGlyphImage_TGA(const TCHAR *szFilename) DWORD size = SizeofResource(g_hInst, hRSrc); BYTE *mem = (BYTE*)LockResource(hRes); if (size > sizeof(header)) { - tga_header_t * header = (tga_header_t *)mem; - if (header->pixel_depth == 32 && (header->image_type == 2 || header->image_type == 10)) { - colormap = (BYTE*)malloc(header->width*header->height * 4); - cx = header->width; - cy = header->height; - ske_ReadTGAImageData((void*)(mem + sizeof(tga_header_t) + header->id_lenght + header->cm_length), size - (sizeof(tga_header_t) + header->id_lenght + header->cm_length), colormap, cx*cy * 4, header->image_type == 10); + tga_header_t *tgahdr = (tga_header_t*)mem; + if (tgahdr->pixel_depth == 32 && (tgahdr->image_type == 2 || tgahdr->image_type == 10)) { + colormap = (BYTE*)malloc(tgahdr->width*tgahdr->height * 4); + cx = tgahdr->width; + cy = tgahdr->height; + ske_ReadTGAImageData((void*)(mem + sizeof(tga_header_t) + tgahdr->id_lenght + tgahdr->cm_length), size - (sizeof(tga_header_t) + tgahdr->id_lenght + tgahdr->cm_length), colormap, cx*cy * 4, tgahdr->image_type == 10); } } FreeResource(hRes); @@ -1773,8 +1770,8 @@ int ske_UnloadSkin(SKINOBJECTSLIST * Skin) mir_free_and_nil(dt->szFileName); if (dt->plTextList && dt->plTextList->realCount > 0) { - for (int i = 0; i < dt->plTextList->realCount; i++) { - GLYPHTEXT *gt = (GLYPHTEXT *)dt->plTextList->items[i]; + for (int k = 0; k < dt->plTextList->realCount; k++) { + GLYPHTEXT *gt = (GLYPHTEXT *)dt->plTextList->items[k]; if (gt) { mir_free(gt->stText); mir_free(gt->stValueText); diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 34ca2187cb..4e95804f4e 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -262,7 +262,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEW), NULL, TRUE); else { //prepare text TCHAR Author[255], URL[MAX_PATH], Contact[255], Description[400], text[2000]; - SkinListData* sd = NULL; + SkinListData* sd2 = NULL; HTREEITEM hti = TreeView_GetSelection(GetDlgItem(hwndDlg, IDC_TREE1)); if (hti == 0) return 0; { @@ -270,17 +270,17 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem = hti; tvi.mask = TVIF_HANDLE | TVIF_PARAM; TreeView_GetItem(GetDlgItem(hwndDlg, IDC_TREE1), &tvi); - sd = (SkinListData*)(tvi.lParam); + sd2 = (SkinListData*)(tvi.lParam); } - if (!sd) return 0; + if (!sd2) return 0; - if (sd->File && !_tcschr(sd->File, _T('%'))) { - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, _countof(Author), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, _countof(URL), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, _countof(Contact), sd->File); - GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, _countof(Description), sd->File); + if (sd2->File && !_tcschr(sd2->File, _T('%'))) { + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Author"), TranslateT("( unknown )"), Author, _countof(Author), sd2->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("URL"), _T(""), URL, _countof(URL), sd2->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Contact"), _T(""), Contact, _countof(Contact), sd2->File); + GetPrivateProfileString(_T("Skin_Description_Section"), _T("Description"), _T(""), Description, _countof(Description), sd2->File); mir_sntprintf(text, TranslateT("Preview is not available\n\n%s\n----------------------\n\n%s\n\nAUTHOR(S):\n%s\n\nCONTACT:\n%s\n\nHOMEPAGE:\n%s"), - sd->Name, Description, Author, Contact, URL); + sd2->Name, Description, Author, Contact, URL); } else { mir_sntprintf(text, TranslateT("%s\n\n%s\n\nAUTHORS:\n%s\n\nCONTACT:\n%s\n\nWEB:\n%s\n\n\n"), @@ -443,11 +443,11 @@ HTREEITEM FindChild(HWND hTree, HTREEITEM Parent, TCHAR * Caption, void * data) if (!data) return tmp; - TVITEM tvi = { 0 }; - tvi.hItem = tmp; - tvi.mask = TVIF_HANDLE | TVIF_PARAM; - TreeView_GetItem(hTree, &tvi); - SkinListData *sd = (SkinListData*)tvi.lParam; + TVITEM tvi2 = { 0 }; + tvi2.hItem = tmp; + tvi2.mask = TVIF_HANDLE | TVIF_PARAM; + TreeView_GetItem(hTree, &tvi2); + SkinListData *sd = (SkinListData*)tvi2.lParam; if (sd) if (!mir_tstrcmpi(sd->File, ((SkinListData*)data)->File)) return tmp; diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index b3d6537c91..8fc3333cff 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -243,9 +243,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) if (p->bShowProtoEmails == 1 && ProtoServiceExists(szProto, PS_GETUNREADEMAILCOUNT)) { int nEmails = (int)CallProtoService(szProto, PS_GETUNREADEMAILCOUNT, 0, 0); if (nEmails > 0) { - TCHAR buf[40]; - mir_sntprintf(buf, _T("[%d]"), nEmails); - p->szProtoEMailCount = mir_tstrdup(buf); + TCHAR str[40]; + mir_sntprintf(str, _T("[%d]"), nEmails); + p->szProtoEMailCount = mir_tstrdup(str); } } @@ -364,25 +364,25 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) } } - SIZE textSize; + SIZE txtSize; if (p.bShowProtoName) { - GetTextExtentPoint32(hDC, p.tszProtoHumanName, (int)mir_tstrlen(p.tszProtoHumanName), &textSize); - w += textSize.cx + 3 + spaceWidth; + GetTextExtentPoint32(hDC, p.tszProtoHumanName, (int)mir_tstrlen(p.tszProtoHumanName), &txtSize); + w += txtSize.cx + 3 + spaceWidth; } if (p.bShowProtoEmails && p.szProtoEMailCount) { - GetTextExtentPoint32(hDC, p.szProtoEMailCount, (int)mir_tstrlen(p.szProtoEMailCount), &textSize); - w += textSize.cx + 3 + spaceWidth; + GetTextExtentPoint32(hDC, p.szProtoEMailCount, (int)mir_tstrlen(p.szProtoEMailCount), &txtSize); + w += txtSize.cx + 3 + spaceWidth; } if (p.bShowStatusName) { - GetTextExtentPoint32(hDC, p.tszProtoStatusText, (int)mir_tstrlen(p.tszProtoStatusText), &textSize); - w += textSize.cx + 3 + spaceWidth; + GetTextExtentPoint32(hDC, p.tszProtoStatusText, (int)mir_tstrlen(p.tszProtoStatusText), &txtSize); + w += txtSize.cx + 3 + spaceWidth; } if ((p.xStatusMode & 8) && p.tszProtoXStatus) { - GetTextExtentPoint32(hDC, p.tszProtoXStatus, (int)mir_tstrlen(p.tszProtoXStatus), &textSize); - w += textSize.cx + 3 + spaceWidth; + GetTextExtentPoint32(hDC, p.tszProtoXStatus, (int)mir_tstrlen(p.tszProtoXStatus), &txtSize); + w += txtSize.cx + 3 + spaceWidth; } if (p.bShowProtoName || (p.bShowProtoEmails && p.szProtoEMailCount) || p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) @@ -527,9 +527,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) ske_DrawText(hDC, p.tszProtoHumanName, cbLen, &rt, 0); if ((p.bShowProtoEmails && p.szProtoEMailCount != NULL) || p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) { - SIZE textSize; - GetTextExtentPoint32(hDC, p.tszProtoHumanName, cbLen, &textSize); - x += textSize.cx + 3; + SIZE txtSize; + GetTextExtentPoint32(hDC, p.tszProtoHumanName, cbLen, &txtSize); + x += txtSize.cx + 3; } } @@ -540,9 +540,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) rt.top = textY; ske_DrawText(hDC, p.szProtoEMailCount, cbLen, &rt, 0); if (p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) { - SIZE textSize; - GetTextExtentPoint32(hDC, p.szProtoEMailCount, cbLen, &textSize); - x += textSize.cx + 3; + SIZE txtSize; + GetTextExtentPoint32(hDC, p.szProtoEMailCount, cbLen, &txtSize); + x += txtSize.cx + 3; } } @@ -553,9 +553,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) rt.top = textY; ske_DrawText(hDC, p.tszProtoStatusText, cbLen, &rt, 0); if (((p.xStatusMode & 8) && p.tszProtoXStatus)) { - SIZE textSize; - GetTextExtentPoint32(hDC, p.tszProtoStatusText, cbLen, &textSize); - x += textSize.cx + 3; + SIZE txtSize; + GetTextExtentPoint32(hDC, p.tszProtoStatusText, cbLen, &txtSize); + x += txtSize.cx + 3; } } @@ -804,16 +804,16 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa bool first = true; for (int pos = 0; pos < protoCount; pos++) { - int i = pcli->pfnGetAccountIndexByPos(pos); - if (i < 0 || i >= protoCount) + int k = pcli->pfnGetAccountIndexByPos(pos); + if (k < 0 || k >= protoCount) continue; char protoF[sizeof(g_CluiData.protoFilter)]; - mir_snprintf(protoF, _countof(protoF), "%s|", accs[i]->szModuleName); + mir_snprintf(protoF, _countof(protoF), "%s|", accs[k]->szModuleName); if (strstri(g_CluiData.protoFilter, protoF)) { if (!first) mir_strncat(filterName, "; ", _countof(filterName) - mir_strlen(filterName)); - mir_strncat(filterName, T2Utf(accs[i]->tszAccountName), _countof(filterName) - mir_strlen(filterName)); + mir_strncat(filterName, T2Utf(accs[k]->tszAccountName), _countof(filterName) - mir_strlen(filterName)); first = false; } } diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index bec68bae1d..f3d98a0056 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -205,9 +205,6 @@ static int FillDialog(HWND hwnd) { LVCOLUMN lvc = { 0 }; HWND hwndList = GetDlgItem(hwnd, IDC_PROTOCOLS); - LVITEMA item = { 0 }; - int protoCount = 0, i, newItem; - PROTOACCOUNT **accs; CLVM_EnumModes(FillModes); ListView_SetExtendedListViewStyle(GetDlgItem(hwnd, IDC_PROTOCOLS), LVS_EX_CHECKBOXES); @@ -216,13 +213,17 @@ static int FillDialog(HWND hwnd) ListView_InsertColumn(GetDlgItem(hwnd, IDC_PROTOCOLS), 0, &lvc); // fill protocols... + int protoCount; + PROTOACCOUNT **accs; Proto_EnumAccounts(&protoCount, &accs); - - item.mask = LVIF_TEXT; - item.iItem = 1000; - for (i = 0; i < protoCount; i++) { - item.pszText = accs[i]->szModuleName; - newItem = SendMessageA(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&item); + { + LVITEMA item = { 0 }; + item.mask = LVIF_TEXT; + item.iItem = 1000; + for (int i = 0; i < protoCount; i++) { + item.pszText = accs[i]->szModuleName; + SendMessageA(hwndList, LVM_INSERTITEMA, 0, (LPARAM)&item); + } } ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE); @@ -242,12 +243,12 @@ static int FillDialog(HWND hwnd) item.iItem = 1000; item.pszText = TranslateT("Ungrouped contacts"); - newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); + SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); TCHAR *szGroup; for (int i = 1; (szGroup = pcli->pfnGetGroupName(i, NULL)) != NULL; i++) { item.pszText = szGroup; - newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); + SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE); ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP); @@ -257,12 +258,12 @@ static int FillDialog(HWND hwnd) lvc.mask = LVCF_FMT; lvc.fmt = LVCFMT_IMAGE | LVCFMT_LEFT; ListView_InsertColumn(hwndList, 0, &lvc); - for (i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { + for (int i = ID_STATUS_OFFLINE; i <= ID_STATUS_OUTTOLUNCH; i++) { LVITEM item = { 0 }; item.mask = LVIF_TEXT; item.pszText = pcli->pfnGetStatusModeDescription(i, 0); item.iItem = i - ID_STATUS_OFFLINE; - newItem = SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); + SendMessage(hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); } ListView_SetColumnWidth(hwndList, 0, LVSCW_AUTOSIZE); ListView_Arrange(hwndList, LVA_ALIGNLEFT | LVA_ALIGNTOP); @@ -343,8 +344,8 @@ static int DeleteAutoModesCallback(char *szsetting) } -void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD statusMask, DWORD stickyStatusMask, unsigned int options, - unsigned int stickies, unsigned int operators, unsigned int lmdat) +void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szProtoFilter, DWORD dwStatusMask, DWORD dwStickyStatusMask, + unsigned int options, unsigned int stickies, unsigned int operators, unsigned int lmdat) { CLVM_EnumModes(DeleteAutoModesCallback); @@ -354,9 +355,9 @@ void SaveViewMode(const char *name, const TCHAR *szGroupFilter, const char *szPr mir_snprintf(szSetting, "%c%s_GF", 246, name); db_set_ws(NULL, CLVM_MODULE, szSetting, szGroupFilter); mir_snprintf(szSetting, "%c%s_SM", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, statusMask); + db_set_dw(NULL, CLVM_MODULE, szSetting, dwStatusMask); mir_snprintf(szSetting, "%c%s_SSM", 246, name); - db_set_dw(NULL, CLVM_MODULE, szSetting, stickyStatusMask); + db_set_dw(NULL, CLVM_MODULE, szSetting, dwStickyStatusMask); mir_snprintf(szSetting, "%c%s_OPT", 246, name); db_set_dw(NULL, CLVM_MODULE, szSetting, options); mir_snprintf(szSetting, "%c%s_LM", 246, name); @@ -486,7 +487,6 @@ static void UpdateFilters() char szSetting[128]; DWORD dwFlags; DWORD opt; - TCHAR szTemp[100]; if (clvm_curItem == LB_ERR) return; @@ -500,10 +500,11 @@ static void UpdateFilters() T2Utf szBuf(szTempBuf); mir_strncpy(g_szModename, szBuf, _countof(g_szModename)); - - mir_sntprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf); - SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp); - + { + TCHAR szTemp[100]; + mir_sntprintf(szTemp, TranslateT("Configuring view mode: %s"), szTempBuf); + SetDlgItemText(clvmHwnd, IDC_CURVIEWMODE2, szTemp); + } mir_snprintf(szSetting, "%c%s_PF", 246, szBuf); ptrA szPF(db_get_sa(NULL, CLVM_MODULE, szSetting)); if (szPF == NULL) diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index d2276d2f72..a3244218a4 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -410,7 +410,6 @@ LBL_Def: goto LBL_Def; case INTM_NAMECHANGED: - ClcContact *contact; if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL)) break; mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), _countof(contact->szText)); diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 7a49a4aa0b..fde06b477e 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -198,8 +198,6 @@ int GetBasicFontID(ClcContact * contact) void PaintNotifyArea(HDC hDC, RECT *rc) { - static int ev_lastIcon = 0; - rc->left += 26; int iCount = GetMenuItemCount(cfg::dat.hMenuNotify); if (cfg::dat.hUpdateContact != 0) { @@ -210,7 +208,6 @@ void PaintNotifyArea(HDC hDC, RECT *rc) rc->left += 18; DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE); ImageList_DrawEx(hCListImages, (int)cfg::dat.hIconNotify, hDC, 4, (rc->bottom + rc->top - 16) / 2, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL); - ev_lastIcon = cfg::dat.hIconNotify; } else if (iCount > 0) { MENUITEMINFO mii = { 0 }; @@ -225,7 +222,6 @@ void PaintNotifyArea(HDC hDC, RECT *rc) rc->left += 18; ImageList_DrawEx(hCListImages, nmi->iIcon, hDC, 4, (rc->bottom + rc->top) / 2 - 8, 16, 16, CLR_NONE, CLR_NONE, ILD_NORMAL); DrawText(hDC, szName, -1, rc, DT_VCENTER | DT_SINGLELINE); - ev_lastIcon = (int)nmi->hIcon; } else { HICON hIcon = reinterpret_cast(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0)); @@ -411,7 +407,6 @@ int g_padding_y = 0; void __inline PaintItem(HDC hdcMem, ClcGroup *group, ClcContact *contact, int indent, int y, struct ClcData *dat, int index, HWND hwnd, DWORD style, RECT *clRect, BOOL *bFirstNGdrawn, int groupCountsFontTopShift, int rowHeight) { - RECT rc; SIZE textSize = { 0 }, countsSize = { 0 }, spaceSize = { 0 }; int fontHeight; BOOL twoRows = FALSE; @@ -524,6 +519,7 @@ set_bg_l: else checkboxWidth = 0; + RECT rc; rc.left = 0; WORD cstatus = contact->wStatus; @@ -840,7 +836,7 @@ set_bg_l: if (!g_hottrack_done) if (ht->IGNORED == 0) DrawAlpha(hdcMem, &rc, ht->COLOR, ht->ALPHA, ht->COLOR2, ht->COLOR2_TRANSPARENT, ht->GRADIENT, - ht->CORNER, ht->BORDERSTYLE, ht->imageItem); + ht->CORNER, ht->BORDERSTYLE, ht->imageItem); } if (g_RTL) @@ -861,17 +857,17 @@ bgskipped: if (IS_THEMED) hTheme = OpenThemeData(hwnd, L"BUTTON"); - RECT rc; - rc.left = leftX; - rc.right = rc.left + dat->checkboxSize; - rc.top = y + ((rowHeight - dat->checkboxSize) >> 1); - rc.bottom = rc.top + dat->checkboxSize; + RECT rc2; + rc2.left = leftX; + rc2.right = rc2.left + dat->checkboxSize; + rc2.top = y + ((rowHeight - dat->checkboxSize) >> 1); + rc2.bottom = rc2.top + dat->checkboxSize; if (hTheme) { - DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc, &rc); + DrawThemeBackground(hTheme, hdcMem, BP_CHECKBOX, flags & CONTACTF_CHECKED ? (g_hottrack ? CBS_CHECKEDHOT : CBS_CHECKEDNORMAL) : (g_hottrack ? CBS_UNCHECKEDHOT : CBS_UNCHECKEDNORMAL), &rc2, &rc2); CloseThemeData(hTheme); hTheme = 0; } - else DrawFrameControl(hdcMem, &rc, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); + else DrawFrameControl(hdcMem, &rc2, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_FLAT | (flags & CONTACTF_CHECKED ? DFCS_CHECKED : 0) | (g_hottrack ? DFCS_HOT : 0)); rcContent.left += checkboxWidth; leftX += checkboxWidth; @@ -886,21 +882,20 @@ bgskipped: iImage = -1; if (pi_avatar && (av_left || av_right)) { - RECT rc; - - rc.left = rcContent.left; - rc.right = clRect->right; - rc.top = y; - rc.bottom = rc.top + rowHeight; + RECT rc2; + rc2.left = rcContent.left; + rc2.right = clRect->right; + rc2.top = y; + rc2.bottom = rc2.top + rowHeight; if (av_left) { - leftOffset += DrawAvatar(hdcMem, &rc, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); + leftOffset += DrawAvatar(hdcMem, &rc2, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); rcContent.left += leftOffset; leftX += leftOffset; } else { - rc.left = (rcContent.right - cfg::dat.avatarSize) + 1; - rightOffset += DrawAvatar(hdcMem, &rc, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); + rc2.left = (rcContent.right - cfg::dat.avatarSize) + 1; + rightOffset += DrawAvatar(hdcMem, &rc2, contact, y, dat, (WORD)(iImage ? cstatus : 0), rowHeight, cEntry->dwDFlags); rcContent.right -= (rightOffset); } } @@ -968,24 +963,24 @@ bgskipped: 0, 0, CLR_NONE, CLR_NONE, ILD_NORMAL); } - //text + // text if (type == CLCIT_DIVIDER) { - RECT rc; - rc.top = y + ((rowHeight) >> 1); rc.bottom = rc.top + 2; - rc.left = rcContent.left; - rc.right = rc.left - dat->rightMargin + ((clRect->right - rc.left - textSize.cx) >> 1) - 3; - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); - TextOut(hdcMem, rc.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, (int)mir_tstrlen(contact->szText)); - rc.left = rc.right + 6 + textSize.cx; - rc.right = clRect->right - dat->rightMargin; - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + RECT rc2; + rc2.top = y + ((rowHeight) >> 1); rc2.bottom = rc2.top + 2; + rc2.left = rcContent.left; + rc2.right = rc2.left - dat->rightMargin + ((clRect->right - rc2.left - textSize.cx) >> 1) - 3; + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT); + TextOut(hdcMem, rc2.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, (int)mir_tstrlen(contact->szText)); + rc2.left = rc2.right + 6 + textSize.cx; + rc2.right = clRect->right - dat->rightMargin; + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT); } else if (type == CLCIT_GROUP) { - RECT rc; + RECT rc2; int leftLineEnd = 0, rightLineStart; fontHeight = dat->fontInfo[FONTID_GROUPS].fontHeight; - rc.top = y + ((rowHeight - fontHeight) >> 1) + cfg::dat.group_padding; - rc.bottom = rc.top + textSize.cy; + rc2.top = y + ((rowHeight - fontHeight) >> 1) + cfg::dat.group_padding; + rc2.bottom = rc2.top + textSize.cy; if (szCounts[0]) { COLORREF clr = GetTextColor(hdcMem); @@ -994,22 +989,22 @@ bgskipped: if (oldGroupColor != -1) SetTextColor(hdcMem, clr); - rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + iconXSpace; - rc.right = clRect->right - dat->rightMargin; + rc2.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + iconXSpace; + rc2.right = clRect->right - dat->rightMargin; if (indent == 0 && iconXSpace == 0) - rc.left += 2; + rc2.left += 2; int required = textSize.cx + countsSize.cx + spaceSize.cx; - if (required > rc.right - rc.left) - textSize.cx = (rc.right - rc.left) - countsSize.cx - spaceSize.cx; + if (required > rc2.right - rc2.left) + textSize.cx = (rc2.right - rc2.left) - countsSize.cx - spaceSize.cx; int labelWidth = textSize.cx + countsSize.cx + spaceSize.cx; - int offset = (g_center) ? ((rc.right - rc.left) - labelWidth) / 2 : 0; + int offset = (g_center) ? ((rc2.right - rc2.left) - labelWidth) / 2 : 0; - TextOut(hdcMem, rc.left + offset + textSize.cx + spaceSize.cx, rc.top + groupCountsFontTopShift, szCounts, (int)mir_tstrlen(szCounts)); - rightLineStart = rc.left + offset + textSize.cx + spaceSize.cx + countsSize.cx + 2; + TextOut(hdcMem, rc2.left + offset + textSize.cx + spaceSize.cx, rc2.top + groupCountsFontTopShift, szCounts, (int)mir_tstrlen(szCounts)); + rightLineStart = rc2.left + offset + textSize.cx + spaceSize.cx + countsSize.cx + 2; if (selected && !g_ignoreselforgroups) SetTextColor(hdcMem, dat->selTextColour); @@ -1017,52 +1012,52 @@ bgskipped: SetTextColor(hdcMem, clr); ChangeToFont(hdcMem, dat, FONTID_GROUPS, &height); SetTextColor(hdcMem, clr); - rc.left += offset; - rc.right = rc.left + textSize.cx; - leftLineEnd = rc.left - 2; - qLeft = rc.left; - DrawText(hdcMem, contact->szText, -1, &rc, DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS); + rc2.left += offset; + rc2.right = rc2.left + textSize.cx; + leftLineEnd = rc2.left - 2; + qLeft = rc2.left; + DrawText(hdcMem, contact->szText, -1, &rc2, DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS); } else if (g_center && !szCounts[0]) { - rc.left = rcContent.left; - rc.right = clRect->right - dat->rightMargin; - if (textSize.cx >= rc.right - rc.left) - textSize.cx = rc.right - rc.left; - - int offset = ((rc.right - rc.left) - textSize.cx) / 2; - rc.left += offset; - rc.right = rc.left + textSize.cx; - leftLineEnd = rc.left - 2; - rightLineStart = rc.right + 2; - DrawText(hdcMem, contact->szText, -1, &rc, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); - qLeft = rc.left; + rc2.left = rcContent.left; + rc2.right = clRect->right - dat->rightMargin; + if (textSize.cx >= rc2.right - rc2.left) + textSize.cx = rc2.right - rc2.left; + + int offset = ((rc2.right - rc2.left) - textSize.cx) / 2; + rc2.left += offset; + rc2.right = rc2.left + textSize.cx; + leftLineEnd = rc2.left - 2; + rightLineStart = rc2.right + 2; + DrawText(hdcMem, contact->szText, -1, &rc2, DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); + qLeft = rc2.left; } else { qLeft = rcContent.left + (indent == 0 && iconXSpace == 0 ? 2 : 0); - rc.left = qLeft; - rc.right = min(rc.left + textSize.cx, clRect->right - dat->rightMargin); - DrawText(hdcMem, contact->szText, -1, &rc, DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS); + rc2.left = qLeft; + rc2.right = min(rc2.left + textSize.cx, clRect->right - dat->rightMargin); + DrawText(hdcMem, contact->szText, -1, &rc2, DT_VCENTER | DT_NOPREFIX | DT_SINGLELINE | DT_WORD_ELLIPSIS); rightLineStart = qLeft + textSize.cx + 2; } if (dat->exStyle & CLS_EX_LINEWITHGROUPS) { if (!g_center) { - rc.top = y + ((rowHeight) >> 1); rc.bottom = rc.top + 2; - rc.left = rightLineStart; - rc.right = clRect->right - 1 - rightIcons*dat->extraColumnSpacing - dat->rightMargin; - if (rc.right - rc.left > 1) - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + rc2.top = y + ((rowHeight) >> 1); rc2.bottom = rc2.top + 2; + rc2.left = rightLineStart; + rc2.right = clRect->right - 1 - rightIcons*dat->extraColumnSpacing - dat->rightMargin; + if (rc2.right - rc2.left > 1) + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT); } else { - rc.top = y + ((rowHeight) >> 1); rc.bottom = rc.top + 2; - rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + iconXSpace; - rc.right = leftLineEnd; - if (rc.right > rc.left) - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); - rc.right = clRect->right - dat->rightMargin; - rc.left = rightLineStart; - if (rc.right > rc.left) - DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT); + rc2.top = y + ((rowHeight) >> 1); rc2.bottom = rc2.top + 2; + rc2.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + iconXSpace; + rc2.right = leftLineEnd; + if (rc2.right > rc2.left) + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT); + rc2.right = clRect->right - dat->rightMargin; + rc2.left = rightLineStart; + if (rc2.right > rc2.left) + DrawEdge(hdcMem, &rc2, BDR_SUNKENOUTER, BF_RECT); } } } @@ -1106,7 +1101,7 @@ bgskipped: if (cEntry->hTimeZone && fLocalTime) { SIZE szTime; - RECT rc = rcContent; + RECT rc2 = rcContent; int fHeight = 0; TCHAR szResult[80]; @@ -1121,38 +1116,38 @@ bgskipped: if (av_right) { if (verticalfit) - rc.left = rcContent.right + (rightIcons * dat->extraColumnSpacing) - szTime.cx - 2; + rc2.left = rcContent.right + (rightIcons * dat->extraColumnSpacing) - szTime.cx - 2; else - rc.left = rcContent.right - szTime.cx - 2; + rc2.left = rcContent.right - szTime.cx - 2; } else if (av_rightwithnick) { if (verticalfit && rightIcons * dat->extraColumnSpacing >= szTime.cx) - rc.left = clRect->right - dat->rightMargin - szTime.cx; + rc2.left = clRect->right - dat->rightMargin - szTime.cx; else if (verticalfit && !avatar_done) - rc.left = clRect->right - dat->rightMargin - szTime.cx; + rc2.left = clRect->right - dat->rightMargin - szTime.cx; else { - rc.left = rcContent.right - szTime.cx - 2; - rcContent.right = rc.left - 2; + rc2.left = rcContent.right - szTime.cx - 2; + rcContent.right = rc2.left - 2; } } else { if (verticalfit) - rc.left = clRect->right - dat->rightMargin - szTime.cx; + rc2.left = clRect->right - dat->rightMargin - szTime.cx; else - rc.left = rcContent.right - szTime.cx - 2; + rc2.left = rcContent.right - szTime.cx - 2; } - DrawText(hdcMem, szResult, -1, &rc, DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE); + DrawText(hdcMem, szResult, -1, &rc2, DT_NOPREFIX | DT_NOCLIP | DT_SINGLELINE); ChangeToFont(hdcMem, dat, idOldFont, 0); SetTextColor(hdcMem, oldColor); verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); if (verticalfit && av_right) - rcContent.right = min(clRect->right - cfg::dat.avatarSize - 2, rc.left - 2); + rcContent.right = min(clRect->right - cfg::dat.avatarSize - 2, rc2.left - 2); else if (verticalfit && !av_rightwithnick) - rcContent.right = min(clRect->right - dat->rightMargin, rc.left - 3); + rcContent.right = min(clRect->right - dat->rightMargin, rc2.left - 3); } else { -nodisplay: + nodisplay: verticalfit = (rowHeight - fontHeight >= g_cysmIcon + 1); if (avatar_done) { if (verticalfit && av_right) @@ -1171,7 +1166,6 @@ nodisplay: rcContent.bottom = y + rowHeight; if (cstatus >= ID_STATUS_OFFLINE && cstatus <= ID_STATUS_OUTTOLUNCH) { - TCHAR *szText = NULL; BYTE smsgValid = cEntry->bStatusMsgValid; if ((dwFlags & CLUI_FRAME_SHOWSTATUSMSG && smsgValid > STATUSMSG_XSTATUSID) || smsgValid == STATUSMSG_XSTATUSNAME) @@ -1221,28 +1215,27 @@ nodisplay: } if (selected) { if (type != CLCIT_DIVIDER) { - TCHAR *szText = contact->szText; - RECT rc; + RECT rc2; int qlen = (int)mir_tstrlen(dat->szQuickSearch); if (hPreviousFont) SelectObject(hdcMem, hPreviousFont); SetTextColor(hdcMem, dat->quickSearchColour); if (type == CLCIT_CONTACT) { - rc.left = rcContent.left; - rc.top = y + ((rowHeight - fontHeight) >> 1); - rc.right = rcContent.right; - rc.bottom = rc.top; + rc2.left = rcContent.left; + rc2.top = y + ((rowHeight - fontHeight) >> 1); + rc2.right = rcContent.right; + rc2.bottom = rc2.top; if (twoRows) - rc.top = y; + rc2.top = y; } else { - rc.left = qLeft; - rc.top = y + ((rowHeight - fontHeight) >> 1); - rc.right = clRect->right - rightOffset; - rc.bottom = rc.top; + rc2.left = qLeft; + rc2.top = y + ((rowHeight - fontHeight) >> 1); + rc2.right = clRect->right - rightOffset; + rc2.bottom = rc2.top; } if (qlen) - DrawText(hdcMem, szText, qlen, &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); + DrawText(hdcMem, contact->szText, qlen, &rc2, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE); } } @@ -1337,13 +1330,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight); SetBkMode(hdcMem, TRANSPARENT); + { + HBRUSH hBrush = CreateSolidBrush(tmpbkcolour); + HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush); + FillRect(hdcMem, rcPaint, hBrush); - HBRUSH hBrush = CreateSolidBrush(tmpbkcolour); - HBRUSH hoBrush = (HBRUSH)SelectObject(hdcMem, hBrush); - FillRect(hdcMem, rcPaint, hBrush); - - SelectObject(hdcMem, hoBrush); - DeleteObject(hBrush); + SelectObject(hdcMem, hoBrush); + DeleteObject(hBrush); + } if (cfg::dat.bWallpaperMode && !dat->bisEmbedded) { SkinDrawBg(hwnd, hdcMem); @@ -1359,9 +1353,9 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) GetObject(dat->hBmpBackground, sizeof(bmp), &bmp); HDC hdcBmp = CreateCompatibleDC(hdcMem); SelectObject(hdcBmp, dat->hBmpBackground); - int y = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0; + int yy = dat->backgroundBmpUse & CLBF_SCROLL ? -dat->yScroll : 0; int maxx = dat->backgroundBmpUse & CLBF_TILEH ? clRect.right : 1; - int maxy = dat->backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : y + 1; + int maxy = dat->backgroundBmpUse & CLBF_TILEV ? rcPaint->bottom : yy + 1; switch (dat->backgroundBmpUse & CLBM_TYPE) { case CLB_STRETCH: if (dat->backgroundBmpUse & CLBF_PROPORTIONAL) { @@ -1408,11 +1402,11 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint) int bitx = 0, bity = 0; - for (; y < maxy; y += desth) { - if (y < rcPaint->top - desth) + for (; yy < maxy; yy += desth) { + if (yy < rcPaint->top - desth) continue; for (int x = 0; x < maxx; x += destw) - StretchBlt(hdcMem, x, y, destw, desth, cfg::dat.hdcPic, bitx, bity, bmp.bmWidth, bmp.bmHeight, SRCCOPY); + StretchBlt(hdcMem, x, yy, destw, desth, cfg::dat.hdcPic, bitx, bity, bmp.bmWidth, bmp.bmHeight, SRCCOPY); } DeleteDC(hdcBmp); } @@ -1452,7 +1446,7 @@ bgdone: group->scanIndex = 0; int indent = 0; - for (int index = 0; y< rcPaint->bottom;) { + for (int index = 0; y < rcPaint->bottom;) { if (group->scanIndex == group->cl.count) { group = group->parent; indent--; @@ -1516,29 +1510,26 @@ bgdone: DeleteDC(hdcMem); if (grey) { - PBYTE bits; BITMAPINFOHEADER bmih = { 0 }; - - int i; - int greyRed, greyGreen, greyBlue; - COLORREF greyColour; bmih.biBitCount = 32; bmih.biSize = sizeof(bmih); bmih.biCompression = BI_RGB; bmih.biHeight = -clRect.bottom; bmih.biPlanes = 1; bmih.biWidth = clRect.right; - bits = (PBYTE)mir_alloc(4 * bmih.biWidth * -bmih.biHeight); + + PBYTE bits = (PBYTE)mir_alloc(4 * bmih.biWidth * -bmih.biHeight); GetDIBits(hdc, hBmpOsb, 0, clRect.bottom, bits, (BITMAPINFO *)&bmih, DIB_RGB_COLORS); - greyColour = GetSysColor(COLOR_3DFACE); - greyRed = GetRValue(greyColour) * 2; - greyGreen = GetGValue(greyColour) * 2; - greyBlue = GetBValue(greyColour) * 2; + + COLORREF greyColour = GetSysColor(COLOR_3DFACE); + int greyRed = GetRValue(greyColour) * 2; + int greyGreen = GetGValue(greyColour) * 2; + int greyBlue = GetBValue(greyColour) * 2; if (divide3[0] == 255) { - for (i = 0; i < sizeof(divide3) / sizeof(divide3[0]); i++) + for (int i = 0; i < sizeof(divide3) / sizeof(divide3[0]); i++) divide3[i] = (i + 1) / 3; } - for (i = 4 * clRect.right *clRect.bottom - 4; i >= 0; i -= 4) { + for (int i = 4 * clRect.right *clRect.bottom - 4; i >= 0; i -= 4) { bits[i] = divide3[bits[i] + greyBlue]; bits[i + 1] = divide3[bits[i + 1] + greyGreen]; bits[i + 2] = divide3[bits[i + 2] + greyRed]; diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp index f95a704439..ef1bf5075a 100644 --- a/plugins/Db3x_mmap/src/dbcrypt.cpp +++ b/plugins/Db3x_mmap/src/dbcrypt.cpp @@ -342,13 +342,13 @@ void CDb3Mmap::ToggleSettingsEncryption(MCONTACT contactID) for (int i = 0; i < arSettings.getCount(); i++) { VarDescr &p = arSettings[i]; if (!m_bEncrypted) { - size_t len; - BYTE *pResult = m_crypto->encodeString(p.szValue, &len); + size_t encodedLen; + BYTE *pResult = m_crypto->encodeString(p.szValue, &encodedLen); if (pResult != NULL) { DBCONTACTWRITESETTING dbcws = { szModule, p.szVar }; dbcws.value.type = DBVT_ENCRYPTED; dbcws.value.pbVal = pResult; - dbcws.value.cpbVal = (WORD)len; + dbcws.value.cpbVal = (WORD)encodedLen; WriteContactSetting(contactID, &dbcws); mir_free(pResult); diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index b04f219815..4e444eaa67 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -216,7 +216,7 @@ LBL_Seek: /**** add to cache **********************/ if (iType != DBVT_BLOB && iType != DBVT_ENCRYPTED) { - DBVARIANT *pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 1); + pCachedValue = m_cache->GetCachedValuePtr(contactID, szCachedSettingName, 1); if (pCachedValue != NULL) { m_cache->SetCachedVariant(dbv, pCachedValue); log3("set cached [%08p] %s (%p)", hContact, szCachedSettingName, pCachedValue); diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 8e13789c0a..424b43837f 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -8,7 +8,7 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo) return; DBVARIANT dbv; - for(ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) { + for (ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) { if (!db_get_s(hContactFrom, module, setting->name, &dbv, 0)) { db_set(hContactTo, module, setting->name, &dbv); db_free(&dbv); @@ -17,47 +17,45 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo) FreeModuleSettingLL(&msll); } -INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + + switch (uMsg) { case WM_INITDIALOG: - { TranslateDialogDefault(hwnd); SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - ModuleAndContact *mac = (ModuleAndContact *)lParam; - TCHAR name[NAME_SIZE], msg[MSG_SIZE]; + { + mac = (ModuleAndContact *)lParam; + TCHAR name[NAME_SIZE], msg[MSG_SIZE]; - mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); - SetWindowText(hwnd, msg); + mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); + SetWindowText(hwnd, msg); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) - { - if (ApplyProtoFilter(hContact)) - continue; + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + if (ApplyProtoFilter(hContact)) + continue; - GetContactName(hContact, NULL, name, _countof(name)); - - int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact); - } + GetContactName(hContact, NULL, name, _countof(name)); + + int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact); + } - GetContactName(NULL, NULL, name, _countof(name)); - int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0); + GetContactName(NULL, NULL, name, _countof(name)); + int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0); + } break; - } - case WM_COMMAND: - { - ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + case WM_COMMAND: switch (LOWORD(wParam)) { case CHK_COPY2ALL: EnableWindow(GetDlgItem(hwnd, IDC_CONTACTS), BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL)); break; case IDOK: - if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL)) { MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0); copyModule(mac->module, mac->hContact, hContact); @@ -70,7 +68,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SetCursor(LoadCursor(NULL, IDC_ARROW)); } refreshTree(1); - // fall through + // fall through case IDCANCEL: mir_free(mac); DestroyWindow(hwnd); @@ -78,7 +76,6 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } break; } - } //switch return 0; } diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index f543a32f28..5f118fd7a6 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" - TCHAR *GetFilter() { static TCHAR filter[MAX_PATH]; @@ -8,10 +7,8 @@ TCHAR *GetFilter() return filter; } - int Openfile(TCHAR *outputFile, const char *module, int maxlen) { - OPENFILENAME ofn = { 0 }; TCHAR filename[MAX_PATH]; if (module) { @@ -31,11 +28,10 @@ int Openfile(TCHAR *outputFile, const char *module, int maxlen) } n++; } - } - else - filename[0] = 0; - + } + else filename[0] = 0; + OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = filename; ofn.lpstrFilter = GetFilter(); @@ -118,13 +114,13 @@ char* NickFromHContact(MCONTACT hContact) if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto))) loaded = Proto_GetAccount(szProto) ? 1 : 0; - if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name))) + if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name))) mir_strncpy(name, "(UNKNOWN)", _countof(name)); - + if (!loaded) { if (szProto[0]) mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); - else + else mir_strncpy(nick, name, _countof(nick)); } else { @@ -134,8 +130,7 @@ char* NickFromHContact(MCONTACT hContact) GetValueA(hContact, szProto, uid, szUID, _countof(szUID)); mir_snprintf(nick, _countof(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID); } - else - mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); + else mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); } } @@ -192,7 +187,7 @@ void exportDB(MCONTACT hContact, const char *module) fprintf(file, "\n\n"); while (hContact) { - + if (ApplyProtoFilter(hContact)) { hContact = db_find_next(hContact); continue; @@ -400,10 +395,10 @@ void importSettings(MCONTACT hContact, char *utf8) for (char *pstr = end + 2; *pstr; pstr++) { if (*pstr == '\\') { switch (pstr[1]) { - case 'n': *pstr = '\n'; break; - case 't': *pstr = '\t'; break; - case 'r': *pstr = '\r'; break; - default: *pstr = pstr[1]; break; + case 'n': *pstr = '\n'; break; + case 't': *pstr = '\t'; break; + case 'r': *pstr = '\r'; break; + default: *pstr = pstr[1]; break; } memmove(pstr + 1, pstr + 2, mir_strlen(pstr + 2) + 1); } @@ -430,10 +425,9 @@ void importSettings(MCONTACT hContact, char *utf8) SetCursor(LoadCursor(NULL, IDC_ARROW)); } - -INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + switch (uMsg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); @@ -450,7 +444,6 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case WM_COMMAND: switch (LOWORD(wParam)) { - case IDCANCEL: DestroyWindow(hwnd); break; @@ -471,16 +464,13 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } - void ImportSettingsMenuItem(MCONTACT hContact) { CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IMPORT), hwnd2mainWindow, ImportDlgProc, hContact); } - int Openfile2Import(TCHAR *outputFiles, int maxlen) { - OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFilter = GetFilter(); @@ -508,12 +498,12 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) DWORD offset = 0; - mir_tstrcpy(szFileNames, _T("")); + mir_tstrcpy(szFileNames, _T("")); if (!FilePath) offset = Openfile2Import(szFileNames, _countof(szFileNames)); else { - _A2T tmp(FilePath); + _A2T tmp(FilePath); if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES) mir_tstrncpy(szFileNames, tmp, _countof(szFileNames)); } diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 42a4bc69a1..d2addc9fc3 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -23,9 +23,9 @@ int renameModule(MCONTACT hContact, const char *oldName, const char *newName) return cnt; } -INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + switch (uMsg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); @@ -35,8 +35,8 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name); SetWindowText(hwnd, msg); + break; - break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: @@ -49,8 +49,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_b(hContact, modulename, "(Default)", 0); } - else - db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); + else db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); refreshTree(1); } @@ -63,7 +62,6 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } - void addModuleDlg(MCONTACT hContact) { CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd2mainWindow, AddModDlgProc, hContact); diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index b76d70f601..30ca9c91d7 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -22,7 +22,6 @@ CLIST_INTERFACE *pcli; HINSTANCE hInst; int hLangpack; -HANDLE hModulesLoaded, hEventPreShutdown, hOptionsInit, hPrebuildContactMenu, hTabsrmmButtonPressed; HANDLE hServiceUpload, hServiceShowManager, hServiceContactMenu, hServiceMainMenu; HGENMENU hMenu, hMainMenu, hSubMenu[ServerList::FTP_COUNT], hMainSubMenu[ServerList::FTP_COUNT]; @@ -38,9 +37,9 @@ void PrebuildMainMenu(); int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam); int UploadFile(MCONTACT hContact, int iFtpNum, UploadJob::EMode mode); -static PLUGININFOEX pluginInfoEx = +static PLUGININFOEX pluginInfoEx = { - sizeof(PLUGININFOEX), + sizeof(PLUGININFOEX), __PLUGIN_NAME, PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM), __DESCRIPTION, @@ -56,7 +55,7 @@ static PLUGININFOEX pluginInfoEx = //------------ BASIC STAFF ------------// extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) -{ +{ hInst = hinstDLL; return TRUE; } @@ -106,11 +105,10 @@ void InitMenuItems() mi.name.t = stzName; CMenuItem mi2; - mi2.flags = CMIF_TCHAR; + mi2.flags = CMIF_TCHAR; mi2.pszService = MS_FTPFILE_CONTACTMENU; - for (int i = 0; i < ServerList::FTP_COUNT; i++) - { + for (int i = 0; i < ServerList::FTP_COUNT; i++) { if (DB::getStringF(0, MODULE, "Name%d", i, stzName)) mir_sntprintf(stzName, _countof(stzName), TranslateT("FTP Server %d"), i + 1); @@ -123,10 +121,10 @@ void InitMenuItems() mi.root = hMainMenu; hMainSubMenu[i] = Menu_AddMainMenuItem(&mi); - + mi2.root = hSubMenu[i]; mi2.pszService = MS_FTPFILE_CONTACTMENU; - mi2.name.t = LPGENT("Upload file(s)"); + mi2.name.t = LPGENT("Upload file(s)"); HGENMENU tmp = Menu_AddContactMenuItem(&mi2); Menu_ConfigureItem(tmp, MCI_OPT_EXECPARAM, mi2.position = i + UploadJob::FTP_RAWFILE); @@ -156,7 +154,7 @@ void InitMenuItems() } memset(&mi, 0, sizeof(mi)); - mi.flags = CMIF_TCHAR; + mi.flags = CMIF_TCHAR; mi.hIcolibItem = iconList[ServerList::FTP_COUNT].hIcolib; mi.position = 3000090001; mi.name.t = LPGENT("FTP File manager"); @@ -166,12 +164,12 @@ void InitMenuItems() PrebuildMainMenu(); - hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); } void InitHotkeys() { - HOTKEYDESC hk = {0}; + HOTKEYDESC hk = { 0 }; hk.cbSize = sizeof(hk); hk.pszDescription = LPGEN("Show FTPFile manager"); hk.pszName = "FTP_ShowManager"; @@ -182,9 +180,8 @@ void InitHotkeys() void InitTabsrmmButton() { - if (ServiceExists(MS_BB_ADDBUTTON)) - { - BBButton btn = {0}; + if (ServiceExists(MS_BB_ADDBUTTON)) { + BBButton btn = { 0 }; btn.cbSize = sizeof(btn); btn.dwButtonID = 1; btn.pszModuleName = MODULE; @@ -193,7 +190,7 @@ void InitTabsrmmButton() btn.bbbFlags = BBBF_ISARROWBUTTON | BBBF_ISIMBUTTON | BBBF_ISLSIDEBUTTON | BBBF_CANBEHIDDEN; btn.ptszTooltip = TranslateT("FTP File"); CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&btn); - hTabsrmmButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); } } @@ -207,87 +204,75 @@ int PrebuildContactMenu(WPARAM wParam, LPARAM) if (szProto) bIsContact = (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IM) ? true : false; bool bHideRoot = opt.bHideInactive; - for (int i = 0; i < ServerList::FTP_COUNT; i++) + for (int i = 0; i < ServerList::FTP_COUNT; i++) if (ftpList[i]->bEnabled) bHideRoot = false; if (opt.bUseSubmenu) Menu_ShowItem(hMenu, bIsContact && !bHideRoot); - for (int i = 0; i < ServerList::FTP_COUNT; i++) + for (int i = 0; i < ServerList::FTP_COUNT; i++) Menu_ShowItem(hSubMenu[i], bIsContact && ftpList[i]->bEnabled); return 0; } void PrebuildMainMenu() { - for (int i=0; i < ServerList::FTP_COUNT; i++) + for (int i = 0; i < ServerList::FTP_COUNT; i++) if (ftpList[i]) Menu_ShowItem(hMainSubMenu[i], ftpList[i]->bEnabled); } -int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) +int TabsrmmButtonPressed(WPARAM hContact, LPARAM lParam) { CustomButtonClickData *cbc = (CustomButtonClickData *)lParam; - if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) - { - if (cbc->flags == BBCF_ARROWCLICKED) - { - HMENU hMenu = CreatePopupMenu(); - if (hMenu) - { + if (!strcmp(cbc->pszModule, MODULE) && cbc->dwButtonId == 1 && hContact) { + if (cbc->flags == BBCF_ARROWCLICKED) { + HMENU hPopupMenu = CreatePopupMenu(); + if (hPopupMenu) { int iCount = 0; - for (UINT i = 0; i < ServerList::FTP_COUNT; i++) - { - if (ftpList[i]->bEnabled) - { + for (UINT i = 0; i < ServerList::FTP_COUNT; i++) { + if (ftpList[i]->bEnabled) { HMENU hModeMenu = CreatePopupMenu(); AppendMenu(hModeMenu, MF_STRING, i + UploadJob::FTP_RAWFILE, TranslateT("Upload file")); AppendMenu(hModeMenu, MF_STRING, i + UploadJob::FTP_ZIPFILE, TranslateT("Zip and upload file")); AppendMenu(hModeMenu, MF_STRING, i + UploadJob::FTP_ZIPFOLDER, TranslateT("Zip and upload folder")); - AppendMenu(hMenu, MF_STRING | MF_POPUP, (UINT_PTR)hModeMenu, ftpList[i]->stzName); + AppendMenu(hPopupMenu, MF_STRING | MF_POPUP, (UINT_PTR)hModeMenu, ftpList[i]->stzName); DestroyMenu(hModeMenu); iCount++; } } - if (iCount != 0) - { + if (iCount != 0) { POINT pt; GetCursorPos(&pt); HWND hwndBtn = WindowFromPoint(pt); - if (hwndBtn) - { + if (hwndBtn) { RECT rc; GetWindowRect(hwndBtn, &rc); SetForegroundWindow(cbc->hwndFrom); - int selected = TrackPopupMenu(hMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0); - if (selected != 0) - { - int ftpNum = selected & (1|2|4); - int mode = selected & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); + int selected = TrackPopupMenu(hPopupMenu, TPM_RETURNCMD, rc.left, rc.bottom, 0, cbc->hwndFrom, 0); + if (selected != 0) { + int ftpNum = selected & (1 | 2 | 4); + int mode = selected & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); UploadFile(hContact, ftpNum, (UploadJob::EMode)mode); } } } - DestroyMenu(hMenu); + DestroyMenu(hPopupMenu); } - } - else - { - UploadFile(hContact, 0, UploadJob::FTP_RAWFILE); } + else UploadFile(hContact, 0, UploadJob::FTP_RAWFILE); } return 0; } -int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **objects, int objCount, DWORD flags) +int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **objects, int objCount, DWORD flags) { - if (!ftpList[iFtpNum]->isValid()) - { + if (!ftpList[iFtpNum]->isValid()) { Utils::msgBox(TranslateT("You have to fill FTP server setting before upload a file."), MB_OK | MB_ICONERROR); return 1; } @@ -304,11 +289,9 @@ int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **ob else result = job->getFiles(); - if (result != 0) - { + if (result != 0) { uDlg = UploadDialog::getInstance(); - if (!uDlg->hwnd || !uDlg->hwndTabs) - { + if (!uDlg->hwnd || !uDlg->hwndTabs) { Utils::msgBox(TranslateT("Error has occurred while trying to create a dialog!"), MB_OK | MB_ICONERROR); delete uDlg; return 1; @@ -317,8 +300,7 @@ int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **ob job->addToUploadDlg(); uDlg->show(); } - else - { + else { delete job; return 1; } @@ -328,12 +310,12 @@ int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode, void **ob int UploadFile(MCONTACT hContact, int iFtpNum, GenericJob::EMode mode) { - return UploadFile(hContact, iFtpNum, mode, NULL, 0, 0); + return UploadFile(hContact, iFtpNum, mode, NULL, 0, 0); } //------------ MIRANDA SERVICES ------------// -INT_PTR UploadService(WPARAM, LPARAM lParam) +INT_PTR UploadService(WPARAM, LPARAM lParam) { FTPUPLOAD* ftpu = (FTPUPLOAD *)lParam; if (ftpu == NULL || ftpu->cbSize != sizeof(FTPUPLOAD)) @@ -343,27 +325,27 @@ INT_PTR UploadService(WPARAM, LPARAM lParam) int mode = (ftpu->mode * GenericJob::FTP_RAWFILE); UploadFile(ftpu->hContact, ftpNum, (GenericJob::EMode)mode, (void**)ftpu->pstzObjects, ftpu->objectCount, ftpu->flags); - return 0; + return 0; } -INT_PTR ShowManagerService(WPARAM, LPARAM) +INT_PTR ShowManagerService(WPARAM, LPARAM) { manDlg = Manager::getInstance(); manDlg->init(); return 0; } -INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam) +INT_PTR ContactMenuService(WPARAM hContact, LPARAM lParam) { - int ftpNum = lParam & (1|2|4); - int mode = lParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); + int ftpNum = lParam & (1 | 2 | 4); + int mode = lParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); return UploadFile(hContact, ftpNum, (UploadJob::EMode)mode); } -INT_PTR MainMenuService(WPARAM wParam, LPARAM) +INT_PTR MainMenuService(WPARAM wParam, LPARAM) { - int ftpNum = wParam & (1|2|4); - int mode = wParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); + int ftpNum = wParam & (1 | 2 | 4); + int mode = wParam & (UploadJob::FTP_RAWFILE | UploadJob::FTP_ZIPFILE | UploadJob::FTP_ZIPFOLDER); return UploadFile(0, ftpNum, (UploadJob::EMode)mode); } @@ -382,7 +364,7 @@ int ModulesLoaded(WPARAM, LPARAM) return 0; } -int Shutdown(WPARAM, LPARAM) +int Shutdown(WPARAM, LPARAM) { deleteTimer.deinit(); @@ -393,7 +375,7 @@ int Shutdown(WPARAM, LPARAM) DeleteJob::jobDone.release(); DBEntry::cleanupDB(); - curl_global_cleanup(); + curl_global_cleanup(); ftpList.deinit(); opt.deinit(); @@ -406,15 +388,15 @@ extern "C" int __declspec(dllexport) Load(void) mir_getLP(&pluginInfoEx); mir_getCLI(); -#ifdef _DEBUG + #ifdef _DEBUG _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); -#endif + #endif CoInitialize(NULL); - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); - hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); - hOptionsInit = HookEvent(ME_OPT_INITIALISE, Options::InitOptions); + HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded); + HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown); + HookEvent(ME_OPT_INITIALISE, Options::InitOptions); hServiceUpload = CreateServiceFunction(MS_FTPFILE_UPLOAD, UploadService); hServiceShowManager = CreateServiceFunction(MS_FTPFILE_SHOWMANAGER, ShowManagerService); @@ -427,22 +409,14 @@ extern "C" int __declspec(dllexport) Load(void) opt.loadOptions(); deleteTimer.init(); ftpList.init(); - return 0; } -extern "C" int __declspec(dllexport) Unload(void) -{ - UnhookEvent(hModulesLoaded); - UnhookEvent(hEventPreShutdown); - UnhookEvent(hOptionsInit); - UnhookEvent(hPrebuildContactMenu); - UnhookEvent(hTabsrmmButtonPressed); - +extern "C" int __declspec(dllexport) Unload(void) +{ DestroyServiceFunction(hServiceUpload); DestroyServiceFunction(hServiceShowManager); DestroyServiceFunction(hServiceContactMenu); DestroyServiceFunction(hServiceMainMenu); - return 0; -} \ No newline at end of file +} diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index 7101b78803..1553d293fb 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -299,12 +299,12 @@ void ThumbInfo::ResizeThumb() } } -void ThumbInfo::RefreshContactIcon(int iIcon) +void ThumbInfo::RefreshContactIcon(int _iIcon) { - if (iIcon == 0xFFFFFFFF || ImageList_GetImageCount(himlMiranda) <= iIcon) - this->iIcon = CallService(MS_CLIST_GETCONTACTICON, hContact, 0); + if (iIcon == 0xFFFFFFFF || ImageList_GetImageCount(himlMiranda) <= _iIcon) + iIcon = CallService(MS_CLIST_GETCONTACTICON, hContact, 0); else - this->iIcon = iIcon; + iIcon = _iIcon; UpdateContent(); } diff --git a/plugins/IEView/src/Options.cpp b/plugins/IEView/src/Options.cpp index 08f4948d52..444966f79a 100644 --- a/plugins/IEView/src/Options.cpp +++ b/plugins/IEView/src/Options.cpp @@ -1083,9 +1083,9 @@ void ProtocolSettings::copyFromTemp() setHistoryEnable(isHistoryEnableTemp()); } -void ProtocolSettings::setNext(ProtocolSettings *next) +void ProtocolSettings::setNext(ProtocolSettings *_next) { - this->next = next; + next = _next; } const char *ProtocolSettings::getProtocolName() diff --git a/plugins/IEView/src/Template.cpp b/plugins/IEView/src/Template.cpp index 3355a4ec13..705ba6ddc3 100644 --- a/plugins/IEView/src/Template.cpp +++ b/plugins/IEView/src/Template.cpp @@ -77,43 +77,28 @@ const char* Token::getText() Template::Template(const char *name, const char *text) { - next = NULL; - tokens = NULL; - this->text = mir_strdup(text); - this->name = mir_strdup(name); + m_next = NULL; + m_tokens = NULL; + m_text = mir_strdup(text); + m_name = mir_strdup(name); tokenize(); } Template::~Template() { - mir_free(text); - mir_free(name); - Token *ptr = tokens, *ptr2; - tokens = NULL; + mir_free(m_text); + mir_free(m_name); + Token *ptr = m_tokens, *ptr2; + m_tokens = NULL; for (; ptr != NULL; ptr = ptr2) { ptr2 = ptr->getNext(); delete ptr; } } -const char* Template::getText() -{ - return text; -} - -const char* Template::getName() -{ - return name; -} - -Template* Template::getNext() -{ - return next; -} - bool Template::equals(const char *name) { - if (!mir_strcmp(name, this->name)) + if (!mir_strcmp(m_name, name)) return true; return false; @@ -163,10 +148,10 @@ static TokenDef tokenNames[] = { void Template::tokenize() { - if (text == NULL) + if (m_text == NULL) return; - char *str = mir_strdup(text); + char *str = mir_strdup(m_text); Token *lastToken = NULL; int lastTokenType = Token::PLAIN; int lastTokenEscape = 0; @@ -211,7 +196,7 @@ void Template::tokenize() if (lastToken != NULL) lastToken->setNext(newToken); else - tokens = newToken; + m_tokens = newToken; lastToken = newToken; lastTokenStart = i; @@ -223,27 +208,22 @@ void Template::tokenize() mir_free(str); } -Token* Template::getTokens() -{ - return tokens; -} - -TemplateMap* TemplateMap::mapList = NULL; +TemplateMap* TemplateMap::m_mapList = NULL; TemplateMap::TemplateMap(const char *name) { - entries = NULL; - next = NULL; - filename = NULL; - this->name = mir_strdup(name); - this->grouping = false; - this->rtl = false; + m_entries = NULL; + m_next = NULL; + m_filename = NULL; + m_name = mir_strdup(name); + m_grouping = false; + m_rtl = false; } TemplateMap::~TemplateMap() { - mir_free(name); - mir_free(filename); + mir_free(m_name); + mir_free(m_filename); clear(); } @@ -251,8 +231,8 @@ TemplateMap::~TemplateMap() TemplateMap* TemplateMap::add(const char *id, const char *filename) { TemplateMap *map; - for (map = mapList; map != NULL; map = map->next) { - if (!mir_strcmp(map->name, id)) { + for (map = m_mapList; map != NULL; map = map->m_next) { + if (!mir_strcmp(map->m_name, id)) { map->clear(); map->setFilename(filename); return map; @@ -260,23 +240,23 @@ TemplateMap* TemplateMap::add(const char *id, const char *filename) } map = new TemplateMap(id); map->setFilename(filename); - map->next = mapList; - mapList = map; + map->m_next = m_mapList; + m_mapList = map; return map; } void TemplateMap::addTemplate(const char *name, const char *text) { Template *tmplate = new Template(name, text); - tmplate->next = entries; - entries = tmplate; + tmplate->m_next = m_entries; + m_entries = tmplate; } void TemplateMap::clear() { Template *ptr, *ptr2; - ptr = entries; - entries = NULL; + ptr = m_entries; + m_entries = NULL; for (; ptr != NULL; ptr = ptr2) { ptr2 = ptr->getNext(); delete ptr; @@ -338,7 +318,6 @@ static TokenDef templateNames[] = { TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, bool onlyInfo) { char lastTemplate[1024], tmp2[1024]; - unsigned int i = 0; if (filename == NULL || mir_strlen(filename) == 0) return NULL; @@ -385,37 +364,27 @@ TemplateMap* TemplateMap::loadTemplateFile(const char *id, const char *filename, "hMessageInGroupStart", "hMessageInGroupInner", "MessageOutGroupStart", "MessageOutGroupInner", "hMessageOutGroupStart", "hMessageOutGroupInner" }; - tmap->grouping = true; - for (i = 0; i < _countof(groupTemplates); i++) { + tmap->m_grouping = true; + for (int i = 0; i < _countof(groupTemplates); i++) { if (tmap->getTemplate(groupTemplates[i]) == NULL) { - tmap->grouping = false; + tmap->m_grouping = false; break; } } static const char *rtlTemplates[] = { "MessageInRTL", "MessageOutRTL" }; //"HTMLStartRTL", - tmap->rtl = true; - for (i = 0; i < _countof(rtlTemplates); i++) { + tmap->m_rtl = true; + for (int i = 0; i < _countof(rtlTemplates); i++) { if (tmap->getTemplate(rtlTemplates[i]) == NULL) { - tmap->rtl = false; + tmap->m_rtl = false; break; } } return tmap; } -bool TemplateMap::isGrouping() -{ - return grouping; -} - -bool TemplateMap::isRTL() -{ - return rtl; -} - Template* TemplateMap::getTemplate(const char *text) { - for (Template *ptr = entries; ptr != NULL; ptr = ptr->getNext()) + for (Template *ptr = m_entries; ptr != NULL; ptr = ptr->getNext()) if (ptr->equals(text)) return ptr; @@ -424,8 +393,8 @@ Template* TemplateMap::getTemplate(const char *text) Template* TemplateMap::getTemplate(const char *proto, const char *text) { - for (TemplateMap *ptr = mapList; ptr != NULL; ptr = ptr->next) - if (!mir_strcmp(ptr->name, proto)) + for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next) + if (!mir_strcmp(ptr->m_name, proto)) return ptr->getTemplate(text); return NULL; @@ -433,22 +402,17 @@ Template* TemplateMap::getTemplate(const char *proto, const char *text) TemplateMap* TemplateMap::getTemplateMap(const char *proto) { - for (TemplateMap *ptr = mapList; ptr != NULL; ptr = ptr->next) - if (!mir_strcmp(ptr->name, proto)) + for (TemplateMap *ptr = m_mapList; ptr != NULL; ptr = ptr->m_next) + if (!mir_strcmp(ptr->m_name, proto)) return ptr; return NULL; } -const char *TemplateMap::getFilename() -{ - return filename; -} - -void TemplateMap::setFilename(const char *_filename) +void TemplateMap::setFilename(const char *filename) { - replaceStr(filename, _filename); - Utils::convertPath(filename); + replaceStr(m_filename, filename); + Utils::convertPath(m_filename); } TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bool onlyInfo) @@ -458,8 +422,8 @@ TemplateMap* TemplateMap::loadTemplates(const char *id, const char *filename, bo void TemplateMap::dropTemplates() { - for (TemplateMap *p = mapList, *p1; p != NULL; p = p1) { - p1 = p->next; + for (TemplateMap *p = m_mapList, *p1; p != NULL; p = p1) { + p1 = p->m_next; delete p; } } diff --git a/plugins/IEView/src/Template.h b/plugins/IEView/src/Template.h index 18ebf40c52..87117c0a45 100644 --- a/plugins/IEView/src/Template.h +++ b/plugins/IEView/src/Template.h @@ -74,34 +74,39 @@ public: void setNext(Token *); }; -class Template { -private: - char *name; - char *text; - Template *next; - Token *tokens; +class Template +{ + char *m_name; + char *m_text; + Template *m_next; + Token *m_tokens; + protected: friend class TemplateMap; - bool equals(const char *name); - void tokenize(); - Template * getNext(); + bool equals(const char *name); + void tokenize(); + Template(const char *name, const char *text); + public: ~Template(); - const char *getText(); - const char *getName(); - Token *getTokens(); + + __forceinline Template* getNext() { return m_next; } + __forceinline const char* getText() const { return m_text; } + __forceinline const char* getName() const { return m_name; } + __forceinline Token* getTokens() const { return m_tokens; } }; -class TemplateMap { -private: - static TemplateMap *mapList; - char *name; - char *filename; - bool grouping; - bool rtl; - Template *entries; - TemplateMap *next; +class TemplateMap +{ + static TemplateMap *m_mapList; + char *m_name; + char *m_filename; + bool m_grouping; + bool m_rtl; + Template *m_entries; + TemplateMap *m_next; + TemplateMap(const char *name); void addTemplate(const char *name, const char *text); void setFilename(const char *filename); @@ -109,6 +114,7 @@ private: static TemplateMap* add(const char *id, const char *filename); static void appendText(char **str, int *sizeAlloced, const char *fmt, ...); static TemplateMap* loadTemplateFile(const char *proto, const char *filename, bool onlyInfo); + public: ~TemplateMap(); static Template* getTemplate(const char *id, const char *name); @@ -116,9 +122,11 @@ public: static TemplateMap* loadTemplates(const char *id, const char *filename, bool onlyInfo); static void dropTemplates(); Template* getTemplate(const char *text); - const char* getFilename(); - bool isGrouping(); - bool isRTL(); + + __forceinline const char* getFilename() { return m_filename; } + + __forceinline bool isGrouping() const { return m_grouping; } + __forceinline bool isRTL() const { return m_rtl; } }; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 22cdff0cf2..3b6407d3d2 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -1319,65 +1319,57 @@ int facebook_client::send_message(int seqid, MCONTACT hContact, const std::strin } } - switch (resp.error_number) - { + switch (resp.error_number) { case 0: - { // Everything is OK - } break; + break; - //case 1356002: // You are offline (probably you can't use mercury or some other request when chat is offline) + // case 1356002: // You are offline (probably you can't use mercury or some other request when chat is offline) case 1356003: // Contact is offline - { parent->setWord(hContact, "Status", ID_STATUS_OFFLINE); return SEND_MESSAGE_ERROR; - } case 1356026: // Contact has alternative client - { client_notify(TranslateT("Need confirmation for sending messages to other clients.\nOpen Facebook website and try to send message to this contact again!")); return SEND_MESSAGE_ERROR; - } case 1357007: // Security check (captcha) is required - { - std::string imageUrl = utils::text::html_entities_decode(utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "img class=\\\"img\\\"", "src=\\\"", "\\\""))); - std::string captchaPersistData = utils::text::source_get_value(&resp.data, 3, "\\\"captcha_persist_data\\\"", "value=\\\"", "\\\""); + { + std::string imageUrl = utils::text::html_entities_decode(utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "img class=\\\"img\\\"", "src=\\\"", "\\\""))); + std::string captchaPersistData = utils::text::source_get_value(&resp.data, 3, "\\\"captcha_persist_data\\\"", "value=\\\"", "\\\""); - parent->debugLogA(" Got imageUrl (first): %s", imageUrl.c_str()); - parent->debugLogA(" Got captchaPersistData (first): %s", captchaPersistData.c_str()); + parent->debugLogA(" Got imageUrl (first): %s", imageUrl.c_str()); + parent->debugLogA(" Got captchaPersistData (first): %s", captchaPersistData.c_str()); - std::string data = "new_captcha_type=TFBCaptcha&skipped_captcha_data=" + captchaPersistData; - data += "&__dyn=&__req=&__rev=&__user=" + this->self_.user_id; - http::response resp = flap(REQUEST_CAPTCHA_REFRESH, NULL, &data); + std::string capStr = "new_captcha_type=TFBCaptcha&skipped_captcha_data=" + captchaPersistData; + capStr += "&__dyn=&__req=&__rev=&__user=" + this->self_.user_id; + http::response capResp = flap(REQUEST_CAPTCHA_REFRESH, NULL, &capStr); - if (resp.code == HTTP_CODE_OK) { - imageUrl = utils::text::html_entities_decode(utils::text::slashu_to_utf8(utils::text::source_get_value(&resp.data, 3, "img class=\\\"img\\\"", "src=\\\"", "\\\""))); - captchaPersistData = utils::text::source_get_value(&resp.data, 3, "\\\"captcha_persist_data\\\"", "value=\\\"", "\\\""); + if (capResp.code == HTTP_CODE_OK) { + imageUrl = utils::text::html_entities_decode(utils::text::slashu_to_utf8(utils::text::source_get_value(&capResp.data, 3, "img class=\\\"img\\\"", "src=\\\"", "\\\""))); + captchaPersistData = utils::text::source_get_value(&capResp.data, 3, "\\\"captcha_persist_data\\\"", "value=\\\"", "\\\""); - parent->debugLogA(" Got imageUrl (second): %s", imageUrl.c_str()); - parent->debugLogA(" Got captchaPersistData (second): %s", captchaPersistData.c_str()); + parent->debugLogA(" Got imageUrl (second): %s", imageUrl.c_str()); + parent->debugLogA(" Got captchaPersistData (second): %s", captchaPersistData.c_str()); - std::string result; - if (!parent->RunCaptchaForm(imageUrl, result)) { - *error_text = Translate("User cancel captcha challenge."); - return SEND_MESSAGE_CANCEL; - } + std::string result; + if (!parent->RunCaptchaForm(imageUrl, result)) { + *error_text = Translate("User cancel captcha challenge."); + return SEND_MESSAGE_CANCEL; + } - return send_message(seqid, hContact, message_text, error_text, captchaPersistData, result); + return send_message(seqid, hContact, message_text, error_text, captchaPersistData, result); + } } - return SEND_MESSAGE_CANCEL; // Cancel because we failed to load captcha image so we can't continue only with error - } default: // Other error parent->debugLogA("!!! Send message error #%d: %s", resp.error_number, resp.error_text.c_str()); return SEND_MESSAGE_ERROR; } - switch (resp.code) - { + switch (resp.code) { case HTTP_CODE_OK: handle_success("send_message"); return SEND_MESSAGE_OK; @@ -1451,10 +1443,10 @@ bool facebook_client::post_status(status_data *status) http::response resp = flap(REQUEST_POST_STATUS, &data); if (status->isPage) { - std::string data = "fb_dtsg=" + this->dtsg_; - data += "&user_id=" + this->self_.user_id; - data += "&url=" + std::string(FACEBOOK_URL_HOMEPAGE); - flap(REQUEST_IDENTITY_SWITCH, &data); + std::string query = "fb_dtsg=" + this->dtsg_; + query += "&user_id=" + this->self_.user_id; + query += "&url=" + std::string(FACEBOOK_URL_HOMEPAGE); + flap(REQUEST_IDENTITY_SWITCH, &query); } if (resp.isValid()) { -- cgit v1.2.3