summaryrefslogtreecommitdiff
path: root/plugins/Boltun/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-20 17:38:06 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-20 17:38:06 +0000
commit6183362250af373372830fbd5d4d952b0038bbfc (patch)
tree986e7c937720b5d93e00dcc2e7ee3b2f47a7286d /plugins/Boltun/src
parent7e4a5794928702bf435f3d7be339a6c553fe618a (diff)
more warning fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@6558 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Boltun/src')
-rw-r--r--plugins/Boltun/src/Engine/Mind.cpp30
-rw-r--r--plugins/Boltun/src/Engine/TalkEngine.cpp13
-rw-r--r--plugins/Boltun/src/Engine/UnrecentChooser.cpp2
-rw-r--r--plugins/Boltun/src/Engine/WordsList.cpp10
-rw-r--r--plugins/Boltun/src/actionQueue.cpp8
-rw-r--r--plugins/Boltun/src/boltun.cpp7
6 files changed, 34 insertions, 36 deletions
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<tstring> strs = Parse(s1);
data->raliases.insert(make_pair(sc, strs));
- for (vector<tstring>::const_iterator it = strs.begin(); it != strs.end(); it++)
+ for (vector<tstring>::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<WordsList, tstring>::iterator it = data->keywords.begin(); it != data->keywords.end(); it++)
+ for (multimap<WordsList, tstring>::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<WordsList, tstring>::iterator it = data->qkeywords.begin(); it != data->qkeywords.end(); it++)
+ for (multimap<WordsList, tstring>::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<WordsList, tstring>::iterator it = data->specialEscapes.begin(); it != data->specialEscapes.end(); it++)
+ for (multimap<WordsList, tstring>::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<WordsList, tstring>::iterator it = data->qspecialEscapes.begin(); it != data->qspecialEscapes.end(); it++)
+ for (multimap<WordsList, tstring>::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<tstring>::iterator it = data->question.begin(); it != data->question.end(); it++)
+ for (set<tstring>::iterator it = data->question.begin(); it != data->question.end(); ++it)
{
file << _T(" <QUESTION>") << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
- for (set<tstring>::iterator it = data->special.begin(); it != data->special.end(); it++)
+ for (set<tstring>::iterator it = data->special.begin(); it != data->special.end(); ++it)
{
file << _T(" <IGNORED>") << _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(" <ESCAPE>") << _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(" <INITIAL>") << _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(" <FAILURE>") << _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(" <REPEAT>") << _T('\r') << endl;
file << (*it) << _T('\r') << endl;
}
- for (map<tstring,vector<tstring>>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); it++)
+ for (map<tstring,vector<tstring>>::const_iterator it = data->raliases.begin(); it != data->raliases.end(); ++it)
{
tstring s;
const vector<tstring>& v = (*it).second;
bool first = true;
- for (vector<tstring>::const_iterator it1 = v.begin(); it1 != v.end(); it1++)
+ for (vector<tstring>::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<tstring> words;
map<int, tstring> 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<mm_cit, mm_cit> 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<Level, tstring>::const_iterator lt_cit;
pair<lt_cit,lt_cit> 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<tstring> &ke
return;
const multimap<WordsList, tstring> &keys = isQuestion ? mind.GetData()->qkeywords :
mind.GetData()->keywords;
- for (multimap<WordsList, tstring>::const_iterator it = keys.begin(); it != keys.end(); it++)
+ for (multimap<WordsList, tstring>::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<tstring> &othe
const multimap<WordsList, tstring> &specs = isQuestion ? mind.GetData()->qspecialEscapes :
mind.GetData()->specialEscapes;
for (multimap<WordsList, tstring>::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<tstring>& keywords,
words.push_back(str);
}
isQuestion = hadQuestionSigns;
- for (vector<tstring>::iterator it = words.begin(); it != words.end(); it++)
+ for (vector<tstring>::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<tstring>::iterator it = itemsList.begin(); it != itemsList.end(); it++)
+ for (vector<tstring>::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<tstring>& s/*, bool& WasStrict*/, float&
{
std::set<tstring> temp;
//WasStrict = true;
- for (vector<tstring>::const_iterator it = s.begin(); it != s.end(); it++)
+ for (vector<tstring>::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<tstring>& s/*, bool& WasStrict*/, float&
bool WordsList::MatchesAny(const vector<tstring>& s) const
{
- for (vector<tstring>::const_iterator it = s.begin(); it != s.end(); it++)
+ for (vector<tstring>::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<tstring>& s) const
vector<tstring> WordsList::ConsistsOf(const set<tstring>& list) const
{
vector<tstring> res;
- for (set<tstring>::const_iterator it = words.begin(); it != words.end(); it++)
+ for (set<tstring>::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<tstring> WordsList::ConsistsOf(const set<tstring>& list) const
vector<tstring> WordsList::DoesntIncludeAny(const set<tstring>& list) const
{
vector<tstring> res;
- for (set<tstring>::const_iterator it = words.begin(); it != words.end(); it++)
+ for (set<tstring>::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<QueueElement>::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<QueueElement>::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:
{