diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-05-18 20:30:21 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-05-18 20:30:21 +0000 |
commit | f3ec06759c21604436567693984ea31c5b1d5e3f (patch) | |
tree | 78d2b0bbaa105cb1faf96e49e0a3e94fa0df4444 | |
parent | 83341d2f5f8b20549d1be6da322cb0cc2f72b5a1 (diff) |
Tox:
- fixed bugs from coverity
- fixed empty profile loading
- version bump
git-svn-id: http://svn.miranda-ng.org/main/trunk@13687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/Tox/src/tox_multimedia.cpp | 3 | ||||
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 9 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.cpp | 4 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.h | 2 | ||||
-rw-r--r-- | protocols/Tox/src/version.h | 2 |
7 files changed, 16 insertions, 10 deletions
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp index 0b0bfe87f2..0fe92349d5 100644 --- a/protocols/Tox/src/tox_multimedia.cpp +++ b/protocols/Tox/src/tox_multimedia.cpp @@ -121,6 +121,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) int friendNumber = m_proto->GetToxFriendNumber(hContact);
if (friendNumber == UINT32_MAX)
{
+ mir_free(cSettings);
Close();
return;
}
@@ -128,9 +129,11 @@ void CToxOutgoingCall::OnCall(CCtrlBase*) int32_t callId;
if (toxav_call(m_proto->toxAv, &callId, friendNumber, cSettings, 10) == TOX_ERROR)
{
+ mir_free(cSettings);
m_proto->debugLogA(__FUNCTION__": failed to start outgoing call");
return;
}
+ mir_free(cSettings);
m_proto->calls[hContact] = callId;
char *message = NULL;
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 1b31e1f9ab..c422dcc947 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -16,7 +16,7 @@ std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName) return profilePath;
}
-bool CToxProto::LoadToxProfile(Tox_Options *options)
+bool CToxProto::LoadToxProfile(const Tox_Options *options)
{
debugLogA(__FUNCTION__": loading tox profile");
@@ -37,11 +37,10 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) fseek(profile, 0, SEEK_END);
size = ftell(profile);
rewind(profile);
- if (size == 0)
+ if (size < 0)
{
fclose(profile);
- debugLogA(__FUNCTION__": tox profile is empty");
- return true;
+ size = 0;
}
data = (uint8_t*)mir_calloc(size);
@@ -54,7 +53,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options) }
fclose(profile);
- if (data != NULL && tox_is_data_encrypted(data))
+ if (data && tox_is_data_encrypted(data))
{
password = mir_utf8encodeW(ptrT(getTStringA("Password")));
if (password == NULL || mir_strlen(password) == 0)
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index ebd75482bd..caa507c315 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -2,7 +2,9 @@ CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
PROTO<CToxProto>(protoName, userName),
- tox(NULL), toxAv(NULL), password(NULL)
+ tox(NULL), toxAv(NULL), password(NULL),
+ isTerminated(false), isConnected(false),
+ hPollingThread(NULL), hOutDevice(NULL)
{
InitNetlib();
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 0431a5b264..97b87f27eb 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -84,7 +84,7 @@ private: std::tstring GetToxProfilePath();
static std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName);
- bool LoadToxProfile(Tox_Options *options);
+ bool LoadToxProfile(const Tox_Options *options);
void SaveToxProfile();
INT_PTR __cdecl OnCopyToxID(WPARAM, LPARAM);
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index 631705a6da..dce86334ae 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -80,11 +80,11 @@ HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCH if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
{
int action = FILERESUME_OVERWRITE;
- const TCHAR **szFilename = (const TCHAR**)mir_alloc(sizeof(TCHAR) * 2);
+ const TCHAR **szFilename = (const TCHAR**)mir_alloc(sizeof(TCHAR*) * 2);
szFilename[0] = fullPath;
szFilename[1] = NULL;
OnFileResume(hTransfer, &action, szFilename);
- //mir_free(szFilename);
+ mir_free(szFilename);
}
return hTransfer;
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h index 110fe4ab65..f683b9e046 100644 --- a/protocols/Tox/src/tox_transfer.h +++ b/protocols/Tox/src/tox_transfer.h @@ -20,6 +20,7 @@ struct FileTransferParam pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
pfts.flags = PFTS_TCHAR;
+ pfts.hContact = NULL;
pfts.totalFiles = 1;
pfts.ptszFiles = (TCHAR**)mir_alloc(sizeof(TCHAR*)*(pfts.totalFiles + 1));
pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_tstrdup(fileName);
@@ -27,6 +28,7 @@ struct FileTransferParam pfts.totalBytes = pfts.currentFileSize = fileSize;
pfts.totalProgress = pfts.currentFileProgress = 0;
pfts.currentFileNumber = 0;
+ pfts.currentFileTime = time(NULL);
pfts.tszWorkingDir = NULL;
transferType = TOX_FILE_KIND_DATA;
diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h index 2899b1acb1..6e494bddca 100644 --- a/protocols/Tox/src/version.h +++ b/protocols/Tox/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
#define __MINOR_VERSION 11
#define __RELEASE_NUM 1
-#define __BUILD_NUM 4
+#define __BUILD_NUM 5
#include <stdver.h>
|