summaryrefslogtreecommitdiff
path: root/src/modules/netlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/netlib')
-rw-r--r--src/modules/netlib/netlib.cpp82
-rw-r--r--src/modules/netlib/netlibautoproxy.cpp2
-rw-r--r--src/modules/netlib/netlibbind.cpp4
-rw-r--r--src/modules/netlib/netlibhttp.cpp18
-rw-r--r--src/modules/netlib/netlibhttpproxy.cpp2
-rw-r--r--src/modules/netlib/netliblog.cpp24
-rw-r--r--src/modules/netlib/netlibopenconn.cpp16
-rw-r--r--src/modules/netlib/netlibopts.cpp88
-rw-r--r--src/modules/netlib/netlibpktrecver.cpp16
-rw-r--r--src/modules/netlib/netlibssl.cpp2
-rw-r--r--src/modules/netlib/netlibupnp.cpp4
11 files changed, 129 insertions, 129 deletions
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp
index 1a6a583679..ed084b523d 100644
--- a/src/modules/netlib/netlib.cpp
+++ b/src/modules/netlib/netlib.cpp
@@ -69,13 +69,13 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which)
DWORD dwCurrentThreadId=GetCurrentThreadId();
WaitForSingleObject(hConnectionHeaderMutex,INFINITE);
- if(nlc==NULL || nlc->handleType!=NLH_CONNECTION) {
+ if (nlc==NULL || nlc->handleType!=NLH_CONNECTION) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
nlncs = (which == NLNCS_SEND) ? &nlc->ncsSend : &nlc->ncsRecv;
- if(nlncs->lockCount && nlncs->dwOwningThreadId==dwCurrentThreadId) {
+ if (nlncs->lockCount && nlncs->dwOwningThreadId==dwCurrentThreadId) {
nlncs->lockCount++;
ReleaseMutex(hConnectionHeaderMutex);
return 1;
@@ -86,14 +86,14 @@ int NetlibEnterNestedCS(struct NetlibConnection *nlc,int which)
WaitForSingleObject(nlncs->hMutex,INFINITE);
nlncs->dwOwningThreadId=dwCurrentThreadId;
nlncs->lockCount=1;
- if(InterlockedDecrement(&nlc->dontCloseNow)==0)
+ if (InterlockedDecrement(&nlc->dontCloseNow)==0)
SetEvent(nlc->hOkToCloseEvent);
return 1;
}
void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs)
{
- if(--nlncs->lockCount==0) {
+ if (--nlncs->lockCount==0) {
nlncs->dwOwningThreadId=0;
ReleaseMutex(nlncs->hMutex);
}
@@ -102,27 +102,27 @@ void NetlibLeaveNestedCS(struct NetlibNestedCriticalSection *nlncs)
static INT_PTR GetNetlibUserSettingInt(const char *szUserModule,const char *szSetting,int defValue)
{
DBVARIANT dbv;
- if(DBGetContactSetting(NULL,szUserModule,szSetting,&dbv)
+ if (DBGetContactSetting(NULL,szUserModule,szSetting,&dbv)
&& DBGetContactSetting(NULL,"Netlib",szSetting,&dbv))
return defValue;
- if(dbv.type==DBVT_BYTE) return dbv.bVal;
- if(dbv.type==DBVT_WORD) return dbv.wVal;
+ if (dbv.type==DBVT_BYTE) return dbv.bVal;
+ if (dbv.type==DBVT_WORD) return dbv.wVal;
return dbv.dVal;
}
static char *GetNetlibUserSettingString(const char *szUserModule,const char *szSetting,int decode)
{
DBVARIANT dbv;
- if(DBGetContactSettingString(NULL,szUserModule,szSetting,&dbv)
+ if (DBGetContactSettingString(NULL,szUserModule,szSetting,&dbv)
&& DBGetContactSettingString(NULL,"Netlib",szSetting,&dbv)) {
return NULL;
}
else {
char *szRet;
- if(decode) CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
+ if (decode) CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal);
szRet=mir_strdup(dbv.pszVal);
DBFreeVariant(&dbv);
- if(szRet==NULL) SetLastError(ERROR_OUTOFMEMORY);
+ if (szRet==NULL) SetLastError(ERROR_OUTOFMEMORY);
return szRet;
}
}
@@ -132,7 +132,7 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
NETLIBUSER *nlu=(NETLIBUSER*)lParam;
struct NetlibUser *thisUser;
- if(nlu==NULL || nlu->cbSize!=sizeof(NETLIBUSER) || nlu->szSettingsModule==NULL
+ if (nlu==NULL || nlu->cbSize!=sizeof(NETLIBUSER) || nlu->szSettingsModule==NULL
|| (!(nlu->flags&NUF_NOOPTIONS) && nlu->szDescriptiveName==NULL)
|| (nlu->flags&NUF_HTTPGATEWAY && (nlu->pfnHttpGatewayInit==NULL))) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -156,7 +156,7 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
if (nlu->szDescriptiveName) {
thisUser->user.ptszDescriptiveName = (thisUser->user.flags&NUF_UNICODE ? mir_u2t((WCHAR*)nlu->ptszDescriptiveName) : mir_a2t(nlu->szDescriptiveName));
}
- if((thisUser->user.szSettingsModule=mir_strdup(nlu->szSettingsModule))==NULL
+ if ((thisUser->user.szSettingsModule=mir_strdup(nlu->szSettingsModule))==NULL
|| (nlu->szDescriptiveName && thisUser->user.ptszDescriptiveName ==NULL)
|| (nlu->szHttpGatewayUserAgent && (thisUser->user.szHttpGatewayUserAgent=mir_strdup(nlu->szHttpGatewayUserAgent))==NULL))
{
@@ -172,9 +172,9 @@ static INT_PTR NetlibRegisterUser(WPARAM,LPARAM lParam)
thisUser->settings.cbSize=sizeof(NETLIBUSERSETTINGS);
thisUser->settings.useProxy=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLUseProxy",0);
thisUser->settings.proxyType=GetNetlibUserSettingInt(thisUser->user.szSettingsModule,"NLProxyType",PROXYTYPE_SOCKS5);
- if(thisUser->user.flags&NUF_NOHTTPSOPTION && thisUser->settings.proxyType==PROXYTYPE_HTTPS)
+ 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;
}
@@ -204,7 +204,7 @@ static INT_PTR NetlibGetUserSettings(WPARAM wParam,LPARAM lParam)
NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
- if(GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -217,7 +217,7 @@ static INT_PTR NetlibSetUserSettings(WPARAM wParam,LPARAM lParam)
NETLIBUSERSETTINGS *nlus=(NETLIBUSERSETTINGS*)lParam;
struct NetlibUser *nlu=(struct NetlibUser*)wParam;
- if(GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
+ if (GetNetlibHandleType(nlu)!=NLH_USER || nlus==NULL || nlus->cbSize!=sizeof(NETLIBUSERSETTINGS)) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
@@ -274,7 +274,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
}
else
{
- if(nlc->s != INVALID_SOCKET) {
+ if (nlc->s != INVALID_SOCKET) {
NetlibDoClose(nlc);
}
if (nlc->s2 != INVALID_SOCKET) closesocket(nlc->s2);
@@ -287,7 +287,7 @@ INT_PTR NetlibCloseHandle(WPARAM wParam, LPARAM)
waitHandles[2]=nlc->ncsRecv.hMutex;
waitHandles[3]=nlc->ncsSend.hMutex;
waitResult=WaitForMultipleObjects( SIZEOF(waitHandles),waitHandles,TRUE,INFINITE);
- if(waitResult<WAIT_OBJECT_0 || waitResult >= WAIT_OBJECT_0 + SIZEOF(waitHandles)) {
+ if (waitResult<WAIT_OBJECT_0 || waitResult >= WAIT_OBJECT_0 + SIZEOF(waitHandles)) {
ReleaseMutex(hConnectionHeaderMutex);
SetLastError(ERROR_INVALID_PARAMETER); //already been closed
return 0;
@@ -415,11 +415,11 @@ INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam)
unsigned char *pszIn,*pszOut;
int outputLen;
- if(szInput==NULL) {
+ if (szInput==NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return (INT_PTR)(char*)NULL;
}
- for(outputLen=0,pszIn=szInput;*pszIn;pszIn++) {
+ for (outputLen=0,pszIn=szInput;*pszIn;pszIn++) {
if ( (48 <= *pszIn && *pszIn <= 57) ||//0-9
(65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ
(97 <= *pszIn && *pszIn <= 122) ||//abc...xyz
@@ -427,16 +427,16 @@ INT_PTR NetlibHttpUrlEncode(WPARAM,LPARAM lParam)
else outputLen+=3;
}
szOutput=(unsigned char*)HeapAlloc(GetProcessHeap(),0,outputLen+1);
- if(szOutput==NULL) {
+ if (szOutput==NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return (INT_PTR)(unsigned char*)NULL;
}
- for(pszOut=szOutput,pszIn=szInput;*pszIn;pszIn++) {
+ for (pszOut=szOutput,pszIn=szInput;*pszIn;pszIn++) {
if ( (48 <= *pszIn && *pszIn <= 57) ||
(65 <= *pszIn && *pszIn <= 90) ||
(97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
- else if(*pszIn==' ') *pszOut++='+';
+ else if (*pszIn==' ') *pszOut++='+';
else {
*pszOut++='%';
*pszOut++=szHexDigits[*pszIn>>4];
@@ -455,18 +455,18 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam)
char *pszOut;
PBYTE pbIn;
- if(nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
+ if (nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if(nlb64->cchEncoded<Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded)) {
+ if (nlb64->cchEncoded<Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded)) {
SetLastError(ERROR_BUFFER_OVERFLOW);
return 0;
}
nlb64->cchEncoded=Netlib_GetBase64EncodedBufferSize(nlb64->cbDecoded);
- for(iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3,pbIn+=3,pszOut+=4) {
+ for (iIn=0,pbIn=nlb64->pbDecoded,pszOut=nlb64->pszEncoded;iIn<nlb64->cbDecoded;iIn+=3,pbIn+=3,pszOut+=4) {
pszOut[0]=base64chars[pbIn[0]>>2];
- if(nlb64->cbDecoded-iIn==1) {
+ if (nlb64->cbDecoded-iIn==1) {
pszOut[1]=base64chars[(pbIn[0]&3)<<4];
pszOut[2]='=';
pszOut[3]='=';
@@ -474,7 +474,7 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam)
break;
}
pszOut[1]=base64chars[((pbIn[0]&3)<<4)|(pbIn[1]>>4)];
- if(nlb64->cbDecoded-iIn==2) {
+ if (nlb64->cbDecoded-iIn==2) {
pszOut[2]=base64chars[(pbIn[1]&0xF)<<2];
pszOut[3]='=';
pszOut+=4;
@@ -489,12 +489,12 @@ INT_PTR NetlibBase64Encode(WPARAM, LPARAM lParam)
static BYTE Base64CharToInt(char c)
{
- if(c>='A' && c<='Z') return c-'A';
- if(c>='a' && c<='z') return c-'a'+26;
- if(c>='0' && c<='9') return c-'0'+52;
- if(c=='+') return 62;
- if(c=='/') return 63;
- if(c=='=') return 64;
+ if (c>='A' && c<='Z') return c-'A';
+ if (c>='a' && c<='z') return c-'a'+26;
+ if (c>='0' && c<='9') return c-'0'+52;
+ if (c=='+') return 62;
+ if (c=='/') return 63;
+ if (c=='=') return 64;
return 255;
}
@@ -506,32 +506,32 @@ INT_PTR NetlibBase64Decode(WPARAM, LPARAM lParam)
BYTE b1,b2,b3,b4;
int iIn;
- if(nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
+ if (nlb64==NULL || nlb64->pszEncoded==NULL || nlb64->pbDecoded==NULL) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if(nlb64->cchEncoded&3) {
+ if (nlb64->cchEncoded&3) {
SetLastError(ERROR_INVALID_DATA);
return 0;
}
- if(nlb64->cbDecoded<Netlib_GetBase64DecodedBufferSize(nlb64->cchEncoded)) {
+ if (nlb64->cbDecoded<Netlib_GetBase64DecodedBufferSize(nlb64->cchEncoded)) {
SetLastError(ERROR_BUFFER_OVERFLOW);
return 0;
}
nlb64->cbDecoded=Netlib_GetBase64DecodedBufferSize(nlb64->cchEncoded);
- for(iIn=0,pszIn=nlb64->pszEncoded,pbOut=nlb64->pbDecoded;iIn<nlb64->cchEncoded;iIn+=4,pszIn+=4,pbOut+=3) {
+ for (iIn=0,pszIn=nlb64->pszEncoded,pbOut=nlb64->pbDecoded;iIn<nlb64->cchEncoded;iIn+=4,pszIn+=4,pbOut+=3) {
b1=Base64CharToInt(pszIn[0]);
b2=Base64CharToInt(pszIn[1]);
b3=Base64CharToInt(pszIn[2]);
b4=Base64CharToInt(pszIn[3]);
- if(b1==255 || b1==64 || b2==255 || b2==64 || b3==255 || b4==255) {
+ if (b1==255 || b1==64 || b2==255 || b2==64 || b3==255 || b4==255) {
SetLastError(ERROR_INVALID_DATA);
return 0;
}
pbOut[0]=(b1<<2)|(b2>>4);
- if(b3==64) {nlb64->cbDecoded-=2; break;}
+ if (b3==64) {nlb64->cbDecoded-=2; break;}
pbOut[1]=(b2<<4)|(b3>>2);
- if(b4==64) {nlb64->cbDecoded--; break;}
+ if (b4==64) {nlb64->cbDecoded--; break;}
pbOut[2]=b4|(b3<<6);
}
return 1;
diff --git a/src/modules/netlib/netlibautoproxy.cpp b/src/modules/netlib/netlibautoproxy.cpp
index 173faa138d..21f841ff3c 100644
--- a/src/modules/netlib/netlibautoproxy.cpp
+++ b/src/modules/netlib/netlibautoproxy.cpp
@@ -425,7 +425,7 @@ void NetlibLoadIeProxy(void)
}
char* szProxyBypass = szProxyBypassStr;
- for(;;)
+ for (;;)
{
char *szProxyBypassEnd = strchr(szProxyBypass, ';');
if (szProxyBypassEnd) *szProxyBypassEnd = 0;
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp
index d1133f9514..3f28551434 100644
--- a/src/modules/netlib/netlibbind.cpp
+++ b/src/modules/netlib/netlibbind.cpp
@@ -53,13 +53,13 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn)
char *pszEnd;
int portMin, portMax, port, portnum = 0;
- for(psz=szPorts;*psz;)
+ for (psz=szPorts;*psz;)
{
while (*psz == ' ' || *psz == ',') psz++;
portMin = strtol(psz, &pszEnd, 0);
if (pszEnd == psz) break;
while (*pszEnd == ' ') pszEnd++;
- if(*pszEnd == '-')
+ if (*pszEnd == '-')
{
psz = pszEnd + 1;
portMax = strtol(psz, &pszEnd, 0);
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp
index 8fba0eed1c..d0be2f35b2 100644
--- a/src/modules/netlib/netlibhttp.cpp
+++ b/src/modules/netlib/netlibhttp.cpp
@@ -100,7 +100,7 @@ static void AppendToCharBuffer(struct ResizableCharBuffer *rcb, const char *fmt,
for (;;)
{
charsDone = mir_vsnprintf(rcb->sz + rcb->iEnd, rcb->cbAlloced-rcb->iEnd, fmt, va);
- if(charsDone >= 0) break;
+ if (charsDone >= 0) break;
rcb->cbAlloced += 512;
rcb->sz = (char*)mir_realloc(rcb->sz, rcb->cbAlloced);
}
@@ -333,7 +333,7 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, DWORD dwTimeoutTime,
char buffer[2048];
char *peol;
- for(;;)
+ for (;;)
{
bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, SIZEOF(buffer) - 1,
MSG_PEEK | recvFlags);
@@ -402,7 +402,7 @@ static int SendHttpRequestAndData(struct NetlibConnection *nlc,struct ResizableC
{
bool sendData = (nlhr->requestType==REQUEST_POST || nlhr->requestType==REQUEST_PUT);
- if(sendContentLengthHeader && sendData)
+ if (sendContentLengthHeader && sendData)
AppendToCharBuffer(httpRequest,"Content-Length: %d\r\n\r\n", nlhr->dataLength);
else
AppendToCharBuffer(httpRequest,"\r\n");
@@ -822,10 +822,10 @@ INT_PTR NetlibHttpFreeRequestStruct(WPARAM, LPARAM lParam)
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- if(nlhr->headers)
+ if (nlhr->headers)
{
int i;
- for(i=0; i<nlhr->headersCount; i++)
+ for (i=0; i<nlhr->headersCount; i++)
{
mir_free(nlhr->headers[i].szName);
mir_free(nlhr->headers[i].szValue);
@@ -850,7 +850,7 @@ INT_PTR NetlibHttpRecvHeaders(WPARAM wParam,LPARAM lParam)
int headersCount = 0, bufferSize = 8192;
bool headersCompleted = false;
- if(!NetlibEnterNestedCS(nlc,NLNCS_RECV))
+ if (!NetlibEnterNestedCS(nlc,NLNCS_RECV))
return 0;
dwRequestTimeoutTime = GetTickCount() + HTTPRECVDATATIMEOUT;
@@ -999,7 +999,7 @@ INT_PTR NetlibHttpTransaction(WPARAM wParam, LPARAM lParam)
++nlhrSend.headersCount;
CallService(MS_SYSTEM_GETVERSIONTEXT,SIZEOF(szMirandaVer),(LPARAM)szMirandaVer);
pspace=strchr(szMirandaVer,' ');
- if(pspace)
+ if (pspace)
{
*pspace++ = '\0';
mir_snprintf(szUserAgent, SIZEOF(szUserAgent), "Miranda/%s (%s)", szMirandaVer, pspace);
@@ -1217,7 +1217,7 @@ next:
while (chunksz != 0)
{
- for(;;)
+ for (;;)
{
recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT,
nlhrReply->pData + nlhrReply->dataLength,
@@ -1242,7 +1242,7 @@ next:
{
dataBufferAlloced += 2048;
nlhrReply->pData = (char*)mir_realloc(nlhrReply->pData, dataBufferAlloced);
- if(nlhrReply->pData == NULL)
+ if (nlhrReply->pData == NULL)
{
SetLastError(ERROR_OUTOFMEMORY);
NetlibHttpFreeRequestStruct(0, (LPARAM)nlhrReply);
diff --git a/src/modules/netlib/netlibhttpproxy.cpp b/src/modules/netlib/netlibhttpproxy.cpp
index decef4e285..fa6c2368b5 100644
--- a/src/modules/netlib/netlibhttpproxy.cpp
+++ b/src/modules/netlib/netlibhttpproxy.cpp
@@ -461,7 +461,7 @@ int NetlibInitHttpConnection(struct NetlibConnection *nlc, struct NetlibUser *nl
/*
* Gena01 - Ok, we should be able to use just POST. Needed for Yahoo, NO GET requests
*/
- if(nlc->nlhpi.szHttpPostUrl == NULL)
+ if (nlc->nlhpi.szHttpPostUrl == NULL)
{
SetLastError(ERROR_BAD_FORMAT);
return 0;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp
index 4dced62c5c..d974406047 100644
--- a/src/modules/netlib/netliblog.cpp
+++ b/src/modules/netlib/netliblog.cpp
@@ -78,7 +78,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
CheckDlgButton(hwndDlg,IDC_TEXTDUMPS,logOptions.textDumps?BST_CHECKED:BST_UNCHECKED);
CheckDlgButton(hwndDlg,IDC_AUTODETECTTEXT,logOptions.autoDetectText?BST_CHECKED:BST_UNCHECKED);
{ int i;
- for( i=0; i < SIZEOF(szTimeFormats); i++ )
+ for ( i=0; i < SIZEOF(szTimeFormats); i++ )
SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_ADDSTRING,0,(LPARAM)TranslateTS( szTimeFormats[i] ));
}
SendDlgItemMessage(hwndDlg,IDC_TIMEFORMAT,CB_SETCURSEL,logOptions.timeFormat,0);
@@ -89,7 +89,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
SetDlgItemText(hwndDlg,IDC_PATH,logOptions.szFile);
CheckDlgButton(hwndDlg,IDC_SHOWTHISDLGATSTART,DBGetContactSettingByte(NULL, "Netlib", "ShowLogOptsAtStart",0)?BST_CHECKED:BST_UNCHECKED);
{ DBVARIANT dbv;
- if(!DBGetContactSettingString(NULL, "Netlib", "RunAtStart",&dbv)) {
+ if (!DBGetContactSettingString(NULL, "Netlib", "RunAtStart",&dbv)) {
SetDlgItemTextA(hwndDlg,IDC_RUNATSTART,dbv.pszVal);
DBFreeVariant(&dbv);
}
@@ -137,8 +137,8 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
break;
*/
case IDC_FILENAME:
- if(HIWORD(wParam)!=EN_CHANGE) break;
- if((HWND)lParam==GetFocus())
+ if (HIWORD(wParam)!=EN_CHANGE) break;
+ if ((HWND)lParam==GetFocus())
CheckDlgButton(hwndDlg,IDC_TOFILE,BST_CHECKED);
{
@@ -178,11 +178,11 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
ofn.nMaxFile=SIZEOF(str)-2;
ofn.nMaxFileTitle=MAX_PATH;
if (LOWORD(wParam)==IDC_FILENAMEBROWSE) {
- if(!GetSaveFileName(&ofn)) return 1;
+ if (!GetSaveFileName(&ofn)) return 1;
} else {
- if(!GetOpenFileName(&ofn)) return 1;
+ if (!GetOpenFileName(&ofn)) return 1;
}
- if(LOWORD(wParam)==IDC_RUNATSTARTBROWSE && _tcschr(str,' ')!=NULL) {
+ if (LOWORD(wParam)==IDC_RUNATSTARTBROWSE && _tcschr(str,' ')!=NULL) {
MoveMemory(str+1,str,SIZEOF(str)-2);
str[0]='"';
lstrcat(str,_T("\""));
@@ -196,7 +196,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
PROCESS_INFORMATION pi;
GetDlgItemText(hwndDlg,IDC_RUNATSTART,str,MAX_PATH);
si.cb=sizeof(si);
- if(str[0]) CreateProcess(NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
+ if (str[0]) CreateProcess(NULL,str,NULL,NULL,FALSE,0,NULL,NULL,&si,&pi);
}
break;
case IDC_SAVE:
@@ -298,7 +298,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg,UINT message,WPARAM wPara
void NetlibLogShowOptions(void)
{
- if(logOptions.hwndOpts==NULL)
+ if (logOptions.hwndOpts==NULL)
logOptions.hwndOpts=CreateDialog(hMirandaInst,MAKEINTRESOURCE(IDD_NETLIBLOGOPTS),NULL,LogOptionsDlgProc);
SetForegroundWindow(logOptions.hwndOpts);
}
@@ -362,14 +362,14 @@ static INT_PTR NetlibLog(WPARAM wParam, LPARAM lParam)
szTime[0] = '\0';
break;
}
- if(logOptions.timeFormat || logOptions.showUser)
+ if (logOptions.timeFormat || logOptions.showUser)
mir_snprintf(szHead, SIZEOF(szHead) - 1, "[%s%s%s] ", szTime,
(logOptions.showUser && logOptions.timeFormat) ? " " : "",
logOptions.showUser ? nlu->user.szSettingsModule : "");
else
szHead[0]=0;
- if(logOptions.toOutputDebugString)
+ if (logOptions.toOutputDebugString)
{
if (szHead[0])
OutputDebugStringA(szHead);
@@ -488,7 +488,7 @@ void NetlibDumpData(struct NetlibConnection *nlc,PBYTE buf,int len,int sent,int
if (logOptions.autoDetectText)
{
int i;
- for(i = 0; i<len; i++)
+ for (i = 0; i<len; i++)
{
if ((buf[i]<' ' && buf[i]!='\t' && buf[i]!='\r' && buf[i]!='\n') || buf[i]>=0x80)
{
diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp
index 5ee3200308..086269c021 100644
--- a/src/modules/netlib/netlibopenconn.cpp
+++ b/src/modules/netlib/netlibopenconn.cpp
@@ -168,7 +168,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
buf[0]=5; //yep, socks5
buf[1]=1; //one auth method
buf[2]=nlu->settings.useProxyAuth?2:0;
- if(NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)buf,3,MSG_DUMPPROXY)==SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
return 0;
}
@@ -178,13 +178,13 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
return 0;
}
- if((buf[1]!=0 && buf[1]!=2)) {
+ if ((buf[1]!=0 && buf[1]!=2)) {
SetLastError(ERROR_INVALID_ID_AUTHORITY);
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLRecv",GetLastError());
return 0;
}
- if(buf[1]==2) { //rfc1929
+ if (buf[1]==2) { //rfc1929
int nUserLen,nPassLen;
PBYTE pAuthBuf;
@@ -196,7 +196,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
memcpy(pAuthBuf+2,nlu->settings.szProxyAuthUser,nUserLen);
pAuthBuf[2+nUserLen]=nPassLen;
memcpy(pAuthBuf+3+nUserLen,nlu->settings.szProxyAuthPassword,nPassLen);
- if(NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)pAuthBuf,3+nUserLen+nPassLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
mir_free(pAuthBuf);
return 0;
@@ -207,7 +207,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
return 0;
}
- if(buf[1]) {
+ if (buf[1]) {
SetLastError(ERROR_ACCESS_DENIED);
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"RecvUntilTimeout",GetLastError());
return 0;
@@ -222,7 +222,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
if (nlc->dnsThroughProxy)
{
hostIP = inet_addr(nloc->szHost);
- if(hostIP == INADDR_NONE)
+ if (hostIP == INADDR_NONE)
nHostLen = lstrlenA(nloc->szHost)+1;
else nHostLen = 4;
}
@@ -237,7 +237,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
pInit[0]=5; //SOCKS5
pInit[1]= nloc->flags & NLOCF_UDP ? 3 : 1; //connect or UDP
pInit[2]=0; //reserved
- if(hostIP==INADDR_NONE) { //DNS lookup through proxy
+ if (hostIP==INADDR_NONE) { //DNS lookup through proxy
pInit[3]=3;
pInit[4]=nHostLen-1;
memcpy(pInit+5,nloc->szHost,nHostLen-1);
@@ -247,7 +247,7 @@ static int NetlibInitSocks5Connection(struct NetlibConnection *nlc,struct Netlib
*(PDWORD)(pInit+4)=hostIP;
}
*(PWORD)(pInit+4+nHostLen)=htons(nloc->wPort);
- if(NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
+ if (NLSend(nlc,(char*)pInit,6+nHostLen,MSG_DUMPPROXY)==SOCKET_ERROR) {
NetlibLogf(nlu,"%s %d: %s() failed (%u)",__FILE__,__LINE__,"NLSend",GetLastError());
mir_free(pInit);
return 0;
diff --git a/src/modules/netlib/netlibopts.cpp b/src/modules/netlib/netlibopts.cpp
index 7a74c8612f..0988f5d552 100644
--- a/src/modules/netlib/netlibopts.cpp
+++ b/src/modules/netlib/netlibopts.cpp
@@ -74,13 +74,13 @@ static const WORD oftenProxyPorts[]={1080,1080,1080,8080,8080,8080};
static void ShowMultipleControls(HWND hwndDlg,const UINT *controls,int cControls,int state)
{
int i;
- for(i=0;i<cControls;i++) ShowWindow(GetDlgItem(hwndDlg,controls[i]),state);
+ for (i=0;i<cControls;i++) ShowWindow(GetDlgItem(hwndDlg,controls[i]),state);
}
static void EnableMultipleControls(HWND hwndDlg,const UINT *controls,int cControls,int state)
{
int i;
- for(i=0;i<cControls;i++) EnableWindow(GetDlgItem(hwndDlg,controls[i]),state);
+ for (i=0;i<cControls;i++) EnableWindow(GetDlgItem(hwndDlg,controls[i]),state);
}
static void AddProxyTypeItem(HWND hwndDlg,int type,int selectType)
@@ -94,32 +94,32 @@ static void AddProxyTypeItem(HWND hwndDlg,int type,int selectType)
static void CopySettingsStruct(NETLIBUSERSETTINGS *dest,NETLIBUSERSETTINGS *source)
{
*dest=*source;
- if(dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
- if(dest->szOutgoingPorts) dest->szOutgoingPorts=mir_strdup(dest->szOutgoingPorts);
- if(dest->szProxyAuthPassword) dest->szProxyAuthPassword=mir_strdup(dest->szProxyAuthPassword);
- if(dest->szProxyAuthUser) dest->szProxyAuthUser=mir_strdup(dest->szProxyAuthUser);
- if(dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer);
+ if (dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
+ if (dest->szOutgoingPorts) dest->szOutgoingPorts=mir_strdup(dest->szOutgoingPorts);
+ if (dest->szProxyAuthPassword) dest->szProxyAuthPassword=mir_strdup(dest->szProxyAuthPassword);
+ if (dest->szProxyAuthUser) dest->szProxyAuthUser=mir_strdup(dest->szProxyAuthUser);
+ if (dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer);
}
static void CombineSettingsStrings(char **dest,char **source)
{
- if(*dest!=NULL && (*source==NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;}
+ if (*dest!=NULL && (*source==NULL || lstrcmpiA(*dest,*source))) {mir_free(*dest); *dest=NULL;}
}
static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NETLIBUSERSETTINGS *source,DWORD sourceFlags)
{
- if(sourceFlags&NUF_OUTGOING) {
- if(*destFlags&NUF_OUTGOING) {
- if(dest->validateSSL!=source->validateSSL) dest->validateSSL=2;
- if(dest->useProxy!=source->useProxy) dest->useProxy=2;
- if(dest->proxyType!=source->proxyType) dest->proxyType=0;
+ if (sourceFlags&NUF_OUTGOING) {
+ if (*destFlags&NUF_OUTGOING) {
+ if (dest->validateSSL!=source->validateSSL) dest->validateSSL=2;
+ if (dest->useProxy!=source->useProxy) dest->useProxy=2;
+ if (dest->proxyType!=source->proxyType) dest->proxyType=0;
CombineSettingsStrings(&dest->szProxyServer,&source->szProxyServer);
- if(dest->wProxyPort!=source->wProxyPort) dest->wProxyPort=0;
- if(dest->useProxyAuth!=source->useProxyAuth) dest->useProxyAuth=2;
+ if (dest->wProxyPort!=source->wProxyPort) dest->wProxyPort=0;
+ if (dest->useProxyAuth!=source->useProxyAuth) dest->useProxyAuth=2;
CombineSettingsStrings(&dest->szProxyAuthUser,&source->szProxyAuthUser);
CombineSettingsStrings(&dest->szProxyAuthPassword,&source->szProxyAuthPassword);
- if(dest->dnsThroughProxy!=source->dnsThroughProxy) dest->dnsThroughProxy=2;
- if(dest->specifyOutgoingPorts!=source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2;
+ if (dest->dnsThroughProxy!=source->dnsThroughProxy) dest->dnsThroughProxy=2;
+ if (dest->specifyOutgoingPorts!=source->specifyOutgoingPorts) dest->specifyOutgoingPorts=2;
CombineSettingsStrings(&dest->szOutgoingPorts,&source->szOutgoingPorts);
}
else {
@@ -127,33 +127,33 @@ static void CombineSettingsStructs(NETLIBUSERSETTINGS *dest,DWORD *destFlags,NET
dest->useProxy=source->useProxy;
dest->proxyType=source->proxyType;
dest->szProxyServer=source->szProxyServer;
- if(dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer);
+ if (dest->szProxyServer) dest->szProxyServer=mir_strdup(dest->szProxyServer);
dest->wProxyPort=source->wProxyPort;
dest->useProxyAuth=source->useProxyAuth;
dest->szProxyAuthUser=source->szProxyAuthUser;
- if(dest->szProxyAuthUser) dest->szProxyAuthUser=mir_strdup(dest->szProxyAuthUser);
+ if (dest->szProxyAuthUser) dest->szProxyAuthUser=mir_strdup(dest->szProxyAuthUser);
dest->szProxyAuthPassword=source->szProxyAuthPassword;
- if(dest->szProxyAuthPassword) dest->szProxyAuthPassword=mir_strdup(dest->szProxyAuthPassword);
+ if (dest->szProxyAuthPassword) dest->szProxyAuthPassword=mir_strdup(dest->szProxyAuthPassword);
dest->dnsThroughProxy=source->dnsThroughProxy;
dest->specifyOutgoingPorts=source->specifyOutgoingPorts;
dest->szOutgoingPorts=source->szOutgoingPorts;
if (dest->szOutgoingPorts) dest->szOutgoingPorts=mir_strdup(dest->szOutgoingPorts);
}
}
- if(sourceFlags&NUF_INCOMING) {
- if(*destFlags&NUF_INCOMING) {
- if(dest->enableUPnP!=source->enableUPnP) dest->enableUPnP=2;
- if(dest->specifyIncomingPorts!=source->specifyIncomingPorts) dest->specifyIncomingPorts=2;
+ if (sourceFlags&NUF_INCOMING) {
+ if (*destFlags&NUF_INCOMING) {
+ if (dest->enableUPnP!=source->enableUPnP) dest->enableUPnP=2;
+ if (dest->specifyIncomingPorts!=source->specifyIncomingPorts) dest->specifyIncomingPorts=2;
CombineSettingsStrings(&dest->szIncomingPorts,&source->szIncomingPorts);
}
else {
dest->enableUPnP=source->enableUPnP;
dest->specifyIncomingPorts=source->specifyIncomingPorts;
dest->szIncomingPorts=source->szIncomingPorts;
- if(dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
+ if (dest->szIncomingPorts) dest->szIncomingPorts=mir_strdup(dest->szIncomingPorts);
}
}
- if((*destFlags&NUF_NOHTTPSOPTION)!=(sourceFlags&NUF_NOHTTPSOPTION))
+ if ((*destFlags&NUF_NOHTTPSOPTION)!=(sourceFlags&NUF_NOHTTPSOPTION))
*destFlags=(*destFlags|sourceFlags)&~NUF_NOHTTPSOPTION;
else *destFlags|=sourceFlags;
}
@@ -188,21 +188,21 @@ static void ChangeSettingStringByEdit(HWND hwndDlg,UINT ctrlId,int iUser,int mem
if (!(tempSettings[i]->flags & NUF_NOOPTIONS))
{
ppszNew=(char**)(((PBYTE)&tempSettings[i]->settings)+memberOffset);
- if(*ppszNew) mir_free(*ppszNew);
+ if (*ppszNew) mir_free(*ppszNew);
*ppszNew=mir_strdup(szNewValue);
}
mir_free(szNewValue);
}
else {
ppszNew=(char**)(((PBYTE)&tempSettings[iUser]->settings)+memberOffset);
- if(*ppszNew) mir_free(*ppszNew);
+ if (*ppszNew) mir_free(*ppszNew);
*ppszNew=szNewValue;
}
}
static void WriteSettingsStructToDb(const char *szSettingsModule,NETLIBUSERSETTINGS *settings,DWORD flags)
{
- if(flags&NUF_OUTGOING) {
+ if (flags&NUF_OUTGOING) {
char szEncodedPassword[512];
DBWriteContactSettingByte(NULL,szSettingsModule,"NLValidateSSL",(BYTE)settings->validateSSL);
DBWriteContactSettingByte(NULL,szSettingsModule,"NLUseProxy",(BYTE)settings->useProxy);
@@ -218,7 +218,7 @@ static void WriteSettingsStructToDb(const char *szSettingsModule,NETLIBUSERSETTI
DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyOutgoingPorts",(BYTE)settings->specifyOutgoingPorts);
DBWriteContactSettingString(NULL,szSettingsModule,"NLOutgoingPorts",settings->szOutgoingPorts?settings->szOutgoingPorts:"");
}
- if(flags&NUF_INCOMING) {
+ if (flags&NUF_INCOMING) {
DBWriteContactSettingByte(NULL,szSettingsModule,"NLEnableUPnP",(BYTE)settings->enableUPnP);
DBWriteContactSettingByte(NULL,szSettingsModule,"NLSpecifyIncomingPorts",(BYTE)settings->specifyIncomingPorts);
DBWriteContactSettingString(NULL,szSettingsModule,"NLIncomingPorts",settings->szIncomingPorts?settings->szIncomingPorts:"");
@@ -252,13 +252,13 @@ void NetlibSaveUserSettingsStruct(const char *szSettingsModule,NETLIBUSERSETTING
if (thisUser->user.flags & NUF_NOOPTIONS) continue;
CombineSettingsStructs(&combinedSettings, &flags, &thisUser->settings, thisUser->user.flags);
}
- if(combinedSettings.validateSSL==2) combinedSettings.validateSSL=0;
- if(combinedSettings.useProxy==2) combinedSettings.useProxy=0;
- if(combinedSettings.proxyType==0) combinedSettings.proxyType=PROXYTYPE_SOCKS5;
- if(combinedSettings.useProxyAuth==2) combinedSettings.useProxyAuth=0;
- if(combinedSettings.dnsThroughProxy==2) combinedSettings.dnsThroughProxy=1;
- if(combinedSettings.enableUPnP==2) combinedSettings.enableUPnP=1;
- if(combinedSettings.specifyIncomingPorts==2) combinedSettings.specifyIncomingPorts=0;
+ if (combinedSettings.validateSSL==2) combinedSettings.validateSSL=0;
+ if (combinedSettings.useProxy==2) combinedSettings.useProxy=0;
+ if (combinedSettings.proxyType==0) combinedSettings.proxyType=PROXYTYPE_SOCKS5;
+ if (combinedSettings.useProxyAuth==2) combinedSettings.useProxyAuth=0;
+ if (combinedSettings.dnsThroughProxy==2) combinedSettings.dnsThroughProxy=1;
+ if (combinedSettings.enableUPnP==2) combinedSettings.enableUPnP=1;
+ if (combinedSettings.specifyIncomingPorts==2) combinedSettings.specifyIncomingPorts=0;
WriteSettingsStructToDb("Netlib",&combinedSettings,flags);
NetlibFreeUserSettingsStruct(&combinedSettings);
LeaveCriticalSection(&csNetlibUser);
@@ -408,7 +408,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
switch(LOWORD(wParam))
{
case IDC_NETLIBUSERS:
- if(HIWORD(wParam)==CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0);
+ if (HIWORD(wParam)==CBN_SELCHANGE) SendMessage(hwndDlg,M_REFRESHALL,0,0);
return 0;
case IDC_LOGOPTIONS:
@@ -462,11 +462,11 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
ChangeSettingIntByCheckbox(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,validateSSL));
break;
case IDC_PROXYHOST:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyServer));
break;
case IDC_PROXYPORT:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
{ int newValue,i;
newValue=GetDlgItemInt(hwndDlg,LOWORD(wParam),NULL,FALSE);
if (iUser == -1)
@@ -479,19 +479,19 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
}
break;
case IDC_PROXYUSER:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthUser));
break;
case IDC_PROXYPASS:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szProxyAuthPassword));
break;
case IDC_PORTSRANGE:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szIncomingPorts));
break;
case IDC_PORTSRANGEO:
- if(HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
+ if (HIWORD(wParam)!=EN_CHANGE || (HWND)lParam!=GetFocus()) return 0;
ChangeSettingStringByEdit(hwndDlg,LOWORD(wParam),iUser,offsetof(NETLIBUSERSETTINGS,szOutgoingPorts));
break;
}
diff --git a/src/modules/netlib/netlibpktrecver.cpp b/src/modules/netlib/netlibpktrecver.cpp
index 85f65aa617..91fc4ddbe9 100644
--- a/src/modules/netlib/netlibpktrecver.cpp
+++ b/src/modules/netlib/netlibpktrecver.cpp
@@ -28,12 +28,12 @@ INT_PTR NetlibPacketRecverCreate(WPARAM wParam,LPARAM lParam)
struct NetlibConnection *nlc=(struct NetlibConnection*)wParam;
struct NetlibPacketRecver *nlpr;
- if(GetNetlibHandleType(nlc)!=NLH_CONNECTION || lParam==0) {
+ if (GetNetlibHandleType(nlc)!=NLH_CONNECTION || lParam==0) {
SetLastError(ERROR_INVALID_PARAMETER);
return (INT_PTR)(struct NetlibPacketRecver*)NULL;
}
nlpr=(struct NetlibPacketRecver*)mir_calloc(sizeof(struct NetlibPacketRecver));
- if(nlpr==NULL) {
+ if (nlpr==NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return (INT_PTR)(struct NetlibPacketRecver*)NULL;
}
@@ -53,7 +53,7 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam)
NETLIBPACKETRECVER *nlprParam=(NETLIBPACKETRECVER*)lParam;
INT_PTR recvResult;
- if(GetNetlibHandleType(nlpr)!=NLH_PACKETRECVER || nlprParam==NULL || nlprParam->cbSize!=sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed>nlpr->packetRecver.bytesAvailable) {
+ if (GetNetlibHandleType(nlpr)!=NLH_PACKETRECVER || nlprParam==NULL || nlprParam->cbSize!=sizeof(NETLIBPACKETRECVER) || nlprParam->bytesUsed>nlpr->packetRecver.bytesAvailable) {
SetLastError(ERROR_INVALID_PARAMETER);
return SOCKET_ERROR;
}
@@ -62,8 +62,8 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam)
return SOCKET_ERROR;
}
nlpr->packetRecver.dwTimeout=nlprParam->dwTimeout;
- if(nlprParam->bytesUsed==0) {
- if(nlpr->packetRecver.bytesAvailable==nlpr->packetRecver.bufferSize) {
+ if (nlprParam->bytesUsed==0) {
+ if (nlpr->packetRecver.bytesAvailable==nlpr->packetRecver.bufferSize) {
nlpr->packetRecver.bytesAvailable=0;
NetlibLogf(nlpr->nlc->nlu,"Packet recver: packet overflowed buffer, ditching");
}
@@ -72,14 +72,14 @@ INT_PTR NetlibPacketRecverGetMore(WPARAM wParam,LPARAM lParam)
MoveMemory(nlpr->packetRecver.buffer,nlpr->packetRecver.buffer+nlprParam->bytesUsed,nlpr->packetRecver.bytesAvailable-nlprParam->bytesUsed);
nlpr->packetRecver.bytesAvailable-=nlprParam->bytesUsed;
}
- if(nlprParam->dwTimeout!=INFINITE) {
- if(!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s,nlprParam->dwTimeout) <= 0) {
+ if (nlprParam->dwTimeout!=INFINITE) {
+ if (!si.pending(nlpr->nlc->hSsl) && WaitUntilReadable(nlpr->nlc->s,nlprParam->dwTimeout) <= 0) {
*nlprParam=nlpr->packetRecver;
return SOCKET_ERROR;
}
}
recvResult=NLRecv(nlpr->nlc, (char*)nlpr->packetRecver.buffer+nlpr->packetRecver.bytesAvailable,nlpr->packetRecver.bufferSize-nlpr->packetRecver.bytesAvailable,0);
- if(recvResult>0) nlpr->packetRecver.bytesAvailable+=recvResult;
+ if (recvResult>0) nlpr->packetRecver.bytesAvailable+=recvResult;
*nlprParam=nlpr->packetRecver;
return recvResult;
}
diff --git a/src/modules/netlib/netlibssl.cpp b/src/modules/netlib/netlibssl.cpp
index 96a9a52348..d533bc1236 100644
--- a/src/modules/netlib/netlibssl.cpp
+++ b/src/modules/netlib/netlibssl.cpp
@@ -793,7 +793,7 @@ int NetlibSslRead(SslHandle *ssl, char *buf, int num, int peek)
// Locate data and (optional) extra buffers.
pDataBuffer = NULL;
pExtraBuffer = NULL;
- for(i = 1; i < 4; i++)
+ for (i = 1; i < 4; i++)
{
if (pDataBuffer == NULL && Buffers[i].BufferType == SECBUFFER_DATA)
pDataBuffer = &Buffers[i];
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp
index 080fed019d..639cade4de 100644
--- a/src/modules/netlib/netlibupnp.cpp
+++ b/src/modules/netlib/netlibupnp.cpp
@@ -381,7 +381,7 @@ retrycon:
LongLog(szData);
sz = 0;
- for(;;)
+ for (;;)
{
int bytesRecv;
@@ -632,7 +632,7 @@ static void discoverUPnP(void)
buf = (char*)mir_alloc(1500);
- for(i = 3; --i && szUrl[0] == 0;)
+ for (i = 3; --i && szUrl[0] == 0;)
{
for (j = 0; j < nip; ++j)
{