summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2016-04-05 20:28:29 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2016-04-05 20:28:29 +0000
commit1b0236528ceec24b16d6ce91a188b2da240f1a7d (patch)
treed60e8e282a0eef4c3a50bb8df5f9512d565d3469 /protocols/Gadu-Gadu
parentab2852015641c9aa9aa2588fb21617e31b7da546 (diff)
Gadu-Gadu: resource leak fixes, cleanup
git-svn-id: http://svn.miranda-ng.org/main/trunk@16590 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp16
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp94
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp29
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp37
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp59
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h12
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp53
-rw-r--r--protocols/Gadu-Gadu/src/image.cpp57
-rw-r--r--protocols/Gadu-Gadu/src/import.cpp20
-rw-r--r--protocols/Gadu-Gadu/src/keepalive.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/links.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/ownerinfo.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/popups.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/services.cpp40
-rw-r--r--protocols/Gadu-Gadu/src/sessions.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/token.cpp1
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp32
18 files changed, 264 insertions, 208 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index f560cddf89..58a8208a27 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -25,7 +25,7 @@
//////////////////////////////////////////////////////////
// Avatars support
-
+//
void GGPROTO::getAvatarFilename(MCONTACT hContact, TCHAR *pszDest, int cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST( _T("%miranda_avatarcache%")), m_szModuleName);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index a73ffa447d..4f8816fd7e 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -892,7 +892,6 @@ retry:
TCHAR id[32];
UIN2IDT(getDword(GG_KEY_UIN, 0), id);
- DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
@@ -1268,7 +1267,7 @@ void GGPROTO::broadcastnewstatus(int newStatus)
////////////////////////////////////////////////////////////
// When contact is deleted
-int GGPROTO::contactdeleted(WPARAM hContact, LPARAM lParam)
+int GGPROTO::contactdeleted(WPARAM hContact, LPARAM)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
@@ -1324,7 +1323,6 @@ static TCHAR* sttSettingToTchar( DBVARIANT* value )
int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
{
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- char *szProto = NULL;
#ifdef DEBUGMODE
debugLogA("dbsettingchanged(): fired. szModule=%s szSetting=%s", cws->szModule, cws->szSetting);
@@ -1403,7 +1401,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
////////////////////////////////////////////////////////////
// All users set offline
-
+//
void GGPROTO::setalloffline()
{
debugLogA("setalloffline(): started. Setting buddies offline");
@@ -1424,7 +1422,7 @@ void GGPROTO::setalloffline()
////////////////////////////////////////////////////////////
// All users set offline
-
+//
void GGPROTO::notifyuser(MCONTACT hContact, int refresh)
{
uin_t uin;
@@ -1519,7 +1517,7 @@ void GGPROTO::notifyall()
////////////////////////////////////////////////////////////
// Get contact by uin
-
+//
MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
{
#ifdef DEBUGMODE
@@ -1606,7 +1604,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
////////////////////////////////////////////////////////////
// Status conversion
-
+//
int GGPROTO::status_m2gg(int status, int descr)
{
// check frends only
@@ -1686,8 +1684,8 @@ int GGPROTO::status_gg2m(int status)
////////////////////////////////////////////////////////////
// Called when contact status is changed
-
-void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version)
+//
+void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int, uint32_t remote_ip, uint16_t remote_port, uint32_t version)
{
#ifdef DEBUGMODE
debugLogA("changecontactstatus(): uin=%d status=%d", uin, status);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 9c498c4e2a..6fb87d7bca 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -20,14 +20,8 @@
#include "gg.h"
-static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
extern INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
-////////////////////////////////////////////////////////////////////////////////
-// SetValue
-
#define SVS_NORMAL 0
#define SVS_GENDER 1
#define SVS_ZEROISUNSPEC 2
@@ -38,6 +32,9 @@ extern INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam
#define SVS_TIMEZONE 7
#define SVS_GGVERSION 9
+////////////////////////////////////////////////////////////////////////////////
+// SetValue
+//
static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule, char *szSetting, int special, int disableIfUndef)
{
DBVARIANT dbv = {0};
@@ -149,38 +146,8 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule
}
////////////////////////////////////////////////////////////////////////////////
-// Options Page : Init
-
-int GGPROTO::options_init(WPARAM wParam, LPARAM lParam)
-{
- OPTIONSDIALOGPAGE odp = { 0 };
- odp.flags = ODPF_TCHAR;
- odp.position = 1003000;
- odp.hInstance = hInstance;
- odp.ptszGroup = LPGENT("Network");
- odp.ptszTitle = m_tszUserName;
- odp.dwInitParam = (LPARAM)this;
- odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
-
- odp.ptszTab = LPGENT("General");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL);
- odp.pfnDlgProc = gg_genoptsdlgproc;
- Options_AddPage(wParam, &odp);
-
- odp.ptszTab = LPGENT("Conference");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_CONFERENCE);
- odp.pfnDlgProc = gg_confoptsdlgproc;
- Options_AddPage(wParam, &odp);
-
- odp.ptszTab = LPGENT("Advanced");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_ADVANCED);
- odp.pfnDlgProc = gg_advoptsdlgproc;
- Options_AddPage(wParam, &odp);
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////
// Check if new user data has been filled in for specified account
+//
void GGPROTO::checknewuser(uin_t uin, const char* passwd)
{
char oldpasswd[128];
@@ -200,7 +167,7 @@ void GGPROTO::checknewuser(uin_t uin, const char* passwd)
////////////////////////////////////////////////////////////////////////////////
// Options Page : Proc
-
+//
static void gg_optsdlgcheck(HWND hwndDlg)
{
TCHAR text[128];
@@ -227,6 +194,7 @@ static void gg_optsdlgcheck(HWND hwndDlg)
////////////////////////////////////////////////////////////////////////////////////////////
// Proc: General options dialog
+//
static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGPROTO *gg = (GGPROTO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -236,7 +204,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
{
DBVARIANT dbv;
DWORD num;
- GGPROTO *gg = (GGPROTO *)lParam;
+ gg = (GGPROTO *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
TranslateDialogDefault(hwndDlg);
@@ -513,7 +481,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
////////////////////////////////////////////////////////////////////////////////////////////
// Proc: Conference options dialog
-
+//
static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGPROTO *gg = (GGPROTO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -576,6 +544,7 @@ static INT_PTR CALLBACK gg_confoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam
////////////////////////////////////////////////////////////////////////////////////////////
// Proc: Advanced options dialog
+//
static INT_PTR CALLBACK gg_advoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGPROTO *gg = (GGPROTO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -696,6 +665,7 @@ struct GGDETAILSDLGDATA
////////////////////////////////////////////////////////////////////////////////
// Info Page : Proc
// lParam: 0 if current user (account owner) details, hContact if on list user details
+//
static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct GGDETAILSDLGDATA *dat = (struct GGDETAILSDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -727,11 +697,10 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case PSN_INFOCHANGED:
+ if (dat)
{
MCONTACT hContact = (MCONTACT)((LPPSHNOTIFY)lParam)->lParam;
GGPROTO *gg = dat->gg;
- if (!dat)
- break;
// Show updated message
if (dat->updating)
@@ -830,6 +799,8 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
EnableWindow(GetDlgItem(hwndDlg, IDC_SAVE), FALSE);
gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_WRITE);
+ if (req == NULL)
+ break;
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
if (mir_tstrlen(text))
@@ -892,9 +863,42 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam,
return FALSE;
}
+
////////////////////////////////////////////////////////////////////////////////
-// Info Page : Init
+// Options Page : Init
+//
+int GGPROTO::options_init(WPARAM wParam, LPARAM)
+{
+ OPTIONSDIALOGPAGE odp = { 0 };
+ odp.flags = ODPF_TCHAR;
+ odp.position = 1003000;
+ odp.hInstance = hInstance;
+ odp.ptszGroup = LPGENT("Network");
+ odp.ptszTitle = m_tszUserName;
+ odp.dwInitParam = (LPARAM)this;
+ odp.flags = ODPF_TCHAR | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
+ odp.ptszTab = LPGENT("General");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL);
+ odp.pfnDlgProc = gg_genoptsdlgproc;
+ Options_AddPage(wParam, &odp);
+
+ odp.ptszTab = LPGENT("Conference");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_CONFERENCE);
+ odp.pfnDlgProc = gg_confoptsdlgproc;
+ Options_AddPage(wParam, &odp);
+
+ odp.ptszTab = LPGENT("Advanced");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_ADVANCED);
+ odp.pfnDlgProc = gg_advoptsdlgproc;
+ Options_AddPage(wParam, &odp);
+ return 0;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// Info Page : Init
+//
int GGPROTO::details_init(WPARAM wParam, LPARAM lParam)
{
MCONTACT hContact = lParam;
@@ -932,8 +936,8 @@ int GGPROTO::details_init(WPARAM wParam, LPARAM lParam)
////////////////////////////////////////////////////////////////////////////////////////////
// Proc: Account manager options dialog
+//
INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-////////////////////////////////////////////////////////////////////////////////////////////
{
GGPROTO *gg = (GGPROTO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -942,7 +946,7 @@ INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
{
DBVARIANT dbv;
DWORD num;
- GGPROTO *gg = (GGPROTO *)lParam;
+ gg = (GGPROTO *)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
TranslateDialogDefault(hwndDlg);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index 3c85052673..2b65aefdb4 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -85,14 +85,15 @@ void GGPROTO::dccconnect(uin_t uin)
gg_LeaveCriticalSection(&ft_mutex, "dccconnect", 36, 1, "ft_mutex", 1);
}
-//////////////////////////////////////////////////////////
-// THREAD: File transfer fail
struct ftfaildata
{
MCONTACT hContact;
HANDLE hProcess;
};
+//////////////////////////////////////////////////////////
+// THREAD: File transfer fail
+//
void __cdecl GGPROTO::ftfailthread(void *param)
{
struct ftfaildata *ft = (struct ftfaildata *)param;
@@ -119,12 +120,12 @@ HANDLE ftfail(GGPROTO *gg, MCONTACT hContact)
return ft->hProcess;
}
-////////////////////////////////////////////////////////////
-// Main DCC connection session thread
-
// Info refresh min time (msec) / half-sec
#define GGSTATREFRESHEVERY 500
+////////////////////////////////////////////////////////////
+// Main DCC connection session thread
+//
void __cdecl GGPROTO::dccmainthread(void*)
{
uin_t uin;
@@ -848,8 +849,8 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer)
////////////////////////////////////////////////////////////
// File receiving allowed
-
-HANDLE GGPROTO::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath)
+//
+HANDLE GGPROTO::FileAllow(MCONTACT, HANDLE hTransfer, const TCHAR* szPath)
{
// Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
@@ -864,8 +865,8 @@ HANDLE GGPROTO::FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPa
////////////////////////////////////////////////////////////
// File transfer canceled
-
-int GGPROTO::FileCancel(MCONTACT hContact, HANDLE hTransfer)
+//
+int GGPROTO::FileCancel(MCONTACT, HANDLE hTransfer)
{
// Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
@@ -880,8 +881,8 @@ int GGPROTO::FileCancel(MCONTACT hContact, HANDLE hTransfer)
////////////////////////////////////////////////////////////
// File receiving denied
-
-int GGPROTO::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason)
+//
+int GGPROTO::FileDeny(MCONTACT, HANDLE hTransfer, const TCHAR *)
{
// Check if its proper dcc
struct gg_common *c = (struct gg_common *) hTransfer;
@@ -896,7 +897,7 @@ int GGPROTO::FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason
////////////////////////////////////////////////////////////
// Called when received an file
-
+//
int GGPROTO::RecvFile(MCONTACT hContact, PROTORECVFILET* pre)
{
return Proto_RecvFile(hContact, pre);
@@ -904,8 +905,8 @@ int GGPROTO::RecvFile(MCONTACT hContact, PROTORECVFILET* pre)
////////////////////////////////////////////////////////////
// Called when user sends a file
-
-HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+//
+HANDLE GGPROTO::SendFile(MCONTACT hContact, const TCHAR *, TCHAR** ppszFiles)
{
char *bslash, *filename;
DWORD ip, ver;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index ece12d3516..e218ad8cde 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -54,7 +54,7 @@ static unsigned long crc_table[256];
//////////////////////////////////////////////////////////
// Extra winsock function for error description
-
+//
TCHAR* ws_strerror(int code)
{
static TCHAR err_desc[160];
@@ -133,8 +133,8 @@ const TCHAR *http_error_string(int h)
//////////////////////////////////////////////////////////
// Gets plugin info
-
-extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion)
+//
+extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
{
return &pluginInfo;
}
@@ -143,7 +143,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO
//////////////////////////////////////////////////////////
// Cleanups from last plugin
-
+//
void GGPROTO::cleanuplastplugin(DWORD version)
{
// Store current plugin version
@@ -178,7 +178,8 @@ void GGPROTO::cleanuplastplugin(DWORD version)
//////////////////////////////////////////////////////////
// When Miranda loaded its modules
-static int gg_modulesloaded(WPARAM wParam, LPARAM lParam)
+//
+static int gg_modulesloaded(WPARAM, LPARAM)
{
// Get SSL API
mir_getSI(&sslApi);
@@ -191,6 +192,7 @@ static int gg_modulesloaded(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// Gets protocol instance associated with a contact
+//
static GGPROTO* gg_getprotoinstance(MCONTACT hContact)
{
char* szProto = GetContactProto(hContact);
@@ -206,7 +208,8 @@ static GGPROTO* gg_getprotoinstance(MCONTACT hContact)
//////////////////////////////////////////////////////////
// Handles PrebuildContactMenu event
-static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM lParam)
+//
+static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM)
{
GGPROTO* gg = gg_getprotoinstance(hContact);
if (gg == NULL)
@@ -221,18 +224,19 @@ static int gg_prebuildcontactmenu(WPARAM hContact, LPARAM lParam)
//////////////////////////////////////////////////////////
// Contact block service function
-INT_PTR GGPROTO::blockuser(WPARAM hContact, LPARAM lParam)
+//
+INT_PTR GGPROTO::blockuser(WPARAM hContact, LPARAM)
{
setByte(hContact, GG_KEY_BLOCK, !getByte(hContact, GG_KEY_BLOCK, 0));
notifyuser(hContact, 1);
return 0;
}
+#define GGS_BLOCKUSER "/BlockUser"
//////////////////////////////////////////////////////////
// Contact blocking initialization
-
-#define GGS_BLOCKUSER "/BlockUser"
+//
void GGPROTO::block_init()
{
CMenuItem mi;
@@ -248,7 +252,7 @@ void GGPROTO::block_init()
//////////////////////////////////////////////////////////
// Contact blocking uninitialization
-
+//
void GGPROTO::block_uninit()
{
Menu_RemoveItem(hBlockMenuItem);
@@ -256,6 +260,7 @@ void GGPROTO::block_uninit()
//////////////////////////////////////////////////////////
// Menus initialization
+//
void GGPROTO::menus_init()
{
HGENMENU hRoot = Menu_GetProtocolRoot(this);
@@ -281,7 +286,7 @@ void GGPROTO::menus_init()
//////////////////////////////////////////////////////////
// Module instance initialization
-
+//
static GGPROTO *gg_proto_init(const char* pszProtoName, const TCHAR* tszUserName)
{
GGPROTO *gg = new GGPROTO(pszProtoName, tszUserName);
@@ -291,7 +296,7 @@ static GGPROTO *gg_proto_init(const char* pszProtoName, const TCHAR* tszUserName
//////////////////////////////////////////////////////////
// Module instance uninitialization
-
+//
static int gg_proto_uninit(PROTO_INTERFACE *proto)
{
GGPROTO *gg = (GGPROTO *)proto;
@@ -302,7 +307,7 @@ static int gg_proto_uninit(PROTO_INTERFACE *proto)
//////////////////////////////////////////////////////////
// When plugin is loaded
-
+//
extern "C" int __declspec(dllexport) Load(void)
{
mir_getLP(&pluginInfo);
@@ -326,7 +331,7 @@ extern "C" int __declspec(dllexport) Load(void)
//////////////////////////////////////////////////////////
// When plugin is unloaded
-
+//
extern "C" int __declspec(dllexport) Unload()
{
WSACleanup();
@@ -424,8 +429,8 @@ void gg_debughandler(int level, const char *format, va_list ap)
//////////////////////////////////////////////////////////
// main DLL function
-
-BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD reason, LPVOID reserved)
+//
+BOOL APIENTRY DllMain(HINSTANCE hInst, DWORD, LPVOID)
{
crc_gentable();
hInstance = hInst;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 3bcfd97cd5..b089305de3 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -119,7 +119,7 @@ GGPROTO::~GGPROTO()
//////////////////////////////////////////////////////////
// when contact is added to list
-
+//
MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr)
{
#ifdef DEBUGMODE
@@ -138,8 +138,8 @@ MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr)
//////////////////////////////////////////////////////////
// checks proto capabilities
-
-DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT hContact)
+//
+DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -164,7 +164,7 @@ DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT hContact)
//////////////////////////////////////////////////////////
// user info request
-
+//
void __cdecl GGPROTO::cmdgetinfothread(void *hContact)
{
debugLogA("cmdgetinfothread(): started. Failed info retreival.");
@@ -173,7 +173,7 @@ void __cdecl GGPROTO::cmdgetinfothread(void *hContact)
debugLogA("cmdgetinfothread(): end.");
}
-int GGPROTO::GetInfo(MCONTACT hContact, int infoType)
+int GGPROTO::GetInfo(MCONTACT hContact, int)
{
gg_pubdir50_t req;
@@ -227,6 +227,7 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType)
debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread");
#endif
ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact);
+ gg_pubdir50_free(req);
return 1;
}
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 2, "sess_mutex", 1);
@@ -238,9 +239,6 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType)
return 1;
}
-//////////////////////////////////////////////////////////
-// when basic search
-
void __cdecl GGPROTO::searchthread(void *)
{
debugLogA("searchthread(): started. Failed search.");
@@ -251,6 +249,9 @@ void __cdecl GGPROTO::searchthread(void *)
#endif
}
+//////////////////////////////////////////////////////////
+// when basic search
+//
HANDLE GGPROTO::SearchBasic(const TCHAR *id)
{
if (!isonline())
@@ -287,7 +288,7 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id)
//////////////////////////////////////////////////////////
// search by details
-
+//
HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TCHAR *lastName)
{
// Check if connected and if there's a search data
@@ -344,10 +345,12 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC
debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
- return (HANDLE)1;
}
- gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 2, "sess_mutex", 1);
- debugLogA("SearchByName(): Seq %d.", req->seq);
+ else
+ {
+ gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 2, "sess_mutex", 1);
+ debugLogA("SearchByName(): Seq %d.", req->seq);
+ }
gg_pubdir50_free(req);
return (HANDLE)1;
@@ -355,7 +358,7 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC
//////////////////////////////////////////////////////////
// search by advanced
-
+//
HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
{
// Check if connected
@@ -455,8 +458,10 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
/* 7 */ szQuery.AppendChar('.');
// No data entered
- if (szQuery.GetLength() <= 7 || (szQuery.GetLength() == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)))
+ if (szQuery.GetLength() <= 7 || (szQuery.GetLength() == 8 && IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED))) {
+ gg_pubdir50_free(req);
return 0;
+ }
// Count crc & check if the data was equal if yes do same search with shift
unsigned long crc = crc_get(szQuery.GetBuffer());
@@ -488,8 +493,8 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg)
//////////////////////////////////////////////////////////
// create adv search dialog
-
-static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
+//
+static INT_PTR CALLBACK gg_advancedsearchdlgproc(HWND hwndDlg, UINT message, WPARAM, LPARAM)
{
switch (message) {
case WM_INITDIALOG:
@@ -508,9 +513,6 @@ HWND GGPROTO::CreateExtendedSearchUI(HWND owner)
MAKEINTRESOURCE(IDD_GGADVANCEDSEARCH), owner, gg_advancedsearchdlgproc, (LPARAM)this);
}
-//////////////////////////////////////////////////////////
-// when messsage sent
-
typedef struct
{
MCONTACT hContact;
@@ -525,6 +527,9 @@ void __cdecl GGPROTO::sendackthread(void *ack)
mir_free(ack);
}
+//////////////////////////////////////////////////////////
+// when messsage sent
+//
int GGPROTO::SendMsg(MCONTACT hContact, int, const char *msg)
{
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
@@ -554,7 +559,7 @@ int GGPROTO::SendMsg(MCONTACT hContact, int, const char *msg)
//////////////////////////////////////////////////////////
// visible lists
-
+//
int GGPROTO::SetApparentMode(MCONTACT hContact, int mode)
{
setWord(hContact, GG_KEY_APPARENT, (WORD)mode);
@@ -564,7 +569,7 @@ int GGPROTO::SetApparentMode(MCONTACT hContact, int mode)
//////////////////////////////////////////////////////////
// sets protocol status
-
+//
int GGPROTO::SetStatus(int iNewStatus)
{
int nNewStatus = gg_normalizestatus(iNewStatus);
@@ -583,9 +588,6 @@ int GGPROTO::SetStatus(int iNewStatus)
return 0;
}
-//////////////////////////////////////////////////////////
-// when away message is requested
-
void __cdecl GGPROTO::getawaymsgthread(void *arg)
{
DBVARIANT dbv;
@@ -604,6 +606,9 @@ void __cdecl GGPROTO::getawaymsgthread(void *arg)
debugLogA("getawaymsgthread(): end");
}
+//////////////////////////////////////////////////////////
+// when away message is requested
+//
HANDLE GGPROTO::GetAwayMsg(MCONTACT hContact)
{
#ifdef DEBUGMODE
@@ -616,7 +621,7 @@ HANDLE GGPROTO::GetAwayMsg(MCONTACT hContact)
//////////////////////////////////////////////////////////
// when away message is being set
// registered as ProtoService PS_SETAWAYMSGT
-
+//
int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg)
{
int status = gg_normalizestatus(iStatus);
@@ -675,7 +680,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg)
//////////////////////////////////////////////////////////
// sends a notification that the user is typing a message
-
+//
int GGPROTO::UserIsTyping(MCONTACT hContact, int type)
{
uin_t uin = getDword(hContact, GG_KEY_UIN, 0);
@@ -693,7 +698,7 @@ int GGPROTO::UserIsTyping(MCONTACT hContact, int type)
//////////////////////////////////////////////////////////
// Custom protocol event
-
+//
int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam)
{
switch (eventType) {
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index 5b6f79292c..6508103fef 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -261,7 +261,11 @@ typedef struct
} GGUSERUTILDLGDATA;
+#ifdef DEBUGMODE
inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, char* mutexName, int logging)
+#else
+inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char*, int, char *, int)
+#endif
{
#ifdef DEBUGMODE
int logAfter = 0;
@@ -279,7 +283,11 @@ inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* call
}
+#ifdef DEBUGMODE
inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, int returnNumber, char* mutexName, int logging) /*0-never, 1-debug, 2-all*/
+#else
+inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char *, int, int, char *, int) /*0-never, 1-debug, 2-all*/
+#endif
{
#ifdef DEBUGMODE
if(logging == 1 && extendedLogging == 1) debugLogA("%s(): %i.%i LeaveCriticalSection %s", callingFunction, sectionNumber, returnNumber, mutexName);
@@ -287,7 +295,11 @@ inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* call
LeaveCriticalSection(mutex);
}
+#ifdef DEBUGMODE
inline void GGPROTO::gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int sleepNumber, int logging){
+#else
+inline void GGPROTO::gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int, int) {
+#endif
SleepEx(miliseconds, alterable);
#ifdef DEBUGMODE
if(logging == 1 && extendedLogging == 1) debugLogA("%s(): %i after SleepEx(%ld,%u)", callingFunction, sleepNumber, miliseconds, alterable);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 51767d71fe..ba8ad0b620 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -27,7 +27,7 @@
////////////////////////////////////////////////////////////////////////////////
// Inits Gadu-Gadu groupchat module using chat.dll
-
+//
int GGPROTO::gc_init()
{
if (ServiceExists(MS_GC_REGISTER)) {
@@ -53,7 +53,7 @@ int GGPROTO::gc_init()
////////////////////////////////////////////////////////////////////////////////
// Groupchat menus initialization
-
+//
void GGPROTO::gc_menus_init(HGENMENU hRoot)
{
if (gc_enabled) {
@@ -81,7 +81,7 @@ void GGPROTO::gc_menus_init(HGENMENU hRoot)
////////////////////////////////////////////////////////////////////////////////
// Releases Gadu-Gadu groupchat module using chat.dll
-
+//
int GGPROTO::gc_destroy()
{
list_t l;
@@ -109,7 +109,7 @@ GGGC* GGPROTO::gc_lookup(const TCHAR *id)
return NULL;
}
-int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam)
+int GGPROTO::gc_event(WPARAM, LPARAM lParam)
{
GCHOOK *gch = (GCHOOK *)lParam;
GGGC *chat = NULL;
@@ -206,13 +206,14 @@ typedef struct _gg_gc_echat
////////////////////////////////////////////////////////////////////////////////
// This is main groupchat initialization routine
-
+//
TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count)
{
- list_t l; int i;
+ list_t l;
GGGC *chat;
TCHAR id[32];
- uin_t uin; DBVARIANT dbv;
+ uin_t uin;
+ DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP };
GCEVENT gce = { sizeof(gce), &gcd };
@@ -222,18 +223,21 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
// Look for existing chat
for(l = chats; l; l = l->next)
{
- GGGC *chat = (GGGC *)l->data;
+ chat = (GGGC *)l->data;
if (!chat) continue;
if (chat->recipients_count == recipients_count + (sender ? 1 : 0))
{
int i, j, found = 0, sok = (sender == 0);
- if (!sok) for(i = 0; i < chat->recipients_count; i++)
- if (sender == chat->recipients[i])
- {
- sok = 1;
- break;
+ if (!sok) {
+ for (i = 0; i < chat->recipients_count; i++) {
+ if (sender == chat->recipients[i])
+ {
+ sok = 1;
+ break;
+ }
}
+ }
if (sok)
for(i = 0; i < chat->recipients_count; i++)
for(j = 0; j < recipients_count; j++)
@@ -260,7 +264,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
{
int unknown = (getcontact(sender, 0, 0, NULL) == NULL),
unknownSender = unknown;
- for(i = 0; i < recipients_count; i++)
+ for(int i = 0; i < recipients_count; i++)
if (!getcontact(recipients[i], 0, 0, NULL))
unknown ++;
if ((getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 2) ||
@@ -287,7 +291,8 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
// Copy recipient list
chat->recipients_count = recipients_count + 1;
chat->recipients = (uin_t *)calloc(chat->recipients_count, sizeof(uin_t));
- for(i = 0; i < recipients_count; i++)
+ int i = 0;
+ for(; i < recipients_count; i++)
chat->recipients[i] = recipients[i];
if (sender) chat->recipients[i] = sender;
debugLog(_T("gc_getchat(): Ignoring new chat %s, count %d."), chat->id, chat->recipients_count);
@@ -298,8 +303,17 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
// Create new chat window
TCHAR status[256];
- TCHAR *senderName = sender ? pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0) : NULL;
- mir_sntprintf(status, (sender) ? TranslateT("%s initiated the conference.") : TranslateT("This is my own conference."), senderName);
+ TCHAR *senderName;
+ if (sender)
+ {
+ senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
+ mir_sntprintf(status, TranslateT("%s initiated the conference.") , senderName);
+ }
+ else
+ {
+ senderName = NULL;
+ mir_sntprintf(status, TranslateT("This is my own conference."));
+ }
GCSESSION gcwindow = { sizeof(gcwindow) };
gcwindow.iType = GCW_CHATROOM;
@@ -357,6 +371,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count
// Copy recipient list
chat->recipients_count = recipients_count + (sender ? 1 : 0);
chat->recipients = (uin_t *)calloc(chat->recipients_count, sizeof(uin_t));
+ int i;
for(i = 0; i < recipients_count; i++)
chat->recipients[i] = recipients[i];
if (sender) chat->recipients[i] = sender;
@@ -561,7 +576,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
return FALSE;
}
-INT_PTR GGPROTO::gc_clearignored(WPARAM wParam, LPARAM lParam)
+INT_PTR GGPROTO::gc_clearignored(WPARAM, LPARAM)
{
list_t l = chats; BOOL cleared = FALSE;
while(l)
@@ -585,7 +600,7 @@ INT_PTR GGPROTO::gc_clearignored(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR GGPROTO::gc_openconf(WPARAM wParam, LPARAM lParam)
+INT_PTR GGPROTO::gc_openconf(WPARAM, LPARAM)
{
// Check if connected
if (!isonline())
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp
index b205aea2a0..2f9d849c7e 100644
--- a/protocols/Gadu-Gadu/src/image.cpp
+++ b/protocols/Gadu-Gadu/src/image.cpp
@@ -65,7 +65,7 @@ int gg_img_remove(GGIMAGEDLGDATA *dat);
////////////////////////////////////////////////////////////////////////////
// Image Module : Adding item to contact menu, creating sync objects
-
+//
int GGPROTO::img_init()
{
// Send image contact menu item
@@ -84,6 +84,7 @@ int GGPROTO::img_init()
////////////////////////////////////////////////////////////////////////////
// Image Module : closing dialogs, sync objects
+//
int GGPROTO::img_shutdown()
{
list_t l;
@@ -114,7 +115,7 @@ int GGPROTO::img_shutdown()
////////////////////////////////////////////////////////////////////////////
// Image Module : destroying list
-
+//
int GGPROTO::img_destroy()
{
// Release all dialogs
@@ -128,7 +129,7 @@ int GGPROTO::img_destroy()
////////////////////////////////////////////////////////////////////////////
// Image Window : Frees image entry structure
-
+//
static int gg_img_releasepicture(void *img)
{
if (!img)
@@ -144,6 +145,7 @@ static int gg_img_releasepicture(void *img)
////////////////////////////////////////////////////////////////////////////
// Painting image
+//
int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat)
{
PAINTSTRUCT paintStruct;
@@ -209,7 +211,7 @@ int gg_img_paint(HWND hwnd, GGIMAGEENTRY *dat)
////////////////////////////////////////////////////////////////////////////////
// Returns supported image filters
-
+//
TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize)
{
TCHAR *szFilterName, *szFilterMask;
@@ -233,7 +235,7 @@ TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize)
////////////////////////////////////////////////////////////////////////////////
// Save specified image entry
-
+//
int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat)
{
if (!dat)
@@ -276,7 +278,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat)
////////////////////////////////////////////////////////////////////////////
// Fit window size to image size
-
+//
BOOL gg_img_fit(HWND hwndDlg)
{
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -349,7 +351,8 @@ BOOL gg_img_fit(HWND hwndDlg)
////////////////////////////////////////////////////////////////////////////
// Dialog resizer procedure
-static int sttImageDlgResizer(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL* urc)
+//
+static int sttImageDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc)
{
switch (urc->wId)
{
@@ -369,6 +372,7 @@ static int sttImageDlgResizer(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL* ur
////////////////////////////////////////////////////////////////////////////
// Send / Recv main dialog procedure
+//
static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -555,8 +559,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
else
{
- int i;
- for (i = 1; img && (i < dat->nImg - 1); i++)
+ for (int i = 1; img && (i < dat->nImg - 1); i++)
img = img->lpNext;
if (!img)
{
@@ -580,9 +583,8 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case IDC_IMG_SAVE:
{
GGIMAGEENTRY *img = dat->lpImages;
- int i;
- for (i = 1; img && (i < dat->nImg); i++)
+ for (int i = 1; img && (i < dat->nImg); i++)
img = img->lpNext;
if (!img)
{
@@ -604,7 +606,6 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
uin_t uin = (uin_t)gg->getDword(dat->hContact, GG_KEY_UIN, 0);
struct gg_msg_richtext_format *r = NULL;
struct gg_msg_richtext_image *p = NULL;
- LPVOID pvData = NULL;
int len;
((struct gg_msg_richtext*)format)->flag = 2;
@@ -699,7 +700,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
////////////////////////////////////////////////////////////////////////////
// Image dialog call thread
-
+//
void __cdecl GGPROTO::img_dlgcallthread(void *param)
{
HWND hMIWnd = 0;
@@ -716,6 +717,7 @@ void __cdecl GGPROTO::img_dlgcallthread(void *param)
////////////////////////////////////////////////////////////////////////////
// Open dialog receive for specified contact
+//
GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact)
{
// Create dialog data
@@ -735,6 +737,7 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, MCONTACT hContact)
////////////////////////////////////////////////////////////////////////////
// Checks if an image is already saved to the specified path
// Returns 1 if yes, 0 if no or -1 if different image on this path is found
+//
int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat)
{
struct _stat st;
@@ -766,6 +769,7 @@ int gg_img_isexists(TCHAR *szPath, GGIMAGEENTRY *dat)
////////////////////////////////////////////////////////////////////////////
// Determine if image's file name has the proper extension
+//
TCHAR *gg_img_hasextension(TCHAR *filename)
{
if (filename != NULL && *filename != '\0')
@@ -789,7 +793,7 @@ TCHAR *gg_img_hasextension(TCHAR *filename)
////////////////////////////////////////////////////////////////////////////////
// Display received image using message with [img] BBCode
-
+//
int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img)
{
GGIMAGEENTRY *dat = (GGIMAGEENTRY *)img;
@@ -862,7 +866,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img)
////////////////////////////////////////////////////////////////////////////
// Return if uin has it's window already opened
-
+//
BOOL GGPROTO::img_opened(uin_t uin)
{
list_t l = imagedlgs;
@@ -878,11 +882,11 @@ BOOL GGPROTO::img_opened(uin_t uin)
////////////////////////////////////////////////////////////////////////////
// Image Module : Looking for window entry, create if not found
-
+//
int GGPROTO::img_display(MCONTACT hContact, void *img)
{
list_t l = imagedlgs;
- GGIMAGEDLGDATA *dat;
+ GGIMAGEDLGDATA *dat = NULL;
if (!img) return FALSE;
@@ -921,7 +925,7 @@ int GGPROTO::img_display(MCONTACT hContact, void *img)
////////////////////////////////////////////////////////////////////////////
// Helper function to determine image file format and the right extension
-
+//
const TCHAR *gg_img_guessfileextension(const char *lpData)
{
if (lpData != NULL)
@@ -940,16 +944,14 @@ const TCHAR *gg_img_guessfileextension(const char *lpData)
////////////////////////////////////////////////////////////////////////////
// Image Window : Loading picture and sending for display
-
+//
void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName)
{
- GGIMAGEENTRY *dat;
-
if (!szFileName &&
(!e || !e->event.image_reply.size || !e->event.image_reply.image || !e->event.image_reply.filename))
return NULL;
- dat = (GGIMAGEENTRY *)calloc(1, sizeof(GGIMAGEENTRY));
+ GGIMAGEENTRY *dat = (GGIMAGEENTRY *)calloc(1, sizeof(GGIMAGEENTRY));
if (dat == NULL)
return NULL;
@@ -1052,6 +1054,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName)
////////////////////////////////////////////////////////////////////////////
// Image Recv : AddEvent proc
+//
INT_PTR GGPROTO::img_recvimage(WPARAM wParam, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT *)lParam;
@@ -1071,6 +1074,7 @@ INT_PTR GGPROTO::img_recvimage(WPARAM wParam, LPARAM lParam)
////////////////////////////////////////////////////////////////////////////
// Removes dat structure
+//
int gg_img_remove(GGIMAGEDLGDATA *dat)
{
GGIMAGEENTRY *temp = NULL, *img = NULL;
@@ -1102,7 +1106,6 @@ int gg_img_remove(GGIMAGEDLGDATA *dat)
//
GGIMAGEDLGDATA* gg_img_find(GGPROTO *gg, uin_t uin, uint32_t crc32)
{
- int res = 0;
list_t l = gg->imagedlgs;
GGIMAGEDLGDATA *dat;
@@ -1133,11 +1136,11 @@ GGIMAGEDLGDATA* gg_img_find(GGPROTO *gg, uin_t uin, uint32_t crc32)
////////////////////////////////////////////////////////////////////////////
// Image Module : Send on Request
-
+//
BOOL GGPROTO::img_sendonrequest(gg_event* e)
{
GGIMAGEDLGDATA *dat = gg_img_find(this, e->event.image_request.sender, e->event.image_request.crc32);
- if (!this || !dat || !isonline())
+ if (!dat || !isonline())
return FALSE;
char* lpszFileNameA = mir_t2a(dat->lpImages->lpszFileName);
@@ -1153,8 +1156,8 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e)
////////////////////////////////////////////////////////////////////////////
// Send Image : Run (Thread and main)
-
-INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM lParam)
+//
+INT_PTR GGPROTO::img_sendimg(WPARAM hContact, LPARAM)
{
GGIMAGEDLGDATA *dat = NULL;
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp
index ee87d05663..0eda9f87f7 100644
--- a/protocols/Gadu-Gadu/src/import.cpp
+++ b/protocols/Gadu-Gadu/src/import.cpp
@@ -125,7 +125,7 @@ char *strndup(char *str, int c)
void GGPROTO::parsecontacts(char *contacts)
{
- char *p = strchr(contacts, ':'), *n;
+ char *p = strchr(contacts, ':'), *n = NULL;
char *strFirstName, *strLastName, *strNickname, *strNick, *strPhone, *strGroup, *strUin, *strMail;
uin_t uin;
@@ -250,8 +250,8 @@ void GGPROTO::parsecontacts(char *contacts)
//////////////////////////////////////////////////////////
// import from server
-
-INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam)
+//
+INT_PTR GGPROTO::import_server(WPARAM, LPARAM)
{
// Check if connected
if (!isonline())
@@ -289,8 +289,8 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// remove from server
-
-INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam)
+//
+INT_PTR GGPROTO::remove_server(WPARAM, LPARAM)
{
// Check if connected
if (!isonline()) {
@@ -328,7 +328,7 @@ INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam)
+INT_PTR GGPROTO::import_text(WPARAM, LPARAM)
{
TCHAR str[MAX_PATH];
TCHAR filter[512], *pfilter;
@@ -399,7 +399,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam)
}
}
-INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam)
+INT_PTR GGPROTO::export_text(WPARAM, LPARAM)
{
TCHAR str[MAX_PATH];
OPENFILENAME ofn = {0};
@@ -462,8 +462,8 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// export to server
-
-INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam)
+//
+INT_PTR GGPROTO::export_server(WPARAM, LPARAM)
{
// Check if connected
if (!isonline())
@@ -511,7 +511,7 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// Import menus and stuff
-
+//
void GGPROTO::import_init(HGENMENU hRoot)
{
CMenuItem mi;
diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp
index a9a0ff52e1..f55a224cb6 100644
--- a/protocols/Gadu-Gadu/src/keepalive.cpp
+++ b/protocols/Gadu-Gadu/src/keepalive.cpp
@@ -26,7 +26,7 @@
#define MAX_TIMERS 8
GGPROTO *g_timers[MAX_TIMERS] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
-static VOID CALLBACK gg_keepalive(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime)
+static VOID CALLBACK gg_keepalive(HWND, UINT, UINT_PTR idEvent, DWORD)
{
int i;
diff --git a/protocols/Gadu-Gadu/src/links.cpp b/protocols/Gadu-Gadu/src/links.cpp
index e64432a3b1..7033e9749a 100644
--- a/protocols/Gadu-Gadu/src/links.cpp
+++ b/protocols/Gadu-Gadu/src/links.cpp
@@ -36,7 +36,7 @@ static INT_PTR gg_menuchoose(WPARAM wParam, LPARAM lParam)
return 0;
}
-static INT_PTR gg_parselink(WPARAM wParam, LPARAM lParam)
+static INT_PTR gg_parselink(WPARAM, LPARAM lParam)
{
char *arg = (char*)lParam;
uin_t uin;
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp
index 96707513f2..013256f92e 100644
--- a/protocols/Gadu-Gadu/src/ownerinfo.cpp
+++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp
@@ -20,15 +20,15 @@
#include "gg.h"
-//////////////////////////////////////////////////////////
-// remind password
-
typedef struct
{
uin_t uin;
const char *email;
} GG_REMIND_PASS;
+//////////////////////////////////////////////////////////
+// remind password
+//
void __cdecl GGPROTO::remindpasswordthread(void *param)
{
// Connection handle
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp
index daf2d252a6..451b3aac5d 100644
--- a/protocols/Gadu-Gadu/src/popups.cpp
+++ b/protocols/Gadu-Gadu/src/popups.cpp
@@ -30,7 +30,7 @@ struct PopupData
/////////////////////////////////////////////////////////////////////////////////////////
// Popup plugin window proc
-
+//
LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
@@ -69,7 +69,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPar
/////////////////////////////////////////////////////////////////////////////////////////
// Popup plugin class registration
-
+//
void GGPROTO::initpopups()
{
TCHAR szDescr[256];
@@ -102,7 +102,7 @@ void GGPROTO::initpopups()
/////////////////////////////////////////////////////////////////////////////////////////
// Show popup - popup plugin support
-
+//
void CALLBACK sttMainThreadCallback(PVOID dwParam)
{
PopupData* puData = (PopupData*)dwParam;
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp
index 5fa6fb5612..f10e42c2e8 100644
--- a/protocols/Gadu-Gadu/src/services.cpp
+++ b/protocols/Gadu-Gadu/src/services.cpp
@@ -48,7 +48,7 @@ char *gg_status2db(int status, const char *suffix)
//////////////////////////////////////////////////////////
// gets protocol status
-
+//
TCHAR* GGPROTO::getstatusmsg(int status)
{
switch(status) {
@@ -72,7 +72,7 @@ TCHAR* GGPROTO::getstatusmsg(int status)
//////////////////////////////////////////////////////////
// sets specified protocol status
-
+//
int GGPROTO::refreshstatus(int status)
{
if (status == ID_STATUS_OFFLINE)
@@ -127,7 +127,7 @@ int GGPROTO::refreshstatus(int status)
//////////////////////////////////////////////////////////
// normalize gg status
-
+//
int gg_normalizestatus(int status)
{
switch(status) {
@@ -143,7 +143,7 @@ int gg_normalizestatus(int status)
//////////////////////////////////////////////////////////
// gets avatar capabilities
// registered as ProtoService PS_GETAVATARCAPS
-
+//
INT_PTR GGPROTO::getavatarcaps(WPARAM wParam, LPARAM lParam)
{
switch (wParam) {
@@ -168,7 +168,7 @@ INT_PTR GGPROTO::getavatarcaps(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// gets avatar information
// registered as ProtoService PS_GETAVATARINFO
-
+//
INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
{
PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam;
@@ -217,10 +217,12 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
ptrA AvatarTs( getStringA(pai->hContact, GG_KEY_AVATARTS));
if (AvatarURL != NULL && AvatarTs != NULL) {
char *AvatarName = strrchr(AvatarURL, '/');
- AvatarName++;
- char AvatarNameWithTS[128];
- mir_snprintf(AvatarNameWithTS, "%s%s", AvatarName, AvatarTs);
- AvatarHash = gg_avatarhash(AvatarNameWithTS);
+ if (AvatarName)
+ {
+ char AvatarNameWithTS[128];
+ mir_snprintf(AvatarNameWithTS, "%s%s", ++AvatarName, AvatarTs);
+ AvatarHash = gg_avatarhash(AvatarNameWithTS);
+ }
}
ptrA AvatarSavedHash( getStringA(pai->hContact, GG_KEY_AVATARHASH));
@@ -279,7 +281,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// gets avatar
// registered as ProtoService PS_GETMYAVATAR
-
+//
INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam)
{
TCHAR *szFilename = (TCHAR*)wParam;
@@ -309,8 +311,8 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// sets avatar
// registered as ProtoService PS_SETMYAVATAR
-
-INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
+//
+INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam)
{
TCHAR *szFilename = (TCHAR*)lParam;
@@ -347,7 +349,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// gets protocol status message
// registered as ProtoService PS_GETMYAWAYMSG
-
+//
INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam)
{
INT_PTR res = 0;
@@ -360,13 +362,13 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam)
return res;
}
+extern INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
//////////////////////////////////////////////////////////
// gets account manager GUI
// registered as ProtoService PS_CREATEACCMGRUI
-
-extern INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-INT_PTR GGPROTO::get_acc_mgr_gui(WPARAM wParam, LPARAM lParam)
+//
+INT_PTR GGPROTO::get_acc_mgr_gui(WPARAM, LPARAM lParam)
{
return (INT_PTR) CreateDialogParam(hInstance, MAKEINTRESOURCE(IDD_ACCMGRUI), (HWND)lParam, gg_acc_mgr_guidlgproc, (LPARAM)this);
}
@@ -374,8 +376,8 @@ INT_PTR GGPROTO::get_acc_mgr_gui(WPARAM wParam, LPARAM lParam)
//////////////////////////////////////////////////////////
// leaves (terminates) conference
// registered as ProtoService PS_LEAVECHAT
-
-INT_PTR GGPROTO::leavechat(WPARAM hContact, LPARAM lParam)
+//
+INT_PTR GGPROTO::leavechat(WPARAM hContact, LPARAM)
{
if (hContact)
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp
index 49a84ea229..6ef0fafce7 100644
--- a/protocols/Gadu-Gadu/src/sessions.cpp
+++ b/protocols/Gadu-Gadu/src/sessions.cpp
@@ -107,7 +107,7 @@ static void gg_listsessions(GGPROTO* gg, HWND hwndDlg)
EnableWindow(GetDlgItem(hwndDlg, IDC_SIGNOUTALL), ListView_GetItemCount(hList) > 0);
}
-static int sttSessionsDlgResizer(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL* urc)
+static int sttSessionsDlgResizer(HWND, LPARAM, UTILRESIZECONTROL* urc)
{
switch (urc->wId)
{
@@ -390,7 +390,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w
return FALSE;
}
-INT_PTR GGPROTO::sessions_view(WPARAM wParam, LPARAM lParam)
+INT_PTR GGPROTO::sessions_view(WPARAM, LPARAM)
{
if (hwndSessionsDlg && IsWindow(hwndSessionsDlg)) {
ShowWindow(hwndSessionsDlg, SW_SHOWNORMAL);
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp
index 6404884486..0a76e2e3ae 100644
--- a/protocols/Gadu-Gadu/src/token.cpp
+++ b/protocols/Gadu-Gadu/src/token.cpp
@@ -104,6 +104,7 @@ INT_PTR CALLBACK gg_tokendlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
////////////////////////////////////////////////////////////////////////////////
// Gets GG token
+//
int GGPROTO::gettoken(GGTOKEN *token)
{
// Zero tokens
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp
index e1be7a0bfe..e513112247 100644
--- a/protocols/Gadu-Gadu/src/userutils.cpp
+++ b/protocols/Gadu-Gadu/src/userutils.cpp
@@ -22,7 +22,7 @@
////////////////////////////////////////////////////////////////////////////////
// Create New Account : Proc
-
+//
void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail)
{
// Connection handles
@@ -67,11 +67,12 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail)
////////////////////////////////////////////////////////////////////////////////
// Remove Account : Proc
+//
void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password)
{
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s;
+ struct gg_pubdir *s = NULL;
GGTOKEN token;
#ifdef DEBUGMODE
@@ -109,14 +110,14 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password)
////////////////////////////////////////////////////////////////////////////////
// Change Password Page : Proc
-
+//
void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass)
{
// Readup email
char email[255] = "\0"; DBVARIANT dbv_email;
// Connection handles
struct gg_http *h;
- struct gg_pubdir *s;
+ struct gg_pubdir *s = NULL;
GGTOKEN token;
#ifdef DEBUGMODE
@@ -160,7 +161,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass)
////////////////////////////////////////////////////////////////////////////////
// Change E-mail Page : Proc
-
+//
void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *newEmail)
{
#ifdef DEBUGMODE
@@ -174,7 +175,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne
return NULL;
// Connection handles
- struct gg_pubdir *s;
+ struct gg_pubdir *s = NULL;
struct gg_http *h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0);
if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
@@ -201,6 +202,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne
////////////////////////////////////////////////////////////////////////////////
// User Util Dlg Page : Data
+//
INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGUSERUTILDLGDATA *dat = (GGUSERUTILDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
@@ -246,10 +248,18 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
if (!dat) break;
switch (dat->mode)
{
- case GG_USERUTIL_CREATE: gg_doregister(dat->gg, pass, email); break;
- case GG_USERUTIL_REMOVE: gg_dounregister(dat->gg, dat->uin, pass); break;
- case GG_USERUTIL_PASS: gg_dochpass(dat->gg, dat->uin, dat->pass, pass); break;
- case GG_USERUTIL_EMAIL: gg_dochemail(dat->gg, dat->uin, dat->pass, dat->email, email); break;
+ case GG_USERUTIL_CREATE:
+ gg_doregister(dat->gg, pass, email);
+ break;
+ case GG_USERUTIL_REMOVE:
+ gg_dounregister(dat->gg, dat->uin, pass);
+ break;
+ case GG_USERUTIL_PASS:
+ gg_dochpass(dat->gg, dat->uin, dat->pass, pass);
+ break;
+ case GG_USERUTIL_EMAIL:
+ gg_dochemail(dat->gg, dat->uin, dat->pass, dat->email, email);
+ break;
}
break;
}
@@ -269,7 +279,7 @@ INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
//////////////////////////////////////////////////////////
// Wait for thread to stop
-
+//
void GGPROTO::threadwait(GGTHREAD *thread)
{
if (!thread->hThread) return;