summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/IcqOscarJ/src/icq_packet.cpp4
-rw-r--r--protocols/JabberG/src/jabber_form.cpp43
-rw-r--r--protocols/Xfire/src/clanbuddylistnamespacket.cpp12
-rw-r--r--protocols/Xfire/src/friendsoffriendlist.cpp4
-rw-r--r--src/core/stdmsg/src/msglog.cpp7
-rw-r--r--src/modules/netlib/netlibopenconn.cpp14
6 files changed, 40 insertions, 44 deletions
diff --git a/protocols/IcqOscarJ/src/icq_packet.cpp b/protocols/IcqOscarJ/src/icq_packet.cpp
index 0211b9528a..3bb6d024ed 100644
--- a/protocols/IcqOscarJ/src/icq_packet.cpp
+++ b/protocols/IcqOscarJ/src/icq_packet.cpp
@@ -634,6 +634,7 @@ void ppackTLVBlockItem(PBYTE *buf, size_t *buflen, WORD wType, PBYTE *pItem, WOR
packWord(*buf + *buflen + 6, *wLength);
memcpy(*buf + *buflen + 8, *pItem, *wLength);
*buflen += 8 + *wLength;
+ *wLength = 0;
}
else {
*buf = (PBYTE)SAFE_REALLOC(*buf, 6 + *buflen);
@@ -644,7 +645,6 @@ void ppackTLVBlockItem(PBYTE *buf, size_t *buflen, WORD wType, PBYTE *pItem, WOR
}
SAFE_FREE((void**)pItem);
- *wLength = 0;
}
@@ -653,7 +653,7 @@ void __fastcall unpackByte(BYTE **pSource, BYTE *byDestination)
if (byDestination)
*byDestination = *(*pSource)++;
else
- *pSource += 1;
+ (*pSource)++;
}
void __fastcall unpackWord(BYTE **pSource, WORD *wDestination)
diff --git a/protocols/JabberG/src/jabber_form.cpp b/protocols/JabberG/src/jabber_form.cpp
index 7afa2152b4..45a71c3210 100644
--- a/protocols/JabberG/src/jabber_form.cpp
+++ b/protocols/JabberG/src/jabber_form.cpp
@@ -718,25 +718,23 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
switch (msg) {
case WM_INITDIALOG:
- {
- HXML n;
- LONG frameExStyle;
-
// lParam is (JABBER_FORM_INFO *)
TranslateDialogDefault(hwndDlg);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME_TEXT), SW_HIDE);
jfi = (JABBER_FORM_INFO*)lParam;
if (jfi != NULL) {
+ HXML n;
+ LONG frameExStyle;
// Set dialog title
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "title")) != NULL && xmlGetText(n) != NULL)
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , _T("title"))) != NULL && xmlGetText(n) != NULL)
SetWindowText(hwndDlg, xmlGetText(n));
else if (jfi->defTitle != NULL)
SetWindowText(hwndDlg, TranslateTS(jfi->defTitle));
// Set instruction field
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , "instructions")) != NULL && xmlGetText(n) != NULL)
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode , _T("instructions"))) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
else {
- if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, "title")) != NULL && xmlGetText(n) != NULL)
+ if (jfi->xNode != NULL && (n = xmlGetChild(jfi->xNode, _T("title"))) != NULL && xmlGetText(n) != NULL)
JabberFormSetInstruction(hwndDlg, xmlGetText(n));
else if (jfi->defTitle != NULL)
JabberFormSetInstruction(hwndDlg, TranslateTS(jfi->defTitle));
@@ -752,26 +750,23 @@ static INT_PTR CALLBACK JabberFormDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
jfi->frameHeight = rect.bottom - rect.top;
JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), jfi->xNode, &(jfi->formHeight));
}
- }
-
- if (jfi->formHeight > jfi->frameHeight) {
- HWND hwndScroll;
- hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL);
- EnableWindow(hwndScroll, TRUE);
- SetScrollRange(hwndScroll, SB_CTL, 0, jfi->formHeight - jfi->frameHeight, FALSE);
- jfi->curPos = 0;
- }
+ if (jfi->formHeight > jfi->frameHeight) {
+ HWND hwndScroll = GetDlgItem(hwndDlg, IDC_VSCROLL);
+ EnableWindow(hwndScroll, TRUE);
+ SetScrollRange(hwndScroll, SB_CTL, 0, jfi->formHeight - jfi->frameHeight, FALSE);
+ jfi->curPos = 0;
+ }
- // Enable WS_EX_CONTROLPARENT on IDC_FRAME (so tab stop goes through all its children)
- frameExStyle = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE);
- frameExStyle |= WS_EX_CONTROLPARENT;
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
+ // Enable WS_EX_CONTROLPARENT on IDC_FRAME (so tab stop goes through all its children)
+ frameExStyle = GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE);
+ frameExStyle |= WS_EX_CONTROLPARENT;
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FRAME), GWL_EXSTYLE, frameExStyle);
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) jfi);
- if (jfi->pfnSubmit != NULL)
- EnableWindow(GetDlgItem(hwndDlg, IDC_SUBMIT), TRUE);
- }
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) jfi);
+ if (jfi->pfnSubmit != NULL)
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SUBMIT), TRUE);
+ }
return TRUE;
case WM_CTLCOLORSTATIC:
diff --git a/protocols/Xfire/src/clanbuddylistnamespacket.cpp b/protocols/Xfire/src/clanbuddylistnamespacket.cpp
index 2a1b4c77a6..76269a01cf 100644
--- a/protocols/Xfire/src/clanbuddylistnamespacket.cpp
+++ b/protocols/Xfire/src/clanbuddylistnamespacket.cpp
@@ -51,7 +51,7 @@ namespace xfirelib {
VariableValue friends;
- XDEBUG2( "Len: %ld\n", length );
+ XDEBUG2( "Len: %d\n", length );
index+=2; //paar bytes überspringen
@@ -66,7 +66,7 @@ namespace xfirelib {
int numberOfIds = friends.getValueAsLong();
- XDEBUG2( "numberofId: %ld\n", numberOfIds );
+ XDEBUG2( "numberofId: %d\n", numberOfIds );
for(int i = 0 ; i < numberOfIds ; i++) {
index += friends.readValue(buf,index,4);
@@ -74,13 +74,13 @@ namespace xfirelib {
XDEBUG3( "UserID: %ld %ld\n",i+1, friends.getValueAsLong() );
}
- XDEBUG2( "NextByte: %ld\n",buf[index] );
- XDEBUG2( "NextByte: %ld\n",buf[index+1] );
+ XDEBUG2( "NextByte: %c\n",buf[index] );
+ XDEBUG2( "NextByte: %c\n",buf[index+1] );
index+=3; //nächsten 3 skippen
- XDEBUG2( "NextByte: %ld\n",buf[index] );
- XDEBUG2( "NextByte: %ld\n",buf[index+1] );
+ XDEBUG2( "NextByte: %c\n",buf[index] );
+ XDEBUG2( "NextByte: %c\n",buf[index+1] );
usernames = new vector<string>;
index = readStrings(usernames,buf,index);
diff --git a/protocols/Xfire/src/friendsoffriendlist.cpp b/protocols/Xfire/src/friendsoffriendlist.cpp
index bb2c4f884f..c2c5fa5c70 100644
--- a/protocols/Xfire/src/friendsoffriendlist.cpp
+++ b/protocols/Xfire/src/friendsoffriendlist.cpp
@@ -50,12 +50,12 @@ namespace xfirelib {
VariableValue friends;
- XDEBUG2( "Len: %ld\n", length );
+ XDEBUG2( "Len: %d\n", length );
index+=8; //paar bytes überspringen
int numberOfIds = (unsigned char)buf[index];
- XDEBUG2( "numberofId: %ld\n", numberOfIds );
+ XDEBUG2( "numberofId: %d\n", numberOfIds );
index++;
index++;//ignore 00
sids = new vector<char *>;
diff --git a/src/core/stdmsg/src/msglog.cpp b/src/core/stdmsg/src/msglog.cpp
index ef6c288bbf..730d0610d1 100644
--- a/src/core/stdmsg/src/msglog.cpp
+++ b/src/core/stdmsg/src/msglog.cpp
@@ -301,17 +301,20 @@ static char *CreateRTFFromDbEvent(SrmmWindowData *dat, MCONTACT hContact, HANDLE
}
if (!(g_dat.flags & SMF_HIDENAMES) && dbei.eventType != EVENTTYPE_JABBER_CHATSTATES && dbei.eventType != EVENTTYPE_JABBER_PRESENCE) {
- TCHAR* szName;
+ TCHAR *szName;
CONTACTINFO ci = { 0 };
if (dbei.flags & DBEF_SENT) {
ci.cbSize = sizeof(ci);
ci.szProto = dbei.szModule;
ci.dwFlag = CNF_DISPLAY | CNF_TCHAR;
- if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)& ci)) {
+ if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
// CNF_DISPLAY always returns a string type
szName = ci.pszVal;
}
+ else
+ // Shouldn't happen?
+ szName = TranslateT("Me");
}
else szName = pcli->pfnGetContactDisplayName(hContact, 0);
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 6286c5c783..9a7ef89155 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -113,7 +113,7 @@ bool RecvUntilTimeout(NetlibConnection *nlc, char *buf, int len, int flags, DWOR
static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
// http://www.socks.nec.com/protocol/socks4.protocol and http://www.socks.nec.com/protocol/socks4a.protocol
- if (!nloc->szHost || !nloc->szHost[0]) return 0;
+ if (!nloc || !nloc->szHost || !nloc->szHost[0]) return 0;
size_t nHostLen = strlen(nloc->szHost) + 1;
size_t nUserLen = nlu->settings.szProxyAuthUser ? strlen(nlu->settings.szProxyAuthUser) + 1 : 1;
@@ -208,7 +208,6 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
}
}
- PBYTE pInit;
size_t nHostLen;
DWORD hostIP;
@@ -222,7 +221,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
return 0;
nHostLen = 4;
}
- pInit = (PBYTE)mir_alloc(6 + nHostLen);
+ PBYTE pInit = (PBYTE)mir_alloc(6 + nHostLen);
pInit[0] = 5; //SOCKS5
pInit[1] = nloc->flags & NLOCF_UDP ? 3 : 1; //connect or UDP
pInit[2] = 0; //reserved
@@ -296,7 +295,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE
static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENCONNECTION *nloc)
{
//rfc2817
- NETLIBHTTPREQUEST nlhrSend = { 0 }, *nlhrReply;
+ NETLIBHTTPREQUEST nlhrSend = { 0 };
char szUrl[512];
nlhrSend.cbSize = sizeof(nlhrSend);
@@ -318,7 +317,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc, NetlibUser *nlu, NE
return 0;
}
- nlhrReply = NetlibHttpRecv(nlc, MSG_DUMPPROXY | MSG_RAW, MSG_DUMPPROXY | MSG_RAW, true);
+ NETLIBHTTPREQUEST *nlhrReply = NetlibHttpRecv(nlc, MSG_DUMPPROXY | MSG_RAW, MSG_DUMPPROXY | MSG_RAW, true);
nlc->usingHttpGateway = false;
if (nlhrReply == NULL)
return false;
@@ -357,16 +356,15 @@ static void FreePartiallyInitedConnection(NetlibConnection *nlc)
SetLastError(dwOriginalLastError);
}
-static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc)
+static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc)
{
int rc = 0, retrycnt = 0;
u_long notblocking = 1;
DWORD lasterr = 0;
static const TIMEVAL tv = { 1, 0 };
- unsigned int dwTimeout = (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2) ? nloc->timeout : 0;
// if dwTimeout is zero then its an old style connection or new with a 0 timeout, select() will error quicker anyway
- if (dwTimeout == 0) dwTimeout = 30;
+ unsigned int dwTimeout = (nloc && (nloc->cbSize == sizeof(NETLIBOPENCONNECTION)) && (nloc->flags & NLOCF_V2) && (nloc->timeout>0)) ? nloc->timeout : 30;
// this is for XP SP2 where there is a default connection attempt limit of 10/second
if (connectionTimeout) {