summaryrefslogtreecommitdiff
path: root/plugins/BasicHistory/src/DatExport.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-08-31 12:19:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-08-31 12:19:31 +0000
commitca942b88c295830544e03804666229e0e955f64b (patch)
treee19134219dae9befdf0b5cb1764873830058d5ad /plugins/BasicHistory/src/DatExport.cpp
parent75a38acd5c2a1e0abd08d3458d36a452dfd0879a (diff)
- memory leak fixed;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@17226 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/BasicHistory/src/DatExport.cpp')
-rw-r--r--plugins/BasicHistory/src/DatExport.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp
index 92975b61ff..7ef7bb0f79 100644
--- a/plugins/BasicHistory/src/DatExport.cpp
+++ b/plugins/BasicHistory/src/DatExport.cpp
@@ -37,12 +37,13 @@ struct MCHeader
#pragma pack(pop)
-typedef struct {
+typedef struct
+{
int cbSize; //size of the structure in bytes
DWORD szModule; //pointer to name of the module that 'owns' this
- //event, ie the one that is in control of the data format
+ //event, ie the one that is in control of the data format
DWORD timestamp; //seconds since 00:00, 01/01/1970. Gives us times until
- //2106 unless you use the standard C library which is
+ //2106 unless you use the standard C library which is
//signed and can only do until 2038. In GMT.
DWORD flags; //the omnipresent flags
WORD eventType; //module-defined event type field
@@ -133,10 +134,10 @@ int DatExport::IsContactInFile(const std::vector<MCONTACT>& contacts)
MCHeader header;
if (!ReadHeader(header, IImport::stream))
return -2;
-
+
if (contacts.size() == 1)
hContact = contacts[0];
-
+
IMP_FILE.seekg(0, std::ios_base::beg);
return -3;
}
@@ -149,12 +150,12 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
dataSize = header.dataSize;
DBEVENTINFO86 messageHeader;
- DBEVENTINFO info = {0};
+ DBEVENTINFO info = { 0 };
info.cbSize = sizeof(DBEVENTINFO);
info.szModule = GetContactProto(hContact);
wchar_t _str[MAXSELECTSTR + 8]; // for safety reason
std::multimap<DWORD, IImport::ExternalMessage> sortedEvents;
- while(dataSize > 0) {
+ while (dataSize > 0) {
messageHeader.cbSize = 0;
IMP_FILE.read((char*)&messageHeader, sizeof(DBEVENTINFO86));
if (!IMP_FILE.good())
@@ -176,7 +177,7 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
IMP_FILE.read((char*)memBuf.c_str(), messageHeader.cbBlob);
if (!IMP_FILE.good())
return false;
-
+
info.eventType = messageHeader.eventType;
info.flags = messageHeader.flags;
info.timestamp = messageHeader.timestamp;
@@ -187,7 +188,7 @@ bool DatExport::GetEventList(std::vector<IImport::ExternalMessage>& eventList)
sortedEvents.insert(std::pair<DWORD, IImport::ExternalMessage>(messageHeader.timestamp, exMsg));
dataSize -= messageHeader.cbSize + messageHeader.cbBlob;
}
-
+
memBuf.resize(0);
memBuf.shrink_to_fit();