From f9883d97b3a586663f85075206fe7e07b41ed366 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 3 Apr 2018 16:56:45 +0300 Subject: unneeded size fields removed --- protocols/EmLanProto/src/mlan.cpp | 2 -- protocols/Gadu-Gadu/src/filetransfer.cpp | 4 --- protocols/ICQCorp/src/transfer.cpp | 1 - protocols/IRCG/src/irclib.cpp | 1 - protocols/IcqOscarJ/src/icq_filetransfer.cpp | 3 +- protocols/IcqOscarJ/src/oscar_filetransfer.cpp | 41 ++++++++++++-------------- protocols/JabberG/src/jabber_file.cpp | 1 - protocols/MRA/src/MraFilesQueue.cpp | 6 ++-- protocols/MRA/src/Mra_functions.cpp | 1 - protocols/MSN/src/msn_misc.cpp | 1 - protocols/Sametime/src/files.cpp | 5 +--- protocols/Tox/src/tox_transfer.h | 1 - 12 files changed, 23 insertions(+), 44 deletions(-) (limited to 'protocols') diff --git a/protocols/EmLanProto/src/mlan.cpp b/protocols/EmLanProto/src/mlan.cpp index c24d0d9e42..e7e6b8963d 100644 --- a/protocols/EmLanProto/src/mlan.cpp +++ b/protocols/EmLanProto/src/mlan.cpp @@ -1099,7 +1099,6 @@ void CMLan::OnInTCPConnection(u_long addr, SOCKET in_sock) ProtoBroadcastAck(PROTONAME, conn->m_hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)conn->m_cid, 0); PROTOFILETRANSFERSTATUS fts; - fts.cbSize = sizeof(fts); fts.flags = PFTS_UNICODE; fts.hContact = conn->m_hContact; fts.totalBytes = rcTotalSize; @@ -1304,7 +1303,6 @@ void CMLan::OnOutTCPConnection(u_long, SOCKET out_socket, LPVOID lpParameter) conn->m_szDir = mir_wstrdup(name); PROTOFILETRANSFERSTATUS fts; - fts.cbSize = sizeof(fts); fts.flags = PFTS_SENDING | PFTS_UNICODE; fts.hContact = conn->m_hContact; fts.totalBytes = size; diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 4d51ee4103..3abef753e7 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -279,7 +279,6 @@ void __cdecl GaduProto::dccmainthread(void*) local_dcc->tick = tick; mir_snprintf(szFilename, "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles.a = nullptr; @@ -309,7 +308,6 @@ void __cdecl GaduProto::dccmainthread(void*) PROTOFILETRANSFERSTATUS pfts; mir_snprintf(szFilename, "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles.a = nullptr; @@ -508,7 +506,6 @@ void __cdecl GaduProto::dccmainthread(void*) local_dcc7->tick = tick; mir_snprintf(szFilename, "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles.a = nullptr; @@ -538,7 +535,6 @@ void __cdecl GaduProto::dccmainthread(void*) PROTOFILETRANSFERSTATUS pfts; mir_snprintf(szFilename, "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles.a = nullptr; diff --git a/protocols/ICQCorp/src/transfer.cpp b/protocols/ICQCorp/src/transfer.cpp index a3917047dc..07a9dbc893 100644 --- a/protocols/ICQCorp/src/transfer.cpp +++ b/protocols/ICQCorp/src/transfer.cpp @@ -306,7 +306,6 @@ void ICQTransfer::ack(unsigned int result) return; PROTOFILETRANSFERSTATUS fts; - fts.cbSize = sizeof(fts); fts.flags = PFTS_UNICODE; fts.hContact = hContact; fts.pszFiles.w = files; diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 956634afb0..5cd1451059 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -724,7 +724,6 @@ CDccSession::CDccSession(CIrcProto* _pro, DCCINFO *pdci) : di = pdci; // Setup values passed to the constructor memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); if (di->iType == DCC_SEND && di->bSender == false) hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 5e001d8abc..03f3484bcb 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -28,7 +28,6 @@ static void file_buildProtoFileTransferStatus(filetransfer* ft, PROTOFILETRANSFERSTATUS* pfts) { memset(pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts->cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts->hContact = ft->hContact; pfts->flags = PFTS_UTF | (ft->sending ? PFTS_SENDING : PFTS_RECEIVING); /* Standard FT is Ansi only */ if (ft->sending) @@ -394,7 +393,7 @@ void CIcqProto::handleFileTransferPacket(directconnect* dc, PBYTE buf, size_t wL } else { /* file resume */ - PROTOFILETRANSFERSTATUS pfts = { 0 }; + PROTOFILETRANSFERSTATUS pfts = {}; file_buildProtoFileTransferStatus(dc->ft, &pfts); if (ProtoBroadcastAck(dc->ft->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, dc->ft, (LPARAM)&pfts)) diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 39bd428744..22e6d6dcd1 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -1006,7 +1006,6 @@ void CIcqProto::oftFileResume(oscar_filetransfer *ft, int action, const wchar_t static void oft_buildProtoFileTransferStatus(oscar_filetransfer* ft, PROTOFILETRANSFERSTATUS* pfts) { memset(pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); - pfts->cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts->hContact = ft->hContact; pfts->flags = PFTS_UTF + ((ft->flags & OFTF_SENDING) ? PFTS_SENDING : PFTS_RECEIVING); if (ft->flags & OFTF_SENDING) @@ -1539,9 +1538,9 @@ int CIcqProto::oft_handleFileData(oscar_connection *oc, BYTE *buf, size_t len) ft->qwBytesDone += dwLen; ft->qwFileBytesDone += dwLen; - if (GetTickCount() > ft->dwLastNotify + 700 || ft->qwFileBytesDone == ft->qwThisFileSize) { // notify FT UI of our progress, at most every 700ms - do not be faster than Miranda + // notify FT UI of our progress, at most every 700ms - do not be faster than Miranda + if (GetTickCount() > ft->dwLastNotify + 700 || ft->qwFileBytesDone == ft->qwThisFileSize) { PROTOFILETRANSFERSTATUS pfts; - oft_buildProtoFileTransferStatus(ft, &pfts); ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&pfts); ft->dwLastNotify = GetTickCount(); @@ -1743,32 +1742,30 @@ void CIcqProto::handleOFT2FramePacket(oscar_connection *oc, WORD datatype, BYTE ft->qwFileBytesDone = 0; - { - /* file resume */ - PROTOFILETRANSFERSTATUS pfts; - - oft_buildProtoFileTransferStatus(ft, &pfts); - if (ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&pfts)) { - oc->status = OCS_WAITING; - break; /* UI supports resume: it will call PS_FILERESUME */ - } + /* file resume */ + PROTOFILETRANSFERSTATUS pfts; + oft_buildProtoFileTransferStatus(ft, &pfts); + if (ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&pfts)) { + oc->status = OCS_WAITING; + break; /* UI supports resume: it will call PS_FILERESUME */ + } - ft->fileId = OpenFileUtf(ft->szThisFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); + ft->fileId = OpenFileUtf(ft->szThisFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE); #ifdef _DEBUG - NetLog_Direct("OFT: OpenFileUtf(%s, %u) returned %u", ft->szThisFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, ft->fileId); + NetLog_Direct("OFT: OpenFileUtf(%s, %u) returned %u", ft->szThisFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, ft->fileId); #endif - if (ft->fileId == -1) { + if (ft->fileId == -1) { #ifdef _DEBUG - NetLog_Direct("OFT: errno=%d", errno); + NetLog_Direct("OFT: errno=%d", errno); #endif - icq_LogMessage(LOG_ERROR, LPGEN("Your file receive has been aborted because Miranda could not open the destination file in order to write to it. You may be trying to save to a read-only folder.")); + icq_LogMessage(LOG_ERROR, LPGEN("Your file receive has been aborted because Miranda could not open the destination file in order to write to it. You may be trying to save to a read-only folder.")); - ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0); - // Release transfer - SafeReleaseFileTransfer((basic_filetransfer**)&oc->ft); - return; - } + ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0); + // Release transfer + SafeReleaseFileTransfer((basic_filetransfer**)&oc->ft); + return; } + // Send "we are ready" oc->status = OCS_DATA; ft->flags |= OFTF_FILE_RECEIVING; diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index eebf790d5d..84a0e0cd37 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -451,7 +451,6 @@ filetransfer::filetransfer(CJabberProto *proto) memset(this, 0, sizeof(filetransfer)); ppro = proto; fileId = -1; - std.cbSize = sizeof(std); std.flags = PFTS_UNICODE; } diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 996503fee4..c106a7b073 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -722,13 +722,12 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) size_t i, dwBuffSizeUsed; LARGE_INTEGER liFileSize; NETLIBSELECT nls = { 0 }; - PROTOFILETRANSFERSTATUS pfts = { 0 }; + PROTOFILETRANSFERSTATUS pfts = {}; mir_free(lpParameter); bFailed = TRUE; bConnected = FALSE; - pfts.cbSize = sizeof(pfts); pfts.hContact = dat->hContact; pfts.flags = (PFTS_RECEIVING | PFTS_UNICODE);// pfts.sending = dat->bSending; //true if sending, false if receiving //pfts.files; @@ -981,8 +980,7 @@ void CMraProto::MraFilesQueueSendThreadProc(LPVOID lpParameter) size_t i, j, dwBuffSizeUsed = 0; LPWSTR lpwszFileName; - PROTOFILETRANSFERSTATUS pfts = { 0 }; - pfts.cbSize = sizeof(pfts); + PROTOFILETRANSFERSTATUS pfts = {}; pfts.hContact = dat->hContact; pfts.flags = (PFTS_SENDING | PFTS_UNICODE);// pfts.sending = dat->bSending; //true if sending, false if receiving pfts.totalFiles = dat->dwFilesCount; diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index 0de82591be..e5c76b7811 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -885,7 +885,6 @@ static void FakeThread(void* param) DWORD CMraProto::ProtoBroadcastAckAsync(MCONTACT hContact, int type, int hResult, HANDLE hProcess, LPARAM lParam) { ACKDATA *ack = (ACKDATA*)::mir_calloc(sizeof(ACKDATA)); - ack->cbSize = sizeof(ACKDATA); ack->szModule = m_szModuleName; ack->hContact = hContact; ack->type = type; diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 4018af2f67..4e09b187f7 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -894,7 +894,6 @@ filetransfer::filetransfer(CMsnProto* prt) { memset(this, 0, sizeof(filetransfer)); fileId = -1; - std.cbSize = sizeof(std); std.flags = PFTS_UNICODE; proto = prt; diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index f4087265c5..e7d206c4fc 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -81,9 +81,7 @@ void __cdecl SendThread(LPVOID param) { proto->debugLogW(L"SendThread() start"); - PROTOFILETRANSFERSTATUS pfts = {0}; - - pfts.cbSize = sizeof(pfts); + PROTOFILETRANSFERSTATUS pfts = {}; pfts.flags = PFTS_UTF; pfts.hContact = ftcd->hContact; if (ftcd->sending == 1) @@ -230,7 +228,6 @@ void mwFileTransfer_recv(mwFileTransfer* ft, struct mwOpaque* data) mwFileTransfer_ack(ft); // acknowledge chunk PROTOFILETRANSFERSTATUS pfts = { 0 }; - pfts.cbSize = sizeof(pfts); pfts.flags = PFTS_UTF; pfts.hContact = ftcd->hContact; if (ftcd->sending == 1) { diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 4c2feb1e68..0e72a4cf77 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -18,7 +18,6 @@ struct FileTransferParam this->fileNumber = fileNumber; transferNumber = (((int64_t)friendNumber) << 32) | ((int64_t)fileNumber); - pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); pfts.flags = PFTS_UNICODE; pfts.hContact = NULL; pfts.totalFiles = 1; -- cgit v1.2.3