From 78c0815c4118fe24ab78cce2dc48a6232dcd824a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 2 Jun 2012 20:55:18 +0000 Subject: - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IRCG/MString.cpp | 2 +- protocols/IRCG/MString.h | 136 +++++++++++++++++++------------------- protocols/IRCG/commandmonitor.cpp | 12 ++-- protocols/IRCG/input.cpp | 4 +- protocols/IRCG/irclib.cpp | 30 ++++----- protocols/IRCG/options.cpp | 16 ++--- protocols/IRCG/output.cpp | 2 +- protocols/IRCG/tools.cpp | 8 +-- protocols/IRCG/userinfo.cpp | 2 +- protocols/IRCG/windows.cpp | 6 +- 10 files changed, 109 insertions(+), 109 deletions(-) (limited to 'protocols/IRCG') diff --git a/protocols/IRCG/MString.cpp b/protocols/IRCG/MString.cpp index 45da9e4965..70016e427e 100644 --- a/protocols/IRCG/MString.cpp +++ b/protocols/IRCG/MString.cpp @@ -75,7 +75,7 @@ bool CMStringData::IsShared() const void CMStringData::Lock() { nRefs--; // Locked buffers can't be shared, so no interlocked operation necessary - if( nRefs == 0 ) + if ( nRefs == 0 ) nRefs = -1; } diff --git a/protocols/IRCG/MString.h b/protocols/IRCG/MString.h index fbef22ddf5..6f90b7741b 100644 --- a/protocols/IRCG/MString.h +++ b/protocols/IRCG/MString.h @@ -126,7 +126,7 @@ public: CMSimpleStringT(const XCHAR* pchSrc, int nLength) { CMStringData* pData = Allocate( nLength, sizeof( XCHAR ) ); - if( pData != NULL ) + if ( pData != NULL ) { Attach( pData ); SetLength( nLength ); @@ -148,9 +148,9 @@ public: { CMStringData* pSrcData = strSrc.GetData(); CMStringData* pOldData = GetData(); - if( pSrcData != pOldData) + if ( pSrcData != pOldData) { - if( pOldData->IsLocked() ) + if ( pOldData->IsLocked() ) SetString( strSrc.GetString(), strSrc.GetLength() ); else { @@ -238,7 +238,7 @@ public: int nNewLength = nOldLength+nLength; PXSTR pszBuffer = GetBuffer( nNewLength ); - if( nOffset <= nOldLength ) + if ( nOffset <= nOldLength ) { pszSrc = pszBuffer+nOffset; // No need to call CopyCharsOverlapped, since the destination is @@ -262,10 +262,10 @@ public: void Empty() { CMStringData* pOldData = GetData(); - if( pOldData->nDataLength == 0 ) + if ( pOldData->nDataLength == 0 ) return; - if( pOldData->IsLocked() ) + if ( pOldData->IsLocked() ) { // Don't reallocate a locked buffer that's shrinking SetLength( 0 ); @@ -281,13 +281,13 @@ public: { CMStringData* pOldData = GetData(); int nLength = pOldData->nDataLength; - if( pOldData->nAllocLength == nLength ) + if ( pOldData->nAllocLength == nLength ) return; - if( !pOldData->IsLocked() ) // Don't reallocate a locked buffer that's shrinking + if ( !pOldData->IsLocked() ) // Don't reallocate a locked buffer that's shrinking { CMStringData* pNewData = Allocate( nLength, sizeof( XCHAR ) ); - if( pNewData == NULL ) { + if ( pNewData == NULL ) { SetLength( nLength ); return; } @@ -311,7 +311,7 @@ public: PXSTR GetBuffer() { CMStringData* pData = GetData(); - if( pData->IsShared() ) + if ( pData->IsShared() ) Fork( pData->nDataLength ); return m_pszData; @@ -343,7 +343,7 @@ public: PXSTR LockBuffer() { CMStringData* pData = GetData(); - if( pData->IsShared() ) + if ( pData->IsShared() ) { Fork( pData->nDataLength ); pData = GetData(); // Do it again, because the fork might have changed it @@ -363,7 +363,7 @@ public: } void ReleaseBuffer( int nNewLength = -1 ) { - if( nNewLength == -1 ) + if ( nNewLength == -1 ) { int nAlloc = GetData()->nAllocLength; nNewLength = StringLengthN( m_pszData, nAlloc); @@ -393,7 +393,7 @@ public: } void SetString( PCXSTR pszSrc, int nLength ) { - if( nLength == 0 ) + if ( nLength == 0 ) { Empty(); } @@ -404,7 +404,7 @@ public: UINT_PTR nOffset = pszSrc - GetString(); PXSTR pszBuffer = GetBuffer( nLength ); - if( nOffset <= nOldLength ) + if ( nOffset <= nOldLength ) { CopyCharsOverlapped( pszBuffer, GetAllocLength(), pszBuffer+nOffset, nLength ); @@ -492,14 +492,14 @@ public: } static int __stdcall StringLengthN(const char* psz, size_t sizeInXChar ) { - if( psz == NULL ) + if ( psz == NULL ) return 0; return int( strnlen( psz, sizeInXChar )); } static int __stdcall StringLengthN(const wchar_t* psz, size_t sizeInXChar ) { - if( psz == NULL ) + if ( psz == NULL ) return 0; return int( wcsnlen( psz, sizeInXChar )); @@ -561,12 +561,12 @@ private: { // Grow exponentially, until we hit 1K. int nNewLength = pOldData->nAllocLength; - if( nNewLength > 1024 ) + if ( nNewLength > 1024 ) nNewLength += 1024; else nNewLength *= 2; - if( nNewLength < nLength ) + if ( nNewLength < nLength ) nNewLength = nLength; Reallocate( nNewLength ); @@ -579,7 +579,7 @@ private: return; CMStringData* pNewData = Realloc( pOldData, nLength, sizeof( XCHAR ) ); - if( pNewData != NULL ) + if ( pNewData != NULL ) Attach( pNewData ); } @@ -816,7 +816,7 @@ public: { int nLen = ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, NULL, NULL ); BSTR bstr = ::SysAllocStringLen( NULL, nLen ); - if( bstr != NULL ) + if ( bstr != NULL ) ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, bstr, nLen ); return bstr; @@ -826,7 +826,7 @@ public: { int nLen = ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, NULL, NULL ); BOOL bSuccess = ::SysReAllocStringLen( pbstr, NULL, nLen ); - if( bSuccess ) + if ( bSuccess ) ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, *pbstr, nLen ); return bSuccess; @@ -1030,7 +1030,7 @@ public: static void __stdcall FloodCharacters( wchar_t ch, int nLength, LPWSTR psz ) { // nLength is in XCHARs - for( int i = 0; i < nLength; i++ ) + for ( int i = 0; i < nLength; i++ ) { psz[i] = ch; } @@ -1144,7 +1144,7 @@ public: CMStringT( char ch, int nLength = 1 ) : CThisSimpleString() { - if( nLength > 0 ) + if ( nLength > 0 ) { PXSTR pszBuffer = this->GetBuffer( nLength ); StringTraits::FloodCharacters( XCHAR( ch ), nLength, pszBuffer ); @@ -1155,7 +1155,7 @@ public: CMStringT( wchar_t ch, int nLength = 1 ) : CThisSimpleString() { - if( nLength > 0 ) + if ( nLength > 0 ) { //Convert ch to the BaseType wchar_t pszCh[2] = { ch , 0 }; @@ -1198,7 +1198,7 @@ public: CMStringT( const YCHAR* pch, int nLength ) : CThisSimpleString() { - if( nLength > 0 ) + if ( nLength > 0 ) { int nDestLength = StringTraits::GetBaseTypeLength( pch, nLength ); PXSTR pszBuffer = this->GetBuffer( nDestLength ); @@ -1231,7 +1231,7 @@ public: { // nDestLength is in XCHARs int nDestLength = (pszSrc != NULL) ? StringTraits::GetBaseTypeLength( pszSrc ) : 0; - if( nDestLength > 0 ) + if ( nDestLength > 0 ) { PXSTR pszBuffer = this->GetBuffer( nDestLength ); StringTraits::ConvertToBaseType( pszBuffer, nDestLength, pszSrc); @@ -1345,18 +1345,18 @@ public: // Delete 'nCount' characters, starting at index 'iIndex' int Delete( int iIndex, int nCount = 1 ) { - if( iIndex < 0 ) + if ( iIndex < 0 ) iIndex = 0; - if( nCount < 0 ) + if ( nCount < 0 ) nCount = 0; int nLength = this->GetLength(); - if( nCount + iIndex > nLength ) + if ( nCount + iIndex > nLength ) { nCount = nLength-iIndex; } - if( nCount > 0 ) + if ( nCount > 0 ) { int nNewLength = nLength-nCount; int nXCHARsToCopy = nLength-(iIndex+nCount)+1; @@ -1375,10 +1375,10 @@ public: // Insert character 'ch' before index 'iIndex' int Insert( int iIndex, XCHAR ch ) { - if( iIndex < 0 ) + if ( iIndex < 0 ) iIndex = 0; - if( iIndex > this->GetLength() ) + if ( iIndex > this->GetLength() ) iIndex = this->GetLength(); int nNewLength = this->GetLength()+1; @@ -1400,10 +1400,10 @@ public: // Insert string 'psz' before index 'iIndex' int Insert( int iIndex, PCXSTR psz ) { - if( iIndex < 0 ) + if ( iIndex < 0 ) iIndex = 0; - if( iIndex > this->GetLength() ) + if ( iIndex > this->GetLength() ) { iIndex = this->GetLength(); } @@ -1411,7 +1411,7 @@ public: // nInsertLength and nNewLength are in XCHARs int nInsertLength = StringTraits::SafeStringLen( psz ); int nNewLength = this->GetLength(); - if( nInsertLength > 0 ) + if ( nInsertLength > 0 ) { nNewLength += nInsertLength; @@ -1436,7 +1436,7 @@ public: int nCount = 0; // short-circuit the nop case - if( chOld != chNew ) + if ( chOld != chNew ) { // otherwise modify each character that matches in the string bool bCopied = false; @@ -1447,9 +1447,9 @@ public: while( iChar < nLength ) { // replace instances of the specified character only - if( pszBuffer[iChar] == chOld ) + if ( pszBuffer[iChar] == chOld ) { - if( !bCopied ) + if ( !bCopied ) { bCopied = true; pszBuffer = this->GetBuffer( nLength ); @@ -1459,7 +1459,7 @@ public: } iChar = int( StringTraits::CharNext( pszBuffer+iChar )-pszBuffer ); } - if( bCopied ) + if ( bCopied ) { this->ReleaseBufferSetLength( nLength ); } @@ -1475,7 +1475,7 @@ public: // nSourceLen is in XCHARs int nSourceLen = StringTraits::SafeStringLen( pszOld ); - if( nSourceLen == 0 ) + if ( nSourceLen == 0 ) return 0; // nReplacementLen is in XCHARs int nReplacementLen = StringTraits::SafeStringLen( pszNew ); @@ -1498,7 +1498,7 @@ public: } // if any changes were made, make them - if( nCount > 0 ) + if ( nCount > 0 ) { // if the buffer is too small, just // allocate a new buffer (slow but sure) @@ -1546,7 +1546,7 @@ public: while( pszSource < pszEnd ) { PXSTR pszNewSource = StringTraits::CharNext( pszSource ); - if( *pszSource != chRemove ) + if ( *pszSource != chRemove ) { // Copy the source to the destination. Remember to copy all bytes of an MBCS character // Copy the source to the destination. Remember to copy all bytes of an MBCS character @@ -1571,7 +1571,7 @@ public: CMStringT Tokenize( PCXSTR pszTokens, int& iStart ) const { - if( (pszTokens == NULL) || (*pszTokens == (XCHAR)0) ) + if ( (pszTokens == NULL) || (*pszTokens == (XCHAR)0) ) { if (iStart < this->GetLength()) return CMStringT( this->GetString()+iStart ); @@ -1580,11 +1580,11 @@ public: { PCXSTR pszPlace = this->GetString()+iStart; PCXSTR pszEnd = this->GetString()+this->GetLength(); - if( pszPlace < pszEnd ) + if ( pszPlace < pszEnd ) { int nIncluding = StringTraits::StringSpanIncluding( pszPlace, pszTokens ); - if( (pszPlace+nIncluding) < pszEnd ) + if ( (pszPlace+nIncluding) < pszEnd ) { pszPlace += nIncluding; int nExcluding = StringTraits::StringSpanExcluding( pszPlace, pszTokens ); @@ -1611,7 +1611,7 @@ public: { // nLength is in XCHARs int nLength = this->GetLength(); - if( iStart < 0 || iStart >= nLength) + if ( iStart < 0 || iStart >= nLength) return -1; // find first single character @@ -1632,7 +1632,7 @@ public: // nLength is in XCHARs int nLength = this->GetLength(); - if( iStart < 0 || iStart > nLength ) + if ( iStart < 0 || iStart > nLength ) return -1; // find first matching substring @@ -1707,9 +1707,9 @@ public: while( *psz != 0 ) { - if( StringTraits::IsSpace( *psz ) ) + if ( StringTraits::IsSpace( *psz ) ) { - if( pszLast == NULL ) + if ( pszLast == NULL ) pszLast = psz; } else @@ -1719,7 +1719,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( pszLast != NULL ) + if ( pszLast != NULL ) { // truncate at trailing space start int iLast = int( pszLast-this->GetString() ); @@ -1742,7 +1742,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( psz != this->GetString() ) + if ( psz != this->GetString() ) { // fix up data and length int iFirst = int( psz-this->GetString() ); @@ -1788,9 +1788,9 @@ public: while( *psz != 0 ) { - if( *psz == chTarget ) + if ( *psz == chTarget ) { - if( pszLast == NULL ) + if ( pszLast == NULL ) { pszLast = psz; } @@ -1802,7 +1802,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( pszLast != NULL ) + if ( pszLast != NULL ) { // truncate at left-most matching character int iLast = int( pszLast-this->GetString() ); @@ -1816,7 +1816,7 @@ public: CMStringT& TrimRight( PCXSTR pszTargets ) { // if we're not trimming anything, we're not doing any work - if( (pszTargets == NULL) || (*pszTargets == 0) ) + if ( (pszTargets == NULL) || (*pszTargets == 0) ) { return *this; } @@ -1829,9 +1829,9 @@ public: while( *psz != 0 ) { - if( StringTraits::StringFindChar( pszTargets, *psz ) != NULL ) + if ( StringTraits::StringFindChar( pszTargets, *psz ) != NULL ) { - if( pszLast == NULL ) + if ( pszLast == NULL ) { pszLast = psz; } @@ -1843,7 +1843,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( pszLast != NULL ) + if ( pszLast != NULL ) { // truncate at left-most matching character int iLast = int( pszLast-this->GetString() ); @@ -1864,7 +1864,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( psz != this->GetString() ) + if ( psz != this->GetString() ) { // fix up data and length int iFirst = int( psz-this->GetString() ); @@ -1883,7 +1883,7 @@ public: CMStringT& TrimLeft( PCXSTR pszTargets ) { // if we're not trimming anything, we're not doing any work - if( (pszTargets == NULL) || (*pszTargets == 0) ) + if ( (pszTargets == NULL) || (*pszTargets == 0) ) { return *this; } @@ -1894,7 +1894,7 @@ public: psz = StringTraits::CharNext( psz ); } - if( psz != this->GetString() ) + if ( psz != this->GetString() ) { // fix up data and length int iFirst = int( psz-this->GetString() ); @@ -1946,14 +1946,14 @@ public: if (nCount < 0) nCount = 0; - if( (iFirst + nCount) > this->GetLength() ) + if ( (iFirst + nCount) > this->GetLength() ) nCount = this->GetLength()-iFirst; - if( iFirst > this->GetLength() ) + if ( iFirst > this->GetLength() ) nCount = 0; // optimize case of returning entire string - if( (iFirst == 0) && ((iFirst+nCount) == this->GetLength()) ) + if ( (iFirst == 0) && ((iFirst+nCount) == this->GetLength()) ) return *this; return CMStringT( this->GetString()+iFirst, nCount ); @@ -1967,7 +1967,7 @@ public: nCount = 0; int nLength = this->GetLength(); - if( nCount >= nLength ) + if ( nCount >= nLength ) { return *this; } @@ -1983,7 +1983,7 @@ public: nCount = 0; int nLength = this->GetLength(); - if( nCount >= nLength ) + if ( nCount >= nLength ) return *this; return CMStringT( this->GetString(), nCount ); @@ -2046,7 +2046,7 @@ public: ULONG nLength = StringTraits::GetEnvironmentVariable( pszVar, NULL, 0 ); BOOL bRetVal = FALSE; - if( nLength == 0 ) + if ( nLength == 0 ) { this->Empty(); } @@ -2065,7 +2065,7 @@ public: BOOL LoadString( UINT nID ) { HINSTANCE hInst = StringTraits::FindStringResourceInstance( nID ); - if( hInst == NULL ) + if ( hInst == NULL ) return FALSE; return LoadString( hInst, nID ); diff --git a/protocols/IRCG/commandmonitor.cpp b/protocols/IRCG/commandmonitor.cpp index 25f07a79ed..0f39828891 100644 --- a/protocols/IRCG/commandmonitor.cpp +++ b/protocols/IRCG/commandmonitor.cpp @@ -172,7 +172,7 @@ VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) if ( DBNick && ( !DBWildcard || !WCCmp(CharLower(DBWildcard), CharLower(DBNick)))) ppro->m_namesToWho += CMString(DBNick) + _T(" "); - else if( DBWildcard ) + else if ( DBWildcard ) ppro->m_namesToWho += CMString(DBWildcard) + _T(" "); if ( DBNick ) DBFreeVariant(&dbv); @@ -545,7 +545,7 @@ bool CIrcProto::OnIrc_MODE( const CIrcMessage* pmsg ) } else if (*p1 != 'b' && *p1 != ' ' && *p1 != '+' && *p1 != '-' ) { bContainsValidModes = true; - if(*p1 != 'l' && *p1 != 'k') + if (*p1 != 'l' && *p1 != 'k') sModes += *p1; flag = true; } @@ -669,7 +669,7 @@ bool CIrcProto::OnIrc_YOURHOST( const CIrcMessage* pmsg ) if ( pmsg->m_bIncoming ) { static const TCHAR* lpszFmt = _T("Your host is %99[^ \x5b,], running version %99s"); TCHAR szHostName[100], szVersion[100]; - if( _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0 ) + if ( _stscanf(pmsg->parameters[1].c_str(), lpszFmt, &szHostName, &szVersion) > 0 ) m_info.sServerName = szHostName; if ( pmsg->parameters[0] != m_info.sNick) m_info.sNick = pmsg->parameters[0]; @@ -940,7 +940,7 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg ) // if all characters are number it indicates we have found the adress, port and size parameters int ind = 0; while ( sTemp[ind] != '\0' ) { - if( !_istdigit( sTemp[ind] )) + if ( !_istdigit( sTemp[ind] )) break; ind++; } @@ -1005,7 +1005,7 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg ) int ind = 0; while ( sTemp[ind] != '\0' ) { - if( !_istdigit( sTemp[ind] )) + if ( !_istdigit( sTemp[ind] )) break; ind++; } @@ -1183,7 +1183,7 @@ bool CIrcProto::IsCTCP( const CIrcMessage* pmsg ) di->bTurbo = bTurbo; di->bSSL = false; di->bReverse = (iPort == 0 && !sToken.IsEmpty() ) ? true : false; - if( di->bReverse ) + if ( di->bReverse ) di->sToken = sTokenBackup; setTString(hContact, "User", pmsg->prefix.sUser.c_str()); diff --git a/protocols/IRCG/input.cpp b/protocols/IRCG/input.cpp index d655107b80..a6724359e0 100644 --- a/protocols/IRCG/input.cpp +++ b/protocols/IRCG/input.cpp @@ -826,7 +826,7 @@ bool CIrcProto::PostIrcMessageWnd( TCHAR* window, HANDLE hContact, const TCHAR* lstrcpyn( windowname, dbv.ptszVal, 255); DBFreeVariant(&dbv); } - else if( window ) + else if ( window ) lstrcpyn( windowname, window, 255 ); else lstrcpyn( windowname, SERVERWINDOW, 255 ); @@ -921,7 +921,7 @@ bool CIrcProto::PostIrcMessageWnd( TCHAR* window, HANDLE hContact, const TCHAR* dcc->SendStuff( mess.c_str()); } } - else if( IsConnected() ) { + else if ( IsConnected() ) { FormatMsg( DoThis ); SendIrcMessage( DoThis.c_str(), false, codepage ); } diff --git a/protocols/IRCG/irclib.cpp b/protocols/IRCG/irclib.cpp index 1dffefff28..a5d3ad1537 100644 --- a/protocols/IRCG/irclib.cpp +++ b/protocols/IRCG/irclib.cpp @@ -102,19 +102,19 @@ void CIrcMessage::ParseIrcCommand(const TCHAR* lpszCmdLine) const TCHAR* p2 = lpszCmdLine; // prefix exists ? - if( *p1 == ':' ) { + if ( *p1 == ':' ) { // break prefix into its components (nick!user@host) p2 = ++p1; while( *p2 && !_tcschr( _T(" !"), *p2 )) ++p2; prefix.sNick.SetString(p1, p2 - p1); - if( *p2 != '!' ) + if ( *p2 != '!' ) goto end_of_prefix; p1 = ++p2; while( *p2 && !_tcschr( _T(" @"), *p2 )) ++p2; prefix.sUser.SetString(p1, p2 - p1); - if( *p2 != '@' ) + if ( *p2 != '@' ) goto end_of_prefix; p1 = ++p2; while( *p2 && *p2 != ' ' ) @@ -245,7 +245,7 @@ void CIrcProto::Disconnect(void) { static const DWORD dwServerTimeout = 5 * 1000; - if( con == NULL ) + if ( con == NULL ) return; KillIdent(); @@ -392,7 +392,7 @@ void CIrcProto::DoReceive() int nLinesProcessed = 0; int cbRead = NLReceive((unsigned char*)chBuf+cbInBuf, sizeof(chBuf)-cbInBuf-1); - if( cbRead <= 0 ) + if ( cbRead <= 0 ) break; cbInBuf += cbRead; @@ -405,7 +405,7 @@ void CIrcProto::DoReceive() // seek end-of-line for(pEnd=pStart; *pEnd && *pEnd != '\r' && *pEnd != '\n'; ++pEnd) ; - if( *pEnd == '\0' ) + if ( *pEnd == '\0' ) break; // uncomplete message. stop parsing. ++nLinesProcessed; @@ -423,7 +423,7 @@ void CIrcProto::DoReceive() char* p1 = pszTemp; // replace end-of-line with NULLs while( *p1 != '\0' ) { - if( *p1 == '\r' || *p1 == '\n') + if ( *p1 == '\r' || *p1 == '\n') *p1 = '\0'; p1++; } @@ -750,7 +750,7 @@ unsigned long ConvertIPToInteger( char* IP ) IN_ADDR in; IN_ADDR intemp; - if( IP == 0 || lstrlenA(IP) == 0) + if ( IP == 0 || lstrlenA(IP) == 0) return 0; intemp.S_un.S_addr = inet_addr(IP); @@ -1098,7 +1098,7 @@ void __cdecl CDccSession::ThreadProc(void *pparam) if ( pThis->di->iType == DCC_CHAT ) pThis->DoChatReceive(); // dcc chat - else if( !pThis->di->bSender ) + else if ( !pThis->di->bSender ) pThis->DoReceiveFile(); // receive a file else if ( pThis->di->bSender ) @@ -1178,7 +1178,7 @@ void CDccSession::DoSendFile() dwRead = CallService( MS_NETLIB_GETMOREPACKETS, (WPARAM)hPackrcver, (LPARAM)&npr); npr.bytesUsed = sizeof(DWORD); - if( dwRead <= 0) + if ( dwRead <= 0) break; // connection closed, or a timeout occurred. dwPacket = *(DWORD*)npr.buffer; @@ -1245,7 +1245,7 @@ DCC_STOP: else // file was not possible to open for reading { ProtoBroadcastAck(m_proto->m_szModuleName, di->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (void *)di, 0); - if( con ) { + if ( con ) { Netlib_CloseHandle(con); con = NULL; } } } @@ -1353,7 +1353,7 @@ void CDccSession::DoChatReceive() int nLinesProcessed = 0; cbRead = NLReceive((unsigned char*)chBuf+cbInBuf, sizeof(chBuf)-cbInBuf-1); - if( cbRead <= 0 ) + if ( cbRead <= 0 ) break; cbInBuf += cbRead; @@ -1366,7 +1366,7 @@ void CDccSession::DoChatReceive() // seek end-of-line for(pEnd=pStart; *pEnd && *pEnd != '\r' && *pEnd != '\n'; ++pEnd) ; - if( *pEnd == '\0' ) + if ( *pEnd == '\0' ) break; // uncomplete message. stop parsing. ++nLinesProcessed; @@ -1375,7 +1375,7 @@ void CDccSession::DoChatReceive() while( *pEnd == '\r' || *pEnd == '\n' ) *pEnd++ = '\0'; - if( *pStart ) { + if ( *pStart ) { // send it off to some messaging module PROTORECVEVENT pre = {0}; @@ -1459,7 +1459,7 @@ void DoIdent(HANDLE hConnection, DWORD, void* extra ) for (;;) { int cbRead = Netlib_Recv(hConnection, szBuf+cbTotal, sizeof(szBuf)-1-cbTotal, 0); - if( cbRead == SOCKET_ERROR || cbRead == 0) + if ( cbRead == SOCKET_ERROR || cbRead == 0) break; cbTotal += cbRead; diff --git a/protocols/IRCG/options.cpp b/protocols/IRCG/options.cpp index 68b86520c7..76f6a97afe 100644 --- a/protocols/IRCG/options.cpp +++ b/protocols/IRCG/options.cpp @@ -817,7 +817,7 @@ void CConnectPrefsDlg::OnApply() m_proto->m_autoOnlineNotification = m_onlineNotif.GetState(); if ( m_proto->m_autoOnlineNotification ) { - if( !m_proto->bTempDisableCheck ) { + if ( !m_proto->bTempDisableCheck ) { m_proto->SetChatTimer(m_proto->OnlineNotifTimer, 500, OnlineNotifTimerProc ); if ( m_proto->m_channelAwayNotification ) m_proto->SetChatTimer( m_proto->OnlineNotifTimer3, 1500, OnlineNotifTimerProc3 ); @@ -1591,17 +1591,17 @@ void CIgnorePrefsDlg::OnEdit( CCtrlButton* ) HWND hWnd = dlg->GetHwnd(); SetWindowText(hWnd, TranslateT("Edit ignore")); if ( szFlags[0] ) { - if( _tcschr(szFlags, 'q')) + if ( _tcschr(szFlags, 'q')) CheckDlgButton(hWnd, IDC_Q, BST_CHECKED); - if( _tcschr(szFlags, 'n')) + if ( _tcschr(szFlags, 'n')) CheckDlgButton(hWnd, IDC_N, BST_CHECKED); - if( _tcschr(szFlags, 'i')) + if ( _tcschr(szFlags, 'i')) CheckDlgButton(hWnd, IDC_I, BST_CHECKED); - if( _tcschr(szFlags, 'd')) + if ( _tcschr(szFlags, 'd')) CheckDlgButton(hWnd, IDC_D, BST_CHECKED); - if( _tcschr(szFlags, 'c')) + if ( _tcschr(szFlags, 'c')) CheckDlgButton(hWnd, IDC_C, BST_CHECKED); - if( _tcschr(szFlags, 'm')) + if ( _tcschr(szFlags, 'm')) CheckDlgButton(hWnd, IDC_M, BST_CHECKED); } SetWindowText(GetDlgItem(hWnd, IDC_MASK), szMask); @@ -1710,7 +1710,7 @@ void CIgnorePrefsDlg::UpdateList() LVITEM lvm; lvm.mask= LVIF_PARAM; lvm.iSubItem = 0; - for( int i =0; i < j; i++) { + for ( int i =0; i < j; i++) { lvm.iItem = i; lvm.lParam = i; m_list.SetItem( &lvm ); diff --git a/protocols/IRCG/output.cpp b/protocols/IRCG/output.cpp index 72ded9c4be..3f64810a68 100644 --- a/protocols/IRCG/output.cpp +++ b/protocols/IRCG/output.cpp @@ -42,7 +42,7 @@ static CMString FormatOutput (const CIrcMessage* pmsg) TCHAR temp[256]; *temp = '\0'; mir_sntprintf(temp, SIZEOF(temp), TranslateT("%s invites you to %s"), pmsg->prefix.sNick.c_str(), pmsg->parameters[1].c_str()); sMessage = temp; - for( int i=2; i < (int)pmsg->parameters.getCount(); i++ ) { + for ( int i=2; i < (int)pmsg->parameters.getCount(); i++ ) { sMessage += _T(": ") + pmsg->parameters[i]; if ( i != pmsg->parameters.getCount()-1 ) sMessage += _T(" "); diff --git a/protocols/IRCG/tools.cpp b/protocols/IRCG/tools.cpp index ae1ae9e061..f2424c5689 100644 --- a/protocols/IRCG/tools.cpp +++ b/protocols/IRCG/tools.cpp @@ -183,7 +183,7 @@ CMString __stdcall GetWord(const TCHAR* text, int index) } p2 = _tcschr(p1, ' '); - if( !p2 ) + if ( !p2 ) p2 = _tcschr(p1, '\0'); if (p1 != p2) @@ -195,7 +195,7 @@ CMString __stdcall GetWord(const TCHAR* text, int index) const TCHAR* __stdcall GetWordAddress(const TCHAR* text, int index) { - if( !text || !lstrlen(text)) + if ( !text || !lstrlen(text)) return text; const TCHAR* temp = text; @@ -344,7 +344,7 @@ String __stdcall GetWord(const char* text, int index) } p2 = strchr(p1, ' '); - if(!p2) + if (!p2) p2 = strchr(p1, '\0'); if (p1 != p2) @@ -365,7 +365,7 @@ TCHAR* __stdcall my_strstri(const TCHAR* s1, const TCHAR* s2) int i,j,k; for(i=0;s1[i];i++) for(j=i,k=0; _totlower(s1[j]) == _totlower(s2[k]);j++,k++) - if(!s2[k+1]) + if (!s2[k+1]) return ( TCHAR* )(s1+i); return NULL; diff --git a/protocols/IRCG/userinfo.cpp b/protocols/IRCG/userinfo.cpp index cecc61cf2f..d7e8f071b4 100644 --- a/protocols/IRCG/userinfo.cpp +++ b/protocols/IRCG/userinfo.cpp @@ -97,7 +97,7 @@ INT_PTR CALLBACK UserDetailsDlgProc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON), true); EnableWindow(GetDlgItem( m_hwnd, IDC_BUTTON2), true); - if( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON ) { + if ( HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BUTTON ) { TCHAR temp[500]; GetDlgItemText( m_hwnd, IDC_WILDCARD, temp, SIZEOF(temp)); DBVARIANT dbv; diff --git a/protocols/IRCG/windows.cpp b/protocols/IRCG/windows.cpp index 37b9356500..79a1b8011f 100644 --- a/protocols/IRCG/windows.cpp +++ b/protocols/IRCG/windows.cpp @@ -1097,7 +1097,7 @@ void CManagerDlg::OnApplyModes( CCtrlButton* ) lstrcat( toadd, _T("t")); if ( wi->pszMode && _tcschr( wi->pszMode, 'n' )) { - if( !m_check2.GetState()) + if ( !m_check2.GetState()) lstrcat( toremove, _T("n")); } else if ( m_check2.GetState()) @@ -1111,7 +1111,7 @@ void CManagerDlg::OnApplyModes( CCtrlButton* ) lstrcat( toadd, _T("i")); if ( wi->pszMode && _tcschr( wi->pszMode, 'm' )) { - if( !m_check4.GetState()) + if ( !m_check4.GetState()) lstrcat( toremove, _T("m")); } else if ( m_check4.GetState()) @@ -1145,7 +1145,7 @@ void CManagerDlg::OnApplyModes( CCtrlButton* ) lstrcat( toremove, _T("k")); appendixremove += _T(" ") + CMString(wi->pszPassword); } - else if( GetWindowTextLength( m_key.GetHwnd())) { + else if ( GetWindowTextLength( m_key.GetHwnd())) { TCHAR temp[400]; m_key.GetText( temp, 14); -- cgit v1.2.3