diff options
23 files changed, 61 insertions, 129 deletions
diff --git a/include/delphi/m_netlib.inc b/include/delphi/m_netlib.inc index 32bb3dc4ac..ac5ab4f947 100644 --- a/include/delphi/m_netlib.inc +++ b/include/delphi/m_netlib.inc @@ -52,20 +52,6 @@ const PROXYTYPE_HTTPS = 4;
PROXYTYPE_IE = 5;
- // for TNETLIBOPENCONNECTION.flags
-
- { this connection will be useed for HTTP communications,
- if configured for an HTTP(S) proxy the connection is opened as if there
- was no proxy }
- NLOCF_HTTP = $0001;
- { this connection should send the sticky headers associated with NetLib
- user apart of any HTTP request}
- NLOCF_STICKYHEADERS = $0002;
- { this connection understands the newer structure, newer cbSize isnt enough}
- NLOCF_V2 = $0004;
- NLOCF_UDP = $0008; // this connection is UDP
- NLOCF_SSL = $0010; // this connection is SSL
-
// for TNETLIBHTTPPROXYINFO.flags
NLHPIF_USEGETSEQUENCE = $0001; // append sequence numbers to GET requests
@@ -116,30 +102,6 @@ const FD_SETSIZE = 65;
type
- twaitcallback = function(timeout:dword):integer; cdecl;
-
- PNETLIBOPENCONNECTION = ^TNETLIBOPENCONNECTION;
- TNETLIBOPENCONNECTION = record
- cbSize : int;
- szHost : PAnsiChar; // can be an IP in string form
- wPort : word;
- flags : dword; // see NLOCF_* flags
- timeout: uint;
- // optional, called in the context of the thread that issued the attempt,
- // if it returns 0 the connection attempt is stopped, the remaining
- // timeout value can also be adjusted
- waitcallback:twaitcallback;
- end;
-
-const
- {$IFNDEF WIN64}
- NETLIBOPENCONNECTION_V1_SIZE = 16;
- {$ELSE}
- NETLIBOPENCONNECTION_V1_SIZE = sizeof(TNETLIBOPENCONNECTION);
- {$ENDIF}
- // old sizeof() is 14 bytes, but there is padding of 2 bytes
-
-type
PNETLIBHTTPHEADER = ^TNETLIBHTTPHEADER;
TNETLIBHTTPHEADER = record
szName : PAnsiChar;
diff --git a/include/m_netlib.h b/include/m_netlib.h index ce0c50e5e6..73b0ff2ff7 100644 --- a/include/m_netlib.h +++ b/include/m_netlib.h @@ -321,7 +321,6 @@ EXTERN_C MIR_APP_DLL(HNETLIBBIND) Netlib_BindPort(HNETLIBUSER nlu, NETLIBBIND *n struct NETLIBOPENCONNECTION
{
- int cbSize;
const char *szHost; // can contain the string representation of an IP
WORD wPort; // host byte order
DWORD flags;
diff --git a/plugins/Ping/src/collection.h b/plugins/Ping/src/collection.h index e19c5874d4..df6fff15c2 100644 --- a/plugins/Ping/src/collection.h +++ b/plugins/Ping/src/collection.h @@ -155,19 +155,16 @@ public: virtual const bool pop(T &val)
{
- if (!head) return false;
+ if (!head)
+ return false;
ListNode<T> *n = head;
- if (head) {
- head = head->next;
- if (n == tail) tail = nullptr;
- val = n->val;
- delete n;
- Collection<T>::count--;
- return true;
- }
- else
- return false;
+ head = head->next;
+ if (n == tail) tail = nullptr;
+ val = n->val;
+ delete n;
+ Collection<T>::count--;
+ return true;
}
};
diff --git a/plugins/Ping/src/utils.cpp b/plugins/Ping/src/utils.cpp index de7a1d0bf9..43c777f315 100644 --- a/plugins/Ping/src/utils.cpp +++ b/plugins/Ping/src/utils.cpp @@ -16,15 +16,7 @@ LRESULT CALLBACK NullWindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l return DefWindowProc(hWnd, message, wParam, lParam);
}
-static INT_PTR CALLBACK sttMainThreadCallback(void *dwParam)
-{
- POPUPDATAW* ppd = (POPUPDATAW*)dwParam;
- PUAddPopupW(ppd);
- free(ppd);
- return 0;
-}
-
-void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int flags)
+void __stdcall ShowPopup(wchar_t *line1, wchar_t *line2, int)
{
if (Miranda_IsTerminated())
return;
@@ -63,8 +55,7 @@ INT_PTR PluginPing(WPARAM, LPARAM lParam) clock_t start_tcp = clock();
//GetLocalTime(&systime);
- NETLIBOPENCONNECTION conn = { 0 };
- conn.cbSize = sizeof(NETLIBOPENCONNECTION);
+ NETLIBOPENCONNECTION conn = {};
conn.szHost = mir_u2a(pa->pszName);
conn.wPort = pa->port;
conn.timeout = options.ping_timeout;
diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index ebd5de898f..7dc75f5c73 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -24,7 +24,7 @@ SONGINFO SongInfo = {}; void Start(void*) { - NETLIBOPENCONNECTION nloc = { sizeof(nloc) }; + NETLIBOPENCONNECTION nloc = {}; char *tmp = (char*)mir_u2a(gbHost); nloc.szHost = tmp; nloc.timeout = 5; diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index cc48552b13..fc760cb980 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -140,8 +140,7 @@ bool CDiscordProto::GatewayThreadWorker() if (!mir_strncmp(m_szGateway, "wss://", 6)) m_szGateway.Delete(0, 6); - NETLIBOPENCONNECTION conn = { 0 }; - conn.cbSize = sizeof(conn); + NETLIBOPENCONNECTION conn = {}; conn.szHost = m_szGateway; conn.flags = NLOCF_V2 | NLOCF_SSL; conn.timeout = 5; diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 3dd16b0769..e72df9fa90 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -194,8 +194,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) { codepage = m_codepage; - NETLIBOPENCONNECTION ncon = { 0 }; - ncon.cbSize = sizeof(ncon); + NETLIBOPENCONNECTION ncon = {}; ncon.szHost = info.sServer.c_str(); ncon.wPort = info.iPort; con = Netlib_OpenConnection(m_hNetlibUser, &ncon); @@ -883,8 +882,7 @@ int CDccSession::SetupConnection() // If a remote computer initiates a chat session this is used to connect to the remote computer (user already accepted at this point). // also used for connecting to a remote computer for remote file transfers if (di->iType == DCC_CHAT && !di->bSender || di->iType == DCC_SEND && di->bSender && di->bReverse) { - NETLIBOPENCONNECTION ncon = { 0 }; - ncon.cbSize = sizeof(ncon); + NETLIBOPENCONNECTION ncon = {}; ncon.szHost = ConvertIntegerToIP(di->dwAdr); ncon.wPort = (WORD)di->iPort; con = Netlib_OpenConnection(m_proto->hNetlibDCC, &ncon); @@ -978,8 +976,7 @@ int CDccSession::SetupConnection() } // connect to the remote computer from which you are receiving the file (now all actions to take (resume/overwrite etc) have been decided - NETLIBOPENCONNECTION ncon = { 0 }; - ncon.cbSize = sizeof(ncon); + NETLIBOPENCONNECTION ncon = {}; ncon.szHost = ConvertIntegerToIP(di->dwAdr); ncon.wPort = (WORD)di->iPort; diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp index fe2aaed8fd..7228b16fc1 100644 --- a/protocols/JabberG/src/jabber_byte.cpp +++ b/protocols/JabberG/src/jabber_byte.cpp @@ -441,10 +441,10 @@ void CJabberProto::ByteSendViaProxy(JABBER_BYTE_TRANSFER *jbt) WORD port = (WORD)atoi(szPort);
replaceStr(jbt->streamhostJID, jbt->szProxyJid);
- NETLIBOPENCONNECTION nloc = { 0 };
- nloc.cbSize = sizeof(nloc);
+ NETLIBOPENCONNECTION nloc = {};
nloc.szHost = szHost;
nloc.wPort = port;
+
HNETLIBCONN hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
mir_free((void*)nloc.szHost);
@@ -608,9 +608,9 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt) debugLogA("bytestream_recv connecting to %s:%d", szHost, port);
NETLIBOPENCONNECTION nloc = { 0 };
- nloc.cbSize = sizeof(nloc);
nloc.szHost = mir_strdup(szHost);
nloc.wPort = port;
+
HNETLIBCONN hConn = Netlib_OpenConnection(m_hNetlibUser, &nloc);
mir_free((void*)nloc.szHost);
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index 1cb53aa248..aff4a01567 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -36,8 +36,7 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft) ft->type = FT_OOB;
- NETLIBOPENCONNECTION nloc = { 0 };
- nloc.cbSize = sizeof(nloc);
+ NETLIBOPENCONNECTION nloc = {};
nloc.szHost = ft->httpHostName;
nloc.wPort = ft->httpPort;
info.s = Netlib_OpenConnection(m_hNetlibUser, &nloc);
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp index 228bb5f5c9..e138c0c733 100644 --- a/protocols/JabberG/src/jabber_ws.cpp +++ b/protocols/JabberG/src/jabber_ws.cpp @@ -42,7 +42,6 @@ BOOL CJabberProto::WsInit(void) HNETLIBCONN CJabberProto::WsConnect(char* host, WORD port)
{
NETLIBOPENCONNECTION nloc = {};
- nloc.cbSize = sizeof(nloc);
nloc.szHost = host;
nloc.wPort = port;
nloc.timeout = 6;
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 655a0c048e..e26d2828f0 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -424,7 +424,6 @@ static void MyNetlibConnFromUrl(const char* szUrl, NETLIBOPENCONNECTION &nloc) if (ppath) *ppath = '\0';
memset(&nloc, 0, sizeof(nloc));
- nloc.cbSize = sizeof(nloc);
nloc.szHost = szHost;
char* pcolon = strrchr(szHost, ':');
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index 94870e2a1f..bad3db275d 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -126,7 +126,6 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) mir_strcpy(info->mServer, MSN_DEFAULT_LOGIN_SERVER);
NETLIBOPENCONNECTION tConn = { 0 };
- tConn.cbSize = sizeof(tConn);
tConn.flags = NLOCF_V2;
tConn.timeout = 5;
tConn.flags = NLOCF_SSL;
diff --git a/protocols/Sametime/src/conference.cpp b/protocols/Sametime/src/conference.cpp index dcba8b5dd6..666ed44cfe 100644 --- a/protocols/Sametime/src/conference.cpp +++ b/protocols/Sametime/src/conference.cpp @@ -146,7 +146,7 @@ void mwServiceConf_conf_opened(mwConference* conf, GList* members) /** triggered when a conference is closed. This is typically when
we've left it */
-void mwServiceConf_conf_closed(mwConference* conf, guint32 reason)
+void mwServiceConf_conf_closed(mwConference* conf, guint32)
{
CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLogW(L"mwServiceConf_conf_closed() start");
@@ -240,7 +240,7 @@ void mwServiceConf_on_text(mwConference* conf, mwLoginInfo* user, const char* wh }
/** typing notification */
-void mwServiceConf_on_typing(mwConference* conf, mwLoginInfo* who, gboolean typing)
+void mwServiceConf_on_typing(mwConference* conf, mwLoginInfo*, gboolean)
{
CSametimeProto* proto = getProtoFromMwConference(conf);
proto->debugLogW(L"mwServiceConf_on_typing() start");
@@ -248,7 +248,7 @@ void mwServiceConf_on_typing(mwConference* conf, mwLoginInfo* who, gboolean typi }
/** optional. called from mwService_free */
-void mwServiceConf_clear(mwServiceConference* srvc)
+void mwServiceConf_clear(mwServiceConference*)
{
}
@@ -277,7 +277,7 @@ void CSametimeProto::TerminateConference(char* name) }
-int CSametimeProto::GcEventHook(WPARAM wParam, LPARAM lParam) {
+int CSametimeProto::GcEventHook(WPARAM, LPARAM lParam) {
GCHOOK* gch = (GCHOOK*)lParam;
@@ -333,7 +333,7 @@ int CSametimeProto::ChatDeleted(MCONTACT hContact) { }
-INT_PTR CSametimeProto::onMenuLeaveChat(WPARAM wParam, LPARAM lParam)
+INT_PTR CSametimeProto::onMenuLeaveChat(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT)wParam;
debugLogW(L"CSametimeProto::onMenuLeaveChat() hContact=[%x]", hContact);
@@ -342,7 +342,7 @@ INT_PTR CSametimeProto::onMenuLeaveChat(WPARAM wParam, LPARAM lParam) }
-INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam)
+INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT)wParam;
debugLogW(L"CSametimeProto::onMenuCreateChat() hContact=[%x]", hContact);
@@ -375,7 +375,7 @@ INT_PTR CSametimeProto::onMenuCreateChat(WPARAM wParam, LPARAM lParam) return 0;
}
-int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM lParam)
+int CSametimeProto::PrebuildContactMenu(WPARAM wParam, LPARAM)
{
MCONTACT hContact = (MCONTACT)wParam;
debugLogW(L"CSametimeProto::PrebuildContactMenu() hContact=[%x]", hContact);
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index a0b3d3dd74..e5dde87da3 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -257,7 +257,7 @@ void mwFileTransfer_handle_ack(mwFileTransfer* ft) }
/** optional. called from mwService_free */
-void mwFileTransfer_clear(mwServiceFileTransfer* srvc)
+void mwFileTransfer_clear(mwServiceFileTransfer*)
{
}
@@ -280,7 +280,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, wchar_t** files, const idb.user = id_block.user;
idb.community = id_block.community;
- FileTransferClientData *ftcd, *prev_ftcd = nullptr, *first_ftcd = nullptr;
+ FileTransferClientData *ftcd, *prev_ftcd = nullptr;
mwFileTransfer *ft, *first_ft = nullptr;
for (int i = 0; files[i]; i++) {
@@ -346,7 +346,6 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s {
mwFileTransfer* ft = (mwFileTransfer*)hFt;
- CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
debugLogW(L"CSametimeProto::AcceptFileTransfer() start");
FileTransferClientData* ftcd = new FileTransferClientData;
@@ -392,7 +391,6 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s void CSametimeProto::RejectFileTransfer(HANDLE hFt)
{
mwFileTransfer* ft = (mwFileTransfer*)hFt;
- CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
debugLogW(L"CSametimeProto::RejectFileTransfer() start");
mwFileTransfer_reject(ft);
@@ -401,7 +399,6 @@ void CSametimeProto::RejectFileTransfer(HANDLE hFt) void CSametimeProto::CancelFileTransfer(HANDLE hFt)
{
mwFileTransfer* ft = (mwFileTransfer*)hFt;
- CSametimeProto* proto = getProtoFromMwFileTransfer(ft);
debugLogW(L"CSametimeProto::CancelFileTransfer() start");
FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft);
diff --git a/protocols/Sametime/src/messaging.cpp b/protocols/Sametime/src/messaging.cpp index cc79c8b9dc..c8c3cb64cb 100644 --- a/protocols/Sametime/src/messaging.cpp +++ b/protocols/Sametime/src/messaging.cpp @@ -88,7 +88,7 @@ void mwIm_conversation_recv(mwConversation* conv, mwImSendType type, gconstpoint ProtoChainRecvMsg(hContact, &pre);
}
-void mwIm_place_invite(struct mwConversation* conv, const char* message, const char* title, const char* name)
+void mwIm_place_invite(struct mwConversation* conv, const char* message, const char*, const char*)
{
CSametimeProto* proto = getProtoFromMwConversation(conv);
proto->debugLogW(L"mwIm_place_invite() start");
diff --git a/protocols/Sametime/src/places.cpp b/protocols/Sametime/src/places.cpp index 8b3a030ed1..2fd862d70d 100644 --- a/protocols/Sametime/src/places.cpp +++ b/protocols/Sametime/src/places.cpp @@ -3,40 +3,40 @@ /* Stubs, NOT IMPLEMENTED NOW */
-void mwServicePlace_opened(struct mwPlace* place)
+void mwServicePlace_opened(struct mwPlace*)
{
}
-void mwServicePlace_closed(struct mwPlace* place, guint32 code)
+void mwServicePlace_closed(struct mwPlace*, guint32)
{
}
-void mwServicePlace_peerJoined(struct mwPlace* place, const struct mwIdBlock* peer)
+void mwServicePlace_peerJoined(struct mwPlace*, const struct mwIdBlock*)
{
}
-void mwServicePlace_peerParted(struct mwPlace* place, const struct mwIdBlock* peer)
+void mwServicePlace_peerParted(struct mwPlace*, const struct mwIdBlock*)
{
}
-void mwServicePlace_peerSetAttribute(struct mwPlace* place, const struct mwIdBlock* peer, guint32 attr, struct mwOpaque* o)
+void mwServicePlace_peerSetAttribute(struct mwPlace*, const struct mwIdBlock*, guint32, struct mwOpaque*)
{
}
-void mwServicePlace_peerUnsetAttribute(struct mwPlace* place, const struct mwIdBlock* peer, guint32 attr)
+void mwServicePlace_peerUnsetAttribute(struct mwPlace*, const struct mwIdBlock*, guint32)
{
}
-void mwServicePlace_message(struct mwPlace* place, const struct mwIdBlock* who, const char* msg)
+void mwServicePlace_message(struct mwPlace*, const struct mwIdBlock*, const char*)
{
}
-void mwServicePlace_clear(struct mwServicePlace* srvc)
+void mwServicePlace_clear(struct mwServicePlace*)
{
}
@@ -52,16 +52,16 @@ mwPlaceHandler mwPlace_handler = { mwServicePlace_clear
};
-void CSametimeProto::InitPlaces(mwSession* session)
+void CSametimeProto::InitPlaces(mwSession* pSession)
{
debugLogW(L"CSametimeProto::InitPlaces()");
- mwSession_addService(session, (mwService*)(service_places = mwServicePlace_new(session, &mwPlace_handler)));
+ mwSession_addService(pSession, (mwService*)(service_places = mwServicePlace_new(pSession, &mwPlace_handler)));
}
-void CSametimeProto::DeinitPlaces(mwSession* session)
+void CSametimeProto::DeinitPlaces(mwSession* pSession)
{
debugLogW(L"CSametimeProto::DeinitPlaces()");
- mwSession_removeService(session, mwService_PLACE);
+ mwSession_removeService(pSession, mwService_PLACE);
mwService_free((mwService*)service_places);
service_places = nullptr;
}
diff --git a/protocols/Sametime/src/sametime_proto.cpp b/protocols/Sametime/src/sametime_proto.cpp index 6bae4d5d0a..f47f031ffb 100644 --- a/protocols/Sametime/src/sametime_proto.cpp +++ b/protocols/Sametime/src/sametime_proto.cpp @@ -100,7 +100,7 @@ int CSametimeProto::FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* return 0;
}
-INT_PTR CSametimeProto::GetCaps(int type, MCONTACT hContact)
+INT_PTR CSametimeProto::GetCaps(int type, MCONTACT)
{
switch (type) {
case PFLAGNUM_1:
@@ -233,7 +233,7 @@ int CSametimeProto::SetStatus(int iNewStatus) m_iDesiredStatus = iNewStatus;
if (iNewStatus != ID_STATUS_OFFLINE) {
if (m_iStatus == ID_STATUS_OFFLINE)
- LogIn(iNewStatus, m_hNetlibUser);
+ LogIn(iNewStatus);
else
SetSessionStatus(iNewStatus);
}
diff --git a/protocols/Sametime/src/sametime_proto.h b/protocols/Sametime/src/sametime_proto.h index e81767cfd5..b97a53c40f 100644 --- a/protocols/Sametime/src/sametime_proto.h +++ b/protocols/Sametime/src/sametime_proto.h @@ -102,7 +102,7 @@ struct CSametimeProto : public PROTO<CSametimeProto> void SessionStarted();
void SessionStopping();
void InitSessionMenu();
- int LogIn(int status, HANDLE hNetlibUser);
+ int LogIn(int status);
int LogOut();
int OnLogInRedirect(char* newHost);
int SetSessionStatus(int status);
diff --git a/protocols/Sametime/src/sametime_session.cpp b/protocols/Sametime/src/sametime_session.cpp index e9cd06818c..2e27b39822 100644 --- a/protocols/Sametime/src/sametime_session.cpp +++ b/protocols/Sametime/src/sametime_session.cpp @@ -142,7 +142,7 @@ void __cdecl SessionAdmin(struct mwSession* session, const char* text) mir_free(tt);
}
-void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from, gboolean may_reply, const char* text)
+void __cdecl SessionAnnounce(struct mwSession* session, struct mwLoginInfo* from, gboolean, const char* text)
{
CSametimeProto* proto = (CSametimeProto*)mwSession_getProperty(session, "PROTO_STRUCT_PTR");
proto->debugLogW(L"SessionAnnounce()");
@@ -275,7 +275,7 @@ int CSametimeProto::SetSessionStatus(int status) return 0;
}
-VOID CALLBACK IdleTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+VOID CALLBACK IdleTimerProc(HWND, UINT, UINT_PTR idEvent, DWORD)
{
CSametimeProto* proto = (CSametimeProto*)idEvent;
@@ -358,7 +358,7 @@ void __cdecl CSametimeProto::KeepAliveThread(void*) return;
}
-int waitcallback(unsigned int* timeout)
+int waitcallback(unsigned int*)
{
return continue_connect ? 1 : 0;
}
@@ -373,7 +373,6 @@ void __cdecl CSametimeProto::SessionThread(LPVOID) // setup
NETLIBOPENCONNECTION conn_data = { 0 };
- conn_data.cbSize = sizeof(NETLIBOPENCONNECTION);
conn_data.flags = NLOCF_V2;
conn_data.szHost = options.server_name;
conn_data.wPort = options.port;
@@ -470,7 +469,7 @@ WORD CSametimeProto::GetServerVersion() return retval;
}
-int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser)
+int CSametimeProto::LogIn(int ls)
{
debugLogW(L"LogIn() start");
@@ -483,7 +482,6 @@ int CSametimeProto::LogIn(int ls, HANDLE hNetlibUser) login_status = ls;
ForkThread(&CSametimeProto::SessionThread);
-
return 0;
}
@@ -515,7 +513,7 @@ int CSametimeProto::OnLogInRedirect(char* newHost) mir_strcpy(options.server_name, newHost);
LogOut();
Sleep(50); //wait for SessionThread end
- LogIn(login_status, m_hNetlibUser);
+ LogIn(login_status);
return 0;
}
@@ -543,7 +541,7 @@ void SendAnnouncement(SendAnnouncementFunc_arg* arg) mwSession_sendAnnounce(proto->session, false, T2Utf(arg->msg), arg->recipients);
}
-INT_PTR CSametimeProto::SessionAnnounce(WPARAM wParam, LPARAM lParam)
+INT_PTR CSametimeProto::SessionAnnounce(WPARAM, LPARAM)
{
debugLogW(L"CSametimeProto::SessionAnnounce() start");
SessionAnnounceDialogProc_arg* sadpArg = (SessionAnnounceDialogProc_arg*)mir_calloc(sizeof(SessionAnnounceDialogProc_arg));
diff --git a/protocols/YAMN/src/proto/netlib.cpp b/protocols/YAMN/src/proto/netlib.cpp index 02fb6d3cdc..507b9b4051 100644 --- a/protocols/YAMN/src/proto/netlib.cpp +++ b/protocols/YAMN/src/proto/netlib.cpp @@ -92,11 +92,9 @@ void CNLClient::Connect(const char* servername, const int port) throw(DWORD) DebugLog(CommFile, "<connect>\n"); #endif try { - NETLIBOPENCONNECTION nloc; - nloc.cbSize = sizeof(NETLIBOPENCONNECTION); + NETLIBOPENCONNECTION nloc = {}; nloc.szHost = servername; nloc.wPort = port; - nloc.flags = 0; if (nullptr == (hConnection = Netlib_OpenConnection(hNetlibUser, &nloc))) { SystemError = WSAGetLastError(); throw NetworkError = (DWORD)ENL_CONNECT; diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 3ced1cf459..ffe6877c27 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -167,7 +167,7 @@ int CMPluginBase::Unload() void CMPluginBase::tryOpenLog() { wchar_t path[MAX_PATH]; - mir_snwprintf(path, L"%s\\%S.txt", VARSW(L"%miranda_logpath%"), m_szModuleName); + mir_snwprintf(path, L"%s\\%S.txt", VARSW(L"%miranda_logpath%").get(), m_szModuleName); m_hLogger = mir_createLog(m_szModuleName, nullptr, path, 0); } diff --git a/src/mir_app/src/netlibhttp.cpp b/src/mir_app/src/netlibhttp.cpp index d29ee6f935..5d37580e86 100644 --- a/src/mir_app/src/netlibhttp.cpp +++ b/src/mir_app/src/netlibhttp.cpp @@ -151,7 +151,6 @@ void NetlibConnFromUrl(const char *szUrl, bool secur, NETLIBOPENCONNECTION &nloc if (ppath) *ppath = '\0';
memset(&nloc, 0, sizeof(nloc));
- nloc.cbSize = sizeof(nloc);
nloc.szHost = szHost;
char* pcolon = strrchr(szHost, ':');
diff --git a/src/mir_app/src/netlibopenconn.cpp b/src/mir_app/src/netlibopenconn.cpp index 7d0c3f101a..80faef277c 100644 --- a/src/mir_app/src/netlibopenconn.cpp +++ b/src/mir_app/src/netlibopenconn.cpp @@ -41,15 +41,14 @@ DWORD DnsLookup(NetlibUser *nlu, const char *szHost) if (ip != INADDR_NONE) return ip; - __try - { + __try { host = gethostbyname(szHost); if (host) return *(u_long*)host->h_addr_list[0]; Netlib_Logf(nlu, "%s %d: %s() for host %s failed (%u)", __FILE__, __LINE__, "gethostbyname", szHost, WSAGetLastError()); } - __except(EXCEPTION_EXECUTE_HANDLER) {} + __except (EXCEPTION_EXECUTE_HANDLER) {} return 0; } @@ -83,7 +82,7 @@ int WaitUntilWritable(SOCKET s, DWORD dwTimeout) FD_ZERO(&writefd); FD_SET(s, &writefd); - switch(select(0, nullptr, &writefd, nullptr, &tv)) { + switch (select(0, nullptr, &writefd, nullptr, &tv)) { case 0: SetLastError(ERROR_TIMEOUT); case SOCKET_ERROR: @@ -164,7 +163,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE buf[0] = 5; //yep, socks5 buf[1] = 1; //one auth method - buf[2] = nlu->settings.useProxyAuth?2:0; + buf[2] = nlu->settings.useProxyAuth ? 2 : 0; if (Netlib_Send(nlc, (char*)buf, 3, MSG_DUMPPROXY) == SOCKET_ERROR) { Netlib_Logf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "Netlib_Send", GetLastError()); return 0; @@ -352,7 +351,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) NetlibUser *nlu = nlc->nlu; // if dwTimeout is zero then its an old style connection or new with a 0 timeout, select() will error quicker anyway - unsigned int dwTimeout = (nloc && (nloc->cbSize == sizeof(NETLIBOPENCONNECTION)) && (nloc->flags & NLOCF_V2) && (nloc->timeout>0)) ? nloc->timeout : 30; + unsigned int dwTimeout = (nloc && (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) { @@ -460,7 +459,7 @@ retry: lasterr = ERROR_TIMEOUT; break; } - else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { + else if (nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -494,7 +493,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION *nloc) 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; + unsigned int dwTimeout = (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; @@ -624,7 +623,7 @@ retry: lasterr = ERROR_TIMEOUT; break; } - else if (nloc->cbSize == sizeof(NETLIBOPENCONNECTION) && nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { + else if (nloc->flags & NLOCF_V2 && nloc->waitcallback != nullptr && nloc->waitcallback(&dwTimeout) == 0) { rc = SOCKET_ERROR; lasterr = ERROR_TIMEOUT; break; @@ -807,7 +806,7 @@ bool NetlibReconnect(NetlibConnection *nlc) MIR_APP_DLL(HNETLIBCONN) Netlib_OpenConnection(NetlibUser *nlu, const NETLIBOPENCONNECTION *nloc) { - if (nloc == nullptr || nloc->cbSize != sizeof(NETLIBOPENCONNECTION) || nloc->szHost == nullptr || nloc->wPort == 0) { + if (nloc == nullptr || nloc->szHost == nullptr || nloc->wPort == 0) { SetLastError(ERROR_INVALID_PARAMETER); return nullptr; |