summaryrefslogtreecommitdiff
path: root/protocols/Xfire
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-02-23 11:27:13 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-02-23 11:27:13 +0000
commit465f5035c1059262b8e0b938b971f0a26015ca36 (patch)
tree0afd134d261311c96f629547c2a1348e8e905a65 /protocols/Xfire
parent3350965c81488d6019936b3d6bf3b96decaf6709 (diff)
XFire: Minor fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Xfire')
-rw-r--r--protocols/Xfire/src/Xfire_avatar_loader.cpp6
-rw-r--r--protocols/Xfire/src/Xfire_game.cpp4
-rw-r--r--protocols/Xfire/src/Xfire_voicechat.cpp11
-rw-r--r--protocols/Xfire/src/all_statusmsg.cpp2
-rw-r--r--protocols/Xfire/src/main.cpp26
-rw-r--r--protocols/Xfire/src/options.cpp2
-rw-r--r--protocols/Xfire/src/tools.cpp8
-rw-r--r--protocols/Xfire/src/userdetails.cpp12
-rw-r--r--protocols/Xfire/src/variables.cpp4
-rw-r--r--protocols/Xfire/src/variablevalue.cpp3
10 files changed, 40 insertions, 38 deletions
diff --git a/protocols/Xfire/src/Xfire_avatar_loader.cpp b/protocols/Xfire/src/Xfire_avatar_loader.cpp
index 44f69dce4b..c28e989b8a 100644
--- a/protocols/Xfire/src/Xfire_avatar_loader.cpp
+++ b/protocols/Xfire/src/Xfire_avatar_loader.cpp
@@ -17,8 +17,8 @@ Xfire_avatar_loader::~Xfire_avatar_loader() {
DeleteCriticalSection(&this->avatarMutex);
}
-void Xfire_avatar_loader::loadThread(LPVOID lparam) {
- Xfire_avatar_loader *loader = (Xfire_avatar_loader*)lparam;
+void Xfire_avatar_loader::loadThread(voud *arg) {
+ Xfire_avatar_loader *loader = (Xfire_avatar_loader*)arg;
//kein loader, dann abbruch
if (!loader)
@@ -75,7 +75,7 @@ BOOL Xfire_avatar_loader::loadAvatar(MCONTACT hcontact, char*username, unsigned
this->list.push_back(process);
if (!threadrunning && client != NULL) {
- mir_forkthread(Xfire_avatar_loader::loadThread, (LPVOID)this);
+ mir_forkthread(Xfire_avatar_loader::loadThread, this);
}
return TRUE;
diff --git a/protocols/Xfire/src/Xfire_game.cpp b/protocols/Xfire/src/Xfire_game.cpp
index 0a0657e72d..12acb76b07 100644
--- a/protocols/Xfire/src/Xfire_game.cpp
+++ b/protocols/Xfire/src/Xfire_game.cpp
@@ -192,11 +192,11 @@ BOOL Xfire_game::checkpath(PROCESSENTRY32* processInfo)
TCHAR fpath[MAX_PATH] = _T("");
//lese den pfad des spiels aus
- GetModuleFileNameEx(op, NULL, fpath, sizeof(fpath));
+ GetModuleFileNameEx(op, NULL, fpath, SIZEOF(fpath));
//8.3 pfade umwandeln, nur wenn sich eine tilde im string befindet
if (_tcschr(fpath, '~'))
- GetLongPathName(fpath, fpath, sizeof(fpath));
+ GetLongPathName(fpath, fpath, SIZEOF(fpath));
//alles in kelinbuchstaben umwandeln
this->strtolowerT(fpath);
diff --git a/protocols/Xfire/src/Xfire_voicechat.cpp b/protocols/Xfire/src/Xfire_voicechat.cpp
index 1d970d05ce..878ffc951c 100644
--- a/protocols/Xfire/src/Xfire_voicechat.cpp
+++ b/protocols/Xfire/src/Xfire_voicechat.cpp
@@ -197,11 +197,11 @@ HMODULE Xfire_voicechat::loadTSR(char* path, BOOL nolocaltest) {
//deutsches sys?
tsrDLL = LoadLibrary(_T("C:\\Programme\\Teamspeak2_RC2\\client_sdk\\TSRemote.dll"));
- if (!tsrDLL)
+ if (!tsrDLL) {
XFireLog("TSRemote.dll load failed (using standard installationpath2)!");
-
- //aufgeben
- return NULL;
+ //aufgeben
+ return NULL;
+ }
}
}
@@ -238,6 +238,9 @@ BOOL Xfire_voicechat::checkforTS3(SendGameStatus2Packet* packet) {
if (ipport->port == 0) {
//packet resetten
resetSendGameStatus2Packet(packet);
+ //unmap, handle schließem
+ UnmapViewOfFile(ipport);
+ CloseHandle(hMapObject);
//in db schreiben
writeToDatabase(packet);
return TRUE;
diff --git a/protocols/Xfire/src/all_statusmsg.cpp b/protocols/Xfire/src/all_statusmsg.cpp
index 46ec481c85..d08db0920f 100644
--- a/protocols/Xfire/src/all_statusmsg.cpp
+++ b/protocols/Xfire/src/all_statusmsg.cpp
@@ -198,7 +198,7 @@ BOOL SetGameStatusMsg()
if (statusMsg == NULL)
return FALSE;
- char *statusmsg;
+ char *statusmsg = NULL;
//statusmsg rein
xgamelist.setString(statusMsg, &statusmsg);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 16e6a8621c..f3e4af5b70 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1107,9 +1107,9 @@ extern "C" __declspec(dllexport) int Load(void)
CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)CurProfileF);
int i;
- for (i = MAX_PATH; 5; i--){
+ for (i = MAX_PATH-1; i > 5; i--){
if (CurProfileF[i] == 't' && CurProfileF[i - 3] == '.'){
- i = i - 3;
+ i -= 3;
break;
}
}
@@ -1745,28 +1745,28 @@ void CList_MakeAllOffline()
CallService(MS_DB_CONTACT_DELETE, (WPARAM)fhandles.at(i), 0);
}
-void SetAvatar2(LPVOID lparam) {
+void SetAvatar2(void *arg) {
static int lasttime = 0;
int sleep = db_get_w(NULL, protocolname, "avatarloadlatency", 1000);
lasttime += sleep;
+ GetBuddyInfo *buddyinfo = (GetBuddyInfo*)arg;
if (mySleep(lasttime, hConnectionClose))
{
- delete lparam;
+ delete buddyinfo;
lasttime -= sleep;
return;
}
- GetBuddyInfo* buddyinfo = (GetBuddyInfo*)lparam;
if (myClient != NULL)
if (myClient->client->connected)
myClient->client->send(buddyinfo);
- delete lparam;
+ delete buddyinfo;
lasttime -= sleep;
}
-void SetAvatar(LPVOID lparam)
+void SetAvatar(void *arg)
//void SetAvatar(MCONTACT hContact, char* username)
{
//EnterCriticalSection(&avatarMutex);
@@ -1777,11 +1777,13 @@ void SetAvatar(LPVOID lparam)
if (bpStatus == ID_STATUS_OFFLINE)
return;
+
+ XFire_SetAvatar* xsa = (XFire_SetAvatar*)arg;
lasttime += sleep;
//Sleep(lasttime);
if (mySleep(lasttime, hConnectionClose))
{
- delete lparam;
+ delete xsa;
lasttime -= sleep;
return;
}
@@ -1791,8 +1793,6 @@ void SetAvatar(LPVOID lparam)
XFireAvatar av;
- XFire_SetAvatar* xsa = (XFire_SetAvatar*)lparam;
-
if (xsa->hContact == NULL)
return;
@@ -2847,7 +2847,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc
GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->port;
gsqq.xfiregameid = entry->game;
- strcpy(gsqq.ip, temp);
+ strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
}
@@ -3048,7 +3048,7 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) {
if (myClient != NULL)
if (myClient->client->connected)
{
- mir_strncpy(buf, (const char *)lParam, 50);
+ mir_strncpy(buf, (const char *)lParam, 49);
mir_forkthread(AckBasicSearch, &buf);
return 1;
}
@@ -3063,7 +3063,7 @@ INT_PTR SearchAddtoList(WPARAM wParam, LPARAM lParam)
{
PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (psr->cbSize != sizeof(PROTOSEARCHRESULT))
+ if (!psr || psr->cbSize != sizeof(PROTOSEARCHRESULT))
return 0;
if ((int)wParam == 0)
diff --git a/protocols/Xfire/src/options.cpp b/protocols/Xfire/src/options.cpp
index 8bfed132e0..d25224d503 100644
--- a/protocols/Xfire/src/options.cpp
+++ b/protocols/Xfire/src/options.cpp
@@ -960,7 +960,7 @@ static INT_PTR CALLBACK DlgProcOpts6(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
//textbuffer löschen
if (text != NULL)
{
- delete text;
+ delete[] text;
text = NULL;
}
//id des spielsbekommen
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp
index 5c42c159b1..791b1d2be8 100644
--- a/protocols/Xfire/src/tools.cpp
+++ b/protocols/Xfire/src/tools.cpp
@@ -74,7 +74,7 @@ BOOL str_replace(char*src, char*find, char*rep)
strcat(temp, (src + pos + strlen(find)));
strcpy(src, temp);
- delete temp;
+ delete[] temp;
return TRUE;
}
@@ -350,10 +350,9 @@ BOOL GetServerIPPort(DWORD pid, char*localaddrr, unsigned long localaddr, char*i
}
DWORD size = 0;
- MIB_UDPTABLE_OWNER_PID *ptab;
GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
+ MIB_UDPTABLE_OWNER_PID *ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
if (ptab == NULL)
return FALSE;
int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
@@ -561,10 +560,9 @@ BOOL GetServerIPPort2(DWORD pid, char*localaddrr, unsigned long localaddr, char*
}
DWORD size = 0;
- MIB_UDPTABLE_OWNER_PID *ptab;
GetExtendedUdpTable(NULL, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
- ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
+ MIB_UDPTABLE_OWNER_PID *ptab = (MIB_UDPTABLE_OWNER_PID*)malloc(size);
if (ptab == NULL)
return FALSE;
int ret = GetExtendedUdpTable(ptab, &size, FALSE, AF_INET, UDP_TABLE_OWNER_PID, 0);
diff --git a/protocols/Xfire/src/userdetails.cpp b/protocols/Xfire/src/userdetails.cpp
index bd0957ac42..0279678928 100644
--- a/protocols/Xfire/src/userdetails.cpp
+++ b/protocols/Xfire/src/userdetails.cpp
@@ -38,16 +38,16 @@ extern Xfire_gamelist xgamelist;
//als funktion, damit es per thread geladen werden kann
-void LoadProfilStatus(LPVOID lparam) {
- if (!lparam || !ghwndDlg)
+void LoadProfilStatus(void *arg) {
+ char *fname = (char*) arg;
+ if (!fname || !ghwndDlg)
return;
//dl
- char url[255] = "http://miniprofile.xfire.com/bg/sh/type/1/";
+ char url[255];
+ mir_snprintf(url, SIZEOF(url),"http://miniprofile.xfire.com/bg/sh/type/1/%s.png",fname);
char* buf = NULL;
unsigned int size = 0;
- strcat_s(url, 255, (char*)lparam);
- strcat_s(url, 255, ".png");
//versuche das icon aus dem inet zulasen
if (GetWWWContent2(url, NULL, FALSE, &buf, &size))
@@ -58,7 +58,7 @@ void LoadProfilStatus(LPVOID lparam) {
delete[] buf;
SendDlgItemMessage(ghwndDlg, IDC_PROFILIMG, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbitmap);
}
- delete[] lparam;
+ delete[] fname;
}
void SetItemTxt(HWND hwndDlg, int feldid, char*feld, MCONTACT hcontact, int type)
diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp
index 1dd8d5ffac..eff15227c4 100644
--- a/protocols/Xfire/src/variables.cpp
+++ b/protocols/Xfire/src/variables.cpp
@@ -194,9 +194,9 @@ char* XFireGetFoldersPath(char * pathtype)
strcat(BaseFolder, "\\");
CallService(MS_DB_GETPROFILENAME, (WPARAM)MAX_PATH, (LPARAM)CurProfileF);
int i;
- for (i = MAX_PATH; 5; i--){
+ for (i = MAX_PATH - 1; i > 5; i--){
if (CurProfileF[i] == 't' && CurProfileF[i - 3] == '.'){
- i = i - 3;
+ i -= 3;
break;
}
}
diff --git a/protocols/Xfire/src/variablevalue.cpp b/protocols/Xfire/src/variablevalue.cpp
index 6e61aab07d..0de417cffd 100644
--- a/protocols/Xfire/src/variablevalue.cpp
+++ b/protocols/Xfire/src/variablevalue.cpp
@@ -49,7 +49,7 @@ using namespace std;
}
void VariableValue::setValue( char * value) {
- if (this->value) delete[] value;
+ if (this->value) delete[] this->value;
this->value = value;
}
void VariableValue::setValue( std::string value ) {
@@ -105,6 +105,7 @@ using namespace std;
memcpy(namestr,packet+index+read,nameLength);
name = string(namestr);
read+=nameLength;
+ delete[] namestr;
return read;
}