From d6eee2018898f2442883a0aa77ad095b75572cfb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 27 Aug 2015 15:15:33 +0000 Subject: fix for 64-bit issues & warnings git-svn-id: http://svn.miranda-ng.org/main/trunk@15043 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/core.cpp | 6 +- protocols/Gadu-Gadu/src/filetransfer.cpp | 36 ++--- protocols/Gadu-Gadu/src/gg_proto.cpp | 241 ++++++++++++++----------------- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/libgadu/http.cpp | 2 +- 5 files changed, 129 insertions(+), 158 deletions(-) (limited to 'protocols/Gadu-Gadu/src') diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index f5558e99ad..014beec412 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -1063,7 +1063,7 @@ retry: pre.descr.t = filenameT; pre.files.t = &filenameT; pre.lParam = (LPARAM)dcc7; - ProtoChainRecvFile((MCONTACT)dcc7->contact, &pre); + ProtoChainRecvFile((UINT_PTR)dcc7->contact, &pre); mir_free(filenameT); e->event.dcc7_new = NULL; @@ -1077,7 +1077,7 @@ retry: if (dcc7->type == GG_SESSION_DCC7_SEND) { debugLogA("mainthread() (%x): File transfer denied by client %d (reason = %d).", this, dcc7->peer_uin, e->event.dcc7_reject.reason); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Remove from watches and free gg_EnterCriticalSection(&ft_mutex, "mainthread", 21, "ft_mutex", 1); @@ -1138,7 +1138,7 @@ retry: } if (dcc7->contact) - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free dcc gg_dcc7_free(dcc7); diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 7034f31036..dfa99bcffe 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -272,7 +272,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc->contact; + pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -285,7 +285,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 3, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -302,7 +302,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc->file_info.filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc->contact; + pfts.hContact = (UINT_PTR)local_dcc->contact; pfts.flags = (local_dcc->type == GG_SESSION_DCC_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -315,11 +315,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc->file_info.size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 4, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 5, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -359,7 +359,7 @@ void __cdecl GGPROTO::dccmainthread(void*) { _close(local_dcc->file_fd); local_dcc->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 6, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -391,7 +391,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pre.lParam = (LPARAM)local_dcc; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 7, "ft_mutex", 1); - ProtoChainRecvFile((MCONTACT)local_dcc->contact, &pre); + ProtoChainRecvFile((UINT_PTR)local_dcc->contact, &pre); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); mir_free(filenameT); @@ -500,7 +500,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc7->contact; + pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -513,7 +513,7 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->offset; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 9, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } break; @@ -530,7 +530,7 @@ void __cdecl GGPROTO::dccmainthread(void*) mir_snprintf(szFilename, _countof(szFilename), "%s%s", local_dcc->folder, local_dcc7->filename); memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS)); pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS); - pfts.hContact = (MCONTACT)local_dcc7->contact; + pfts.hContact = (UINT_PTR)local_dcc7->contact; pfts.flags = (local_dcc7->type == GG_SESSION_DCC7_SEND); pfts.pszFiles = NULL; pfts.totalFiles = 1; @@ -543,11 +543,11 @@ void __cdecl GGPROTO::dccmainthread(void*) pfts.currentFileProgress = local_dcc7->size; pfts.currentFileTime = 0; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 10, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_DATA, local_dcc7, (LPARAM)&pfts); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); _close(local_dcc7->file_fd); local_dcc7->file_fd = -1; gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 11, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_SUCCESS, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc @@ -591,7 +591,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->contact) { gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 12, "ft_mutex", 1); - ProtoBroadcastAck((MCONTACT)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); + ProtoBroadcastAck((UINT_PTR)local_dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, local_dcc7, 0); gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } @@ -679,7 +679,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const TCHAR* szPath) TCHAR error[512]; mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); - ProtoBroadcastAck((MCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Free transfer gg_free_dcc(dcc); return 0; @@ -715,7 +715,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) if (iFtRemoveRes == -1) { debugLogA("dcc7fileallow(): File transfer denied."); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -729,7 +729,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const TCHAR* szPath) mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath); showpopup(m_tszUserName, error, GG_POPUP_ERROR); gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER); - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Free transfer gg_dcc7_free(dcc7); return 0; @@ -800,7 +800,7 @@ int GGPROTO::dccfilecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dccfilecancel", 44, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck((MCONTACT)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); + ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); // Close file if (dcc->file_fd != -1) { @@ -830,7 +830,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) gg_LeaveCriticalSection(&ft_mutex, "dcc7filecancel", 45, 1, "ft_mutex", 1); // Send failed info - ProtoBroadcastAck((MCONTACT)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); + ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0); // Close file if (dcc7->file_fd != -1) { diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index d77fb87d72..855542a409 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -21,7 +21,7 @@ #include "gg.h" -GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : +GGPROTO::GGPROTO(const char *pszProtoName, const TCHAR *tszUserName) : PROTO(pszProtoName, tszUserName), avatar_requests(1, NumericKeySortT), avatar_transfers(1, NumericKeySortT) @@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED); TCHAR szPath[MAX_PATH]; - mir_sntprintf(szPath, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST( _T("%miranda_userdata%")), m_tszUserName); + mir_sntprintf(szPath, _T("%s\\%s\\ImageCache"), (TCHAR*)VARST(_T("%miranda_userdata%")), m_tszUserName); hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName); DWORD dwVersion; @@ -142,22 +142,22 @@ MCONTACT GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *pmsr) DWORD_PTR GGPROTO::GetCaps(int type, MCONTACT hContact) { switch (type) { - case PFLAGNUM_1: - return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_EXTSEARCHUI | PF1_SEARCHBYNAME | - PF1_MODEMSG | PF1_NUMERICUSERID | PF1_VISLIST | PF1_FILE; - case PFLAGNUM_2: - return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE | - PF2_LONGAWAY; - case PFLAGNUM_3: - return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE; - case PFLAGNUM_4: - return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE; - case PFLAGNUM_5: - return PF2_LONGAWAY; - case PFLAG_UNIQUEIDTEXT: - return (DWORD_PTR) Translate("Gadu-Gadu Number"); - case PFLAG_UNIQUEIDSETTING: - return (DWORD_PTR) GG_KEY_UIN; + case PFLAGNUM_1: + return PF1_IM | PF1_BASICSEARCH | PF1_EXTSEARCH | PF1_EXTSEARCHUI | PF1_SEARCHBYNAME | + PF1_MODEMSG | PF1_NUMERICUSERID | PF1_VISLIST | PF1_FILE; + case PFLAGNUM_2: + return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE | + PF2_LONGAWAY; + case PFLAGNUM_3: + return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_FREECHAT | PF2_INVISIBLE; + case PFLAGNUM_4: + return PF4_NOCUSTOMAUTH | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE; + case PFLAGNUM_5: + return PF2_LONGAWAY; + case PFLAG_UNIQUEIDTEXT: + return (DWORD_PTR)Translate("Gadu-Gadu Number"); + case PFLAG_UNIQUEIDSETTING: + return (DWORD_PTR)GG_KEY_UIN; } return 0; } @@ -169,7 +169,7 @@ void __cdecl GGPROTO::cmdgetinfothread(void *hContact) { debugLogA("cmdgetinfothread(): started. Failed info retreival."); gg_sleep(100, FALSE, "cmdgetinfothread", 103, 1); - ProtoBroadcastAck((MCONTACT)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); + ProtoBroadcastAck((UINT_PTR)hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE)1, 0); debugLogA("cmdgetinfothread(): end."); } @@ -178,13 +178,11 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_t req; // Custom contact info - if (hContact) - { - if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) - { -#ifdef DEBUGMODE + if (hContact) { + if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) { + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -194,15 +192,13 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_seq_set(req, GG_SEQ_INFO); debugLogA("GetInfo(): Requesting user info.", req->seq); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 48, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -210,13 +206,11 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) } } // Own contact info - else - { - if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ))) - { -#ifdef DEBUGMODE + else { + if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ))) { + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -225,15 +219,13 @@ int GGPROTO::GetInfo(MCONTACT hContact, int infoType) gg_pubdir50_seq_set(req, GG_SEQ_CHINFO); debugLogA("GetInfo(): Requesting owner info.", req->seq); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 49, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread"); -#endif + #endif ForkThread(&GGPROTO::cmdgetinfothread, (void*)hContact); return 1; } @@ -266,9 +258,9 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); if (!req) { -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -278,12 +270,11 @@ HANDLE GGPROTO::SearchBasic(const TCHAR *id) gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchBasic", 50, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -308,33 +299,30 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); if (req == NULL) { -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } // Add nick,firstName,lastName and search it CMStringA szQuery; - if (nick) - { + if (nick) { T2Utf nick_utf8(nick); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nick_utf8); szQuery.Append(nick_utf8); } szQuery.AppendChar('.'); - if (firstName) - { + if (firstName) { T2Utf firstName_utf8(firstName); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); szQuery.Append(firstName_utf8); } szQuery.AppendChar('.'); - if (lastName) - { + if (lastName) { T2Utf lastName_utf8(lastName); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); szQuery.Append(lastName_utf8); @@ -350,12 +338,11 @@ HANDLE GGPROTO::SearchByName(const TCHAR *nick, const TCHAR *firstName, const TC gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchByName", 51, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HANDLE)1; } @@ -376,11 +363,10 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) return 0; gg_pubdir50_t req = gg_pubdir50_new(GG_PUBDIR50_SEARCH); - if (!req) - { -#ifdef DEBUGMODE + if (!req) { + #ifdef DEBUGMODE debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HWND)1; } @@ -390,8 +376,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data TCHAR text[64]; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf firstName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8); szQuery.Append(firstName_utf8); @@ -399,8 +384,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf lastName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8); szQuery.Append(lastName_utf8); @@ -408,8 +392,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf nickName_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8); szQuery.Append(nickName_utf8); @@ -417,8 +400,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { T2Utf city_utf8(text); gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8); szQuery.Append(city_utf8); @@ -426,8 +408,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ szQuery.AppendChar('.'); GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text)); - if (mir_tstrlen(text)) - { + if (mir_tstrlen(text)) { int yearTo = _tstoi(text); int yearFrom; time_t t = time(NULL); @@ -455,21 +436,19 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) } /* 5 */ szQuery.AppendChar('.'); - switch(SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)) - { - case 1: - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_FEMALE); - szQuery.Append(GG_PUBDIR50_GENDER_MALE); - break; - case 2: - gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_MALE); - szQuery.Append(GG_PUBDIR50_GENDER_FEMALE); - break; + switch (SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_GETCURSEL, 0, 0)) { + case 1: + gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_FEMALE); + szQuery.Append(GG_PUBDIR50_GENDER_MALE); + break; + case 2: + gg_pubdir50_add(req, GG_PUBDIR50_GENDER, GG_PUBDIR50_GENDER_MALE); + szQuery.Append(GG_PUBDIR50_GENDER_FEMALE); + break; } /* 6 */ szQuery.AppendChar('.'); - if (IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)) - { + if (IsDlgButtonChecked(hwndDlg, IDC_ONLYCONNECTED)) { gg_pubdir50_add(req, GG_PUBDIR50_ACTIVE, GG_PUBDIR50_ACTIVE_TRUE); szQuery.Append(GG_PUBDIR50_ACTIVE_TRUE); } @@ -489,15 +468,13 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); - if (isonline()) - { + if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "SearchAdvanced", 52, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) - { + if (!gg_pubdir50(sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 1, "sess_mutex", 1); -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread"); -#endif + #endif ForkThread(&GGPROTO::searchthread, NULL); return (HWND)1; } @@ -512,9 +489,9 @@ 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 wParam, LPARAM lParam) { - switch(message) { + switch (message) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)_T("")); // 0 @@ -544,7 +521,7 @@ void __cdecl GGPROTO::sendackthread(void *ack) { GG_SEQ_ACK *pAck = (GG_SEQ_ACK *)ack; gg_sleep(100, FALSE, "sendackthread", 105, 1); - ProtoBroadcastAck(pAck->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE) pAck->seq, 0); + ProtoBroadcastAck(pAck->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)pAck->seq, 0); mir_free(ack); } @@ -560,17 +537,15 @@ int GGPROTO::SendMsg(MCONTACT hContact, int, const char *msg) gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1); int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg); gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1); - if (!getByte(GG_KEY_MSGACK, GG_KEYDEF_MSGACK)) - { + if (!getByte(GG_KEY_MSGACK, GG_KEYDEF_MSGACK)) { // Auto-ack message without waiting for server ack GG_SEQ_ACK *ack = (GG_SEQ_ACK*)mir_alloc(sizeof(GG_SEQ_ACK)); - if (ack) - { + if (ack) { ack->seq = seq; ack->hContact = hContact; -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SendMsg(): ForkThread 16 GGPROTO::sendackthread"); -#endif + #endif ForkThread(&GGPROTO::sendackthread, ack); } } @@ -615,15 +590,15 @@ void __cdecl GGPROTO::getawaymsgthread(void *arg) { DBVARIANT dbv; - MCONTACT hContact = (MCONTACT) arg; + MCONTACT hContact = (UINT_PTR)arg; debugLogA("getawaymsgthread(): started"); gg_sleep(100, FALSE, "getawaymsgthread", 106, 1); - if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) - { + if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR)) { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, (LPARAM)dbv.ptszVal); debugLog(_T("getawaymsgthread(): Reading away msg <%s>."), dbv.ptszVal); db_free(&dbv); - } else { + } + else { ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)1, 0); } debugLogA("getawaymsgthread(): end"); @@ -651,47 +626,43 @@ int GGPROTO::SetAwayMsg(int iStatus, const TCHAR *newMsg) gg_EnterCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, "modemsg_mutex", 1); // Select proper our msg ptr - switch(status) - { - case ID_STATUS_ONLINE: - msgPtr = &modemsg.online; - break; - case ID_STATUS_AWAY: - msgPtr = &modemsg.away; - break; - case ID_STATUS_DND: - msgPtr = &modemsg.dnd; - break; - case ID_STATUS_FREECHAT: - msgPtr = &modemsg.freechat; - break; - case ID_STATUS_INVISIBLE: - msgPtr = &modemsg.invisible; - break; - default: - gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 1, "modemsg_mutex", 1); - return 1; + switch (status) { + case ID_STATUS_ONLINE: + msgPtr = &modemsg.online; + break; + case ID_STATUS_AWAY: + msgPtr = &modemsg.away; + break; + case ID_STATUS_DND: + msgPtr = &modemsg.dnd; + break; + case ID_STATUS_FREECHAT: + msgPtr = &modemsg.freechat; + break; + case ID_STATUS_INVISIBLE: + msgPtr = &modemsg.invisible; + break; + default: + gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 1, "modemsg_mutex", 1); + return 1; } // Check if we change status here somehow if (*msgPtr && newMsg && !mir_tstrcmp(*msgPtr, newMsg) - || !*msgPtr && (!newMsg || !*newMsg)) - { - if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) - { + || !*msgPtr && (!newMsg || !*newMsg)) { + if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) { debugLogA("SetAwayMsg(): Message hasn't been changed, return."); gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 2, "modemsg_mutex", 1); return 0; } } - else - { + else { if (*msgPtr) mir_free(*msgPtr); *msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL; -#ifdef DEBUGMODE + #ifdef DEBUGMODE debugLogA("SetAwayMsg(): Message changed."); -#endif + #endif } gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 3, "modemsg_mutex", 1); @@ -725,7 +696,7 @@ int GGPROTO::UserIsTyping(MCONTACT hContact, int type) int GGPROTO::OnEvent(PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam) { - switch( eventType ) { + switch (eventType) { case EV_PROTO_ONLOAD: HookProtoEvent(ME_OPT_INITIALISE, &GGPROTO::options_init); HookProtoEvent(ME_USERINFO_INITIALISE, &GGPROTO::details_init); diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index b76e4816cd..4e2bfc3038 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -306,7 +306,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcwindow.pszModule = m_szModuleName; gcwindow.ptszName = sender ? senderName : TranslateT("Conference"); gcwindow.ptszID = chat->id; - gcwindow.dwItemData = (DWORD)chat; + gcwindow.dwItemData = (UINT_PTR)chat; gcwindow.ptszStatusbarText = status; // Here we put nice new hash sign diff --git a/protocols/Gadu-Gadu/src/libgadu/http.cpp b/protocols/Gadu-Gadu/src/libgadu/http.cpp index d07dca27d3..e1cc1b457f 100644 --- a/protocols/Gadu-Gadu/src/libgadu/http.cpp +++ b/protocols/Gadu-Gadu/src/libgadu/http.cpp @@ -330,7 +330,7 @@ int gg_http_watch_fd(struct gg_http *h) unsigned int left; char *line; - left = h->header_size - ((long)(tmp) - (long)(h->header) + sep_len); + left = h->header_size - ((INT_PTR)tmp - (INT_PTR)(h->header) + sep_len); gg_debug(GG_DEBUG_MISC, "=> http, got all header (%d bytes, %d left)\n", h->header_size - left, left); -- cgit v1.2.3