summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-04 14:31:19 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-04 14:31:19 +0300
commitdb915e4f76078302d66cff79ed9a3eb63024a261 (patch)
tree44e432ab17bb3a25682c5190e31d55cb09fb7952 /plugins/NewStory/src/history_array.cpp
parent40269f18dd845b95093877f479f179f1c59a101a (diff)
code cleaning
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp48
1 files changed, 20 insertions, 28 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 86946e6a16..f4138a68a7 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -27,45 +27,39 @@ bool HistoryArray::ItemData::load(EventLoadMode mode)
switch (dbe.eventType) {
case EVENTTYPE_STATUSCHANGE:
case EVENTTYPE_MESSAGE:
- {
- atext = (char*)dbe.pBlob;
+ atext = (char *)dbe.pBlob;
atext_del = false;
- aLength = mir_strlen(atext);
+ aLength = (int)mir_strlen(atext);
if (dbe.cbBlob > (DWORD)aLength + 1) {
- wtext = (wchar_t*)(dbe.pBlob + aLength + 1);
+ wtext = (wchar_t *)(dbe.pBlob + aLength + 1);
wtext_del = false;
}
break;
- }
case EVENTTYPE_AUTHREQUEST:
- {
atext = new char[512];
atext_del = true;
if ((dbe.cbBlob > 8) && *(dbe.pBlob + 8)) {
mir_snprintf(atext, 512, ("%s requested authorization"), dbe.pBlob + 8);
}
else {
- mir_snprintf(atext, 512, ("%d requested authorization"), *(DWORD*)(dbe.pBlob));
+ mir_snprintf(atext, 512, ("%d requested authorization"), *(DWORD *)(dbe.pBlob));
}
- aLength = mir_strlen(atext);
+ aLength = (int)mir_strlen(atext);
break;
- }
case EVENTTYPE_ADDED:
- {
atext = new char[512];
atext_del = true;
if ((dbe.cbBlob > 8) && *(dbe.pBlob + 8)) {
mir_snprintf(atext, 512, ("%s added you to the contact list"), dbe.pBlob + 8);
}
else {
- mir_snprintf(atext, 512, ("%d added you to the contact list"), *(DWORD*)(dbe.pBlob));
+ mir_snprintf(atext, 512, ("%d added you to the contact list"), *(DWORD *)(dbe.pBlob));
}
- aLength = mir_strlen(atext);
+ aLength = (int)mir_strlen(atext);
break;
}
- }
if (atext && !wtext) {
#ifdef UNICODE
@@ -78,17 +72,15 @@ bool HistoryArray::ItemData::load(EventLoadMode mode)
wtext_del = false;
#endif
}
- else
- if (!atext && wtext) {
- // strange situation, really :) I'll fix this later
- }
- else
- if (!atext && !wtext) {
- atext = "";
- atext_del = false;
- wtext = L"";
- wtext_del = false;
- }
+ else if (!atext && wtext) {
+ // strange situation, really :) I'll fix this later
+ }
+ else if (!atext && !wtext) {
+ atext = "";
+ atext_del = false;
+ wtext = L"";
+ wtext_del = false;
+ }
return true;
}
@@ -119,7 +111,7 @@ HistoryArray::~HistoryArray()
bool HistoryArray::allocateBlock(int count)
{
- ItemBlock* newBlock = new ItemBlock;
+ ItemBlock *newBlock = new ItemBlock;
newBlock->items = new ItemData[count];
newBlock->count = count;
newBlock->prev = tail;
@@ -139,7 +131,7 @@ bool HistoryArray::allocateBlock(int count)
void HistoryArray::clear()
{
while (head) {
- ItemBlock* next = head->next;
+ ItemBlock *next = head->next;
// for (int i = 0; i < head->count; ++i)
// destroyEvent(head->items[i]);
delete[] head->items;
@@ -195,10 +187,10 @@ bool HistoryArray::preloadEvents(int count)
return true;
}
*/
-HistoryArray::ItemData* HistoryArray::get(int id, EventLoadMode mode)
+HistoryArray::ItemData *HistoryArray::get(int id, EventLoadMode mode)
{
int offset = 0;
- for (ItemBlock* p = head; p; p = p->next) {
+ for (ItemBlock *p = head; p; p = p->next) {
if (id < offset + p->count) {
if (mode != ELM_NOTHING)
p->items[id - offset].load(mode);