summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/sendqueue.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-04-26 21:45:16 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-04-26 21:45:16 +0000
commit965ba4945c4efe30614e756c2c7b5ec102cf7c41 (patch)
tree4052305aa31b9a6d5e55985b80d73e173bd313aa /plugins/TabSRMM/src/sendqueue.cpp
parent0cc8cfe3e675f898f5e4f8b1ddc167ab77b7a163 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@4545 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/sendqueue.cpp')
-rw-r--r--plugins/TabSRMM/src/sendqueue.cpp37
1 files changed, 12 insertions, 25 deletions
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp
index 03732b2b1b..73c3e505e3 100644
--- a/plugins/TabSRMM/src/sendqueue.cpp
+++ b/plugins/TabSRMM/src/sendqueue.cpp
@@ -73,7 +73,7 @@ void SendQueue::handleError(TWindowData *dat, const int iEntry) const
*/
int SendQueue::addTo(TWindowData *dat, const int iLen, int dwFlags)
{
- int iLength = 0, i;
+ int i;
int iFound = NR_SENDJOBS;
if (m_currentIndex >= NR_SENDJOBS) {
@@ -104,20 +104,15 @@ entry_found:
}
SendJob &job = m_jobs[iFound];
- iLength = iLen;
+ int iLength = iLen;
if (iLength > 0) {
if (job.szSendBuffer == NULL) {
if (iLength < HISTORY_INITIAL_ALLOCSIZE)
iLength = HISTORY_INITIAL_ALLOCSIZE;
job.szSendBuffer = (char*)mir_alloc(iLength);
- job.dwLen = iLength;
- }
- else {
- if (iLength > job.dwLen) {
- job.szSendBuffer = (char*)mir_realloc(job.szSendBuffer, iLength);
- job.dwLen = iLength;
- }
}
+ else job.szSendBuffer = (char*)mir_realloc(job.szSendBuffer, iLength);
+
CopyMemory(job.szSendBuffer, dat->sendBuffer, iLen);
}
job.dwFlags = dwFlags;
@@ -459,15 +454,9 @@ send_unsplitted:
void SendQueue::clearJob(const int iIndex)
{
- m_jobs[iIndex].hOwner = 0;
- m_jobs[iIndex].hwndOwner = 0;
- m_jobs[iIndex].iStatus = 0;
- m_jobs[iIndex].iAcksNeeded = 0;
- m_jobs[iIndex].dwFlags = 0;
- m_jobs[iIndex].chunkSize = 0;
- m_jobs[iIndex].dwTime = 0;
- m_jobs[iIndex].hSendId = 0;
- m_jobs[iIndex].iSendLength = 0;
+ SendJob &job = m_jobs[iIndex];
+ mir_free(job.szSendBuffer);
+ memset(&job, 0, sizeof(SendJob));
}
/*
@@ -718,8 +707,7 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
SkinPlaySound("SendError");
TCHAR *szAckMsg = mir_a2t((char *)ack->lParam);
- mir_sntprintf(job.szErrorMsg, SIZEOF(job.szErrorMsg),
- TranslateT("Delivery failure: %s"), szAckMsg);
+ mir_sntprintf(job.szErrorMsg, SIZEOF(job.szErrorMsg), TranslateT("Delivery failure: %s"), szAckMsg);
job.iStatus = SQ_ERROR;
mir_free(szAckMsg);
KillTimer(dat->hwnd, TIMERID_MSGSEND + iFound);
@@ -727,12 +715,11 @@ int SendQueue::ackMessage(TWindowData *dat, WPARAM wParam, LPARAM lParam)
handleError(dat, iFound);
return 0;
}
- else {
+
inform_and_discard:
- _DebugPopup(job.hOwner, TranslateT("A message delivery has failed after the contacts chat window was closed. You may want to resend the last message"));
- clearJob(iFound);
- return 0;
- }
+ _DebugPopup(job.hOwner, TranslateT("A message delivery has failed after the contacts chat window was closed. You may want to resend the last message"));
+ clearJob(iFound);
+ return 0;
}
DBEVENTINFO dbei = { sizeof(dbei) };