summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-02-15 10:57:54 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-02-15 10:57:54 +0000
commit58f3f2d387c7b3a020eaf4f0b30bf70522adcfad (patch)
tree0e09137c3b8b84a79616a9c65df9eacff377d777 /protocols/Tox/src
parent60b391e2a55749c0cf9e96f53515673a0898a0d5 (diff)
code cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@12120 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/common.h2
-rw-r--r--protocols/Tox/src/main.cpp3
-rw-r--r--protocols/Tox/src/tox_account.cpp4
-rw-r--r--protocols/Tox/src/tox_address.h1
-rw-r--r--protocols/Tox/src/tox_avatars.cpp6
-rw-r--r--protocols/Tox/src/tox_contacts.cpp10
-rw-r--r--protocols/Tox/src/tox_events.cpp3
-rw-r--r--protocols/Tox/src/tox_messages.cpp12
-rw-r--r--protocols/Tox/src/tox_options.cpp7
-rw-r--r--protocols/Tox/src/tox_profile.cpp2
-rw-r--r--protocols/Tox/src/tox_proto.cpp26
-rw-r--r--protocols/Tox/src/tox_search.cpp10
-rw-r--r--protocols/Tox/src/tox_transfer.cpp4
13 files changed, 44 insertions, 46 deletions
diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h
index fa3728896b..24ff0df963 100644
--- a/protocols/Tox/src/common.h
+++ b/protocols/Tox/src/common.h
@@ -75,7 +75,7 @@ struct ItemInfo
int SelNumber;
};
-extern HWND hAddNodeDlg;
+extern HWND hAddNodeDlg, hChangeNodeDlg;
int OptInit(WPARAM wParam, LPARAM lParam);
int PreShutdown(WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp
index d8022cf6ac..8970172126 100644
--- a/protocols/Tox/src/main.cpp
+++ b/protocols/Tox/src/main.cpp
@@ -26,7 +26,7 @@ DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
return TRUE;
}
-extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
+extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -40,7 +40,6 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_OPT_INITIALISE, OptInit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
-
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "TOX";
pd.type = PROTOTYPE_PROTOCOL;
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp
index 08124f9238..6fb8123702 100644
--- a/protocols/Tox/src/tox_account.cpp
+++ b/protocols/Tox/src/tox_account.cpp
@@ -14,10 +14,8 @@ int CToxProto::OnAccountLoaded(WPARAM, LPARAM)
return 0;
}
-int CToxProto::OnAccountRenamed(WPARAM, LPARAM lParam)
+int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
{
- PROTOACCOUNT *account = (PROTOACCOUNT*)lParam;
-
std::tstring newPath = GetToxProfilePath();
TCHAR oldPath[MAX_PATH];
mir_sntprintf(oldPath, MAX_PATH, _T("%s\\%s.tox"), VARST(_T("%miranda_userdata%")), accountName);
diff --git a/protocols/Tox/src/tox_address.h b/protocols/Tox/src/tox_address.h
index 2bd0d82bbe..a4b152427d 100644
--- a/protocols/Tox/src/tox_address.h
+++ b/protocols/Tox/src/tox_address.h
@@ -56,7 +56,6 @@ public:
char *endptr;
const char *pos = hex;
int size = mir_strlen(hex) / 2;
- uint8_t *result = (uint8_t*)mir_alloc(size);
for (int i = 0; i < size; i++)
{
char buf[5] = { '0', 'x', pos[0], pos[1], 0 };
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index a19f47faf9..6d52088b22 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -159,7 +159,7 @@ INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
return -1;
}
-INT_PTR CToxProto::SetMyAvatar(WPARAM wParam, LPARAM lParam)
+INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
TCHAR *path = (TCHAR*)lParam;
std::tstring avatarPath = GetAvatarFilePath();
@@ -192,7 +192,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM wParam, LPARAM lParam)
return 0;
}
-void CToxProto::OnGotFriendAvatarInfo(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, void *arg)
+void CToxProto::OnGotFriendAvatarInfo(Tox *, int32_t number, uint8_t format, uint8_t *hash, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -228,7 +228,7 @@ void CToxProto::OnGotFriendAvatarInfo(Tox *tox, int32_t number, uint8_t format,
}
}
-void CToxProto::OnGotFriendAvatarData(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t length, void *arg)
+void CToxProto::OnGotFriendAvatarData(Tox *, int32_t number, uint8_t, uint8_t *hash, uint8_t *data, uint32_t length, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 29bc67baf7..5b06d3f41e 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -149,7 +149,7 @@ void CToxProto::LoadFriendList(void*)
}
}
-int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam)
+int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
if (!IsOnline())
{
@@ -166,7 +166,7 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam)
return 0;
}
-void CToxProto::OnFriendRequest(Tox *tox, const uint8_t *data, const uint8_t *message, const uint16_t messageSize, void *arg)
+void CToxProto::OnFriendRequest(Tox *, const uint8_t *data, const uint8_t *message, const uint16_t messageSize, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -201,7 +201,7 @@ void CToxProto::OnFriendRequest(Tox *tox, const uint8_t *data, const uint8_t *me
ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&pre);
}
-void CToxProto::OnFriendNameChange(Tox *tox, const int friendNumber, const uint8_t *name, const uint16_t nameSize, void *arg)
+void CToxProto::OnFriendNameChange(Tox *, const int friendNumber, const uint8_t *name, const uint16_t, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -212,7 +212,7 @@ void CToxProto::OnFriendNameChange(Tox *tox, const int friendNumber, const uint8
}
}
-void CToxProto::OnStatusMessageChanged(Tox *tox, const int friendNumber, const uint8_t* message, const uint16_t messageSize, void *arg)
+void CToxProto::OnStatusMessageChanged(Tox *, const int friendNumber, const uint8_t* message, const uint16_t, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -224,7 +224,7 @@ void CToxProto::OnStatusMessageChanged(Tox *tox, const int friendNumber, const u
}
}
-void CToxProto::OnUserStatusChanged(Tox *tox, int32_t friendNumber, uint8_t usertatus, void *arg)
+void CToxProto::OnUserStatusChanged(Tox *, int32_t friendNumber, uint8_t usertatus, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp
index d0b30674d2..41832cdee7 100644
--- a/protocols/Tox/src/tox_events.cpp
+++ b/protocols/Tox/src/tox_events.cpp
@@ -49,5 +49,8 @@ int PreShutdown(WPARAM, LPARAM)
if (hAddNodeDlg)
SendMessage(hAddNodeDlg, WM_CLOSE, 0, 0);
+ if (hChangeNodeDlg)
+ SendMessage(hChangeNodeDlg, WM_CLOSE, 0, 0);
+
return 0;
}
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp
index c513780f3f..b03e73e34a 100644
--- a/protocols/Tox/src/tox_messages.cpp
+++ b/protocols/Tox/src/tox_messages.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-void CToxProto::OnFriendMessage(Tox *tox, const int number, const uint8_t *message, const uint16_t messageSize, void *arg)
+void CToxProto::OnFriendMessage(Tox *, const int number, const uint8_t *message, const uint16_t, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -16,7 +16,7 @@ void CToxProto::OnFriendMessage(Tox *tox, const int number, const uint8_t *messa
}
}
-void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action, const uint16_t actionSize, void *arg)
+void CToxProto::OnFriendAction(Tox *, const int number, const uint8_t *action, const uint16_t actionSize, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -33,7 +33,7 @@ void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action
}
}
-int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
+int __cdecl CToxProto::SendMsg(MCONTACT hContact, int, const char* msg)
{
ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
int32_t friendNumber = tox_get_friend_number(tox, pubKey);
@@ -63,7 +63,7 @@ int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
return result;
}
-void CToxProto::OnReadReceipt(Tox *tox, int32_t number, uint32_t receipt, void *arg)
+void CToxProto::OnReadReceipt(Tox *, int32_t number, uint32_t receipt, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -78,7 +78,7 @@ void CToxProto::OnReadReceipt(Tox *tox, int32_t number, uint32_t receipt, void *
}
}
-int CToxProto::OnPreCreateMessage(WPARAM wParam, LPARAM lParam)
+int CToxProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
{
MessageWindowEvent *evt = (MessageWindowEvent *)lParam;
if (strcmp(GetContactProto(evt->hContact), m_szModuleName))
@@ -101,7 +101,7 @@ int CToxProto::OnPreCreateMessage(WPARAM wParam, LPARAM lParam)
return 1;
}
-void CToxProto::OnTypingChanged(Tox *tox, const int number, uint8_t isTyping, void *arg)
+void CToxProto::OnTypingChanged(Tox *, const int number, uint8_t isTyping, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index 3ee3b0a90e..49b4ddb06a 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -1,6 +1,6 @@
#include "common.h"
-HWND hAddNodeDlg;
+HWND hAddNodeDlg, hChangeNodeDlg;
bool UpdateListFlag = false;
INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
@@ -375,6 +375,7 @@ INT_PTR CALLBACK ChangeNodeDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WM_DESTROY:
ItemInfo *SelItem = (ItemInfo *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hChangeNodeDlg = 0;
Utils_SaveWindowPosition(hwndDlg, NULL, MODULE, "ChangeNodeDlg");
delete SelItem;
break;
@@ -404,11 +405,11 @@ INT_PTR CALLBACK ToxNodesOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
return FALSE;
case IDC_CHANGE:
- {
+ if (hChangeNodeDlg == 0) {
ItemInfo SelItem = { 0 };
SelItem.hwndList = hwndList;
SelItem.SelNumber = ListView_GetSelectionMark(hwndList);
- CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ADDNODE), hwndDlg, ChangeNodeDlgProc, (LPARAM)&SelItem);
+ hChangeNodeDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_ADDNODE), hwndDlg, ChangeNodeDlgProc, (LPARAM)&SelItem);
}
return FALSE;
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp
index 9a1c2fc51b..9bb69f6289 100644
--- a/protocols/Tox/src/tox_profile.cpp
+++ b/protocols/Tox/src/tox_profile.cpp
@@ -41,7 +41,7 @@ bool CToxProto::LoadToxProfile()
}
uint8_t *data = (uint8_t*)mir_calloc(size);
- if (fread((char*)data, sizeof(char), size, profile) != size)
+ if (fread((char*)data, sizeof(char), size, profile) != (size_t)size)
{
fclose(profile);
debugLogA("CToxProto::LoadToxData: could not read tox profile");
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 419dbb2814..ce8c15c83e 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -57,7 +57,7 @@ CToxProto::~CToxProto()
UninitNetlib();
}
-DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT hContact)
+DWORD_PTR __cdecl CToxProto::GetCaps(int type, MCONTACT)
{
switch (type)
{
@@ -100,7 +100,7 @@ MCONTACT __cdecl CToxProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
return AddContact(address.c_str(), _T(""), flags & PALF_TEMPORARY);
}
-MCONTACT __cdecl CToxProto::AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) { return 0; }
+MCONTACT __cdecl CToxProto::AddToListByEvent(int, int, MEVENT) { return 0; }
int __cdecl CToxProto::Authorize(MEVENT hDbEvent)
{
@@ -126,7 +126,7 @@ int __cdecl CToxProto::Authorize(MEVENT hDbEvent)
return 0;
}
-int __cdecl CToxProto::AuthDeny(MEVENT hDbEvent, const PROTOCHAR* szReason) { return 0; }
+int __cdecl CToxProto::AuthDeny(MEVENT, const PROTOCHAR*) { return 0; }
int __cdecl CToxProto::AuthRecv(MCONTACT, PROTORECVEVENT* pre)
{
@@ -157,11 +157,11 @@ int __cdecl CToxProto::AuthRequest(MCONTACT hContact, const PROTOCHAR *szMessage
return 1;
}
-HANDLE __cdecl CToxProto::ChangeInfo(int iInfoType, void* pInfoData) { return 0; }
+HANDLE __cdecl CToxProto::ChangeInfo(int, void*) { return 0; }
-int __cdecl CToxProto::GetInfo(MCONTACT hContact, int infoType) { return 0; }
+int __cdecl CToxProto::GetInfo(MCONTACT, int) { return 0; }
-int __cdecl CToxProto::RecvContacts(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
+int __cdecl CToxProto::RecvContacts(MCONTACT, PROTORECVEVENT*) { return 0; }
int __cdecl CToxProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT *pre)
{
@@ -173,13 +173,13 @@ int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
return Proto_RecvMessage(hContact, pre);
}
-int __cdecl CToxProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) { return 0; }
+int __cdecl CToxProto::RecvUrl(MCONTACT, PROTORECVEVENT*) { return 0; }
-int __cdecl CToxProto::SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT* hContactsList) { return 0; }
+int __cdecl CToxProto::SendContacts(MCONTACT, int, int, MCONTACT*) { return 0; }
-int __cdecl CToxProto::SendUrl(MCONTACT hContact, int flags, const char* url) { return 0; }
+int __cdecl CToxProto::SendUrl(MCONTACT, int, const char*) { return 0; }
-int __cdecl CToxProto::SetApparentMode(MCONTACT hContact, int mode) { return 0; }
+int __cdecl CToxProto::SetApparentMode(MCONTACT, int) { return 0; }
int __cdecl CToxProto::SetStatus(int iNewStatus)
{
@@ -253,10 +253,10 @@ int __cdecl CToxProto::SetStatus(int iNewStatus)
return 0;
}
-HANDLE __cdecl CToxProto::GetAwayMsg(MCONTACT hContact) { return 0; }
-int __cdecl CToxProto::RecvAwayMsg(MCONTACT hContact, int mode, PROTORECVEVENT* evt) { return 0; }
+HANDLE __cdecl CToxProto::GetAwayMsg(MCONTACT) { return 0; }
+int __cdecl CToxProto::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*) { return 0; }
-int __cdecl CToxProto::SetAwayMsg(int iStatus, const PROTOCHAR *msg)
+int __cdecl CToxProto::SetAwayMsg(int, const PROTOCHAR *msg)
{
if (IsOnline())
{
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp
index d62eccd593..b7aa7ec9df 100644
--- a/protocols/Tox/src/tox_search.cpp
+++ b/protocols/Tox/src/tox_search.cpp
@@ -31,7 +31,6 @@ void CToxProto::SearchByNameAsync(void *arg)
char dnsQuery[512];
mir_snprintf(dnsQuery, 512, "_%s._tox.%s", dnsString, server->domain);
- bool success = false;
DNS_RECORDA *record = NULL;
DnsQuery_A(dnsQuery, DNS_TYPE_TEXT, 0, NULL, (PDNS_RECORD*)&record, NULL);
while (record)
@@ -69,7 +68,7 @@ void CToxProto::SearchByNameAsync(void *arg)
mir_free(arg);
}
-INT_PTR CToxProto::SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+INT_PTR CToxProto::SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM, LPARAM lParam)
{
CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
@@ -91,11 +90,11 @@ INT_PTR CToxProto::SearchDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
return FALSE;
}
-HANDLE __cdecl CToxProto::SearchBasic(const PROTOCHAR* id) { return 0; }
+HANDLE __cdecl CToxProto::SearchBasic(const PROTOCHAR*) { return 0; }
-HANDLE __cdecl CToxProto::SearchByEmail(const PROTOCHAR* email) { return 0; }
+HANDLE __cdecl CToxProto::SearchByEmail(const PROTOCHAR*) { return 0; }
-HANDLE __cdecl CToxProto::SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName) { return 0; }
+HANDLE __cdecl CToxProto::SearchByName(const PROTOCHAR*, const PROTOCHAR*, const PROTOCHAR*) { return 0; }
HWND __cdecl CToxProto::SearchAdvanced(HWND owner)
{
@@ -115,7 +114,6 @@ HWND __cdecl CToxProto::SearchAdvanced(HWND owner)
if (std::regex_search(query, match, regex))
{
std::string address = match[1];
- MCONTACT hContact = GetContact(address.c_str());
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_TCHAR;
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index cad34a1646..be0159dcdc 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -3,7 +3,7 @@
/* FILE RECEIVING */
// incoming file flow
-void CToxProto::OnFriendFile(Tox *tox, int32_t friendNumber, uint8_t fileNumber, uint64_t fileSize, const uint8_t *fileName, uint16_t length, void *arg)
+void CToxProto::OnFriendFile(Tox *, int32_t friendNumber, uint8_t fileNumber, uint64_t fileSize, const uint8_t *fileName, uint16_t, void *arg)
{
CToxProto *proto = (CToxProto*)arg;
@@ -262,7 +262,7 @@ void CToxProto::SendFileAsync(void *arg)
/* COMMON */
// file request is cancelled
-int __cdecl CToxProto::FileCancel(MCONTACT hContact, HANDLE hTransfer)
+int __cdecl CToxProto::FileCancel(MCONTACT, HANDLE hTransfer)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
transfer->status = CANCELED;