diff options
author | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-01-21 20:04:48 +0000 |
commit | d154673f93ad95197bce8cadb995daa5bc39f5d8 (patch) | |
tree | 191522aa88f9f845a9c27b1ddb86116b87033c4b /src/modules/netlib | |
parent | be50a70bfd8b3f3daf0c3351fdce6e2fea515bd7 (diff) |
minor code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@7820 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r-- | src/modules/netlib/netlib.cpp | 4 | ||||
-rw-r--r-- | src/modules/netlib/netlibautoproxy.cpp | 6 | ||||
-rw-r--r-- | src/modules/netlib/netlibbind.cpp | 12 | ||||
-rw-r--r-- | src/modules/netlib/netlibhttp.cpp | 72 | ||||
-rw-r--r-- | src/modules/netlib/netlibhttpproxy.cpp | 16 | ||||
-rw-r--r-- | src/modules/netlib/netliblog.cpp | 4 | ||||
-rw-r--r-- | src/modules/netlib/netlibopenconn.cpp | 54 | ||||
-rw-r--r-- | src/modules/netlib/netlibopts.cpp | 12 | ||||
-rw-r--r-- | src/modules/netlib/netlibpktrecver.cpp | 2 | ||||
-rw-r--r-- | src/modules/netlib/netlibsecurity.cpp | 6 | ||||
-rw-r--r-- | src/modules/netlib/netlibsock.cpp | 22 | ||||
-rw-r--r-- | src/modules/netlib/netlibssl.cpp | 16 | ||||
-rw-r--r-- | src/modules/netlib/netlibupnp.cpp | 10 |
13 files changed, 118 insertions, 118 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index dff3084348..47e3b13763 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -180,7 +180,7 @@ static INT_PTR NetlibRegisterUser(WPARAM, LPARAM lParam) thisUser->settings.proxyType = GetNetlibUserSettingInt(thisUser->user.szSettingsModule, "NLProxyType", PROXYTYPE_SOCKS5);
if (thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType == PROXYTYPE_HTTPS)
thisUser->settings.proxyType = PROXYTYPE_HTTP;
- if ( !(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) {
+ if (!(thisUser->user.flags&(NUF_HTTPCONNS|NUF_HTTPGATEWAY)) && thisUser->settings.proxyType == PROXYTYPE_HTTP) {
thisUser->settings.useProxy = 0;
thisUser->settings.proxyType = PROXYTYPE_SOCKS5;
}
@@ -236,7 +236,7 @@ void NetlibDoClose(NetlibConnection *nlc, bool noShutdown) NetlibLogf(nlc->nlu, "(%p:%u) Connection closed internal", nlc, nlc->s);
if (nlc->hSsl) {
- if ( !noShutdown) si.shutdown(nlc->hSsl);
+ if (!noShutdown) si.shutdown(nlc->hSsl);
si.sfree(nlc->hSsl);
nlc->hSsl = NULL;
}
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp index 44cfde41cd..27054b3e8c 100644 --- a/src/modules/netlib/netlibautoproxy.cpp +++ b/src/modules/netlib/netlibautoproxy.cpp @@ -238,9 +238,9 @@ static void NetlibInitAutoProxy(void) {
if (bAutoProxyInit) return;
- if ( !hModJS)
+ if (!hModJS)
{
- if ( !(hModJS = LoadLibraryA("jsproxy.dll")))
+ if (!(hModJS = LoadLibraryA("jsproxy.dll")))
return;
pInternetInitializeAutoProxyDll = (pfnInternetInitializeAutoProxyDll)
@@ -273,7 +273,7 @@ static void NetlibIeProxyThread(void *arg) IeProxyParam *param = (IeProxyParam*)arg;
param->szProxy = NULL;
- if ( !bAutoProxyInit) {
+ if (!bAutoProxyInit) {
WaitForSingleObject(hIeProxyMutex, INFINITE);
NetlibInitAutoProxy();
ReleaseMutex(hIeProxyMutex);
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index 2c2ebf1530..382a00ee37 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -78,7 +78,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn) ++portnum;
if (s == INVALID_SOCKET) continue;
- if ( !before && portnum <= *portn) continue;
+ if (!before && portnum <= *portn) continue;
if (before && portnum >= *portn)
return false;
@@ -210,7 +210,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) they better have given wPort == 0, let's hope so */
if (nlu->settings.specifyIncomingPorts && nlu->settings.szIncomingPorts && nlb->wPort == 0)
{
- if ( !BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum))
+ if (!BindSocketToPort(nlu->settings.szIncomingPorts, nlbp->s, nlbp->s6, &nlu->outportnum))
{
NetlibLogf(nlu, "Netlib bind: Not enough ports for incoming connections specified");
SetLastError(WSAEADDRINUSE);
@@ -232,7 +232,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) {
SOCKADDR_IN sin = {0};
int len = sizeof(sin);
- if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
+ if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
sin6.sin6_port = sin.sin_port;
foundPort = 1;
}
@@ -240,7 +240,7 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) if (bind(nlbp->s6, (PSOCKADDR)&sin6, sizeof(sin6)) == 0)
foundPort = 1;
}
- if ( !foundPort)
+ if (!foundPort)
{
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError());
closesocket(nlbp->s);
@@ -270,12 +270,12 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) {
SOCKADDR_INET_M sin = {0};
int len = sizeof(sin);
- if ( !getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
+ if (!getsockname(nlbp->s, (PSOCKADDR)&sin, &len))
{
nlb->wPort = ntohs(sin.Ipv4.sin_port);
nlb->dwInternalIP = ntohl(sin.Ipv4.sin_addr.S_un.S_addr);
}
- else if ( !getsockname(nlbp->s6, (PSOCKADDR)&sin, &len))
+ else if (!getsockname(nlbp->s6, (PSOCKADDR)&sin, &len))
nlb->wPort = ntohs(sin.Ipv6.sin6_port);
else
{
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index d1d231d7a3..87e1278f86 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -109,7 +109,7 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, unsigned dwTimeoutTime, ch {
DWORD dwTimeNow;
- if ( !si.pending(nlc->hSsl)) {
+ if (!si.pending(nlc->hSsl)) {
while ((dwTimeNow = GetTickCount()) < dwTimeoutTime) {
unsigned dwDeltaTime = min(dwTimeoutTime - dwTimeNow, 1000);
int res = WaitUntilReadable(nlc->s, dwDeltaTime);
@@ -159,9 +159,9 @@ static char* NetlibHttpFindAuthHeader(NETLIBHTTPREQUEST *nlhrReply, const char * }
}
- if (szNegoHdr && ( !szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr;
- if (szNtlmHdr && ( !szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr;
- if ( !szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr;
+ if (szNegoHdr && (!szProvider || !_stricmp(szProvider, "Negotiate"))) return szNegoHdr;
+ if (szNtlmHdr && (!szProvider || !_stricmp(szProvider, "NTLM"))) return szNtlmHdr;
+ if (!szProvider || !_stricmp(szProvider, "Basic")) return szBasicHdr;
return NULL;
}
@@ -204,7 +204,7 @@ static NetlibConnection* NetlibHttpProcessUrl(NETLIBHTTPREQUEST *nlhr, NetlibUse bool httpProxy = !(nloc.flags & NLOCF_SSL) && nlc->proxyType == PROXYTYPE_HTTP;
bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
- if ( !httpProxy && !sameHost) {
+ if (!httpProxy && !sameHost) {
NetlibDoClose(nlc);
mir_free((char*)nlc->nloc.szHost);
@@ -232,7 +232,7 @@ struct HttpSecurityContext void Destroy(void)
{
- if ( !m_hNtlmSecurity) return;
+ if (!m_hNtlmSecurity) return;
NetlibDestroySecurityProvider(m_hNtlmSecurity);
m_hNtlmSecurity = NULL;
@@ -253,7 +253,7 @@ struct HttpSecurityContext if (m_hNtlmSecurity) {
bool newAuth = !m_szProvider || !szProvider || _stricmp(m_szProvider, szProvider);
- newAuth = newAuth || (m_szHost != szHost && ( !m_szHost || !szHost || _stricmp(m_szHost, szHost)));
+ newAuth = newAuth || (m_szHost != szHost && (!m_szHost || !szHost || _stricmp(m_szHost, szHost)));
if (newAuth)
Destroy();
}
@@ -287,7 +287,7 @@ struct HttpSecurityContext szAuthHdr = NtlmCreateResponseFromChallenge(m_hNtlmSecurity,
szChallenge, szLogin, szPassw, true, complete);
- if ( !szAuthHdr) {
+ if (!szAuthHdr) {
NetlibLogf(NULL, "Security login %s failed, user: %S pssw: %S",
szProvider, szLogin ? szLogin : _T("(no user)"), szPassw ? _T("(exist)") : _T("(no psw)"));
}
@@ -429,8 +429,8 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if ( !nlc->usingHttpGateway)
- if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND))
+ if (!nlc->usingHttpGateway)
+ if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
const char *pszFullUrl = nlhr->szUrl;
@@ -439,12 +439,12 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) unsigned complete = false;
int count = 11;
while (--count) {
- if ( !NetlibReconnect(nlc)) {
+ if (!NetlibReconnect(nlc)) {
bytesSent = SOCKET_ERROR;
break;
}
- if ( !pszUrl) {
+ if (!pszUrl) {
pszUrl = pszFullUrl;
if (nlhr->flags & (NLHRF_SMARTREMOVEHOST | NLHRF_REMOVEHOST | NLHRF_GENERATEHOST)) {
bool usingProxy = nlc->proxyType == PROXYTYPE_HTTP && !(nlhr->flags & NLHRF_SSL);
@@ -503,11 +503,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) doneHostHeader = doneContentLengthHeader = doneProxyAuthHeader = doneAuthHeader = 0;
for (i=0; i < nlhr->headersCount; i++) {
NETLIBHTTPHEADER &p = nlhr->headers[i];
- if ( !lstrcmpiA(p.szName, "Host")) doneHostHeader = 1;
- else if ( !lstrcmpiA(p.szName, "Content-Length")) doneContentLengthHeader = 1;
- else if ( !lstrcmpiA(p.szName, "Proxy-Authorization")) doneProxyAuthHeader = 1;
- else if ( !lstrcmpiA(p.szName, "Authorization")) doneAuthHeader = 1;
- else if ( !lstrcmpiA(p.szName, "Connection")) continue;
+ if (!lstrcmpiA(p.szName, "Host")) doneHostHeader = 1;
+ else if (!lstrcmpiA(p.szName, "Content-Length")) doneContentLengthHeader = 1;
+ else if (!lstrcmpiA(p.szName, "Proxy-Authorization")) doneProxyAuthHeader = 1;
+ else if (!lstrcmpiA(p.szName, "Authorization")) doneAuthHeader = 1;
+ else if (!lstrcmpiA(p.szName, "Connection")) continue;
if (p.szValue == NULL) continue;
AppendToCharBuffer(&httpRequest, "%s: %s\r\n", p.szName, p.szValue);
}
@@ -535,7 +535,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) DWORD fflags = MSG_PEEK | MSG_NODUMP | ((nlhr->flags & NLHRF_NOPROXY) ? MSG_RAW : 0);
DWORD dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout;
- if ( !HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, NULL, NULL)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &nlhr->resultCode, NULL, NULL)) {
NetlibLogf(nlc->nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", GetLastError(), count);
DWORD err = GetLastError();
if (err == ERROR_TIMEOUT || err == ERROR_BAD_FORMAT || err == ERROR_BUFFER_OVERFLOW || lastFirstLineFail || nlc->termRequested || nlhr->requestType == REQUEST_CONNECT) {
@@ -613,11 +613,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(pszAuthHdr); pszAuthHdr = NULL;
if (nlhrReply) {
char *szAuthStr = NULL;
- if ( !complete) {
+ if (!complete) {
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "WWW-Authenticate", httpSecurity.m_szProvider);
if (szAuthStr) {
char *szChallenge = strchr(szAuthStr, ' ');
- if ( !szChallenge || !*lrtrimp(szChallenge))
+ if (!szChallenge || !*lrtrimp(szChallenge))
complete = true;
}
}
@@ -647,11 +647,11 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(pszProxyAuthHdr); pszProxyAuthHdr = NULL;
if (nlhrReply) {
char *szAuthStr = NULL;
- if ( !complete) {
+ if (!complete) {
szAuthStr = NetlibHttpFindAuthHeader(nlhrReply, "Proxy-Authenticate", httpSecurity.m_szProvider);
if (szAuthStr) {
char *szChallenge = strchr(szAuthStr, ' ');
- if ( !szChallenge || !*lrtrimp(szChallenge + 1))
+ if (!szChallenge || !*lrtrimp(szChallenge + 1))
complete = true;
}
}
@@ -695,7 +695,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) mir_free(szHost);
mir_free(szNewUrl);
- if ( !nlc->usingHttpGateway)
+ if (!nlc->usingHttpGateway)
NetlibLeaveNestedCS(&nlc->ncsSend);
return bytesSent;
@@ -727,7 +727,7 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam) INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam)
{
NetlibConnection *nlc = (struct NetlibConnection*)wParam;
- if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV))
+ if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
return 0;
char *peol, *pbuffer;
@@ -740,7 +740,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam, LPARAM lParam) nlhr->requestType = REQUEST_RESPONSE;
int firstLineLength = 0;
- if ( !HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, lParam | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhr);
return 0;
@@ -857,12 +857,12 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) bool doneUserAgentHeader = NetlibHttpFindHeader(nlhr, "User-Agent") != NULL;
bool doneAcceptEncoding = NetlibHttpFindHeader(nlhr, "Accept-Encoding") != NULL;
- if ( !doneUserAgentHeader || !doneAcceptEncoding) {
+ if (!doneUserAgentHeader || !doneAcceptEncoding) {
nlhrSend.headers = (NETLIBHTTPHEADER*)mir_alloc(sizeof(NETLIBHTTPHEADER) * (nlhrSend.headersCount + 2));
memcpy(nlhrSend.headers, nlhr->headers, sizeof(NETLIBHTTPHEADER) * nlhr->headersCount);
}
- if ( !doneUserAgentHeader) {
+ if (!doneUserAgentHeader) {
nlhrSend.headers[nlhrSend.headersCount].szName = "User-Agent";
nlhrSend.headers[nlhrSend.headersCount].szValue = szUserAgent;
++nlhrSend.headersCount;
@@ -876,18 +876,18 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam) }
else mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s", szMirandaVer);
}
- if ( !doneAcceptEncoding) {
+ if (!doneAcceptEncoding) {
nlhrSend.headers[nlhrSend.headersCount].szName = "Accept-Encoding";
nlhrSend.headers[nlhrSend.headersCount].szValue = "deflate, gzip";
++nlhrSend.headersCount;
}
if (NetlibHttpSendRequest((WPARAM)nlc, (LPARAM)&nlhrSend) == SOCKET_ERROR) {
- if ( !doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
+ if (!doneUserAgentHeader || !doneAcceptEncoding) mir_free(nlhrSend.headers);
nlhr->resultCode = nlhrSend.resultCode;
NetlibCloseHandle((WPARAM)nlc, 0);
return 0;
}
- if ( !doneUserAgentHeader || !doneAcceptEncoding)
+ if (!doneUserAgentHeader || !doneAcceptEncoding)
mir_free(nlhrSend.headers);
dflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT:0) |
@@ -1029,10 +1029,10 @@ next: for (i=0; i<nlhrReply->headersCount; i++) {
NETLIBHTTPHEADER &p = nlhrReply->headers[i];
- if ( !lstrcmpiA(p.szName, "Content-Length"))
+ if (!lstrcmpiA(p.szName, "Content-Length"))
dataLen = atoi(p.szValue);
- if ( !lstrcmpiA(p.szName, "Content-Encoding")) {
+ if (!lstrcmpiA(p.szName, "Content-Encoding")) {
cenc = i;
if (strstr(p.szValue, "gzip"))
cenctype = 1;
@@ -1040,10 +1040,10 @@ next: cenctype = 2;
}
- if ( !lstrcmpiA(p.szName, "Connection"))
+ if (!lstrcmpiA(p.szName, "Connection"))
close = !lstrcmpiA(p.szValue, "close");
- if ( !lstrcmpiA(p.szName, "Transfer-Encoding") &&
+ if (!lstrcmpiA(p.szName, "Transfer-Encoding") &&
!lstrcmpiA(p.szValue, "chunked"))
{
chunked = true;
@@ -1052,7 +1052,7 @@ next: }
}
- if (nlhrReply->resultCode >= 200 && (dataLen > 0 || ( !isConnect && dataLen < 0))) {
+ if (nlhrReply->resultCode >= 200 && (dataLen > 0 || (!isConnect && dataLen < 0))) {
int recvResult, chunksz = -1;
int dataBufferAlloced;
@@ -1161,7 +1161,7 @@ next: if (close &&
(nlc->proxyType != PROXYTYPE_HTTP || nlc->nloc.flags & NLOCF_SSL) &&
- ( !isConnect || nlhrReply->resultCode != 200))
+ (!isConnect || nlhrReply->resultCode != 200))
NetlibDoClose(nlc);
return nlhrReply;
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp index aebf65ee55..5980a1f5b1 100644 --- a/src/modules/netlib/netlibhttpproxy.cpp +++ b/src/modules/netlib/netlibhttpproxy.cpp @@ -42,7 +42,7 @@ static int HttpGatewayReadSetResult(NetlibConnection *nlc, char *buf, int num, i int rbytes = nlc->dataBufferLen - bytes;
memcpy(buf, nlc->dataBuffer, bytes);
- if ( !peek)
+ if (!peek)
{
memmove(nlc->dataBuffer, nlc->dataBuffer + bytes, rbytes);
nlc->dataBufferLen = rbytes;
@@ -121,13 +121,13 @@ static bool NetlibHttpGatewaySend(NetlibConnection *nlc, RequestType reqType, co bool sameHost = lstrcmpA(nlc->nloc.szHost, nloc.szHost) == 0 && nlc->nloc.wPort == nloc.wPort;
- if ( !sameHost)
+ if (!sameHost)
{
NetlibDoClose(nlc);
mir_free((char*)nlc->nloc.szHost);
nlc->nloc = nloc;
- if ( !NetlibDoConnect(nlc))
+ if (!NetlibDoConnect(nlc))
return false;
}
else
@@ -188,7 +188,7 @@ static bool NetlibHttpGatewayOscarPost(NetlibConnection *nlc, const char *buf, i nlcSend.wProxyPort = nlc->wProxyPort;
nlcSend.proxyType = nlc->proxyType;
- if ( !NetlibReconnect(&nlcSend)) return false;
+ if (!NetlibReconnect(&nlcSend)) return false;
nlc->s2 = nlcSend.s;
nlcSend.hOkToCloseEvent = CreateEvent(NULL, TRUE, TRUE, NULL);
@@ -272,7 +272,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) {
bool peek = (flags & MSG_PEEK) != 0;
- if (nlc->dataBufferLen != 0 && ( !peek || nlc->dataBufferLen >= len))
+ if (nlc->dataBufferLen != 0 && (!peek || nlc->dataBufferLen >= len))
{
return HttpGatewayReadSetResult(nlc, buf, len, peek);
}
@@ -304,7 +304,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) int numPackets = 0;
if (nlc->nlhpi.szHttpGetUrl)
{
- if ( !NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0))
+ if (!NetlibHttpGatewaySend(nlc, reqOldGet, NULL, 0))
{
if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested)
break;
@@ -315,7 +315,7 @@ int NetlibHttpGatewayRecv(NetlibConnection *nlc, char *buf, int len, int flags) }
else
{
- if ( !NetlibHttpGatewayStdPost(nlc, numPackets))
+ if (!NetlibHttpGatewayStdPost(nlc, numPackets))
{
if (GetLastError() == ERROR_ACCESS_DENIED || nlc->termRequested)
break;
@@ -422,7 +422,7 @@ int NetlibInitHttpConnection(NetlibConnection *nlc, NetlibUser *nlu, NETLIBOPENC return 0;
}
}
- if ( !nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply))
+ if (!nlu->user.pfnHttpGatewayInit(nlc, nloc, nlhrReply))
{
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
return 0;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index b09a6bdcb1..21c0bf6231 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -350,10 +350,10 @@ static INT_PTR NetlibLogW(WPARAM wParam, LPARAM lParam) void NetlibLogf(NetlibUser* nlu, const char *fmt, ...)
{
if (nlu == NULL) {
- if ( !logOptions.toLog)
+ if (!logOptions.toLog)
return;
}
- else if ( !nlu->toLog)
+ else if (!nlu->toLog)
return;
va_list va;
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 1f2530f8f4..ba0269065c 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->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;
@@ -130,7 +130,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE //if cannot resolve host, try resolving through proxy (requires SOCKS4a)
DWORD ip = DnsLookup(nlu, nloc->szHost);
*(PDWORD)&pInit[4] = ip ? ip : 0x01000000;
- if ( !ip) {
+ if (!ip) {
memcpy(&pInit[len], nloc->szHost, nHostLen);
len += nHostLen;
}
@@ -141,7 +141,7 @@ static int NetlibInitSocks4Connection(NetlibConnection *nlc, NetlibUser *nlu, NE }
char reply[8];
- if ( !RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if (!RecvUntilTimeout(nlc, reply, sizeof(reply), MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -171,7 +171,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE }
//confirmation of auth method
- if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -200,7 +200,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE }
mir_free(pAuthBuf);
- if ( !RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if (!RecvUntilTimeout(nlc, (char*)buf, 2, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -248,7 +248,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE }
mir_free(pInit);
- if ( !RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if (!RecvUntilTimeout(nlc, (char*)buf, 5, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -289,7 +289,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE NetlibLogf(nlu, "%s %d: %s() unknown address type (%u)", __FILE__, __LINE__, "NetlibInitSocks5Connection", (int)buf[3]);
return 0;
}
- if ( !RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
+ if (!RecvUntilTimeout(nlc, (char*)buf, nRecvSize, MSG_DUMPPROXY, RECV_DEFAULT_TIMEOUT)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "RecvUntilTimeout", GetLastError());
return 0;
}
@@ -390,7 +390,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) sin.sin_family = AF_INET;
if (nlc->proxyType) {
- if ( !nlc->szProxyServer) return false;
+ if (!nlc->szProxyServer) return false;
if (nloc)
NetlibLogf(nlc->nlu, "(%p) Connecting to proxy %s:%d for %s:%d ....", nlc, nlc->szProxyServer, nlc->wProxyPort, nloc->szHost, nloc->wPort);
@@ -401,7 +401,7 @@ static bool my_connectIPv4(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) he = gethostbyname(nlc->szProxyServer);
}
else {
- if ( !nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false;
+ if (!nloc || !nloc->szHost || nloc->szHost[0] == '[' || strchr(nloc->szHost, ':')) return false;
NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
sin.sin_port = htons(nloc->wPort);
@@ -425,7 +425,7 @@ retry: return false;
if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) {
- if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
+ if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, nlc->s, INVALID_SOCKET, &nlc->nlu->inportnum))
NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
@@ -541,7 +541,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) }
if (nlc->proxyType) {
- if ( !nlc->szProxyServer)
+ if (!nlc->szProxyServer)
return false;
if (nloc)
@@ -556,7 +556,7 @@ static bool my_connectIPv6(NetlibConnection *nlc, NETLIBOPENCONNECTION * nloc) }
}
else {
- if ( !nloc || !nloc->szHost)
+ if (!nloc || !nloc->szHost)
return false;
NetlibLogf(nlc->nlu, "(%p) Connecting to server %s:%d....", nlc, nloc->szHost, nloc->wPort);
@@ -583,7 +583,7 @@ retry: if (nlc->nlu->settings.specifyOutgoingPorts && nlc->nlu->settings.szOutgoingPorts && nlc->nlu->settings.szOutgoingPorts[0]) {
SOCKET s = ai->ai_family == AF_INET ? nlc->s : INVALID_SOCKET;
SOCKET s6 = ai->ai_family == AF_INET6 ? nlc->s : INVALID_SOCKET;
- if ( !BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum))
+ if (!BindSocketToPort(nlc->nlu->settings.szOutgoingPorts, s, s6, &nlc->nlu->inportnum))
NetlibLogf(nlc->nlu, "Netlib connect: Not enough ports for outgoing connections specified");
}
@@ -680,7 +680,7 @@ static int NetlibHttpFallbackToDirect(NetlibConnection *nlc, NetlibUser *nlu, NE nlc->proxyAuthNeeded = false;
nlc->proxyType = 0;
mir_free(nlc->szProxyServer); nlc->szProxyServer = NULL;
- if ( !my_connect(nlc, nloc)) {
+ if (!my_connect(nlc, nloc)) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "connect", WSAGetLastError());
return false;
}
@@ -727,41 +727,41 @@ bool NetlibDoConnect(NetlibConnection *nlc) }
if (usingProxy && !((nloc->flags & (NLOCF_HTTP | NLOCF_SSL)) == NLOCF_HTTP && (nlc->proxyType == PROXYTYPE_HTTP || nlc->proxyType == PROXYTYPE_HTTPS))) {
- if ( !WaitUntilWritable(nlc->s, 30000))
+ if (!WaitUntilWritable(nlc->s, 30000))
return false;
switch (nlc->proxyType) {
case PROXYTYPE_SOCKS4:
- if ( !NetlibInitSocks4Connection(nlc, nlu, nloc))
+ if (!NetlibInitSocks4Connection(nlc, nlu, nloc))
return false;
break;
case PROXYTYPE_SOCKS5:
- if ( !NetlibInitSocks5Connection(nlc, nlu, nloc))
+ if (!NetlibInitSocks5Connection(nlc, nlu, nloc))
return false;
break;
case PROXYTYPE_HTTPS:
nlc->proxyAuthNeeded = true;
- if ( !NetlibInitHttpsConnection(nlc, nlu, nloc)) {
+ if (!NetlibInitHttpsConnection(nlc, nlu, nloc)) {
usingProxy = false;
- if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc))
+ if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc))
return false;
}
break;
case PROXYTYPE_HTTP:
nlc->proxyAuthNeeded = true;
- if ( !(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) {
+ if (!(nlu->user.flags & NUF_HTTPGATEWAY || nloc->flags & NLOCF_HTTPGATEWAY) || nloc->flags & NLOCF_SSL) {
//NLOCF_HTTP not specified and no HTTP gateway available: try HTTPS
- if ( !NetlibInitHttpsConnection(nlc, nlu, nloc)) {
+ if (!NetlibInitHttpsConnection(nlc, nlu, nloc)) {
//can't do HTTPS: try direct
usingProxy = false;
- if ( !NetlibHttpFallbackToDirect(nlc, nlu, nloc))
+ if (!NetlibHttpFallbackToDirect(nlc, nlu, nloc))
return false;
}
}
- else if ( !NetlibInitHttpConnection(nlc, nlu, nloc))
+ else if (!NetlibInitHttpConnection(nlc, nlu, nloc))
return false;
break;
@@ -773,7 +773,7 @@ bool NetlibDoConnect(NetlibConnection *nlc) }
}
else if (nloc->flags & NLOCF_HTTPGATEWAY) {
- if ( !NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
+ if (!NetlibInitHttpConnection(nlc, nlu, nloc)) return false;
nlc->usingDirectHttpGateway = true;
}
@@ -804,11 +804,11 @@ bool NetlibReconnect(NetlibConnection *nlc) break;
}
- if ( !opened)
+ if (!opened)
NetlibDoClose(nlc, true);
}
- if ( !opened) {
+ if (!opened) {
if (Miranda_Terminated())
return false;
@@ -850,7 +850,7 @@ INT_PTR NetlibOpenConnection(WPARAM wParam, LPARAM lParam) NetlibInitializeNestedCS(&nlc->ncsSend);
NetlibInitializeNestedCS(&nlc->ncsRecv);
- if ( !NetlibDoConnect(nlc)) {
+ if (!NetlibDoConnect(nlc)) {
FreePartiallyInitedConnection(nlc);
return 0;
}
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp index 208921475d..5d54ef3cde 100644 --- a/src/modules/netlib/netlibopts.cpp +++ b/src/modules/netlib/netlibopts.cpp @@ -166,7 +166,7 @@ static void ChangeSettingIntByCheckbox(HWND hwndDlg, UINT ctrlId, int iUser, int CheckDlgButton(hwndDlg, ctrlId, newValue ? BST_CHECKED : BST_UNCHECKED);
if (iUser == -1) {
for (int i=0; i<tempSettings.getCount(); i++)
- if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
+ if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
*(int*)(((PBYTE)&tempSettings[i]->settings) + memberOffset) = newValue;
}
else *(int*)(((PBYTE)&tempSettings[iUser]->settings) + memberOffset) = newValue;
@@ -180,7 +180,7 @@ static void ChangeSettingStringByEdit(HWND hwndDlg, UINT ctrlId, int iUser, int GetDlgItemTextA(hwndDlg, ctrlId, szNewValue, newValueLen+1);
if (iUser == -1) {
for (int i=0; i<tempSettings.getCount(); i++)
- if ( !(tempSettings[i]->flags & NUF_NOOPTIONS)) {
+ if (!(tempSettings[i]->flags & NUF_NOOPTIONS)) {
char **ppszNew = (char**)(((PBYTE)&tempSettings[i]->settings)+memberOffset);
mir_free(*ppszNew);
*ppszNew = mir_strdup(szNewValue);
@@ -306,7 +306,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS4, settings.proxyType);
AddProxyTypeItem(hwndDlg, PROXYTYPE_SOCKS5, settings.proxyType);
if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTP, settings.proxyType);
- if ( !(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType);
+ if (!(flags & NUF_NOHTTPSOPTION)) AddProxyTypeItem(hwndDlg, PROXYTYPE_HTTPS, settings.proxyType);
if (flags & (NUF_HTTPCONNS | NUF_HTTPGATEWAY) || !(flags & NUF_NOHTTPSOPTION))
AddProxyTypeItem(hwndDlg, PROXYTYPE_IE, settings.proxyType);
SetDlgItemTextA(hwndDlg, IDC_PROXYHOST, settings.szProxyServer?settings.szProxyServer:"");
@@ -344,7 +344,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, EnableMultipleControls(hwndDlg, useProxyControls, SIZEOF(useProxyControls), TRUE);
if (selectedProxyType == 0) {
for (int i=0; i < tempSettings.getCount(); i++) {
- if ( !tempSettings[i]->settings.useProxy ||
+ if (!tempSettings[i]->settings.useProxy ||
tempSettings[i]->flags & NUF_NOOPTIONS || !(tempSettings[i]->flags & NUF_OUTGOING))
continue;
@@ -444,7 +444,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, int newValue = GetDlgItemInt(hwndDlg, LOWORD(wParam), NULL, FALSE);
if (iUser == -1) {
for (int i=0; i < tempSettings.getCount(); i++)
- if ( !(tempSettings[i]->flags & NUF_NOOPTIONS))
+ if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
tempSettings[i]->settings.wProxyPort = newValue;
}
else tempSettings[iUser]->settings.wProxyPort = newValue;
@@ -503,7 +503,7 @@ int NetlibOptInitialise(WPARAM wParam, LPARAM) {
mir_cslock lck(csNetlibUser);
for (int i=0; i < netlibUser.getCount(); i++)
- if ( !(netlibUser[i]->user.flags & NUF_NOOPTIONS))
+ if (!(netlibUser[i]->user.flags & NUF_NOOPTIONS))
++optionsCount;
}
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp index 99a6dcb7c1..9ba78d299a 100644 --- a/src/modules/netlib/netlibpktrecver.cpp +++ b/src/modules/netlib/netlibpktrecver.cpp @@ -75,7 +75,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam, LPARAM lParam) nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
}
if (nlprParam->dwTimeout != INFINITE) {
- if ( !si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
+ if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s, nlprParam->dwTimeout) <= 0) {
*nlprParam = nlpr->packetRecver;
return SOCKET_ERROR;
}
diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 5dcb11d5ab..404453c2d4 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -183,7 +183,7 @@ void NetlibDestroySecurityProvider(HANDLE hSecurity) char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chlsz)
{
- if ( !szChallenge || !szChallenge[0]) return NULL;
+ if (!szChallenge || !szChallenge[0]) return NULL;
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
unsigned char inDataBuffer[1024];
@@ -283,7 +283,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, if (login != NULL && login[0] != '\0' && !hNtlm->hasDomain)
{
NtlmType2packet* pkt = (NtlmType2packet*)token;
- if ( !strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2)
+ if (!strncmp(pkt->sign, "NTLMSSP", 8) && pkt->type == 2)
{
wchar_t* domainName = (wchar_t*)&token[pkt->targetName.offset];
@@ -393,7 +393,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, szOutputToken = mir_base64_encode((PBYTE)outputSecurityToken.pvBuffer, outputSecurityToken.cbBuffer);
}
else {
- if ( !login || !psw) return NULL;
+ if (!login || !psw) return NULL;
char *szLogin = mir_t2a(login);
char *szPassw = mir_t2a(psw);
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index 1bb6a2b936..e3afd442cd 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -39,12 +39,12 @@ INT_PTR NetlibSend(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if ( !NetlibEnterNestedCS(nlc, NLNCS_SEND))
+ if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW))
{
- if ( !(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend)
+ if (!(nlb->flags & MSG_NOHTTPGATEWAYWRAP) && nlc->nlu->user.pfnHttpGatewayWrapSend)
{
NetlibDumpData(nlc, (PBYTE)nlb->buf, nlb->len, 1, nlb->flags);
result = nlc->nlu->user.pfnHttpGatewayWrapSend((HANDLE)nlc, (PBYTE)nlb->buf, nlb->len, nlb->flags | MSG_NOHTTPGATEWAYWRAP, NetlibSend);
@@ -77,7 +77,7 @@ INT_PTR NetlibRecv(WPARAM wParam, LPARAM lParam) return SOCKET_ERROR;
}
- if ( !NetlibEnterNestedCS(nlc, NLNCS_RECV))
+ if (!NetlibEnterNestedCS(nlc, NLNCS_RECV))
return SOCKET_ERROR;
if (nlc->usingHttpGateway && !(nlb->flags & MSG_RAW))
@@ -139,7 +139,7 @@ INT_PTR NetlibSelect(WPARAM, LPARAM lParam) int pending = 0;
fd_set readfd, writefd, exceptfd;
WaitForSingleObject(hConnectionHeaderMutex, INFINITE);
- if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
+ if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
|| !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
|| !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
{
@@ -169,7 +169,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) int pending = 0;
fd_set readfd, writefd, exceptfd;
- if ( !ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
+ if (!ConnectionListToSocketList(nls->hReadConns, &readfd, pending)
|| !ConnectionListToSocketList(nls->hWriteConns, &writefd, pending)
|| !ConnectionListToSocketList(nls->hExceptConns, &exceptfd, pending))
{
@@ -216,7 +216,7 @@ INT_PTR NetlibSelectEx(WPARAM, LPARAM lParam) bool NetlibStringToAddress(const char* str, SOCKADDR_INET_M* addr)
{
- if ( !str) return false;
+ if (!str) return false;
int len = sizeof(SOCKADDR_INET_M);
return !WSAStringToAddressA((char*)str, AF_INET6, NULL, (PSOCKADDR)addr, &len);
@@ -226,7 +226,7 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) {
char saddr[128];
DWORD len = sizeof(saddr);
- if ( !WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
+ if (!WSAAddressToStringA((PSOCKADDR)addr, sizeof(*addr), NULL, saddr, &len))
return mir_strdup(saddr);
if (addr->si_family == AF_INET) {
@@ -242,12 +242,12 @@ char* NetlibAddressToString(SOCKADDR_INET_M* addr) void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo)
{
- if ( !nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return;
+ if (!nlc || !connInfo || connInfo->cbSize < sizeof(NETLIBCONNINFO)) return;
SOCKADDR_INET_M sin = {0};
int len = sizeof(sin);
- if ( !getsockname(nlc->s, (PSOCKADDR)&sin, &len)) {
+ if (!getsockname(nlc->s, (PSOCKADDR)&sin, &len)) {
connInfo->wPort = ntohs(sin.Ipv4.sin_port);
connInfo->dwIpv4 = sin.si_family == AF_INET ? htonl(sin.Ipv4.sin_addr.s_addr) : 0;
@@ -281,7 +281,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
if (ai->ai_family == AF_INET ||
(ai->ai_family == AF_INET6 &&
- ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
+ (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
++n;
}
@@ -294,7 +294,7 @@ static NETLIBIPLIST* GetMyIpv6(unsigned flags) SOCKADDR_INET_M* iaddr = (SOCKADDR_INET_M*)ai->ai_addr;
if (ai->ai_family == AF_INET ||
(ai->ai_family == AF_INET6 &&
- ( !(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
+ (!(flags & 1) || IsAddrGlobal(&iaddr->Ipv6.sin6_addr))))
{
char* szIp = NetlibAddressToString(iaddr);
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp index 7f952b3ab6..eaf961912b 100644 --- a/src/modules/netlib/netlibssl.cpp +++ b/src/modules/netlib/netlibssl.cpp @@ -147,7 +147,7 @@ static bool SSL_library_init(void) WaitForSingleObject(g_hSslMutex, INFINITE);
- if ( !bSslInitDone)
+ if (!bSslInitDone)
{
g_hSchannel = LoadLibraryA("schannel.dll");
if (g_hSchannel)
@@ -203,7 +203,7 @@ BOOL NetlibSslPending(SslHandle *ssl) static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertFlags)
{
- if ( !fnCertGetCertificateChain)
+ if (!fnCertGetCertificateChain)
return true;
static LPSTR rgszUsages[] =
@@ -239,7 +239,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF ChainPara.RequestedUsage.Usage.cUsageIdentifier = SIZEOF(rgszUsages);
ChainPara.RequestedUsage.Usage.rgpszUsageIdentifier = rgszUsages;
- if ( !fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore,
+ if (!fnCertGetCertificateChain(NULL, pServerCert, NULL, pServerCert->hCertStore,
&ChainPara, 0, NULL, &pChainContext))
{
scRet = GetLastError();
@@ -256,7 +256,7 @@ static bool VerifyCertificate(SslHandle *ssl, PCSTR pszServerName, DWORD dwCertF PolicyStatus.cbSize = sizeof(PolicyStatus);
- if ( !fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
+ if (!fnCertVerifyCertificateChainPolicy(CERT_CHAIN_POLICY_SSL, pChainContext,
&PolicyPara, &PolicyStatus))
{
scRet = GetLastError();
@@ -566,7 +566,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) DWORD dwFlags = 0;
- if ( !host || inet_addr(host) != INADDR_NONE)
+ if (!host || inet_addr(host) != INADDR_NONE)
dwFlags |= 0x00001000;
bool res = SSL_library_init();
@@ -574,7 +574,7 @@ SslHandle *NetlibSslConnect(SOCKET s, const char* host, int verify) if (res) res = ClientConnect(ssl, host);
if (res && verify) res = VerifyCertificate(ssl, host, dwFlags);
- if ( !res)
+ if (!res)
{
NetlibSslFree(ssl);
ssl = NULL;
@@ -664,7 +664,7 @@ static int NetlibSslReadSetResult(SslHandle *ssl, char *buf, int num, int peek) int rbytes = ssl->cbRecDataBuf - bytes;
memcpy(buf, ssl->pbRecDataBuf, bytes);
- if ( !peek)
+ if (!peek)
{
memmove(ssl->pbRecDataBuf, ssl->pbRecDataBuf + bytes, rbytes);
ssl->cbRecDataBuf = rbytes;
@@ -689,7 +689,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek) if (num <= 0) return 0;
- if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && ( !peek || ssl->cbRecDataBuf >= num)))
+ if (ssl->state != sockOpen || (ssl->cbRecDataBuf != 0 && (!peek || ssl->cbRecDataBuf >= num)))
{
return NetlibSslReadSetResult(ssl, buf, num, peek);
}
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index c0364adbbb..b10278e1dd 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -236,7 +236,7 @@ static void validateSocket(void) break;
}
- if ( !opened)
+ if (!opened)
closeRouterConnection();
}
@@ -350,7 +350,7 @@ retrycon: NetlibLogf(NULL, "UPnP connect timeout");
break;
}
- else if ( !FD_ISSET(sock, &wfd))
+ else if (!FD_ISSET(sock, &wfd))
{
closeRouterConnection();
NetlibLogf(NULL, "UPnP connect failed");
@@ -807,7 +807,7 @@ void NetlibUPnPCleanup(void*) break;
}
- if ( !incoming)
+ if (!incoming)
return;
}
@@ -837,10 +837,10 @@ void NetlibUPnPCleanup(void*) if (httpTransact(szCtlUrl, szData, 4096, "GetGenericPortMappingEntry", ControlAction) != 200)
break;
- if ( !txtParseParam(szData, "<NewPortMappingDescription", ">", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0)
+ if (!txtParseParam(szData, "<NewPortMappingDescription", ">", "<", buf, sizeof(buf)) || strcmp(buf, "Miranda") != 0)
continue;
- if ( !txtParseParam(szData, "<NewInternalClient", ">", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0)
+ if (!txtParseParam(szData, "<NewInternalClient", ">", "<", buf, sizeof(buf)) || strcmp(buf, lip) != 0)
continue;
if (txtParseParam(szData, "<NewExternalPort", ">", "<", buf, sizeof(buf)))
|