From 0db449bf70966941453cfbb8ec05fd430a96dc12 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 24 Jul 2019 13:20:12 +0300 Subject: useless member NETLIBOPENCONNECTION::cbSize removed --- src/mir_app/src/CMPluginBase.cpp | 2 +- src/mir_app/src/netlibhttp.cpp | 1 - src/mir_app/src/netlibopenconn.cpp | 19 +++++++++---------- 3 files changed, 10 insertions(+), 12 deletions(-) (limited to 'src/mir_app') 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; -- cgit v1.2.3