From 6183362250af373372830fbd5d4d952b0038bbfc Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 Oct 2013 17:38:06 +0000 Subject: more warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@6558 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Boltun/src/Engine/Mind.cpp | 30 +++++++++++++-------------- plugins/Boltun/src/Engine/TalkEngine.cpp | 13 ++++++------ plugins/Boltun/src/Engine/UnrecentChooser.cpp | 2 +- plugins/Boltun/src/Engine/WordsList.cpp | 10 ++++----- plugins/Boltun/src/actionQueue.cpp | 8 +++---- plugins/Boltun/src/boltun.cpp | 7 +++---- 6 files changed, 34 insertions(+), 36 deletions(-) (limited to 'plugins/Boltun/src') diff --git a/plugins/Boltun/src/Engine/Mind.cpp b/plugins/Boltun/src/Engine/Mind.cpp index 6f558e002b..d497da606d 100644 --- a/plugins/Boltun/src/Engine/Mind.cpp +++ b/plugins/Boltun/src/Engine/Mind.cpp @@ -266,7 +266,7 @@ void Mind::Load(tstring filename) delete c; vector strs = Parse(s1); data->raliases.insert(make_pair(sc, strs)); - for (vector::const_iterator it = strs.begin(); it != strs.end(); it++) + for (vector::const_iterator it = strs.begin(); it != strs.end(); ++it) data->aliases.insert(make_pair(*it, sc)); } break; @@ -316,72 +316,72 @@ 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++) + for (vector::const_iterator it1 = v.begin(); it1 != v.end(); ++it1) { if (first) { diff --git a/plugins/Boltun/src/Engine/TalkEngine.cpp b/plugins/Boltun/src/Engine/TalkEngine.cpp index 0c711ab652..a72bbdeb80 100644 --- a/plugins/Boltun/src/Engine/TalkEngine.cpp +++ b/plugins/Boltun/src/Engine/TalkEngine.cpp @@ -98,7 +98,6 @@ tstring TalkBot::ReplaceAliases(const tstring &message) tstring sentence = message; tstring result; int len = (int)sentence.length(); - vector words; map sm; //Find smiles for (size_t i = 0; i < sentence.length() - 1; i++) @@ -280,7 +279,7 @@ TalkBot::MessageInfo* TalkBot::Reply(void* contact, tstring incomingMessage, boo _tcscpy(str, incomingMessage.c_str()); CharLower(str); incomingMessage = str; - delete str; + delete [] str; ContactData* contactData = contactDatas->GetData(contact); if (incomingMessage == contactData->lastMessage && GetTickCount() < contactData->lastMessageTime + 30*60*1000) @@ -366,7 +365,7 @@ bool TalkBot::FindExact(ContactData* contactData, const tstring &incomingMessage return false; } pair range = map.equal_range(incomingMessage); - for (mm_cit it = range.first; it != range.second; it++) + for (mm_cit it = range.first; it != range.second; ++it) contactData->chooser.AddChoice((*it).second); res = contactData->chooser.Choose(); return true; @@ -461,7 +460,7 @@ tstring TalkBot::ChooseResult(ContactData* contactData, Level maxValue, const mu }*/ typedef multimap::const_iterator lt_cit; pair range = mm.equal_range(target); - for (lt_cit it = range.first; it != range.second; it++) + for (lt_cit it = range.first; it != range.second; ++it) contactData->chooser.AddChoice((*it).second); #ifdef DEBUG_SHOW_LEVEL tstring lev = LevelToStr(target); @@ -478,7 +477,7 @@ void TalkBot::FindByKeywords(ContactData* contactData, const vector &ke 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)) @@ -497,7 +496,7 @@ 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++) + it != specs.end(); ++it) if ((*it).first.MatchesAny(otherwords)) { #ifdef DEBUG_SHOW_SOLUTION_REASON @@ -575,7 +574,7 @@ void TalkBot::SplitAndSortWords(tstring sentence, vector& keywords, words.push_back(str); } isQuestion = hadQuestionSigns; - for (vector::iterator it = words.begin(); it != words.end(); it++) + for (vector::iterator it = words.begin(); it != words.end(); ++it) { if (!isQuestion) { diff --git a/plugins/Boltun/src/Engine/UnrecentChooser.cpp b/plugins/Boltun/src/Engine/UnrecentChooser.cpp index d11806503b..5a3d4f7fd1 100644 --- a/plugins/Boltun/src/Engine/UnrecentChooser.cpp +++ b/plugins/Boltun/src/Engine/UnrecentChooser.cpp @@ -83,7 +83,7 @@ void UnRecentChooser::SaveChoice(tstring choice) //Add answer if (items.find(choice) != items.end()) { - for (vector::iterator it = itemsList.begin(); it != itemsList.end(); it++) + for (vector::iterator it = itemsList.begin(); it != itemsList.end(); ++it) if (*it == choice) { itemsList.erase(it); diff --git a/plugins/Boltun/src/Engine/WordsList.cpp b/plugins/Boltun/src/Engine/WordsList.cpp index 08cd150aaf..d9ba65aa90 100644 --- a/plugins/Boltun/src/Engine/WordsList.cpp +++ b/plugins/Boltun/src/Engine/WordsList.cpp @@ -37,7 +37,7 @@ WordsList::operator tstring() const while (true) { res += *it; - it++; + ++it; if (it != words.end()) res += _T(" "); else @@ -92,7 +92,7 @@ bool WordsList::MatchesAll(const vector& s/*, bool& WasStrict*/, float& { std::set temp; //WasStrict = true; - for (vector::const_iterator it = s.begin(); it != s.end(); it++) + for (vector::const_iterator it = s.begin(); it != s.end(); ++it) { /* if (words.find(*it) == words.end()) if (unstrict) @@ -114,7 +114,7 @@ bool WordsList::MatchesAll(const vector& s/*, bool& WasStrict*/, float& bool WordsList::MatchesAny(const vector& s) const { - for (vector::const_iterator it = s.begin(); it != s.end(); it++) + for (vector::const_iterator it = s.begin(); it != s.end(); ++it) if (words.find(*it) != words.end()) return true; return false; @@ -123,7 +123,7 @@ bool WordsList::MatchesAny(const vector& s) const vector WordsList::ConsistsOf(const set& list) const { vector res; - for (set::const_iterator it = words.begin(); it != words.end(); it++) + for (set::const_iterator it = words.begin(); it != words.end(); ++it) if (list.find(*it) == list.end()) res.push_back(*it); return res; @@ -132,7 +132,7 @@ vector WordsList::ConsistsOf(const set& list) const vector WordsList::DoesntIncludeAny(const set& list) const { vector res; - for (set::const_iterator it = words.begin(); it != words.end(); it++) + for (set::const_iterator it = words.begin(); it != words.end(); ++it) if (list.find(*it) != list.end()) res.push_back(*it); return res; diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index 014e8919ba..3514ae994b 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -111,7 +111,7 @@ static void TimerAnswer(HANDLE hContact, const TalkBot::MessageInfo* info) bot->AnswerGiven(hContact, *info); delete info; - delete msg; + delete [] msg; typingContactsLock.Enter(); typingContacts.erase(hContact); @@ -169,7 +169,7 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f if (!actionQueue.empty()) { list::iterator it = actionQueue.end(); - it--; + --it; while (true) { if ((*it).hContact == hContact) @@ -178,7 +178,7 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f break; list::iterator tmp = it; if (tmp != actionQueue.begin()) - tmp--; + --tmp; actionQueue.erase(it); it = tmp; if (actionQueue.empty()) @@ -186,7 +186,7 @@ void DoAnswer(HANDLE hContact, const TalkBot::MessageInfo *info, bool sticky = f } if (it == actionQueue.begin()) break; - it--; + --it; } } typingContactsLock.Enter(); diff --git a/plugins/Boltun/src/boltun.cpp b/plugins/Boltun/src/boltun.cpp index 4ad9379bb5..26a370b50e 100644 --- a/plugins/Boltun/src/boltun.cpp +++ b/plugins/Boltun/src/boltun.cpp @@ -163,8 +163,7 @@ static bool LoadMind(const TCHAR* filename, int &line) delete mind; return false; } - if (bot) - delete bot; + delete bot; bot = new TalkBot(*mind); delete mind; UpdateEngine(); @@ -408,7 +407,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP ofn.lpstrInitialDir = path; if (!GetOpenFileName(&ofn)) { - delete filename; + delete[] filename; delete[] filt; break; } @@ -427,7 +426,7 @@ static INT_PTR CALLBACK EngineDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP filename = f; Config.MindFileName = filename; SetDlgItemText(hwndDlg, IDC_MINDFILE, filename); - delete origf; + delete[] origf; } case IDC_BTNRELOAD: { -- cgit v1.2.3