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/AimOscar/connection.cpp | 50 +++--- protocols/AimOscar/conv.cpp | 12 +- protocols/AimOscar/links.cpp | 2 +- protocols/AimOscar/server.cpp | 10 +- protocols/AimOscar/services.cpp | 2 +- protocols/AimOscar/theme.cpp | 4 +- protocols/AimOscar/ui.cpp | 12 +- protocols/AimOscar/utility.cpp | 2 +- protocols/FacebookRM/chat.cpp | 2 +- protocols/FacebookRM/contacts.cpp | 18 +- protocols/FacebookRM/dialogs.cpp | 6 +- protocols/FacebookRM/messages.cpp | 6 +- protocols/FacebookRM/process.cpp | 4 +- protocols/FacebookRM/proto.cpp | 8 +- protocols/FacebookRM/theme.cpp | 4 +- protocols/GTalkExt/db.cpp | 2 +- protocols/GTalkExt/notifications.cpp | 2 +- protocols/Gadu-Gadu/core.c | 52 +++--- protocols/Gadu-Gadu/dialogs.c | 6 +- protocols/Gadu-Gadu/filetransfer.c | 22 +-- protocols/Gadu-Gadu/groupchat.c | 24 +-- protocols/Gadu-Gadu/import.c | 6 +- protocols/Gadu-Gadu/oauth.c | 12 +- protocols/Gadu-Gadu/ownerinfo.c | 4 +- protocols/Gadu-Gadu/services.c | 24 +-- protocols/Gadu-Gadu/token.c | 2 +- protocols/Gadu-Gadu/userutils.c | 16 +- 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 +- protocols/IcqOscarJ/chan_05ping.cpp | 2 +- protocols/IcqOscarJ/changeinfo/dlgproc.cpp | 4 +- protocols/IcqOscarJ/changeinfo/editstring.cpp | 20 +-- protocols/IcqOscarJ/changeinfo/upload.cpp | 2 +- protocols/IcqOscarJ/i18n.cpp | 4 +- protocols/IcqOscarJ/icq_direct.cpp | 2 +- protocols/IcqOscarJ/icq_popups.cpp | 2 +- protocols/JabberG/MString.cpp | 2 +- protocols/JabberG/MString.h | 136 +++++++-------- protocols/JabberG/jabber_adhoc.cpp | 2 +- protocols/JabberG/jabber_captcha.cpp | 8 +- protocols/JabberG/jabber_events.cpp | 2 +- protocols/JabberG/jabber_iq_handlers.cpp | 30 ++-- protocols/JabberG/jabber_iqid.cpp | 2 +- protocols/JabberG/jabber_iqid_muc.cpp | 2 +- protocols/JabberG/jabber_list.cpp | 4 +- protocols/JabberG/jabber_opt.cpp | 2 +- protocols/JabberG/jabber_privacy.cpp | 2 +- protocols/JabberG/jabber_proto.cpp | 6 +- protocols/JabberG/jabber_proxy.cpp | 16 +- protocols/JabberG/jabber_search.h | 4 +- protocols/JabberG/jabber_svc.cpp | 2 +- protocols/JabberG/jabber_thread.cpp | 2 +- protocols/JabberG/jabber_vcard.cpp | 4 +- protocols/JabberG/jabber_xstatus.cpp | 6 +- protocols/MRA/Mra.cpp | 2 +- protocols/MRA/MraAdvancedSearch.cpp | 2 +- protocols/MRA/MraAntiSpam.cpp | 4 +- protocols/MRA/MraAvatars.cpp | 2 +- protocols/MRA/MraFilesQueue.cpp | 4 +- protocols/MRA/MraFilesQueue_mod.cpp | 4 +- protocols/MRA/MraMRIMProxy.cpp | 2 +- protocols/MRA/MraPopUp.cpp | 2 +- protocols/MRA/MraSelectEMail.cpp | 2 +- protocols/MRA/Mra_functions.cpp | 10 +- protocols/MRA/Mra_options.cpp | 4 +- protocols/MRA/Mra_proto.cpp | 12 +- protocols/MRA/Sdk/Base64.h | 8 +- protocols/MSN/des.c | 18 +- protocols/MSN/msn_commands.cpp | 2 +- protocols/MSN/msn_threads.cpp | 2 +- protocols/Omegle/chat.cpp | 2 +- protocols/Omegle/dialogs.cpp | 2 +- protocols/Omegle/proto.cpp | 4 +- protocols/Omegle/theme.cpp | 4 +- protocols/Weather/weather.h | 2 + protocols/Weather/weather_conv.cpp | 2 +- protocols/Yahoo/avatar.cpp | 12 +- protocols/Yahoo/file_transfer.cpp | 6 +- protocols/Yahoo/im.cpp | 12 +- protocols/Yahoo/libyahoo2/libyahoo2.c | 228 +++++++++++++------------- protocols/Yahoo/libyahoo2/yahoo_httplib.c | 32 ++-- protocols/Yahoo/libyahoo2/yahoo_list.c | 8 +- protocols/Yahoo/options.cpp | 2 +- protocols/Yahoo/proto.cpp | 14 +- protocols/Yahoo/services.cpp | 4 +- protocols/Yahoo/util.cpp | 4 +- protocols/Yahoo/yahoo.cpp | 10 +- 95 files changed, 615 insertions(+), 613 deletions(-) (limited to 'protocols') diff --git a/protocols/AimOscar/connection.cpp b/protocols/AimOscar/connection.cpp index 79c1e7c41d..81548f875b 100644 --- a/protocols/AimOscar/connection.cpp +++ b/protocols/AimOscar/connection.cpp @@ -102,7 +102,7 @@ void CAimProto::aim_connection_authorization(void) hServerPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 2048 * 4); packetRecv.cbSize = sizeof(packetRecv); packetRecv.dwTimeout = 5000; - for(;;) + for (;;) { int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv); if (recvResult == 0) @@ -118,12 +118,12 @@ void CAimProto::aim_connection_authorization(void) else { unsigned short flap_length=0; - for(;packetRecv.bytesUsed0) { unsigned short flap_length=0; - for(;packetRecv.bytesUsed0) { unsigned short flap_length=0; - for(;packetRecv.bytesUsed 0) { unsigned short flap_length=0; - for(; packetRecv.bytesUsed < packetRecv.bytesAvailable; packetRecv.bytesUsed = flap_length) + for (; packetRecv.bytesUsed < packetRecv.bytesAvailable; packetRecv.bytesUsed = flap_length) { if (!packetRecv.buffer) break; @@ -429,7 +429,7 @@ void __cdecl CAimProto::aim_chatnav_negotiation( void* ) NETLIBPACKETRECVER packetRecv = {0}; packetRecv.cbSize = sizeof(packetRecv); packetRecv.dwTimeout = DEFAULT_KEEPALIVE_TIMER*1000; - for(;;) + for (;;) { int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM)&packetRecv); if (recvResult == 0) @@ -454,12 +454,12 @@ void __cdecl CAimProto::aim_chatnav_negotiation( void* ) if(recvResult>0) { unsigned short flap_length=0; - for(;packetRecv.bytesUsed0) { unsigned short flap_length=0; - for(;packetRecv.bytesUsed0) { unsigned short flap_length=0; - for(;packetRecv.bytesUsed")) != NULL || (ptr = strstr(dest, "")) != NULL) + if ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) { *ptr = '['; *(ptr+2) = 'b'; @@ -219,7 +219,7 @@ char* html_to_bbcodes(char *src) *ptr = '['; *(ptr+1) = 'i'; *(ptr+2) = ']'; - if((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) + if ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) { *ptr = '['; *(ptr+2) = 'i'; @@ -236,7 +236,7 @@ char* html_to_bbcodes(char *src) *ptr = '['; *(ptr+1) = 'u'; *(ptr+2) = ']'; - if((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) + if ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) { *ptr = '['; *(ptr+2) = 'u'; @@ -253,7 +253,7 @@ char* html_to_bbcodes(char *src) *ptr = '['; *(ptr+1) = 's'; *(ptr+2) = ']'; - if((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) + if ((ptr = strstr(dest, "")) != NULL || (ptr = strstr(dest, "")) != NULL) { *ptr = '['; *(ptr+2) = 's'; @@ -718,7 +718,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) pos+=strlen(Face); strcpy(&buf[pos],"\""); pos++; - if(!(cfOld.dwEffects & CFE_AUTOBACKCOLOR)) + if (!(cfOld.dwEffects & CFE_AUTOBACKCOLOR)) { strcpy(&buf[pos]," back=#"); pos+=6; @@ -734,7 +734,7 @@ char* rtf_to_html(HWND hwndDlg,int DlgItem) strcpy(&buf[pos],chBackColor); pos+=6; } - if(!(cfOld.dwEffects & CFE_AUTOCOLOR)) + if (!(cfOld.dwEffects & CFE_AUTOCOLOR)) { strcpy(&buf[pos]," color=#"); pos+=8; diff --git a/protocols/AimOscar/links.cpp b/protocols/AimOscar/links.cpp index 42cbc25cf1..c4eec4ae69 100644 --- a/protocols/AimOscar/links.cpp +++ b/protocols/AimOscar/links.cpp @@ -147,7 +147,7 @@ static INT_PTR ServiceParseAimLink(WPARAM /*wParam*/,LPARAM lParam) return 0; } /* open a chatroom */ - else if(!_tcsnicmp(arg, _T("gochat?"), 7)) + else if (!_tcsnicmp(arg, _T("gochat?"), 7)) { TCHAR *tok, *tok2; char *rm = NULL; diff --git a/protocols/AimOscar/server.cpp b/protocols/AimOscar/server.cpp index 3ff1ecff89..490444303b 100644 --- a/protocols/AimOscar/server.cpp +++ b/protocols/AimOscar/server.cpp @@ -467,7 +467,7 @@ void CAimProto::snac_user_online(SNAC &snac)//family 0x0003 } if(f002&&f003&&f004&&f005) strcpy(client,CLIENT_TRILLIAN_PRO); - else if((f004&&f005&&f007&&f008) || (f004&&f005&&O104&&O105)) + else if ((f004&&f005&&f007&&f008) || (f004&&f005&&O104&&O105)) strcpy(client,CLIENT_ICHAT); else if(f003&f004&f005) strcpy(client,CLIENT_TRILLIAN); @@ -1647,7 +1647,7 @@ void CAimProto::snac_received_info(SNAC &snac)//family 0x0002 write_away_message(sn,Translate("No information has been provided by the server."),false); request_away_message = 0; } - if(!profile_received&&request_HTML_profile) + if (!profile_received&&request_HTML_profile) write_profile(sn,"No Profile",false); request_HTML_profile=0; } @@ -2387,11 +2387,11 @@ void CAimProto::snac_admin_account_confirm(SNAC &snac)//family 0x0007 { unsigned short* type=(unsigned short*)&buf[SNAC_SIZE*2+1+sn_length]; *type=htons(*type); - if(*type==0x0000)//typing finished + if (*type==0x0000)//typing finished CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,(WPARAM)PROTOTYPE_CONTACTTYPING_OFF); - else if(*type==0x0001)//typed + else if (*type==0x0001)//typed CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,PROTOTYPE_CONTACTTYPING_INFINITE); - else if(*type==0x0002)//typing + else if (*type==0x0002)//typing CallService(MS_PROTO_CONTACTISTYPING,(WPARAM)hContact,(LPARAM)60); } } diff --git a/protocols/AimOscar/services.cpp b/protocols/AimOscar/services.cpp index d50c455013..caf2209560 100644 --- a/protocols/AimOscar/services.cpp +++ b/protocols/AimOscar/services.cpp @@ -127,7 +127,7 @@ int CAimProto::OnDbSettingChanged(WPARAM wParam,LPARAM lParam) if (cws->value.type == DBVT_DELETED) { DBVARIANT dbv; - if(!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) + if (!DBGetContactSettingStringUtf(hContact, MOD_KEY_CL, OTH_KEY_GP, &dbv) && dbv.pszVal[0]) { add_contact_to_group(hContact, dbv.pszVal); DBFreeVariant(&dbv); diff --git a/protocols/AimOscar/theme.cpp b/protocols/AimOscar/theme.cpp index 04a928887a..315fd1d0e4 100644 --- a/protocols/AimOscar/theme.cpp +++ b/protocols/AimOscar/theme.cpp @@ -282,7 +282,7 @@ static int OnExtraIconsApply(WPARAM wParam, LPARAM /*lParam*/) void remove_AT_icons(CAimProto* ppro) { - if(!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return; + if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return; HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact) @@ -296,7 +296,7 @@ void remove_AT_icons(CAimProto* ppro) void remove_ES_icons(CAimProto* ppro) { - if(!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return; + if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return; HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); while (hContact) diff --git a/protocols/AimOscar/ui.cpp b/protocols/AimOscar/ui.cpp index 2bfee72319..d365d910ae 100644 --- a/protocols/AimOscar/ui.cpp +++ b/protocols/AimOscar/ui.cpp @@ -254,7 +254,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isSub = (cfOld.dwEffects & CFE_SUBSCRIPT) && (cfOld.dwMask & CFM_SUBSCRIPT); BOOL isSuper = (cfOld.dwEffects & CFE_SUPERSCRIPT) && (cfOld.dwMask & CFM_SUPERSCRIPT); - if(!isSub&&!isSuper) + if (!isSub&&!isSuper) { DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_BOLD),hThemeButton,lpDIS->itemState|ODS_SELECTED, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("norm_scrpt"), 16, 16, 0, 0, DI_NORMAL); @@ -314,7 +314,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cfOld.dwMask = CFM_ITALIC; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isItalic = (cfOld.dwEffects & CFE_ITALIC) && (cfOld.dwMask & CFM_ITALIC); - if(!isItalic) + if (!isItalic) { DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_ITALIC),hThemeButton,lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nitalic"), 16, 16, 0, 0, DI_NORMAL); @@ -334,7 +334,7 @@ static INT_PTR CALLBACK userinfo_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, L cfOld.dwMask = CFM_UNDERLINE; SendDlgItemMessage(hwndDlg, IDC_PROFILE, EM_GETCHARFORMAT, SCF_SELECTION, (LPARAM)&cfOld); BOOL isUnderline = (cfOld.dwEffects & CFE_UNDERLINE) && (cfOld.dwMask & CFM_UNDERLINE); - if(!isUnderline) + if (!isUnderline) { DrawMyControl(lpDIS->hDC,GetDlgItem(hwndDlg, IDC_UNDERLINE),hThemeButton,lpDIS->itemState, lpDIS->rcItem); DrawIconEx(lpDIS->hDC, 4, 5, LoadIconEx("nundrln"), 16, 16, 0, 0, DI_NORMAL); @@ -945,7 +945,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (IsDlgButtonChecked(hwndDlg, IDC_AT)) { int acc_disabled = ppro->getByte(AIM_KEY_AT, 0); - if(!acc_disabled) + if (!acc_disabled) remove_AT_icons(ppro); ppro->setByte(AIM_KEY_AT, 1); } @@ -962,7 +962,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP { int es_disabled = ppro->getByte(AIM_KEY_ES, 0); ppro->setByte(AIM_KEY_ES, 1); - if(!es_disabled) + if (!es_disabled) remove_ES_icons(ppro); } else @@ -978,7 +978,7 @@ static INT_PTR CALLBACK options_dialog(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (IsDlgButtonChecked(hwndDlg, IDC_HF)) { int hf = ppro->getByte(AIM_KEY_HF, 0); - if(!hf) + if (!hf) ShowWindow(GetDlgItem(hwndDlg, IDC_MASQ), SW_SHOW); ppro->setByte(AIM_KEY_HF, 1); } diff --git a/protocols/AimOscar/utility.cpp b/protocols/AimOscar/utility.cpp index 4867ec0678..dfa18843ad 100644 --- a/protocols/AimOscar/utility.cpp +++ b/protocols/AimOscar/utility.cpp @@ -108,7 +108,7 @@ void CAimProto::start_connection(void *arg) broadcast_status(ID_STATUS_OFFLINE); return; } - if(!getString(AIM_KEY_PW, &dbv)) + if (!getString(AIM_KEY_PW, &dbv)) DBFreeVariant(&dbv); else { diff --git a/protocols/FacebookRM/chat.cpp b/protocols/FacebookRM/chat.cpp index 5fc0c8ac6e..2b66e730a1 100644 --- a/protocols/FacebookRM/chat.cpp +++ b/protocols/FacebookRM/chat.cpp @@ -266,7 +266,7 @@ int FacebookProto::OnJoinChat(WPARAM,LPARAM suppress) SetTopic("Omegle is a great way of meeting new friends!"); // Note: Initialization will finish up in SetChatStatus, called separately - if(!suppress) + if (!suppress) SetChatStatus(m_iStatus); */ return 0; diff --git a/protocols/FacebookRM/contacts.cpp b/protocols/FacebookRM/contacts.cpp index 23a6ca4455..d9acefa076 100644 --- a/protocols/FacebookRM/contacts.cpp +++ b/protocols/FacebookRM/contacts.cpp @@ -27,9 +27,9 @@ bool FacebookProto::IsMyContact(HANDLE hContact, bool include_chat) const char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, reinterpret_cast(hContact),0) ); - if( proto && strcmp(m_szModuleName,proto) == 0 ) + if ( proto && strcmp(m_szModuleName,proto) == 0 ) { - if( include_chat ) + if ( include_chat ) return true; else return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0; @@ -44,13 +44,13 @@ HANDLE FacebookProto::ContactIDToHContact(std::string user_id) hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0) ) { - if(!IsMyContact(hContact)) + if (!IsMyContact(hContact)) continue; DBVARIANT dbv; - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { - if( strcmp(user_id.c_str(),dbv.pszVal) == 0 ) + if ( strcmp(user_id.c_str(),dbv.pszVal) == 0 ) { DBFreeVariant(&dbv); return hContact; @@ -70,15 +70,15 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ if (!dont_check) { // First, check if this contact exists hContact = ContactIDToHContact(fbu->user_id); - if( hContact ) + if ( hContact ) return hContact; } // If not, make a new contact! hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); - if( hContact ) + if ( hContact ) { - if( CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0 ) + if ( CallService(MS_PROTO_ADDTOCONTACT,(WPARAM)hContact,(LPARAM)m_szModuleName) == 0 ) { DBWriteContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,fbu->user_id.c_str()); @@ -90,7 +90,7 @@ HANDLE FacebookProto::AddToContactList(facebook_user* fbu, BYTE type, bool dont_ DBDeleteContactSetting(hContact, "CList", "MyHandle"); DBVARIANT dbv; - if( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv) ) + if ( !DBGetContactSettingTString(NULL,m_szModuleName,FACEBOOK_KEY_DEF_GROUP,&dbv) ) { DBWriteContactSettingTString(hContact,"CList","Group",dbv.ptszVal); DBFreeVariant(&dbv); diff --git a/protocols/FacebookRM/dialogs.cpp b/protocols/FacebookRM/dialogs.cpp index 721ef35905..da897e0073 100644 --- a/protocols/FacebookRM/dialogs.cpp +++ b/protocols/FacebookRM/dialogs.cpp @@ -50,7 +50,7 @@ INT_PTR CALLBACK FBAccountProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLong(hwnd,GWLP_USERDATA,lparam); DBVARIANT dbv; - if( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) { SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal); DBFreeVariant(&dbv); @@ -195,7 +195,7 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SetWindowLong(hwnd,GWLP_USERDATA,lparam); DBVARIANT dbv; - if( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) + if ( !DBGetContactSettingString(0,proto->ModuleName(),FACEBOOK_KEY_LOGIN,&dbv) ) { SetDlgItemTextA(hwnd,IDC_UN,dbv.pszVal); DBFreeVariant(&dbv); @@ -216,7 +216,7 @@ INT_PTR CALLBACK FBOptionsProc( HWND hwnd, UINT message, WPARAM wparam, LPARAM l SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, FACEBOOK_GROUP_NAME_LIMIT, 0); - if( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv) ) + if ( !DBGetContactSettingTString(0,proto->ModuleName(),FACEBOOK_KEY_DEF_GROUP,&dbv) ) { SetDlgItemText(hwnd,IDC_GROUP,dbv.ptszVal); DBFreeVariant(&dbv); diff --git a/protocols/FacebookRM/messages.cpp b/protocols/FacebookRM/messages.cpp index 072ae88b4f..9725ec40c9 100644 --- a/protocols/FacebookRM/messages.cpp +++ b/protocols/FacebookRM/messages.cpp @@ -26,7 +26,7 @@ int FacebookProto::RecvMsg(HANDLE hContact, PROTORECVEVENT *pre) { DBVARIANT dbv; - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { ForkThread( &FacebookProto::MessagingWorker, this, new send_messaging(dbv.pszVal, FACEBOOK_RECV_MESSAGE ) ); DBFreeVariant(&dbv); @@ -53,7 +53,7 @@ void FacebookProto::SendMsgWorker(void *p) { ProtoBroadcastAck(m_szModuleName, data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, data->msgid, (LPARAM)Translate("You cannot send messages when you are offline.")); } - else if( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + else if ( !DBGetContactSettingString(data->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { int retries = 5; std::string error_text = ""; @@ -130,7 +130,7 @@ void FacebookProto::SendTypingWorker(void *p) } DBVARIANT dbv; - if( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(typing->hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { std::string data = "typ="; data += ( typing->status == PROTOTYPE_SELFTYPING_ON ) ? "1" : "0"; // PROTOTYPE_SELFTYPING_OFF diff --git a/protocols/FacebookRM/process.cpp b/protocols/FacebookRM/process.cpp index 056b8115dc..e63d186fb3 100644 --- a/protocols/FacebookRM/process.cpp +++ b/protocols/FacebookRM/process.cpp @@ -133,12 +133,12 @@ void FacebookProto::ProcessFriendList( void* data ) hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)hContact,0) ) { - if(!IsMyContact(hContact)) + if (!IsMyContact(hContact)) continue; DBVARIANT dbv; facebook_user *fbu; - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { std::string id = dbv.pszVal; DBFreeVariant(&dbv); diff --git a/protocols/FacebookRM/proto.cpp b/protocols/FacebookRM/proto.cpp index 820a1c3fb6..992977b372 100644 --- a/protocols/FacebookRM/proto.cpp +++ b/protocols/FacebookRM/proto.cpp @@ -456,7 +456,7 @@ int FacebookProto::VisitProfile(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast(wParam); DBVARIANT dbv; - if( wParam != 0 && !DBGetContactSettingString(hContact,m_szModuleName,"Homepage",&dbv) ) + if ( wParam != 0 && !DBGetContactSettingString(hContact,m_szModuleName,"Homepage",&dbv) ) { CallService(MS_UTILS_OPENURL,1,reinterpret_cast(dbv.pszVal)); DBFreeVariant(&dbv); @@ -497,7 +497,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) if ( !DBGetContactSettingUTF8String(hContact, m_szModuleName, FACEBOOK_KEY_NAME, &dbv) ) { mir_snprintf(str,SIZEOF(str),Translate("Do you want to cancel your friendship with '%s'?"), dbv.pszVal); DBFreeVariant(&dbv); - } else if( !DBGetContactSettingUTF8String(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { + } else if ( !DBGetContactSettingUTF8String(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { mir_snprintf(str,SIZEOF(str),Translate("Do you want to cancel your friendship with '%s'?"), dbv.pszVal); DBFreeVariant(&dbv); } @@ -505,7 +505,7 @@ int FacebookProto::CancelFriendship(WPARAM wParam,LPARAM lParam) TCHAR *text = mir_a2t_cp(str, CP_UTF8); if (MessageBox( 0, text, m_tszUserName, MB_ICONWARNING | MB_YESNO | MB_DEFBUTTON2 ) == IDYES) { - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { std::string* id = new std::string(dbv.pszVal); @@ -534,7 +534,7 @@ int FacebookProto::RequestFriendship(WPARAM wParam,LPARAM lParam) HANDLE hContact = reinterpret_cast(wParam); DBVARIANT dbv; - if( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) + if ( !DBGetContactSettingString(hContact,m_szModuleName,FACEBOOK_KEY_ID,&dbv) ) { std::string* id = new std::string(dbv.pszVal); ForkThread( &FacebookProto::AddContactToServer, this, ( void* )id ); diff --git a/protocols/FacebookRM/theme.cpp b/protocols/FacebookRM/theme.cpp index fd8d0be032..88e0ab5498 100644 --- a/protocols/FacebookRM/theme.cpp +++ b/protocols/FacebookRM/theme.cpp @@ -118,11 +118,11 @@ static FacebookProto * GetInstanceByHContact(HANDLE hContact) { char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, reinterpret_cast(hContact),0) ); - if(!proto) + if (!proto) return 0; for(int i=0; idcc) + if (!gg->dcc) { gg->event = CreateEvent(NULL, TRUE, FALSE, NULL); gg_dccstart(gg); @@ -369,9 +369,9 @@ void __cdecl gg_mainthread(GGPROTO *gg, void *empty) // Check if dcc is running and setup forwarding port if(gg->dcc && DBGetContactSettingByte(NULL, GG_PROTO, GG_KEY_FORWARDING, GG_KEYDEF_FORWARDING)) { - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_FORWARDHOST, &dbv)) + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_FORWARDHOST, &dbv)) { - if(!(p.external_addr = gg_dnslookup(gg, dbv.pszVal))) + if (!(p.external_addr = gg_dnslookup(gg, dbv.pszVal))) { char error[128]; mir_snprintf(error, sizeof(error), Translate("External direct connections hostname %s is invalid. Disabling external host forwarding."), dbv.pszVal); @@ -399,7 +399,7 @@ retry: // Check manual hosts if(hostnum < hostcount) { - if(!(p.server_addr = gg_dnslookup(gg, hosts[hostnum].hostname))) + if (!(p.server_addr = gg_dnslookup(gg, hosts[hostnum].hostname))) { char error[128]; mir_snprintf(error, sizeof(error), Translate("Server hostname %s is invalid. Using default hostname provided by the network."), hosts[hostnum].hostname); @@ -510,7 +510,7 @@ retry: while(gg_isonline(gg)) { // Connection broken/closed - if(!(e = gg_watch_fd(gg->sess))) + if (!(e = gg_watch_fd(gg->sess))) { gg_netlog(gg, "gg_mainthread(%x): Connection closed.", gg); EnterCriticalSection(&gg->sess_mutex); @@ -814,12 +814,12 @@ retry: // Received message case GG_EVENT_MSG: // This is CTCP request - if((e->event.msg.msgclass & GG_CLASS_CTCP)) + if ((e->event.msg.msgclass & GG_CLASS_CTCP)) { gg_dccconnect(gg, e->event.msg.sender); } // Check if not conference and block - else if(!e->event.msg.recipients_count || gg->gc_enabled) + else if (!e->event.msg.recipients_count || gg->gc_enabled) { // Check if groupchat if(e->event.msg.recipients_count && gg->gc_enabled && !DBGetContactSettingByte(NULL, GG_PROTO, GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF)) @@ -844,7 +844,7 @@ retry: } } // Check if not empty message ( who needs it? ) - else if(!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && strcmp(e->event.msg.message, "\xA0\0")) + else if (!e->event.msg.recipients_count && e->event.msg.message && *e->event.msg.message && strcmp(e->event.msg.message, "\xA0\0")) { CCSDATA ccs = {0}; PROTORECVEVENT pre = {0}; @@ -994,7 +994,7 @@ retry: HANDLE hContact = gg_getcontact(gg, e->event.image_reply.sender, 1, 0, NULL); void *img = (void *)gg_img_loadpicture(gg, e, 0); - if(!img) + if (!img) break; if(DBGetContactSettingByte(NULL, GG_PROTO, GG_KEY_IMGMETHOD, GG_KEYDEF_IMGMETHOD) == 1 || gg_img_opened(gg, e->event.image_reply.sender)) @@ -1038,7 +1038,7 @@ retry: dcc7->contact = gg_getcontact(gg, dcc7->peer_uin, 0, 0, NULL); // Check if user is on the list and if it is my uin - if(!dcc7->contact || DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, -1) != dcc7->uin) { + if (!dcc7->contact || DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, -1) != dcc7->uin) { gg_dcc7_free(dcc7); e->event.dcc7_new = NULL; break; @@ -1327,11 +1327,11 @@ int gg_dbsettingchanged(GGPROTO *gg, WPARAM wParam, LPARAM lParam) char *szProto = NULL; // Check if the contact is NULL or we are not online - if(!gg_isonline(gg)) + if (!gg_isonline(gg)) return 0; // If contact has been blocked - if(!strcmp(cws->szModule, GG_PROTO) && !strcmp(cws->szSetting, GG_KEY_BLOCK)) + if (!strcmp(cws->szModule, GG_PROTO) && !strcmp(cws->szSetting, GG_KEY_BLOCK)) { gg_notifyuser(gg, hContact, 1); return 0; @@ -1348,7 +1348,7 @@ int gg_dbsettingchanged(GGPROTO *gg, WPARAM wParam, LPARAM lParam) { // Most important... check redundancy (fucking cascading) static int cascade = 0; - if(!cascade && dbv.pszVal) + if (!cascade && dbv.pszVal) { GCDEST gcdest = {GG_PROTO, dbv.pszVal, GC_EVENT_CHANGESESSIONAME}; GCEVENT gcevent = {sizeof(GCEVENT), &gcdest}; @@ -1367,14 +1367,14 @@ int gg_dbsettingchanged(GGPROTO *gg, WPARAM wParam, LPARAM lParam) } // Contact list changes - if(!strcmp(cws->szModule, "CList")) + if (!strcmp(cws->szModule, "CList")) { // If name changed... change nick - if(!strcmp(cws->szSetting, "MyHandle") && cws->value.type == DBVT_ASCIIZ && cws->value.pszVal) + if (!strcmp(cws->szSetting, "MyHandle") && cws->value.type == DBVT_ASCIIZ && cws->value.pszVal) DBWriteContactSettingString(hContact, GG_PROTO, GG_KEY_NICK, cws->value.pszVal); // If not on list changed - if(!strcmp(cws->szSetting, "NotOnList")) + if (!strcmp(cws->szSetting, "NotOnList")) { if(DBGetContactSettingByte(hContact, "CList", "Hidden", 0)) return 0; @@ -1540,7 +1540,7 @@ HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *szNic szProto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0); if(szProto != NULL && !strcmp(szProto, GG_PROTO)) { - if((uin_t)DBGetContactSettingDword(hContact, GG_PROTO, GG_KEY_UIN, 0) == uin + if ((uin_t)DBGetContactSettingDword(hContact, GG_PROTO, GG_KEY_UIN, 0) == uin && DBGetContactSettingByte(hContact, GG_PROTO, "ChatRoom", 0) == 0) { if(inlist) @@ -1553,11 +1553,11 @@ HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *szNic } hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM) hContact, 0); } - if(!create) return NULL; + if (!create) return NULL; hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0); - if(!hContact) + if (!hContact) { gg_netlog(gg, "gg_getcontact(): Failed to create Gadu-Gadu contact %s", szNick); return NULL; @@ -1572,7 +1572,7 @@ HANDLE gg_getcontact(GGPROTO *gg, uin_t uin, int create, int inlist, char *szNic } gg_netlog(gg, "gg_getcontact(): Added buddy: %d", uin); - if(!inlist) + if (!inlist) { DBWriteContactSettingByte(hContact, "CList", "NotOnList", 1); //DBWriteContactSettingByte(hContact, "CList", "Hidden", 1); @@ -1743,7 +1743,7 @@ void gg_changecontactstatus(GGPROTO *gg, uin_t uin, int status, const char *ides HANDLE hContact = gg_getcontact(gg, uin, 0, 0, NULL); // Check if contact is on list - if(!hContact) return; + if (!hContact) return; // Write contact status DBWriteContactSettingWord(hContact, GG_PROTO, GG_KEY_STATUS, (WORD)status_gg2m(gg, status)); diff --git a/protocols/Gadu-Gadu/dialogs.c b/protocols/Gadu-Gadu/dialogs.c index 63a87570e6..b6bfc8f5c0 100644 --- a/protocols/Gadu-Gadu/dialogs.c +++ b/protocols/Gadu-Gadu/dialogs.c @@ -320,7 +320,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, GetDlgItemText(hwndDlg, IDC_UIN, email, sizeof(email)); uin = atoi(email); GetDlgItemText(hwndDlg, IDC_EMAIL, email, sizeof(email)); - if(!strlen(email)) + if (!strlen(email)) MessageBox( NULL, Translate("You need to specify your registration e-mail first."), @@ -724,7 +724,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, dat->updating = FALSE; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat); // Add genders - if(!dat->hContact) + if (!dat->hContact) { SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)_T("")); // 0 SendDlgItemMessage(hwndDlg, IDC_GENDER, CB_ADDSTRING, 0, (LPARAM)Translate("Female")); // 1 @@ -920,7 +920,7 @@ int gg_details_init(GGPROTO *gg, WPARAM wParam, LPARAM lParam) } // Start search for user data - if((HANDLE)lParam == NULL) + if ((HANDLE)lParam == NULL) gg_getinfo((PROTO_INTERFACE *)gg, NULL, 0); return 0; diff --git a/protocols/Gadu-Gadu/filetransfer.c b/protocols/Gadu-Gadu/filetransfer.c index f738dfa774..cc55b993b8 100644 --- a/protocols/Gadu-Gadu/filetransfer.c +++ b/protocols/Gadu-Gadu/filetransfer.c @@ -45,7 +45,7 @@ void gg_dccstart(GGPROTO *gg) } // Check if we wan't direct connections - if(!DBGetContactSettingByte(NULL, GG_PROTO, GG_KEY_DIRECTCONNS, GG_KEYDEF_DIRECTCONNS)) + if (!DBGetContactSettingByte(NULL, GG_PROTO, GG_KEY_DIRECTCONNS, GG_KEYDEF_DIRECTCONNS)) { gg_netlog(gg, "gg_dccstart(): No direct connections setup."); if(gg->event) SetEvent(gg->event); @@ -65,7 +65,7 @@ void gg_dccconnect(GGPROTO *gg, uin_t uin) gg_netlog(gg, "gg_dccconnect(): Connecting to uin %d.", uin); // If unknown user or not on list ignore - if(!hContact) return; + if (!hContact) return; // Read user IP and port ip = swap32(DBGetContactSettingDword(hContact, GG_PROTO, GG_KEY_CLIENTIP, 0)); @@ -73,9 +73,9 @@ void gg_dccconnect(GGPROTO *gg, uin_t uin) myuin = DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, 0); // If not port nor ip nor my uin (?) specified - if(!ip || !port || !uin) return; + if (!ip || !port || !uin) return; - if(!(dcc = gg_dcc_get_file(ip, port, myuin, uin))) + if (!(dcc = gg_dcc_get_file(ip, port, myuin, uin))) return; // Add client dcc to watches @@ -144,7 +144,7 @@ void __cdecl gg_dccmainthread(GGPROTO *gg, void *empty) } // Create listen socket on config direct port - if(!(gg->dcc = gg_dcc_socket_create(uin, (uint16_t)DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_DIRECTPORT, GG_KEYDEF_DIRECTPORT)))) + if (!(gg->dcc = gg_dcc_socket_create(uin, (uint16_t)DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_DIRECTPORT, GG_KEYDEF_DIRECTPORT)))) { gg_netlog(gg, "gg_dccmainthread(): Cannot create DCC listen socket. Exiting."); // Signalize mainthread we haven't start @@ -652,7 +652,7 @@ HANDLE gg_sendfile(PROTO_INTERFACE *proto, HANDLE hContact, const PROTOCHAR* szD uin_t myuin, uin; // Check if main dcc thread is on - if(!gg_isonline(gg)) return ftfail(gg, hContact); + if (!gg_isonline(gg)) return ftfail(gg, hContact); filename = gg_t2a(ppszFiles[0]); @@ -696,7 +696,7 @@ HANDLE gg_sendfile(PROTO_INTERFACE *proto, HANDLE hContact, const PROTOCHAR* szD } // Return if bad connection info - if(!port || !uin || !myuin) + if (!port || !uin || !myuin) { gg_netlog(gg, "gg_sendfile(): Bad contact uin or my uin. Exit."); mir_free(filename); @@ -704,7 +704,7 @@ HANDLE gg_sendfile(PROTO_INTERFACE *proto, HANDLE hContact, const PROTOCHAR* szD } // Try to connect if not ask user to connect me - if((ip && port >= 10 && !(dcc = gg_dcc_send_file(ip, port, myuin, uin))) || (port < 10 && port > 0)) + if ((ip && port >= 10 && !(dcc = gg_dcc_send_file(ip, port, myuin, uin))) || (port < 10 && port > 0)) { // Make fake dcc structure dcc = malloc(sizeof(struct gg_dcc)); @@ -766,7 +766,7 @@ HANDLE gg_dccfileallow(GGPROTO *gg, HANDLE hTransfer, const PROTOCHAR* szPath) LeaveCriticalSection(&gg->ft_mutex); // Open file for appending and check if ok - if((dcc->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) + if ((dcc->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) { gg_netlog(gg, "gg_dccfileallow(): Failed to create file \"%s\".", fileName); ProtoBroadcastAck(GG_PROTO, dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0); @@ -814,7 +814,7 @@ HANDLE gg_dcc7fileallow(GGPROTO *gg, HANDLE hTransfer, const PROTOCHAR* szPath) } // Open file for appending and check if ok - if((dcc7->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) + if ((dcc7->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1) { gg_netlog(gg, "gg_dcc7fileallow(): Failed to create file \"%s\".", fileName); gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER); @@ -973,7 +973,7 @@ int gg_filecancel(PROTO_INTERFACE *proto, HANDLE hContact, HANDLE hTransfer) struct gg_common *c = (struct gg_common *) hTransfer; // Check if its proper dcc - if(!c) return 0; + if (!c) return 0; if (c->type == GG_SESSION_DCC7_SEND || c->type == GG_SESSION_DCC7_GET) return gg_dcc7filecancel((GGPROTO *) proto, hTransfer); diff --git a/protocols/Gadu-Gadu/groupchat.c b/protocols/Gadu-Gadu/groupchat.c index 26a797f163..9ead102cf8 100644 --- a/protocols/Gadu-Gadu/groupchat.c +++ b/protocols/Gadu-Gadu/groupchat.c @@ -131,7 +131,7 @@ int gg_gc_event(GGPROTO *gg, WPARAM wParam, LPARAM lParam) uin_t uin; // Check if we got our protocol, and fields are set - if(!gch + if (!gch || !gch->pDest || !gch->pDest->pszID || !gch->pDest->pszModule @@ -153,7 +153,7 @@ int gg_gc_event(GGPROTO *gg, WPARAM wParam, LPARAM lParam) while (hContact) { DBVARIANT dbv; - if(!DBGetContactSettingString(hContact, GG_PROTO, "ChatRoomID", &dbv)) + if (!DBGetContactSettingString(hContact, GG_PROTO, "ChatRoomID", &dbv)) { if(dbv.pszVal && !strcmp(gch->pDest->pszID, dbv.pszVal)) CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0); @@ -177,7 +177,7 @@ int gg_gc_event(GGPROTO *gg, WPARAM wParam, LPARAM lParam) gcevent.pszUID = id; gcevent.pszText = gch->pszText; - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_NICK, &dbv)) + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_NICK, &dbv)) gcevent.pszNick = dbv.pszVal; else gcevent.pszNick = Translate("Me"); @@ -201,7 +201,7 @@ int gg_gc_event(GGPROTO *gg, WPARAM wParam, LPARAM lParam) if(gch->pDest->iType == GC_USER_PRIVMESS) { HANDLE hContact = NULL; - if((uin = atoi(gch->pszUID)) && (hContact = gg_getcontact(gg, uin, 1, 0, NULL))) + if ((uin = atoi(gch->pszUID)) && (hContact = gg_getcontact(gg, uin, 1, 0, NULL))) CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)0); } gg_netlog(gg, "gg_gc_event(): Unhandled event %d, chat %x, uin %d, text \"%s\".", gch->pDest->iType, chat, uin, gch->pszText); @@ -230,18 +230,18 @@ char *gg_gc_getchat(GGPROTO *gg, uin_t sender, uin_t *recipients, int recipients GCEVENT gcevent = {sizeof(GCEVENT), &gcdest}; gg_netlog(gg, "gg_gc_getchat(): Count %d.", recipients_count); - if(!recipients) return NULL; + if (!recipients) return NULL; // Look for existing chat for(l = gg->chats; l; l = l->next) { GGGC *chat = (GGGC *)l->data; - if(!chat) continue; + if (!chat) continue; if(chat->recipients_count == recipients_count + (sender ? 1 : 0)) { int i, j, found = 0, sok = (sender == 0); - if(!sok) for(i = 0; i < chat->recipients_count; i++) + if (!sok) for(i = 0; i < chat->recipients_count; i++) if(sender == chat->recipients[i]) { sok = 1; @@ -273,15 +273,15 @@ char *gg_gc_getchat(GGPROTO *gg, uin_t sender, uin_t *recipients, int recipients int unknown = (gg_getcontact(gg, sender, 0, 0, NULL) == NULL), unknownSender = unknown; for(i = 0; i < recipients_count; i++) - if(!gg_getcontact(gg, recipients[i], 0, 0, NULL)) + if (!gg_getcontact(gg, recipients[i], 0, 0, NULL)) unknown ++; - if((DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 2) || + if ((DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 2) || (DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL) == 2 && recipients_count >= DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_COUNT_TOTAL, GG_KEYDEF_GC_COUNT_TOTAL)) || (DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN) == 2 && unknown >= DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_COUNT_UNKNOWN, GG_KEYDEF_GC_COUNT_UNKNOWN))) chat->ignore = TRUE; - if(!chat->ignore && ((DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 1) || + if (!chat->ignore && ((DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT) == 1) || (DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL) == 1 && recipients_count >= DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_COUNT_TOTAL, GG_KEYDEF_GC_COUNT_TOTAL)) || (DBGetContactSettingWord(NULL, GG_PROTO, GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN) == 1 && @@ -353,7 +353,7 @@ char *gg_gc_getchat(GGPROTO *gg, uin_t sender, uin_t *recipients, int recipients if(uin = DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, 0)) { UIN2ID(uin, id); - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_NICK, &dbv)) + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_NICK, &dbv)) gcevent.pszNick = dbv.pszVal; else gcevent.pszNick = Translate("Me"); @@ -646,7 +646,7 @@ int gg_gc_changenick(GGPROTO *gg, HANDLE hContact, char *pszNick) { list_t l; uin_t uin = DBGetContactSettingDword(hContact, GG_PROTO, GG_KEY_UIN, 0); - if(!uin || !pszNick) return 0; + if (!uin || !pszNick) return 0; gg_netlog(gg, "gg_gc_changenick(): Nickname for uin %d changed to %s.", uin, pszNick); // Lookup for chats having this nick diff --git a/protocols/Gadu-Gadu/import.c b/protocols/Gadu-Gadu/import.c index a933135baf..43a0367402 100644 --- a/protocols/Gadu-Gadu/import.c +++ b/protocols/Gadu-Gadu/import.c @@ -276,7 +276,7 @@ void gg_parsecontacts(GGPROTO *gg, char *contacts) n = strchr(p, '\n'); p = (n + 1); } - if(!n) p = NULL; + if (!n) p = NULL; // Loadup contact if(uin && strNick) @@ -447,7 +447,7 @@ static INT_PTR gg_import_text(GGPROTO *gg, WPARAM wParam, LPARAM lParam) #ifdef DEBUGMODE gg_netlog(gg, "gg_import_text()"); #endif - if(!GetOpenFileName(&ofn)) return 0; + if (!GetOpenFileName(&ofn)) return 0; f = fopen(str, "r"); _stat(str, &st); @@ -519,7 +519,7 @@ static INT_PTR gg_export_text(GGPROTO *gg, WPARAM wParam, LPARAM lParam) #ifdef DEBUGMODE gg_netlog(gg, "gg_export_text(%s).", str); #endif - if(!GetSaveFileName(&ofn)) return 0; + if (!GetSaveFileName(&ofn)) return 0; if(f = fopen(str, "w")) { diff --git a/protocols/Gadu-Gadu/oauth.c b/protocols/Gadu-Gadu/oauth.c index 849852d32b..2c0631d655 100644 --- a/protocols/Gadu-Gadu/oauth.c +++ b/protocols/Gadu-Gadu/oauth.c @@ -366,16 +366,16 @@ char *gg_oauth_header(GGPROTO *gg, const char *httpmethod, const char *url) DBVARIANT dbv; UIN2ID(DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, 0), uin); - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_PASSWORD, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); password = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); } - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKEN, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKEN, &dbv)) { token = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); } - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKENSECRET, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKENSECRET, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); token_secret = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); @@ -400,7 +400,7 @@ int gg_oauth_receivetoken(GGPROTO *gg) HANDLE nlc = NULL; UIN2ID(DBGetContactSettingDword(NULL, GG_PROTO, GG_KEY_UIN, 0), uin); - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_PASSWORD, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_PASSWORD, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); password = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); @@ -564,11 +564,11 @@ int gg_oauth_checktoken(GGPROTO *gg, int force) DBVARIANT dbv; int res = 1; - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKEN, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKEN, &dbv)) { token = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); } - if(!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKENSECRET, &dbv)) { + if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_TOKENSECRET, &dbv)) { CallService(MS_DB_CRYPT_DECODESTRING, (WPARAM)(int)strlen(dbv.pszVal) + 1, (LPARAM)dbv.pszVal); token_secret = mir_strdup(dbv.pszVal); DBFreeVariant(&dbv); diff --git a/protocols/Gadu-Gadu/ownerinfo.c b/protocols/Gadu-Gadu/ownerinfo.c index aeeb7f1a9b..28cfb4df75 100644 --- a/protocols/Gadu-Gadu/ownerinfo.c +++ b/protocols/Gadu-Gadu/ownerinfo.c @@ -39,14 +39,14 @@ void __cdecl gg_remindpasswordthread(GGPROTO *gg, void *param) #ifdef DEBUGMODE gg_netlog(gg, "gg_remindpasswordthread(): Starting."); #endif - if(!rp || !rp->email || !rp->uin || !strlen(rp->email)) + if (!rp || !rp->email || !rp->uin || !strlen(rp->email)) { if(rp) free(rp); return; } // Get token - if(!gg_gettoken(gg, &token)) return; + if (!gg_gettoken(gg, &token)) return; if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0))) { diff --git a/protocols/Gadu-Gadu/services.c b/protocols/Gadu-Gadu/services.c index bbb7434f6b..7591356f81 100644 --- a/protocols/Gadu-Gadu/services.c +++ b/protocols/Gadu-Gadu/services.c @@ -132,7 +132,7 @@ int gg_refreshstatus(GGPROTO *gg, int status) return TRUE; } - if(!gg_isonline(gg)) + if (!gg_isonline(gg)) { DWORD exitCode = 0; GetExitCodeThread(gg->pth_sess.hThread, &exitCode); @@ -279,7 +279,7 @@ HANDLE gg_basicsearch(PROTO_INTERFACE *proto, const PROTOCHAR *id) gg_pubdir50_t req; char *ida; - if(!gg_isonline(gg)) + if (!gg_isonline(gg)) return (HANDLE)0; if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) @@ -297,7 +297,7 @@ HANDLE gg_basicsearch(PROTO_INTERFACE *proto, const PROTOCHAR *id) mir_free(ida); EnterCriticalSection(&gg->sess_mutex); - if(!gg_pubdir50(gg->sess, req)) + if (!gg_pubdir50(gg->sess, req)) { LeaveCriticalSection(&gg->sess_mutex); gg_forkthread(gg, gg_searchthread, NULL); @@ -317,10 +317,10 @@ static HANDLE gg_searchbydetails(PROTO_INTERFACE *proto, const PROTOCHAR *nick, char data[512] = "\0"; // Check if connected and if there's a search data - if(!gg_isonline(gg)) + if (!gg_isonline(gg)) return 0; - if(!nick && !firstName && !lastName) + if (!nick && !firstName && !lastName) return 0; if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) @@ -368,7 +368,7 @@ static HANDLE gg_searchbydetails(PROTO_INTERFACE *proto, const PROTOCHAR *nick, gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); EnterCriticalSection(&gg->sess_mutex); - if(!gg_pubdir50(gg->sess, req)) + if (!gg_pubdir50(gg->sess, req)) { LeaveCriticalSection(&gg->sess_mutex); gg_forkthread(gg, gg_searchthread, NULL); @@ -432,7 +432,7 @@ int gg_getinfo(PROTO_INTERFACE *proto, HANDLE hContact, int infoType) if(gg_isonline(gg)) { EnterCriticalSection(&gg->sess_mutex); - if(!gg_pubdir50(gg->sess, req)) + if (!gg_pubdir50(gg->sess, req)) { LeaveCriticalSection(&gg->sess_mutex); gg_forkthread(gg, gg_cmdgetinfothread, hContact); @@ -457,7 +457,7 @@ int gg_getinfo(PROTO_INTERFACE *proto, HANDLE hContact, int infoType) if(gg_isonline(gg)) { EnterCriticalSection(&gg->sess_mutex); - if(!gg_pubdir50(gg->sess, req)) + if (!gg_pubdir50(gg->sess, req)) { LeaveCriticalSection(&gg->sess_mutex); gg_forkthread(gg, gg_cmdgetinfothread, hContact); @@ -617,7 +617,7 @@ HWND gg_searchbyadvanced(PROTO_INTERFACE *proto, HWND hwndDlg) unsigned long crc; // Check if connected - if(!gg_isonline(gg)) return (HWND)0; + if (!gg_isonline(gg)) return (HWND)0; if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) { @@ -672,11 +672,11 @@ HWND gg_searchbyadvanced(PROTO_INTERFACE *proto, HWND hwndDlg) yearFrom = atoi(age); // Count & fix ranges - if(!yearTo) + if (!yearTo) yearTo = ay; else yearTo = ay - yearTo; - if(!yearFrom) + if (!yearFrom) yearFrom = 0; else yearFrom = ay - yearFrom; @@ -723,7 +723,7 @@ HWND gg_searchbyadvanced(PROTO_INTERFACE *proto, HWND hwndDlg) if(gg_isonline(gg)) { EnterCriticalSection(&gg->sess_mutex); - if(!gg_pubdir50(gg->sess, req)) + if (!gg_pubdir50(gg->sess, req)) { LeaveCriticalSection(&gg->sess_mutex); gg_forkthread(gg, gg_searchthread, NULL); diff --git a/protocols/Gadu-Gadu/token.c b/protocols/Gadu-Gadu/token.c index 44bfb1f794..378766ef4a 100644 --- a/protocols/Gadu-Gadu/token.c +++ b/protocols/Gadu-Gadu/token.c @@ -115,7 +115,7 @@ int gg_gettoken(GGPROTO *gg, GGTOKEN *token) strcpy(token->id, ""); strcpy(token->val, ""); - if(!(h = gg_token(0)) || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) + if (!(h = gg_token(0)) || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) { char error[128]; mir_snprintf(error, sizeof(error), Translate("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0)); diff --git a/protocols/Gadu-Gadu/userutils.c b/protocols/Gadu-Gadu/userutils.c index 1217488c93..721e4d32cf 100644 --- a/protocols/Gadu-Gadu/userutils.c +++ b/protocols/Gadu-Gadu/userutils.c @@ -32,10 +32,10 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) #ifdef DEBUGMODE gg_netlog(gg, "gg_doregister(): Starting."); #endif - if(!newPass || !newEmail) return NULL; + if (!newPass || !newEmail) return NULL; // Load token - if(!gg_gettoken(gg, &token)) return NULL; + if (!gg_gettoken(gg, &token)) return NULL; if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = h->data) || !s->success || !s->uin) { @@ -87,10 +87,10 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) #ifdef DEBUGMODE gg_netlog(gg, "gg_dounregister(): Starting."); #endif - if(!uin || !password) return NULL; + if (!uin || !password) return NULL; // Load token - if(!gg_gettoken(gg, &token)) return NULL; + if (!gg_gettoken(gg, &token)) return NULL; if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = h->data) || !s->success || s->uin != uin) { @@ -141,7 +141,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) #ifdef DEBUGMODE gg_netlog(gg, "gg_dochpass(): Starting."); #endif - if(!uin || !password || !newPass) return NULL; + if (!uin || !password || !newPass) return NULL; if (!DBGetContactSettingString(NULL, GG_PROTO, GG_KEY_EMAIL, &dbv_email)) { @@ -150,7 +150,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) } // Load token - if(!gg_gettoken(gg, &token)) return NULL; + if (!gg_gettoken(gg, &token)) return NULL; if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = h->data) || !s->success) { @@ -199,10 +199,10 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne #ifdef DEBUGMODE gg_netlog(gg, "gg_doemail(): Starting."); #endif - if(!uin || !email || !newEmail) return NULL; + if (!uin || !email || !newEmail) return NULL; // Load token - if(!gg_gettoken(gg, &token)) return NULL; + if (!gg_gettoken(gg, &token)) return NULL; if (!(h = gg_change_passwd4(uin, newEmail, password, password, token.id, token.val, 0)) || !(s = h->data) || !s->success) { 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); diff --git a/protocols/IcqOscarJ/chan_05ping.cpp b/protocols/IcqOscarJ/chan_05ping.cpp index ac0dc1d87f..d245bd65bf 100644 --- a/protocols/IcqOscarJ/chan_05ping.cpp +++ b/protocols/IcqOscarJ/chan_05ping.cpp @@ -53,7 +53,7 @@ void __cdecl CIcqProto::KeepAliveThread(void *arg) info->hKeepAliveEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - for(;;) + for (;;) { DWORD dwWait = ICQWaitForSingleObject(info->hKeepAliveEvent, dwInterval); if (serverThreadHandle == NULL) // connection lost, end diff --git a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp index dd9b9800a8..8d80430f0e 100644 --- a/protocols/IcqOscarJ/changeinfo/dlgproc.cpp +++ b/protocols/IcqOscarJ/changeinfo/dlgproc.cpp @@ -427,8 +427,8 @@ INT_PTR CALLBACK ChangeInfoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return TRUE; } case NM_KILLFOCUS: - if(!IsStringEditWindow(GetFocus())) dat->EndStringEdit(1); - if(!IsListEditWindow(GetFocus())) dat->EndListEdit(1); + if (!IsStringEditWindow(GetFocus())) dat->EndStringEdit(1); + if (!IsListEditWindow(GetFocus())) dat->EndListEdit(1); break; } break; diff --git a/protocols/IcqOscarJ/changeinfo/editstring.cpp b/protocols/IcqOscarJ/changeinfo/editstring.cpp index 1a4d7138c6..f105ac914a 100644 --- a/protocols/IcqOscarJ/changeinfo/editstring.cpp +++ b/protocols/IcqOscarJ/changeinfo/editstring.cpp @@ -76,15 +76,15 @@ static void EscapesToMultiline(WCHAR *str,PDWORD selStart,PDWORD selEnd) static void EscapesToBinary(char *str) { - for(;*str;str++) + for (;*str;str++) { - if(*str!='\\') continue; + if (*str!='\\') continue; if(str[1]=='n') {*str++='\r'; *str='\n'; continue;} if(str[1]=='0') { char *codeend; *str=(char)strtol(str+1,&codeend,8); - if(*str==0) {*str='\\'; continue;} + if (*str==0) {*str='\\'; continue;} memmove(str+1,codeend,strlennull(codeend)+1); continue; } @@ -106,9 +106,9 @@ char *BinaryToEscapes(char *str) char *out,*pout; out=pout=(char*)SAFE_MALLOC(len); - for(;*str;str++) + for (;*str;str++) { - if((unsigned char)*str>=' ') + if ((unsigned char)*str>=' ') { *pout++=*str; continue; @@ -127,7 +127,7 @@ char *BinaryToEscapes(char *str) } *pout++='\\'; for(i = 0; i < SIZEOF(escapes); i += 2) - if(*str==escapes[i+1]) + if (*str==escapes[i+1]) { *pout++=escapes[i]; extra--; @@ -135,7 +135,7 @@ char *BinaryToEscapes(char *str) } if(i < SIZEOF(escapes)) continue; *pout++='0'; extra--; - if(*str>=8) + if (*str>=8) { *pout++=(*str>>3)+'0'; extra--; @@ -218,7 +218,7 @@ static LRESULT CALLBACK ExpandButtonSubclassProc(HWND hwnd,UINT msg,WPARAM wPara { DWORD startTime,timeNow; startTime=GetTickCount(); - for(;;) + for (;;) { UpdateWindow(hwndEdit); timeNow=GetTickCount(); @@ -285,7 +285,7 @@ void ChangeInfoData::BeginStringEdit(int iItem, RECT *rc, int i, WORD wVKey) hwndUpDown=CreateWindow(UPDOWN_CLASS,_T(""),WS_VISIBLE|WS_CHILD|UDS_AUTOBUDDY|UDS_ALIGNRIGHT|UDS_HOTTRACK|UDS_NOTHOUSANDS|UDS_SETBUDDYINT,0,0,0,0,hwndList,NULL,hInst,NULL); SendMessage(hwndUpDown, UDM_SETRANGE32, range[0], range[1]); SendMessage(hwndUpDown, UDM_SETPOS32, 0, settingData[i].value); - if(!(setting[i].displayType & LIF_ZEROISVALID) && settingData[i].value==0) + if (!(setting[i].displayType & LIF_ZEROISVALID) && settingData[i].value==0) SetWindowTextA(hwndEdit, ""); GetClientRect(hwndUpDown, &rcUpDown); rc->right -= rcUpDown.right; @@ -306,7 +306,7 @@ void ChangeInfoData::EndStringEdit(int save) GetWindowTextA(hwndEdit,(char*)text,GetWindowTextLength(hwndEdit)+1); EscapesToBinary(text); - if((setting[iEditItem].displayType&LIM_TYPE)==LI_NUMBER) + if ((setting[iEditItem].displayType&LIM_TYPE)==LI_NUMBER) { LPARAM newValue; int *range=(int*)setting[iEditItem].pList; diff --git a/protocols/IcqOscarJ/changeinfo/upload.cpp b/protocols/IcqOscarJ/changeinfo/upload.cpp index 0f82a87b99..05193e467b 100644 --- a/protocols/IcqOscarJ/changeinfo/upload.cpp +++ b/protocols/IcqOscarJ/changeinfo/upload.cpp @@ -40,7 +40,7 @@ int CIcqProto::StringToListItemId(const char *szSetting,int def) int i; for(i=0;i= unicode_size) break; - if((c & 0x80) == 0) + if ((c & 0x80) == 0) { unicode[out_index++] = c; } - else if((c & 0xe0) == 0xe0) + else if ((c & 0xe0) == 0xe0) { unicode[out_index] = (c & 0x1F) << 12; c = utf8[index++]; diff --git a/protocols/IcqOscarJ/icq_direct.cpp b/protocols/IcqOscarJ/icq_direct.cpp index 6a81a9b253..55e860adea 100644 --- a/protocols/IcqOscarJ/icq_direct.cpp +++ b/protocols/IcqOscarJ/icq_direct.cpp @@ -964,7 +964,7 @@ int DecryptDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) } X1 = buf[M1] ^ 0xFF; - if(((B1 >> 16) & 0xFF) != X1) + if (((B1 >> 16) & 0xFF) != X1) { return 0; } diff --git a/protocols/IcqOscarJ/icq_popups.cpp b/protocols/IcqOscarJ/icq_popups.cpp index e1cdadada6..3bc1382ef2 100644 --- a/protocols/IcqOscarJ/icq_popups.cpp +++ b/protocols/IcqOscarJ/icq_popups.cpp @@ -124,7 +124,7 @@ INT_PTR CALLBACK DlgProcIcqPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR case IDC_POPUP_LOG2_TIMEOUT: case IDC_POPUP_LOG3_TIMEOUT: case IDC_POPUP_SPAM_TIMEOUT: - if((HIWORD(wParam) == EN_CHANGE) && bInitDone) + if ((HIWORD(wParam) == EN_CHANGE) && bInitDone) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; default: diff --git a/protocols/JabberG/MString.cpp b/protocols/JabberG/MString.cpp index 524231fde2..773871d1a5 100644 --- a/protocols/JabberG/MString.cpp +++ b/protocols/JabberG/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/JabberG/MString.h b/protocols/JabberG/MString.h index fbef22ddf5..6f90b7741b 100644 --- a/protocols/JabberG/MString.h +++ b/protocols/JabberG/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/JabberG/jabber_adhoc.cpp b/protocols/JabberG/jabber_adhoc.cpp index f83fc88c3a..29cee4cd8e 100644 --- a/protocols/JabberG/jabber_adhoc.cpp +++ b/protocols/JabberG/jabber_adhoc.cpp @@ -608,6 +608,6 @@ int __cdecl CJabberProto::ContactMenuRunCommands(WPARAM wParam, LPARAM lParam ) void CJabberProto::ContactMenuAdhocCommands( CJabberAdhocStartupParams* param ) { - if( param ) + if ( param ) CreateDialogParam( hInst, MAKEINTRESOURCE( IDD_FORM ), NULL, JabberAdHoc_CommandDlgProc, (LPARAM)param ); } diff --git a/protocols/JabberG/jabber_captcha.cpp b/protocols/JabberG/jabber_captcha.cpp index 046edc3863..c090499cd2 100644 --- a/protocols/JabberG/jabber_captcha.cpp +++ b/protocols/JabberG/jabber_captcha.cpp @@ -51,7 +51,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam params = (CAPTCHA_FORM_PARAMS*)lParam; LPCTSTR hint = params->hint; - if( hint == NULL ) + if ( hint == NULL ) hint = TranslateT("Enter the text you see"); SetDlgItemText( hwndDlg, IDC_INSTRUCTION, TranslateTS( hint ) ); SetWindowLongPtr( hwndDlg, GWLP_USERDATA, ( LONG )params ); @@ -112,7 +112,7 @@ INT_PTR CALLBACK JabberCaptchaFormDlgProc( HWND hwndDlg, UINT msg, WPARAM wParam return FALSE; } -bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info ){ +bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info ) { CAPTCHA_FORM_PARAMS param; char *ImageBuf = 0; const TCHAR *PicType = 0; @@ -165,7 +165,7 @@ bool CJabberProto::ProcessCaptcha (HXML node, HXML parentNode, ThreadData* info return true; } -void CJabberProto::GetCaptchaImage ( HXML node, char *ImageBuf, const TCHAR *PicType, TCHAR*& CaptchaPath ){ +void CJabberProto::GetCaptchaImage ( HXML node, char *ImageBuf, const TCHAR *PicType, TCHAR*& CaptchaPath ) { HXML o = xmlGetChild( node , "data" ); int bufferLen; char* buffer = JabberBase64DecodeT(xmlGetText( o ), &bufferLen ); @@ -227,7 +227,7 @@ void CJabberProto::sendCaptchaResult(TCHAR* buf, ThreadData* info, LPCTSTR from, info -> send (iq); } -void CJabberProto::sendCaptchaError(ThreadData* info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge ){ +void CJabberProto::sendCaptchaError(ThreadData* info, LPCTSTR from, LPCTSTR to, LPCTSTR challenge ) { XmlNode message( _T("message")); HXML query= message << XATTR(_T("type"), _T("error")) << XATTR(_T("to"), from) << XATTR(_T("id"), challenge) << XATTR(_T("from"), to) << XCHILD(_T("error")) << XATTR(_T("type"), _T("modify")) diff --git a/protocols/JabberG/jabber_events.cpp b/protocols/JabberG/jabber_events.cpp index 7e26de73d9..722f55f6b4 100644 --- a/protocols/JabberG/jabber_events.cpp +++ b/protocols/JabberG/jabber_events.cpp @@ -45,7 +45,7 @@ Last change by : $Author: borkra $ int CJabberProto::OnContactDeleted( WPARAM wParam, LPARAM ) { - if( !m_bJabberOnline ) // should never happen + if ( !m_bJabberOnline ) // should never happen return 0; DBVARIANT dbv; diff --git a/protocols/JabberG/jabber_iq_handlers.cpp b/protocols/JabberG/jabber_iq_handlers.cpp index 31a843f7bf..bcb7192c5b 100644 --- a/protocols/JabberG/jabber_iq_handlers.cpp +++ b/protocols/JabberG/jabber_iq_handlers.cpp @@ -90,7 +90,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); - if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) + if ( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) return FALSE; // Call GetNativeSystemInfo if supported or GetSystemInfo otherwise. @@ -111,14 +111,14 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 ) { - if( osvi.wProductType == VER_NT_WORKSTATION ) + if ( osvi.wProductType == VER_NT_WORKSTATION ) StringCchCat(pszOS, BUFSIZE, TEXT("Windows 7 ")); else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 R2 " )); } if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 ) { - if( osvi.wProductType == VER_NT_WORKSTATION ) + if ( osvi.wProductType == VER_NT_WORKSTATION ) StringCchCat(pszOS, BUFSIZE, TEXT("Windows Vista ")); else StringCchCat(pszOS, BUFSIZE, TEXT("Windows Server 2008 " )); @@ -190,13 +190,13 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) { - if( GetSystemMetrics(SM_SERVERR2) ) + if ( GetSystemMetrics(SM_SERVERR2) ) StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Server 2003 R2, ")); else if ( osvi.wSuiteMask==VER_SUITE_STORAGE_SERVER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Storage Server 2003")); else if ( osvi.wSuiteMask==VER_SUITE_WH_SERVER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Windows Home Server")); - else if( osvi.wProductType == VER_NT_WORKSTATION && + else if ( osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64) { StringCchCat(pszOS, BUFSIZE, TEXT( "Windows XP Professional x64 Edition")); @@ -208,17 +208,17 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) { if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_IA64 ) { - if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + if ( osvi.wSuiteMask & VER_SUITE_DATACENTER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Edition for Itanium-based Systems" )); - else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise Edition for Itanium-based Systems" )); } else if ( si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 ) { - if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + if ( osvi.wSuiteMask & VER_SUITE_DATACENTER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter x64 Edition" )); - else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise x64 Edition" )); else StringCchCat(pszOS, BUFSIZE, TEXT( "Standard x64 Edition" )); } @@ -227,9 +227,9 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) { if ( osvi.wSuiteMask & VER_SUITE_COMPUTE_SERVER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Compute Cluster Edition" )); - else if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + else if ( osvi.wSuiteMask & VER_SUITE_DATACENTER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Edition" )); - else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) StringCchCat(pszOS, BUFSIZE, TEXT( "Enterprise Edition" )); else if ( osvi.wSuiteMask & VER_SUITE_BLADE ) StringCchCat(pszOS, BUFSIZE, TEXT( "Web Edition" )); @@ -241,7 +241,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) { StringCchCat(pszOS, BUFSIZE, TEXT("Windows XP ")); - if( osvi.wSuiteMask & VER_SUITE_PERSONAL ) + if ( osvi.wSuiteMask & VER_SUITE_PERSONAL ) StringCchCat(pszOS, BUFSIZE, TEXT( "Home Edition" )); else StringCchCat(pszOS, BUFSIZE, TEXT( "Professional" )); } @@ -256,9 +256,9 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) } else { - if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + if ( osvi.wSuiteMask & VER_SUITE_DATACENTER ) StringCchCat(pszOS, BUFSIZE, TEXT( "Datacenter Server" )); - else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + else if ( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) StringCchCat(pszOS, BUFSIZE, TEXT( "Advanced Server" )); else StringCchCat(pszOS, BUFSIZE, TEXT( "Server" )); } @@ -266,7 +266,7 @@ BOOL GetOSDisplayString(LPTSTR pszOS, int BUFSIZE) // Include service pack (if any) and build number. - if( _tcslen(osvi.szCSDVersion) > 0 ) + if ( _tcslen(osvi.szCSDVersion) > 0 ) { StringCchCat(pszOS, BUFSIZE, TEXT(" ") ); StringCchCat(pszOS, BUFSIZE, osvi.szCSDVersion); diff --git a/protocols/JabberG/jabber_iqid.cpp b/protocols/JabberG/jabber_iqid.cpp index db15079953..72ddcf6d4c 100644 --- a/protocols/JabberG/jabber_iqid.cpp +++ b/protocols/JabberG/jabber_iqid.cpp @@ -345,7 +345,7 @@ void CJabberProto::GroupchatJoinByHContact( HANDLE hContact, bool autojoin ) TCHAR *nick = JGetStringT( hContact, "MyNick" ); if ( !nick ) { nick = JabberNickFromJID( m_szJabberJID ); - if( !nick ) { + if ( !nick ) { mir_free( roomjid ); return; } diff --git a/protocols/JabberG/jabber_iqid_muc.cpp b/protocols/JabberG/jabber_iqid_muc.cpp index c088c265de..9cd4cdb51c 100644 --- a/protocols/JabberG/jabber_iqid_muc.cpp +++ b/protocols/JabberG/jabber_iqid_muc.cpp @@ -288,7 +288,7 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc( HWND hwndDlg, UINT msg, WPARAM ListView_GetSubItemRect( nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc ); if ( nm->iSubItem == 1 ) { - if( nm->nmcd.lItemlParam == ( LPARAM )( -1 )) + if ( nm->nmcd.lItemlParam == ( LPARAM )( -1 )) hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_ADDCONTACT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 ); else hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_DELETE ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 ); diff --git a/protocols/JabberG/jabber_list.cpp b/protocols/JabberG/jabber_list.cpp index 47f336187f..2397e0bd73 100644 --- a/protocols/JabberG/jabber_list.cpp +++ b/protocols/JabberG/jabber_list.cpp @@ -82,7 +82,7 @@ void CJabberProto::ListWipe( void ) int i; EnterCriticalSection( &m_csLists ); - for( i=0; i < m_lstRoster.getCount(); i++ ) + for ( i=0; i < m_lstRoster.getCount(); i++ ) JabberListFreeItemInternal( m_lstRoster[i] ); m_lstRoster.destroy(); @@ -432,7 +432,7 @@ int CJabberProto::ListFindNext( JABBER_LIST list, int fromOffset ) { EnterCriticalSection( &m_csLists ); int i = ( fromOffset >= 0 ) ? fromOffset : 0; - for( ; ilist == list ) { LeaveCriticalSection( &m_csLists ); return i; diff --git a/protocols/JabberG/jabber_opt.cpp b/protocols/JabberG/jabber_opt.cpp index 574cf4b50c..5baae257e7 100644 --- a/protocols/JabberG/jabber_opt.cpp +++ b/protocols/JabberG/jabber_opt.cpp @@ -1292,7 +1292,7 @@ void CJabberProto::_RosterExportToFile(HWND hwndDlg) ofn.nMaxFile = SIZEOF(filename); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = _T("xml"); - if(!GetSaveFileName(&ofn)) return; + if (!GetSaveFileName(&ofn)) return; FILE * fp = fopent(filename,_T("w")); if (!fp) return; diff --git a/protocols/JabberG/jabber_privacy.cpp b/protocols/JabberG/jabber_privacy.cpp index f6c1514c29..67c8504d76 100644 --- a/protocols/JabberG/jabber_privacy.cpp +++ b/protocols/JabberG/jabber_privacy.cpp @@ -2153,7 +2153,7 @@ void CJabberDlgPrivacyLists::clcClist_OnClick(CCtrlClc::TEventInfo *evt) if(evt->info->iColumn==-1) return; hItem = m_clcClist.HitTest(evt->info->pt.x, evt->info->pt.y, &hitFlags); if(hItem==NULL) return; - if(!(hitFlags&CLCHT_ONITEMEXTRA)) return; + if (!(hitFlags&CLCHT_ONITEMEXTRA)) return; iImage = m_clcClist.GetExtraImage(hItem, evt->info->iColumn); if (iImage != 0xFF) diff --git a/protocols/JabberG/jabber_proto.cpp b/protocols/JabberG/jabber_proto.cpp index 21f067e12e..2457eab7a2 100644 --- a/protocols/JabberG/jabber_proto.cpp +++ b/protocols/JabberG/jabber_proto.cpp @@ -1130,7 +1130,7 @@ HANDLE __cdecl CJabberProto::SendFile( HANDLE hContact, const TCHAR* szDescripti ft->std.ptszFiles = ( TCHAR** ) mir_calloc( sizeof( TCHAR* )* ft->std.totalFiles ); ft->fileSize = ( unsigned __int64* ) mir_calloc( sizeof( unsigned __int64 ) * ft->std.totalFiles ); - for( i=j=0; i < ft->std.totalFiles; i++ ) { + for ( i=j=0; i < ft->std.totalFiles; i++ ) { if ( _tstati64( ppszFiles[i], &statbuf )) Log( "'%s' is an invalid filename", ppszFiles[i] ); else { @@ -1565,7 +1565,7 @@ int __cdecl CJabberProto::UserIsTyping( HANDLE hContact, int type ) if ( jcb & JABBER_CAPS_CHATSTATES ) { m << XATTR( _T("type"), _T("chat")) << XATTRID( SerialNext()); - switch ( type ){ + switch ( type ) { case PROTOTYPE_SELFTYPING_OFF: m << XCHILDNS( _T("paused"), _T(JABBER_FEAT_CHATSTATES)); m_ThreadInfo->send( m ); @@ -1581,7 +1581,7 @@ int __cdecl CJabberProto::UserIsTyping( HANDLE hContact, int type ) if ( item->messageEventIdStr != NULL ) x << XCHILD( _T("id"), item->messageEventIdStr ); - switch ( type ){ + switch ( type ) { case PROTOTYPE_SELFTYPING_OFF: m_ThreadInfo->send( m ); break; diff --git a/protocols/JabberG/jabber_proxy.cpp b/protocols/JabberG/jabber_proxy.cpp index 9ee30bf03b..e6f7ef2f7b 100644 --- a/protocols/JabberG/jabber_proxy.cpp +++ b/protocols/JabberG/jabber_proxy.cpp @@ -37,14 +37,14 @@ int JabberHttpGatewayInit( HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NET char szSid[33], szHttpServer[256], szHttpGetUrl[300], szHttpPostUrl[300]; NETLIBHTTPPROXYINFO nlhpi = {0}; - for( responseBytes = 0; ; ) { + for ( responseBytes = 0; ; ) { recvResult = Netlib_Recv( hConn, response + responseBytes, sizeof( response ) - responseBytes, MSG_DUMPPROXY ); - if( recvResult<=0 ) break; + if ( recvResult<=0 ) break; responseBytes += recvResult; - if( responseBytes == sizeof( response )) + if ( responseBytes == sizeof( response )) break; } - if( responseBytes < 31 ) + if ( responseBytes < 31 ) { SetLastError( ERROR_INVALID_DATA ); return 0; @@ -60,7 +60,7 @@ int JabberHttpGatewayInit( HANDLE /*hConn*/, NETLIBOPENCONNECTION* /*nloc*/, NET unpackDWord( &buf, &dwSid4 ); sprintf( szSid, "%08x%08x%08x%08x", dwSid1, dwSid2, dwSid3, dwSid4 ); unpackWord( &buf, &wIpLen ); - if( responseBytes < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof( szHttpServer ) - 1 ) + if ( responseBytes < 30 + wIpLen || wIpLen == 0 || wIpLen > sizeof( szHttpServer ) - 1 ) { SetLastError( ERROR_INVALID_DATA ); return 0; @@ -111,9 +111,9 @@ int icq_httpGatewayWrapSend( HANDLE hConn, PBYTE buf, int len, int flags, MIRAND packString( &packet, buf, ( WORD )len ); sendResult = Netlib_Send( hConn, packet.pData, packet.wLen, flags ); mir_free( packet.pData ); - if( sendResult <= 0 ) + if ( sendResult <= 0 ) return sendResult; - if( sendResult < 14 ) + if ( sendResult < 14 ) return 0; return sendResult - 14; } @@ -125,7 +125,7 @@ PBYTE icq_httpGatewayUnwrapRecv( NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, in int i, copyBytes; tbuf = buf; - for( i = 0;; ) + for ( i = 0;; ) { if ( tbuf - buf + 2 > len ) break; unpackWord( &tbuf, &wLen ); diff --git a/protocols/JabberG/jabber_search.h b/protocols/JabberG/jabber_search.h index c978f2ff9c..ca754e4238 100644 --- a/protocols/JabberG/jabber_search.h +++ b/protocols/JabberG/jabber_search.h @@ -165,7 +165,7 @@ public: int index=_Records.getIndex(rec); if (index<0) { - if(!_Records.insert(rec)) delete rec; + if (!_Records.insert(rec)) delete rec; else { index=_Records.getIndex(rec); @@ -186,7 +186,7 @@ public: if (index<0) { _KEYTYPE* newKey=CopyProc(Key); - if(!_Records.insert(rec)) + if (!_Records.insert(rec)) { delete rec; DestroyProc(newKey); diff --git a/protocols/JabberG/jabber_svc.cpp b/protocols/JabberG/jabber_svc.cpp index 31ff002999..ed5bfd7b78 100644 --- a/protocols/JabberG/jabber_svc.cpp +++ b/protocols/JabberG/jabber_svc.cpp @@ -480,7 +480,7 @@ INT_PTR __cdecl CJabberProto::JabberServiceParseXmppURI( WPARAM wParam, LPARAM l return 1; // skip // - for( ++szJid; *szJid == _T( '/' ); ++szJid ); + for ( ++szJid; *szJid == _T( '/' ); ++szJid ); // empty jid? if ( !*szJid ) diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp index 3c343600c8..bfb3ba0129 100644 --- a/protocols/JabberG/jabber_thread.cpp +++ b/protocols/JabberG/jabber_thread.cpp @@ -1735,7 +1735,7 @@ void CJabberProto::OnProcessPresence( HXML node, ThreadData* info ) Log( "Not hasXAvatar" ); for ( int i = 1; ( xNode=xmlGetNthChild( node, _T("x"), i )) != NULL; i++ ) { if ( !lstrcmp( xmlGetAttrValue( xNode, _T("xmlns")), _T("vcard-temp:x:update"))) { - if (( xNode = xmlGetChild( xNode , "photo" )) != NULL ){ + if (( xNode = xmlGetChild( xNode , "photo" )) != NULL ) { LPCTSTR txt = xmlGetText( xNode ); if ( txt != NULL && txt[0] != 0) { JSetByte( hContact, "AvatarXVcard", 1 ); diff --git a/protocols/JabberG/jabber_vcard.cpp b/protocols/JabberG/jabber_vcard.cpp index ee7b2d4638..2ec8dcf3d7 100644 --- a/protocols/JabberG/jabber_vcard.cpp +++ b/protocols/JabberG/jabber_vcard.cpp @@ -817,7 +817,7 @@ static INT_PTR CALLBACK ContactDlgProc( HWND hwndDlg, UINT msg, WPARAM, LPARAM l HICON hIcon; ListView_GetSubItemRect( nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc ); - if( nm->nmcd.lItemlParam==( LPARAM )( -1 ) && nm->iSubItem==3 ) + if ( nm->nmcd.lItemlParam==( LPARAM )( -1 ) && nm->iSubItem==3 ) hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_ADDCONTACT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 ); else if ( nm->iSubItem==2 && nm->nmcd.lItemlParam!=( LPARAM )( -1 )) hIcon = ( HICON )LoadImage( hInst, MAKEINTRESOURCE( IDI_EDIT ), IMAGE_ICON, GetSystemMetrics( SM_CXSMICON ), GetSystemMetrics( SM_CYSMICON ), 0 ); @@ -872,7 +872,7 @@ static INT_PTR CALLBACK ContactDlgProc( HWND hwndDlg, UINT msg, WPARAM, LPARAM l char idstr[33]; DBVARIANT dbv; - for( i=lvi.lParam;;i++ ) { + for ( i=lvi.lParam;;i++ ) { WORD nFlag; wsprintfA( idstr, szIdTemplate, i+1 ); diff --git a/protocols/JabberG/jabber_xstatus.cpp b/protocols/JabberG/jabber_xstatus.cpp index 96bc7fd948..28e1c63096 100644 --- a/protocols/JabberG/jabber_xstatus.cpp +++ b/protocols/JabberG/jabber_xstatus.cpp @@ -443,7 +443,7 @@ void CPepService::ResetPublish() void CPepService::ForceRepublishOnLogin() { - if(!m_wasPublished) + if (!m_wasPublished) Publish(); } @@ -799,7 +799,7 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText void CPepMood::ShowSetDialog(BYTE bQuiet) { - if( !bQuiet ) { + if ( !bQuiet ) { CJabberDlgPepSimple dlg(m_proto, TranslateT("Set Mood")); for (int i = 1; i < SIZEOF(g_arrMoods); ++i) dlg.AddStatusMode(i, g_arrMoods[i].szTag, m_icons.GetIcon(g_arrMoods[i].szTag), TranslateTS(g_arrMoods[i].szName)); @@ -1070,7 +1070,7 @@ void CPepActivity::InitGui() TCHAR szSection[100]; mir_sntprintf(szSection, SIZEOF(szSection), _T("Status Icons/%s/Activities"), m_proto->m_tszUserName); - for (int i = 0; i < SIZEOF(g_arrActivities); i++){ + for (int i = 0; i < SIZEOF(g_arrActivities); i++) { if (g_arrActivities[i].szFirst) m_icons.RegisterIcon(g_arrActivities[i].szFirst, szFile, g_arrActivities[i].iconid, szSection, TranslateTS(g_arrActivities[i].szTitle)); if (g_arrActivities[i].szSecond) diff --git a/protocols/MRA/Mra.cpp b/protocols/MRA/Mra.cpp index e5e5d22e0f..26cdc4ffec 100644 --- a/protocols/MRA/Mra.cpp +++ b/protocols/MRA/Mra.cpp @@ -326,7 +326,7 @@ return(0); void VersionConversions() { - /*switch(DB_Mra_GetDword(NULL,"LastPluginVersion",PLUGIN_MAKE_VERSION(0,0,0,0))){ + /*switch(DB_Mra_GetDword(NULL,"LastPluginVersion",PLUGIN_MAKE_VERSION(0,0,0,0))) { default: case PLUGIN_MAKE_VERSION(1,14,0,0): case PLUGIN_MAKE_VERSION(1,14,0,1): diff --git a/protocols/MRA/MraAdvancedSearch.cpp b/protocols/MRA/MraAdvancedSearch.cpp index 86ac51309a..c97ae8aba2 100644 --- a/protocols/MRA/MraAdvancedSearch.cpp +++ b/protocols/MRA/MraAdvancedSearch.cpp @@ -196,7 +196,7 @@ INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,L } break; case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDOK: SendMessage(GetParent(hWndDlg),WM_COMMAND,MAKEWPARAM(IDOK,BN_CLICKED),(LPARAM)GetDlgItem(GetParent(hWndDlg),IDOK)); break; diff --git a/protocols/MRA/MraAntiSpam.cpp b/protocols/MRA/MraAntiSpam.cpp index 38607c2107..20be25d33a 100644 --- a/protocols/MRA/MraAntiSpam.cpp +++ b/protocols/MRA/MraAntiSpam.cpp @@ -224,7 +224,7 @@ INT_PTR CALLBACK MraAntiSpamDlgProcOpts(HWND hWndDlg,UINT msg,WPARAM wParam,LPAR } dwCount=((i*2)+1024); - for(;ilpwszFullPath;lpwszCurPos--) + for (;lpwszCurPos>lpwszFullPath;lpwszCurPos--) { if ((*lpwszCurPos)=='\\') { @@ -1129,7 +1129,7 @@ void MraFilesQueueRecvThreadProc(LPVOID lpParameter) while(bContinue) { - switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)){ + switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)) { case SOCKET_ERROR: case 0:// Time out dwRetErrorCode=GetLastError(); diff --git a/protocols/MRA/MraFilesQueue_mod.cpp b/protocols/MRA/MraFilesQueue_mod.cpp index 23488c9a91..b315636a69 100644 --- a/protocols/MRA/MraFilesQueue_mod.cpp +++ b/protocols/MRA/MraFilesQueue_mod.cpp @@ -104,7 +104,7 @@ BOOL CALLBACK MraFilesQueueDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LP CheckDlgButton(hWndDlg,IDC_FILE_SEND_IGNORYADDITIONALPORTS,DB_Mra_GetByte(NULL,"FileSendIgnoryAdditionalPorts",MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS)); CheckDlgButton(hWndDlg,IDC_FILE_SEND_HIDE_MY_ADDRESSES,DB_Mra_GetByte(NULL,"FileSendHideMyAddresses",MRA_DEF_FS_HIDE_MY_ADDRESSES)); CheckDlgButton(hWndDlg,IDC_FILE_SEND_ADD_EXTRA_ADDRESS,DB_Mra_GetByte(NULL,"FileSendAddExtraAddresses",MRA_DEF_FS_ADD_EXTRA_ADDRESSES)); - if(!DBGetContactSetting(NULL,PROTOCOL_NAME,"FileSendExtraAddresses",&dbv)) { + if (!DBGetContactSetting(NULL,PROTOCOL_NAME,"FileSendExtraAddresses",&dbv)) { //bit of a security hole here, since it's easy to extract a password from an edit box SetDlgItemText(hWndDlg,IDC_FILE_SEND_EXTRA_ADDRESS,dbv.pszVal); DBFreeVariant(&dbv); @@ -846,7 +846,7 @@ HANDLE MraFilesQueueConnectOut(MRA_FILES_QUEUE_ITEM *pmrafqFilesQueueItem) nloc.flags=NLOCF_V2; if (DB_Mra_GetByte(NULL,"FileSendIgnoryAdditionalPorts",MRA_DEF_FS_IGNORY_ADDITIONAL_PORTS)) {// фильтруем порты для одного IP, вместо 3 будем коннектится только к одному - switch(DB_Mra_GetWord(NULL,"ServerPort",MRA_DEFAULT_SERVER_PORT)){ + switch(DB_Mra_GetWord(NULL,"ServerPort",MRA_DEFAULT_SERVER_PORT)) { case MRA_SERVER_PORT_STANDART_NLB: dwLocalPort=MRA_SERVER_PORT_STANDART; break; diff --git a/protocols/MRA/MraMRIMProxy.cpp b/protocols/MRA/MraMRIMProxy.cpp index 296cd5f4de..1eb3ac24c9 100644 --- a/protocols/MRA/MraMRIMProxy.cpp +++ b/protocols/MRA/MraMRIMProxy.cpp @@ -162,7 +162,7 @@ DWORD MraMrimProxyConnect(HANDLE hMraMrimProxyData,HANDLE *phConnection) while(bContinue) { - switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)){ + switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)) { case SOCKET_ERROR: case 0:// Time out dwRetErrorCode=GetLastError(); diff --git a/protocols/MRA/MraPopUp.cpp b/protocols/MRA/MraPopUp.cpp index 9a2fac8fb9..00247bd3a7 100644 --- a/protocols/MRA/MraPopUp.cpp +++ b/protocols/MRA/MraPopUp.cpp @@ -64,7 +64,7 @@ INT_PTR CALLBACK MraPopupDlgProcOpts(HWND hWndDlg, UINT msg, WPARAM wParam, LPAR } return(TRUE); case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDC_COMBO_POPUP_TYPE: if (HIWORD(wParam) == CBN_SELCHANGE) { BOOL bEnabled, bUseWinColors; diff --git a/protocols/MRA/MraSelectEMail.cpp b/protocols/MRA/MraSelectEMail.cpp index ba9da3d471..cf993ebd7e 100644 --- a/protocols/MRA/MraSelectEMail.cpp +++ b/protocols/MRA/MraSelectEMail.cpp @@ -61,7 +61,7 @@ INT_PTR CALLBACK MraSelectEMailDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,L EndDialog(hWndDlg,NO_ERROR); break; case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDC_LIST_EMAILS: if (HIWORD(wParam)==LBN_DBLCLK) { diff --git a/protocols/MRA/Mra_functions.cpp b/protocols/MRA/Mra_functions.cpp index 222dd85dda..bb88dc3dcd 100644 --- a/protocols/MRA/Mra_functions.cpp +++ b/protocols/MRA/Mra_functions.cpp @@ -462,7 +462,7 @@ DWORD GetContactFlags(HANDLE hContact) if (DBGetContactSettingByte(hContact,"CList","Hidden",0)) dwRet|=CONTACT_FLAG_SHADOW; - switch(DB_Mra_GetWord(hContact,"ApparentMode",0)){ + switch(DB_Mra_GetWord(hContact,"ApparentMode",0)) { case ID_STATUS_OFFLINE: dwRet|=CONTACT_FLAG_INVISIBLE; break; @@ -490,7 +490,7 @@ DWORD SetContactFlags(HANDLE hContact,DWORD dwContactFlag) }else{ DBDeleteContactSetting(hContact,"CList","Hidden"); } - switch(dwContactFlag&(CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE)){ + switch(dwContactFlag&(CONTACT_FLAG_INVISIBLE|CONTACT_FLAG_VISIBLE)) { case CONTACT_FLAG_INVISIBLE: DB_Mra_SetWord(hContact,"ApparentMode",ID_STATUS_OFFLINE); break; @@ -578,7 +578,7 @@ DWORD SetContactBasicInfoW(HANDLE hContact,DWORD dwSetInfoFlags,DWORD dwFlags,DW if(dwFlags&SCBIF_NICK) { - if((dwFlags&SCBIF_FLAG) && ((dwContactFlag&CONTACT_FLAG_UNICODE_NAME)==0)) + if ((dwFlags&SCBIF_FLAG) && ((dwContactFlag&CONTACT_FLAG_UNICODE_NAME)==0)) { if (lpwszNick && dwNickSize) DB_SetStringExA(hContact,"CList","MyHandle",(LPSTR)lpwszNick,dwNickSize); }else{ @@ -1759,7 +1759,7 @@ INT_PTR CALLBACK SetXStatusDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARA DestroyWindow(hWndDlg); break; case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDOK: DestroyWindow(hWndDlg); break; @@ -1895,7 +1895,7 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg,UINT message,WPARAM wPa DestroyWindow(hWndDlg); break; case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDOK: { DWORD dwFlags; diff --git a/protocols/MRA/Mra_options.cpp b/protocols/MRA/Mra_options.cpp index b0f1484843..d478ac5308 100644 --- a/protocols/MRA/Mra_options.cpp +++ b/protocols/MRA/Mra_options.cpp @@ -72,7 +72,7 @@ INT_PTR CALLBACK DlgProcOptsAccount(HWND hWndDlg,UINT msg,WPARAM wParam,LPARAM l } return(TRUE); case WM_COMMAND: - switch (LOWORD(wParam)){ + switch (LOWORD(wParam)) { case IDC_NEW_ACCOUNT_LINK: CallService(MS_UTILS_OPENURL,TRUE,(LPARAM)MRA_REGISTER_URL); return(TRUE); @@ -152,7 +152,7 @@ INT_PTR CALLBACK DlgProcOptsConnections(HWND hWndDlg,UINT msg,WPARAM wParam,LPAR } return(TRUE); case WM_COMMAND: - switch(LOWORD(wParam)){ + switch(LOWORD(wParam)) { case IDC_BUTTON_DEFAULT: SET_DLG_ITEM_TEXTA(hWndDlg,IDC_SERVER,MRA_DEFAULT_SERVER); SetDlgItemInt(hWndDlg,IDC_SERVERPORT,MRA_DEFAULT_SERVER_PORT,FALSE); diff --git a/protocols/MRA/Mra_proto.cpp b/protocols/MRA/Mra_proto.cpp index 7d1c865d5f..04e6023dd8 100644 --- a/protocols/MRA/Mra_proto.cpp +++ b/protocols/MRA/Mra_proto.cpp @@ -230,7 +230,7 @@ DWORD MraGetNLBData(LPSTR lpszHost,SIZE_T dwHostBuffSize,WORD *pwPort) while(MraGetStatus(0,0)!=ID_STATUS_OFFLINE && bContinue) { - switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)){ + switch(CallService(MS_NETLIB_SELECT,0,(LPARAM)&nls)) { case SOCKET_ERROR: case 0:// Time out bContinue=FALSE; @@ -951,7 +951,7 @@ DWORD MraCommandDispather(mrim_packet_header_t *pmaHeader,DWORD *pdwPingPeriod,D case MRIM_CS_ANKETA_INFO: if (MraSendQueueFind(masMraSettings.hSendQueueHandle,pmaHeader->seq,NULL,&hContact,&dwAckType,(LPBYTE*)&lpsString.lpszData,&lpsString.dwSize)==NO_ERROR) { - switch(GetUL(&lpbDataCurrent)){ + switch(GetUL(&lpbDataCurrent)) { case MRIM_ANKETA_INFO_STATUS_OK:// поиск успешно завершен { DWORD dwFeildsNum,dwMaxRows,dwServerTime,dwStatus; @@ -1014,7 +1014,7 @@ DWORD MraCommandDispather(mrim_packet_header_t *pmaHeader,DWORD *pdwPingPeriod,D }else if (CompareStringA(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),NORM_IGNORECASE,pmralpsFeilds[i].lpszData,pmralpsFeilds[i].dwSize,"Sex",3)==CSTR_EQUAL) { - switch(StrToUNum32(pmralpsValues[i].lpszData,pmralpsValues[i].dwSize)){ + switch(StrToUNum32(pmralpsValues[i].lpszData,pmralpsValues[i].dwSize)) { case 1:// мужской DB_Mra_SetByte(hContact,"Gender",'M'); break; @@ -1400,7 +1400,7 @@ DWORD MraCommandDispather(mrim_packet_header_t *pmaHeader,DWORD *pdwPingPeriod,D dwControlParam=0; for(j=0;j> 27)) & 0x0FFFFFFF; Y = ((Y << 1) | (Y >> 27)) & 0x0FFFFFFF; @@ -365,7 +365,7 @@ void des_set_key( des_context *ctx, unsigned char key[8] ) des_main_ks( ctx->esk, key ); - for( i = 0; i < 32; i += 2 ) + for ( i = 0; i < 32; i += 2 ) { ctx->dsk[i ] = ctx->esk[30 - i]; ctx->dsk[i + 1] = ctx->esk[31 - i]; @@ -431,7 +431,7 @@ void des_cbc_encrypt( des_context *ctx, while( len > 0 ) { - for( i = 0; i < 8; i++ ) + for ( i = 0; i < 8; i++ ) output[i] = input[i] ^ iv[i]; des_crypt( ctx->esk, output, output ); @@ -460,7 +460,7 @@ void des_cbc_decrypt( des_context *ctx, memcpy( temp, input, 8 ); des_crypt( ctx->dsk, input, output ); - for( i = 0; i < 8; i++ ) + for ( i = 0; i < 8; i++ ) output[i] = output[i] ^ iv[i]; memcpy( iv, temp, 8 ); @@ -481,7 +481,7 @@ void des3_set_2keys( des3_context *ctx, unsigned char key[16] ) des_main_ks( ctx->esk , key ); des_main_ks( ctx->dsk + 32, key + 8 ); - for( i = 0; i < 32; i += 2 ) + for ( i = 0; i < 32; i += 2 ) { ctx->dsk[i ] = ctx->esk[30 - i]; ctx->dsk[i + 1] = ctx->esk[31 - i]; @@ -508,7 +508,7 @@ void des3_set_3keys( des3_context *ctx, unsigned char key[24] ) des_main_ks( ctx->dsk + 32, key + 8 ); des_main_ks( ctx->esk + 64, key + 16 ); - for( i = 0; i < 32; i += 2 ) + for ( i = 0; i < 32; i += 2 ) { ctx->dsk[i ] = ctx->esk[94 - i]; ctx->dsk[i + 1] = ctx->esk[95 - i]; @@ -598,7 +598,7 @@ void des3_cbc_encrypt( des3_context *ctx, while( len > 0 ) { - for( i = 0; i < 8; i++ ) + for ( i = 0; i < 8; i++ ) output[i] = input[i] ^ iv[i]; des3_crypt( ctx->esk, output, output ); @@ -627,7 +627,7 @@ void des3_cbc_decrypt( des3_context *ctx, memcpy( temp, input, 8 ); des3_crypt( ctx->dsk, input, output ); - for( i = 0; i < 8; i++ ) + for ( i = 0; i < 8; i++ ) output[i] = output[i] ^ iv[i]; memcpy( iv, temp, 8 ); diff --git a/protocols/MSN/msn_commands.cpp b/protocols/MSN/msn_commands.cpp index a85ff46fe4..af6494f741 100644 --- a/protocols/MSN/msn_commands.cpp +++ b/protocols/MSN/msn_commands.cpp @@ -278,7 +278,7 @@ void CMsnProto::sttCustomSmiley(const char* msgBody, char* email, char* nick, in unsigned iCount = 0; bool parseSmiley = true; - for(;;) + for (;;) { tok2 = strchr(tok1, '\t'); if (tok2 == NULL) break; diff --git a/protocols/MSN/msn_threads.cpp b/protocols/MSN/msn_threads.cpp index 4043806b51..f312fcdc01 100644 --- a/protocols/MSN/msn_threads.cpp +++ b/protocols/MSN/msn_threads.cpp @@ -200,7 +200,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) } else { - for(;;) + for (;;) { char* peol = strchr(info->mData, '\r'); if (peol == NULL) diff --git a/protocols/Omegle/chat.cpp b/protocols/Omegle/chat.cpp index 169877b9fb..b69a41bf50 100644 --- a/protocols/Omegle/chat.cpp +++ b/protocols/Omegle/chat.cpp @@ -307,7 +307,7 @@ int OmegleProto::OnJoinChat(WPARAM,LPARAM suppress) SetTopic(); // Note: Initialization will finish up in SetChatStatus, called separately - if(!suppress) + if (!suppress) SetChatStatus(m_iStatus); return 0; diff --git a/protocols/Omegle/dialogs.cpp b/protocols/Omegle/dialogs.cpp index e6a05d688e..21aadb34a8 100644 --- a/protocols/Omegle/dialogs.cpp +++ b/protocols/Omegle/dialogs.cpp @@ -39,7 +39,7 @@ static BOOL StoreDBCheckState(OmegleProto* ppro, HWND hwnd, int idCtrl, const ch static void LoadDBText(OmegleProto* ppro, HWND hwnd, int idCtrl, const char* szSetting) { DBVARIANT dbv; - if( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv) ) + if ( !DBGetContactSettingTString(NULL, ppro->m_szModuleName, szSetting, &dbv) ) { SetDlgItemText(hwnd, idCtrl, dbv.ptszVal); DBFreeVariant(&dbv); diff --git a/protocols/Omegle/proto.cpp b/protocols/Omegle/proto.cpp index 7fd27e65c6..e6d2324aa3 100644 --- a/protocols/Omegle/proto.cpp +++ b/protocols/Omegle/proto.cpp @@ -243,9 +243,9 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM) const char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, reinterpret_cast(hContact),0) ); - if( proto && strcmp(m_szModuleName,proto) == 0 ) + if ( proto && strcmp(m_szModuleName,proto) == 0 ) { - if( include_chat ) + if ( include_chat ) return true; else return DBGetContactSettingByte(hContact,m_szModuleName,"ChatRoom",0) == 0; diff --git a/protocols/Omegle/theme.cpp b/protocols/Omegle/theme.cpp index ea1cf9cf16..740d16277e 100644 --- a/protocols/Omegle/theme.cpp +++ b/protocols/Omegle/theme.cpp @@ -96,11 +96,11 @@ static OmegleProto * GetInstanceByHContact(HANDLE hContact) { char *proto = reinterpret_cast( CallService(MS_PROTO_GETCONTACTBASEPROTO, reinterpret_cast(hContact),0) ); - if(!proto) + if (!proto) return 0; for(int i=0; i. */ //============ THE INCLUDES =========== + +#define _CRT_SECURE_NO_WARNINGS #include #include diff --git a/protocols/Weather/weather_conv.cpp b/protocols/Weather/weather_conv.cpp index 9f466c3772..8cab451181 100644 --- a/protocols/Weather/weather_conv.cpp +++ b/protocols/Weather/weather_conv.cpp @@ -453,7 +453,7 @@ void TrimString(WCHAR *str) void ConvertBackslashes(char *str) { char *pstr; - for( pstr=str; *pstr; pstr = CharNextA(pstr)) { + for ( pstr=str; *pstr; pstr = CharNextA(pstr)) { if (*pstr=='\\') { switch(pstr[1]) { case 'n': *pstr='\n'; break; diff --git a/protocols/Yahoo/avatar.cpp b/protocols/Yahoo/avatar.cpp index 4ad7233cb9..9b093ccb3d 100644 --- a/protocols/Yahoo/avatar.cpp +++ b/protocols/Yahoo/avatar.cpp @@ -37,7 +37,7 @@ int YAHOO_avt_hash(const char *key, DWORD len) while(i--) { checksum = (checksum << 4) + *p++; - if((g = (checksum & 0xf0000000)) != 0) + if ((g = (checksum & 0xf0000000)) != 0) checksum ^= g >> 23; checksum &= ~g; @@ -186,7 +186,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) SetDword(hContact, "PictLoading", 1); } - if(!error) { + if (!error) { NETLIBHTTPREQUEST nlhr={0},*nlhrReply; @@ -406,7 +406,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p LOG(("[ext_yahoo_got_picture] My Checksum: %d", mcksum)); - if (!DBGetContactSettingString(NULL, m_szModuleName, "AvatarURL", &dbv)){ + if (!DBGetContactSettingString(NULL, m_szModuleName, "AvatarURL", &dbv)) { if (lstrcmpiA(pic_url, dbv.pszVal) == 0) { DBVARIANT dbv2; /*time_t ts; @@ -562,7 +562,7 @@ void CYahooProto::ext_got_picture_upload(const char *me, const char *url,unsigne SetString(NULL, "AvatarURL", url); //YAHOO_SetDword("AvatarExpires", ts); - if (!DBGetContactSettingString(NULL, m_szModuleName, "AvatarInv", &dbv) ){ + if (!DBGetContactSettingString(NULL, m_szModuleName, "AvatarInv", &dbv) ) { LOG(("[ext_yahoo_got_picture_upload] Buddy: %s told us this is bad??", dbv.pszVal)); LOG(("[ext_yahoo_got_picture] Sending url: %s checksum: %d to '%s'!", url, cksum, dbv.pszVal)); @@ -809,8 +809,8 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) DBVARIANT dbv; int ret = -3; - if (GetDword("AvatarHash", 0)){ - if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)){ + if (GetDword("AvatarHash", 0)) { + if (!DBGetContactSettingTString(NULL, m_szModuleName, "AvatarFile", &dbv)) { if (_taccess(dbv.ptszVal, 0) == 0){ lstrcpyn(buffer, dbv.ptszVal, size-1); buffer[size-1] = '\0'; diff --git a/protocols/Yahoo/file_transfer.cpp b/protocols/Yahoo/file_transfer.cpp index c18ef4c22b..58958c3c4a 100644 --- a/protocols/Yahoo/file_transfer.cpp +++ b/protocols/Yahoo/file_transfer.cpp @@ -162,7 +162,7 @@ static void upload_file(int id, int fd, int error, void *data) error = 1; } - if(!error) { + if (!error) { HANDLE myhFile = CreateFile(sf->pfts.tszCurrentFile, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_WRITE, @@ -304,7 +304,7 @@ static void dl_file(int id, int fd, int error, const char *filename, unsigned lo error = 1; } - if(!error) { + if (!error) { HANDLE myhFile; TCHAR filefull[MAX_PATH]; @@ -734,7 +734,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri /*DebugLog("Getting Files"); - if ( ppszFiles[1] != NULL ){ + if ( ppszFiles[1] != NULL ) { MessageBoxA(NULL, "YAHOO protocol allows only one file to be sent at a time", "Yahoo", MB_OK | MB_ICONINFORMATION); return 0; } diff --git a/protocols/Yahoo/im.cpp b/protocols/Yahoo/im.cpp index 455a545b74..03360e2374 100644 --- a/protocols/Yahoo/im.cpp +++ b/protocols/Yahoo/im.cpp @@ -50,7 +50,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons return; } - if(!msg) { + if (!msg) { LOG(("Empty Incoming Message, exiting.")); return; } @@ -80,15 +80,15 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons // strip the fade tag !_strnicmp(c, "",7) || // strip the alternate colors tag - !_strnicmp(c, "",6)){ + !_strnicmp(c, "",6)) { while ((*c++ != '>') && (*c != '\0')); } else // strip ANSI color combination - if ((*c == 0x1b) && (*(c+1) == '[')){ + if ((*c == 0x1b) && (*(c+1) == '[')) { while ((*c++ != 'm') && (*c != '\0')); } else - if (*c != '\0'){ + if (*c != '\0') { umsg[oidx++] = *c; /* Adding \r to \r\n conversion */ @@ -104,7 +104,7 @@ void CYahooProto::ext_got_im(const char *me, const char *who, int protocol, cons /* Need to strip off formatting stuff first. Then do all decoding/converting */ LOG(("%s: %s", who, umsg)); - //if(!strcmp(umsg, "")) + //if (!strcmp(umsg, "")) // :P("\a"); ccs.szProtoService = PSR_MESSAGE; @@ -236,7 +236,7 @@ int __cdecl CYahooProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre ) DBDeleteContactSetting(hContact, "CList", "Hidden"); // NUDGES - if( !lstrcmpA(pre->szMessage, "") && ServiceExists("NUDGE/Send")){ + if ( !lstrcmpA(pre->szMessage, "") && ServiceExists("NUDGE/Send")) { DebugLog("[YahooRecvMessage] Doing Nudge Service!"); NotifyEventHooks(hYahooNudge, (WPARAM)hContact, pre->timestamp); return 0; diff --git a/protocols/Yahoo/libyahoo2/libyahoo2.c b/protocols/Yahoo/libyahoo2/libyahoo2.c index e118a76d18..287e4a3b9f 100644 --- a/protocols/Yahoo/libyahoo2/libyahoo2.c +++ b/protocols/Yahoo/libyahoo2/libyahoo2.c @@ -471,45 +471,45 @@ static struct yahoo_server_settings * _yahoo_assign_server_settings(va_list ap) if(key == NULL) break; - if(!strcmp(key, "pager_host")) { + if (!strcmp(key, "pager_host")) { svalue = va_arg(ap, char *); free(yss->pager_host); yss->pager_host = strdup(svalue); - } else if(!strcmp(key, "pager_port")) { + } else if (!strcmp(key, "pager_port")) { nvalue = va_arg(ap, int); yss->pager_port = nvalue; - } else if(!strcmp(key, "filetransfer_host")) { + } else if (!strcmp(key, "filetransfer_host")) { svalue = va_arg(ap, char *); free(yss->filetransfer_host); yss->filetransfer_host = strdup(svalue); - } else if(!strcmp(key, "filetransfer_port")) { + } else if (!strcmp(key, "filetransfer_port")) { nvalue = va_arg(ap, int); yss->filetransfer_port = nvalue; - } else if(!strcmp(key, "webcam_host")) { + } else if (!strcmp(key, "webcam_host")) { svalue = va_arg(ap, char *); free(yss->webcam_host); yss->webcam_host = strdup(svalue); - } else if(!strcmp(key, "webcam_port")) { + } else if (!strcmp(key, "webcam_port")) { nvalue = va_arg(ap, int); yss->webcam_port = nvalue; - } else if(!strcmp(key, "webcam_description")) { + } else if (!strcmp(key, "webcam_description")) { svalue = va_arg(ap, char *); free(yss->webcam_description); yss->webcam_description = strdup(svalue); - } else if(!strcmp(key, "local_host")) { + } else if (!strcmp(key, "local_host")) { svalue = va_arg(ap, char *); free(yss->local_host); yss->local_host = strdup(svalue); - } else if(!strcmp(key, "conn_type")) { + } else if (!strcmp(key, "conn_type")) { nvalue = va_arg(ap, int); yss->conn_type = nvalue; - } else if(!strcmp(key, "picture_checksum")) { + } else if (!strcmp(key, "picture_checksum")) { nvalue = va_arg(ap, int); yss->pic_cksum = nvalue; - } else if(!strcmp(key, "web_messenger")) { + } else if (!strcmp(key, "web_messenger")) { nvalue = va_arg(ap, int); yss->web_messenger = nvalue; - } else if(!strcmp(key, "login_host")) { + } else if (!strcmp(key, "login_host")) { svalue = va_arg(ap, char *); free(yss->login_host); yss->login_host = strdup(svalue); @@ -525,7 +525,7 @@ static struct yahoo_server_settings * _yahoo_assign_server_settings(va_list ap) static void yahoo_free_server_settings(struct yahoo_server_settings *yss) { - if(!yss) + if (!yss) return; free(yss->pager_host); @@ -642,7 +642,7 @@ static void yahoo_free_buddies(YList * list) for(l = list; l; l = l->next) { struct yahoo_buddy *bud = (struct yahoo_buddy *) l->data; - if(!bud) + if (!bud) continue; FREE(bud->group); @@ -973,7 +973,7 @@ static void yahoo_add_to_send_queue(struct yahoo_input_data *yid, void *data, in yid->txqueues = y_list_append(yid->txqueues, tx); - if(!yid->write_tag) + if (!yid->write_tag) yid->write_tag=YAHOO_CALLBACK(ext_yahoo_add_handler)(yid->yd->client_id, yid->fd, YAHOO_INPUT_WRITE, yid); } @@ -1004,7 +1004,7 @@ static void yahoo_send_packet(struct yahoo_input_data *yid, struct yahoo_packet yahoo_packet_read(pkt, data + pos, len - pos); - if( yid->type == YAHOO_CONNECTION_FT || + if ( yid->type == YAHOO_CONNECTION_FT || ( yid->type == YAHOO_CONNECTION_PAGER && ( pkt->service == YAHOO_SERVICE_KEEPALIVE || pkt->service == YAHOO_SERVICE_PING || @@ -1060,7 +1060,7 @@ static int yahoo_send_data(int fd, const char *data, int len) void yahoo_close(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return; del_from_list(yd); @@ -1620,16 +1620,16 @@ static void yahoo_process_conference(struct yahoo_input_data *yid, struct yahoo_ utf8 = atoi(pair->value); } - if(!room) + if (!room) return; if(host) { for(l = members; l; l = l->next) { char * w = (char *) l->data; - if(!strcmp(w, host)) + if (!strcmp(w, host)) break; } - if(!l) + if (!l) members = y_list_append(members, strdup(host)); } /* invite, decline, join, left, message -> status == 1 */ @@ -1765,7 +1765,7 @@ static void yahoo_process_chat(struct yahoo_input_data *yid, struct yahoo_packet } } - if(!room) { + if (!room) { if (pkt->service == YAHOO_SERVICE_CHATLOGOUT) { /* yahoo originated chat logout */ YAHOO_CALLBACK(ext_yahoo_chat_yahoologout)(yid->yd->client_id, id); return ; @@ -1845,7 +1845,7 @@ static void yahoo_process_message(struct yahoo_input_data *yid, struct yahoo_pac switch (pair->key) { /*case 1: */ case 4: - if(!message->from) + if (!message->from) message->from = pair->value; break; @@ -2979,9 +2979,9 @@ static void yahoo_process_buddyadd(struct yahoo_input_data *yid, struct yahoo_pa //yahoo_dump_unhandled(pkt); - if(!who) + if (!who) return; - if(!where) + if (!where) where = "Unknown"; bud = y_new0(struct yahoo_buddy, 1); @@ -3037,7 +3037,7 @@ static void yahoo_process_buddydel(struct yahoo_input_data *yid, struct yahoo_pa } } - if(!who || !where) + if (!who || !where) return; bud = y_new0(struct yahoo_buddy, 1); @@ -3266,7 +3266,7 @@ void yahoo_send_picture_info(int id, const char *who, int type, const char *pic_ struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -3299,7 +3299,7 @@ void yahoo_send_picture_update(int id, const char *who, int type) struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -3326,7 +3326,7 @@ void yahoo_send_picture_checksum(int id, const char *who, int cksum) struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -3359,7 +3359,7 @@ void yahoo_send_picture_status(int id, int buddy_icon) struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -3693,7 +3693,7 @@ static void yahoo_process_webcam_key(struct yahoo_input_data *yid, struct yahoo_ } l = webcam_queue; - if(!l) + if (!l) return; who = (char *) l->data; @@ -3871,7 +3871,7 @@ static struct yahoo_packet * yahoo_getdata(struct yahoo_input_data * yid) int pos = 0; int pktlen; - if(!yd) + if (!yd) return NULL; DEBUG_MSG(("rxlen is %d", yid->rxlen)); @@ -4009,7 +4009,7 @@ static struct yab * yahoo_getyab(struct yahoo_input_data *yid) int pos = 0, end=0; struct yahoo_data *yd = yid->yd; - if(!yd) + if (!yd) return NULL; //DEBUG_MSG(("rxlen is %d", yid->rxlen)); @@ -4061,7 +4061,7 @@ static char * yahoo_getwebcam_master(struct yahoo_input_data *yid) char *server=NULL; struct yahoo_data *yd = yid->yd; - if(!yid || !yd) + if (!yid || !yd) return NULL; DEBUG_MSG(("rxlen is %d", yid->rxlen)); @@ -4114,10 +4114,10 @@ static int yahoo_get_webcam_data(struct yahoo_input_data *yid) int connect=0; struct yahoo_data *yd = yid->yd; - if(!yd) + if (!yd) return -1; - if(!yid->wcm || !yid->wcd || !yid->rxlen) + if (!yid->wcm || !yid->wcd || !yid->rxlen) return -1; DEBUG_MSG(("rxlen is %d", yid->rxlen)); @@ -4272,7 +4272,7 @@ int yahoo_write_ready(int id, int fd, void *data) struct data_queue *tx; LOG(("write callback: id=%d fd=%d data=%p", id, fd, data)); - if(!yid || !yid->txqueues) + if (!yid || !yid->txqueues) return -2; tx = (struct data_queue *) yid->txqueues->data; @@ -4313,7 +4313,7 @@ int yahoo_write_ready(int id, int fd, void *data) free(tx); yid->txqueues = y_list_remove_link(yid->txqueues, yid->txqueues); y_list_free_1(l); - if(!yid->txqueues) { + if (!yid->txqueues) { //LOG(("yahoo_write_ready(%d, %d) !txqueues", id, fd)); YAHOO_CALLBACK(ext_yahoo_remove_handler)(id, yid->write_tag); yid->write_tag = 0; @@ -4372,7 +4372,7 @@ static void yahoo_process_yab_connection(struct yahoo_input_data *yid, int over) while(find_input_by_id_and_type(id, YAHOO_CONNECTION_YAB) && (yab = yahoo_getyab(yid)) != NULL) { - if(!yab->id) + if (!yab->id) continue; //changed=1; @@ -4380,7 +4380,7 @@ static void yahoo_process_yab_connection(struct yahoo_input_data *yid, int over) for(buds = yd->buddies; buds; buds=buds->next) { struct yahoo_buddy * bud = (struct yahoo_buddy *) buds->data; - if(!strcmp(bud->id, yab->id)) { + if (!strcmp(bud->id, yab->id)) { yab_used = TRUE; bud->yab_entry = yab; if(yab->nname) { @@ -4432,7 +4432,7 @@ static void yahoo_process_search_connection(struct yahoo_input_data *yid, int ov pyid = find_input_by_id_and_type(yid->yd->client_id, YAHOO_CONNECTION_PAGER); - if(!over || !pyid) { + if (!over || !pyid) { LOG(("yahoo_process_search_connection] ?? Not Done yet? Waiting for more packets!")); return; } @@ -4458,7 +4458,7 @@ static void yahoo_process_search_connection(struct yahoo_input_data *yid, int ov cp = p; np = strchr(p, 4); - if(!np) + if (!np) break; *np = 0; p = np+1; @@ -4685,7 +4685,7 @@ int yahoo_read_ready(int id, int fd, void *data) int len; //LOG(("read callback: id=%d fd=%d data=%p", id, fd, data)); - if(!yid) + if (!yid) return -2; @@ -4746,7 +4746,7 @@ int yahoo_init_with_attributes(const char *username, const char *password, const yd = y_new0(struct yahoo_data, 1); - if(!yd) + if (!yd) return 0; yd->user = strdup(username); @@ -4853,7 +4853,7 @@ void yahoo_login(int id, enum yahoo_status initial) LOG(("[yahoo_login] id: %d, initial status: %d", id, initial)); - if(!yd) + if (!yd) return; yss = yd->server_settings; @@ -4871,7 +4871,7 @@ void yahoo_login(int id, enum yahoo_status initial) int yahoo_get_fd(int id) { struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); - if(!yid) + if (!yid) return 0; else return yid->fd; @@ -4884,7 +4884,7 @@ void yahoo_send_im(int id, const char *from, const char *who, int protocol, cons struct yahoo_data *yd; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -4941,7 +4941,7 @@ void yahoo_send_typing(int id, const char *from, const char *who, int protocol, struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -4980,7 +4980,7 @@ void yahoo_set_away(int id, enum yahoo_status state, const char *msg, int away) //int service; enum yahoo_status cs; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5059,7 +5059,7 @@ void yahoo_set_stealth(int id, const char *buddy, int protocol, int add) //int service; //char s[4]; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5090,7 +5090,7 @@ void yahoo_logoff(int id) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5127,7 +5127,7 @@ void yahoo_get_list(int id) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5159,7 +5159,7 @@ void yahoo_get_yab(int id) char url[1024]; char buff[1024]; - if(!yd) + if (!yd) return; yid = y_new0(struct yahoo_input_data, 1); @@ -5188,7 +5188,7 @@ void yahoo_set_yab(int id, struct yab * yab) char *temp; int size = sizeof(url)-1; - if(!yd) + if (!yd) return; yid = y_new0(struct yahoo_input_data, 1); @@ -5271,7 +5271,7 @@ void yahoo_set_identity_status(int id, const char * identity, int active) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5290,7 +5290,7 @@ void yahoo_refresh(int id) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5306,7 +5306,7 @@ void yahoo_send_ping(int id) struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); struct yahoo_data *yd; struct yahoo_packet *pkt=NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5320,7 +5320,7 @@ void yahoo_keepalive(int id) struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); struct yahoo_data *yd; struct yahoo_packet *pkt=NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5352,7 +5352,7 @@ void yahoo_add_buddy(int id, const char *fname, const char *lname, const char *w struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5410,7 +5410,7 @@ void yahoo_remove_buddy(int id, const char *who, int protocol, const char *group struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5434,7 +5434,7 @@ void yahoo_accept_buddy(int id, const char *who, int protocol) struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5461,7 +5461,7 @@ void yahoo_reject_buddy(int id, const char *who, int protocol, const char *msg) struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5489,7 +5489,7 @@ void yahoo_ignore_buddy(int id, const char *who, int unignore) struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5510,7 +5510,7 @@ void yahoo_change_buddy_group(int id, const char *who, const char *old_group, co struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5549,7 +5549,7 @@ void yahoo_group_rename(int id, const char *old_group, const char *new_group) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5568,7 +5568,7 @@ void yahoo_conference_addinvite(int id, const char * from, const char *who, cons struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5579,7 +5579,7 @@ void yahoo_conference_addinvite(int id, const char * from, const char *who, cons yahoo_packet_hash(pkt, 57, room); yahoo_packet_hash(pkt, 58, msg); yahoo_packet_hash(pkt, 13, "0"); - for(; members; members = members->next) { + for (; members; members = members->next) { yahoo_packet_hash(pkt, 52, (char *)members->data); yahoo_packet_hash(pkt, 53, (char *)members->data); } @@ -5596,7 +5596,7 @@ void yahoo_conference_invite(int id, const char * from, YList *who, const char * struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5604,7 +5604,7 @@ void yahoo_conference_invite(int id, const char * from, YList *who, const char * yahoo_packet_hash(pkt, 1, (from?from:yd->user)); yahoo_packet_hash(pkt, 50, yd->user); - for(; who; who = who->next) { + for (; who; who = who->next) { yahoo_packet_hash(pkt, 52, (char *)who->data); } yahoo_packet_hash(pkt, 57, room); @@ -5622,7 +5622,7 @@ void yahoo_conference_logon(int id, const char *from, YList *who, const char *ro struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5633,7 +5633,7 @@ void yahoo_conference_logon(int id, const char *from, YList *who, const char *ro yahoo_packet_hash(pkt, 57, room); - for(; who; who = who->next) { + for (; who; who = who->next) { yahoo_packet_hash(pkt, 3, (char *)who->data); } @@ -5648,14 +5648,14 @@ void yahoo_conference_decline(int id, const char * from, YList *who, const char struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; pkt = yahoo_packet_new(YAHOO_SERVICE_CONFDECLINE, YPACKET_STATUS_DEFAULT, yd->session_id); yahoo_packet_hash(pkt, 1, (from?from:yd->user)); - for(; who; who = who->next) { + for (; who; who = who->next) { yahoo_packet_hash(pkt, 3, (char *)who->data); } yahoo_packet_hash(pkt, 57, room); @@ -5672,14 +5672,14 @@ void yahoo_conference_logoff(int id, const char * from, YList *who, const char * struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; pkt = yahoo_packet_new(YAHOO_SERVICE_CONFLOGOFF, YPACKET_STATUS_DEFAULT, yd->session_id); yahoo_packet_hash(pkt, 1, (from?from:yd->user)); - for(; who; who = who->next) { + for (; who; who = who->next) { yahoo_packet_hash(pkt, 3, (char *)who->data); } yahoo_packet_hash(pkt, 57, room); @@ -5695,14 +5695,14 @@ void yahoo_conference_message(int id, const char * from, YList *who, const char struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; pkt = yahoo_packet_new(YAHOO_SERVICE_CONFMSG, YPACKET_STATUS_DEFAULT, yd->session_id); yahoo_packet_hash(pkt, 1, (from?from:yd->user)); - for(; who; who = who->next) { + for (; who; who = who->next) { yahoo_packet_hash(pkt, 53, (char *)who->data); } yahoo_packet_hash(pkt, 57, room); @@ -5723,7 +5723,7 @@ void yahoo_get_chatrooms(int id, int chatroomid) char url[1024]; char buff[1024]; - if(!yd) + if (!yd) return; yid = y_new0(struct yahoo_input_data, 1); @@ -5752,7 +5752,7 @@ void yahoo_chat_logon(int id, const char *from, const char *room, const char *ro struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5786,7 +5786,7 @@ void yahoo_chat_message(int id, const char *from, const char *room, const char struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5814,7 +5814,7 @@ void yahoo_chat_logoff(int id, const char *from) struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -5842,7 +5842,7 @@ void yahoo_webcam_get_feed(int id, const char *who) struct yahoo_data *yd; struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; /* @@ -5928,7 +5928,7 @@ void yahoo_webcam_invite(int id, const char *who) struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); struct yahoo_packet *pkt; - if(!yid) + if (!yid) return; pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YPACKET_STATUS_NOTIFY, yid->yd->session_id); @@ -5951,7 +5951,7 @@ static void yahoo_search_internal(int id, int t, const char *text, int g, int ar char buff[1024]; char *ctext, *p; - if(!yd) + if (!yd) return; yid = y_new0(struct yahoo_input_data, 1); @@ -5991,10 +5991,10 @@ void yahoo_search(int id, enum yahoo_search_type t, const char *text, enum yahoo struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); struct yahoo_search_state *yss; - if(!yid) + if (!yid) return; - if(!yid->ys) + if (!yid->ys) yid->ys = y_new0(struct yahoo_search_state, 1); yss = yid->ys; @@ -6015,7 +6015,7 @@ void yahoo_search_again(int id, int start) struct yahoo_input_data *yid = find_input_by_id_and_type(id, YAHOO_CONNECTION_PAGER); struct yahoo_search_state *yss; - if(!yid || !yid->ys) + if (!yid || !yid->ys) return; yss = yid->ys; @@ -6070,7 +6070,7 @@ static void _yahoo_send_file_connected(int id, int fd, int error, void *data) inputs = y_list_remove(inputs, yid); /* while(yahoo_tcp_readline(buff, sizeof(buff), nyd->fd) > 0) { - if(!strcmp(buff, "")) + if (!strcmp(buff, "")) break; } @@ -6093,7 +6093,7 @@ void yahoo_send_file(int id, const char *who, const char *msg, struct send_file_data *sfd; const char *s; - if(!yd) + if (!yd) return; yss = yd->server_settings; @@ -6147,7 +6147,7 @@ void yahoo_send_file_y7(int id, const char *from, const char *to, const char *re char url[255]; char *s; - if(!yd) + if (!yd) return; yss = yd->server_settings; @@ -6183,7 +6183,7 @@ void yahoo_send_avatar(int id, const char *name, unsigned long size, struct send_file_data *sfd; const char *s; - if(!yd) + if (!yd) return; yss = yd->server_settings; @@ -6237,7 +6237,7 @@ enum yahoo_status yahoo_current_status(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return YAHOO_STATUS_OFFLINE; return yd->current_status; @@ -6246,7 +6246,7 @@ enum yahoo_status yahoo_current_status(int id) const YList * yahoo_get_buddylist(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return NULL; return yd->buddies; } @@ -6254,7 +6254,7 @@ const YList * yahoo_get_buddylist(int id) const YList * yahoo_get_ignorelist(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return NULL; return yd->ignore; } @@ -6262,7 +6262,7 @@ const YList * yahoo_get_ignorelist(int id) const YList * yahoo_get_identities(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return NULL; return yd->identities; } @@ -6270,17 +6270,17 @@ const YList * yahoo_get_identities(int id) const char * yahoo_get_cookie(int id, const char *which) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return NULL; - if(!strncasecmp(which, "y", 1)) + if (!strncasecmp(which, "y", 1)) return yd->cookie_y; - if(!strncasecmp(which, "t", 1)) + if (!strncasecmp(which, "t", 1)) return yd->cookie_t; - if(!strncasecmp(which, "c", 1)) + if (!strncasecmp(which, "c", 1)) return yd->cookie_c; - if(!strncasecmp(which, "login", 5)) + if (!strncasecmp(which, "login", 5)) return yd->login_cookie; - if(!strncasecmp(which, "b", 1)) + if (!strncasecmp(which, "b", 1)) return yd->cookie_b; return NULL; } @@ -6288,7 +6288,7 @@ const char * yahoo_get_cookie(int id, const char *which) const char * yahoo_get_pw_token(int id) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return NULL; return yd->pw_token; @@ -6298,7 +6298,7 @@ void yahoo_get_url_handle(int id, const char *url, yahoo_get_url_handle_callback callback, void *data) { struct yahoo_data *yd = find_conn_by_id(id); - if(!yd) + if (!yd) return; yahoo_get_url_fd(id, url, yd, callback, data); @@ -6316,7 +6316,7 @@ void yahoo_request_buddy_avatar(int id, const char *buddy) struct yahoo_packet *pkt = NULL; struct yahoo_server_settings *yss; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6342,7 +6342,7 @@ void yahoo_ftdc_deny(int id, const char *buddy, const char *filename, const char struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6366,7 +6366,7 @@ void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6388,7 +6388,7 @@ void yahoo_ft7dc_deny(int id, const char *buddy, const char *ft_token) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6410,7 +6410,7 @@ void yahoo_ft7dc_abort(int id, const char *buddy, const char *ft_token) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6432,7 +6432,7 @@ void yahoo_ft7dc_relay(int id, const char *buddy, const char *ft_token) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6454,7 +6454,7 @@ void yahoo_ft7dc_nextfile(int id, const char *buddy, const char *ft_token) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6480,7 +6480,7 @@ char *yahoo_ft7dc_send(int id, const char *buddy, YList *files) md5_byte_t result[16]; md5_state_t ctx; - if(!yid) + if (!yid) return NULL; md5_init(&ctx); @@ -6541,7 +6541,7 @@ void yahoo_send_file7info(int id, const char *me, const char *who, const char *f struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) + if (!yid) return; yd = yid->yd; @@ -6569,7 +6569,7 @@ unsigned char *yahoo_webmessenger_idle_packet(int id, int *len) int pos = 0; int web_messenger = 1; - if(!yid) { + if (!yid) { DEBUG_MSG(("NO Yahoo Input Data???")); return NULL; } @@ -6612,7 +6612,7 @@ void yahoo_send_idle_packet(int id) struct yahoo_data *yd; struct yahoo_packet *pkt = NULL; - if(!yid) { + if (!yid) { DEBUG_MSG(("NO Yahoo Input Data???")); return; } @@ -6638,7 +6638,7 @@ void yahoo_send_im_ack(int id, const char *me, const char *buddy, const char *se DEBUG_MSG(("[yahoo_send_im_ack] My Id: %s, Buddy: %s, Seq #: %s, Retry: %d", me, buddy, seqn, sendn)); - if(!yid) { + if (!yid) { DEBUG_MSG(("NO Yahoo Input Data???")); return; } diff --git a/protocols/Yahoo/libyahoo2/yahoo_httplib.c b/protocols/Yahoo/libyahoo2/yahoo_httplib.c index 39b33fa2e1..c7bcb55858 100644 --- a/protocols/Yahoo/libyahoo2/yahoo_httplib.c +++ b/protocols/Yahoo/libyahoo2/yahoo_httplib.c @@ -126,14 +126,14 @@ int url_to_host_port_path(const char *url, char *host, int *port, char *path) slash = strchr(urlcopy, '/'); colon = strchr(urlcopy, ':'); - if(!colon || (slash && slash < colon)) { + if (!colon || (slash && slash < colon)) { *port = 80; } else { *colon = 0; *port = atoi(colon+1); } - if(!slash) { + if (!slash) { strcpy(path, "/"); } else { strcpy(path, slash); @@ -158,13 +158,13 @@ char *yahoo_urlencode(const char *instr) char *str = NULL; int len = strlen(instr); - if(!(str = y_new(char, 3*len + 1) )) + if (!(str = y_new(char, 3*len + 1) )) return ""; while(instr[ipos]) { while(isurlchar(instr[ipos])) str[bpos++] = instr[ipos++]; - if(!instr[ipos]) + if (!instr[ipos]) break; snprintf(&str[bpos], 4, "%%%.2x", instr[ipos]); @@ -188,7 +188,7 @@ char *yahoo_urldecode(const char *instr) unsigned dec; int len = strlen(instr); - if(!(str = y_new(char, len+1) )) + if (!(str = y_new(char, len+1) )) return ""; while(instr[ipos]) { @@ -198,7 +198,7 @@ char *yahoo_urldecode(const char *instr) ipos++; } else str[bpos++] = instr[ipos++]; - if(!instr[ipos]) + if (!instr[ipos]) break; if(instr[ipos+1] && instr[ipos+2]) { @@ -235,7 +235,7 @@ char *yahoo_xmldecode(const char *instr) unsigned dec; int len = strlen(instr); - if(!(str = y_new(char, len+1) )) + if (!(str = y_new(char, len+1) )) return ""; while(instr[ipos]) { @@ -245,7 +245,7 @@ char *yahoo_xmldecode(const char *instr) ipos++; } else str[bpos++] = instr[ipos++]; - if(!instr[ipos] || !instr[ipos+1]) + if (!instr[ipos] || !instr[ipos+1]) break; ipos++; @@ -260,7 +260,7 @@ char *yahoo_xmldecode(const char *instr) } else { int i; for (i=0; i<5; i++) - if(!strncmp(instr+ipos, entitymap[i][0], + if (!strncmp(instr+ipos, entitymap[i][0], strlen(entitymap[i][0]))) { str[bpos++] = entitymap[i][1][0]; ipos += strlen(entitymap[i][0]); @@ -319,7 +319,7 @@ void yahoo_http_post(int id, const char *url, const char *cookies, long content_ char ck[2048]; char buff[4096]; - if(!url_to_host_port_path(url, host, &port, path)) + if (!url_to_host_port_path(url, host, &port, path)) return; if (cookies == NULL || cookies[0] == '\0') @@ -351,7 +351,7 @@ void yahoo_http_get(int id, const char *url, const char *cookies, char ck[2048]; char buff[4096]; - if(!url_to_host_port_path(url, host, &port, path)) + if (!url_to_host_port_path(url, host, &port, path)) return; if (cookies == NULL || cookies[0] == '\0') @@ -394,17 +394,17 @@ static void yahoo_got_url_fd(int id, int fd, int error, void *data) while((n=yahoo_tcp_readline(buff, sizeof(buff), fd)) > 0) { LOG(("Read:%s:\n", buff)); - if(!strcmp(buff, "")) + if (!strcmp(buff, "")) break; - if( !strncasecmp(buff, "Content-length:", + if ( !strncasecmp(buff, "Content-length:", strlen("Content-length:")) ) { tmp = strrchr(buff, ' '); if(tmp) filesize = atol(tmp); } - if( !strncasecmp(buff, "Content-disposition:", + if ( !strncasecmp(buff, "Content-disposition:", strlen("Content-disposition:")) ) { tmp = strstr(buff, "name="); if(tmp) { @@ -418,9 +418,9 @@ static void yahoo_got_url_fd(int id, int fd, int error, void *data) } else { char *tmp2; tmp2 = strchr(tmp, ';'); - if(!tmp2) + if (!tmp2) tmp2 = strchr(tmp, '\r'); - if(!tmp2) + if (!tmp2) tmp2 = strchr(tmp, '\n'); if(tmp2) *tmp2 = '\0'; diff --git a/protocols/Yahoo/libyahoo2/yahoo_list.c b/protocols/Yahoo/libyahoo2/yahoo_list.c index ae7e86b9c6..b3e40c208e 100644 --- a/protocols/Yahoo/libyahoo2/yahoo_list.c +++ b/protocols/Yahoo/libyahoo2/yahoo_list.c @@ -66,10 +66,10 @@ YList *y_list_concat(YList * list, YList * add) { YList *l; - if(!list) + if (!list) return add; - if(!add) + if (!add) return list; for (l = list; l->next; l = l->next) @@ -132,7 +132,7 @@ int y_list_length(const YList * list) */ int y_list_empty(const YList * list) { - if(!list) + if (!list) return 1; else return 0; @@ -140,7 +140,7 @@ int y_list_empty(const YList * list) int y_list_singleton(const YList * list) { - if(!list || list->next) + if (!list || list->next) return 0; return 1; } diff --git a/protocols/Yahoo/options.cpp b/protocols/Yahoo/options.cpp index 764fe0c56e..01fa96330a 100644 --- a/protocols/Yahoo/options.cpp +++ b/protocols/Yahoo/options.cpp @@ -171,7 +171,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar ppro = ( CYahooProto* )lParam; SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam ); - if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )){ + if ( !ppro->GetString( YAHOO_LOGINSERVER, &dbv )) { SetDlgItemTextA( hwndDlg, IDC_LOGINSERVER, dbv.pszVal ); DBFreeVariant( &dbv ); } diff --git a/protocols/Yahoo/proto.cpp b/protocols/Yahoo/proto.cpp index 2aad750efa..e5de41ae29 100644 --- a/protocols/Yahoo/proto.cpp +++ b/protocols/Yahoo/proto.cpp @@ -241,7 +241,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) /* Need to remove the buddy from our Miranda Lists */ DBVARIANT dbv; - if (hContact != NULL && !DBGetContactSettingString( hContact, m_szModuleName, YAHOO_LOGINID, &dbv )){ + if (hContact != NULL && !DBGetContactSettingString( hContact, m_szModuleName, YAHOO_LOGINID, &dbv )) { DebugLog("Accepting buddy:%s", dbv.pszVal); accept(dbv.pszVal, GetWord(hContact, "yprotoid", 0)); DBFreeVariant(&dbv); @@ -263,23 +263,23 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) memset( &dbei, 0, sizeof( dbei )); dbei.cbSize = sizeof( dbei ); - if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ){ + if (( dbei.cbBlob = YAHOO_CallService( MS_DB_EVENT_GETBLOBSIZE, ( WPARAM )hdbe, 0 )) == -1 ) { DebugLog("[YahooAuthDeny] ERROR: Can't get blob size"); return 1; } dbei.pBlob = ( PBYTE )alloca( dbei.cbBlob ); - if ( YAHOO_CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )){ + if ( YAHOO_CallService( MS_DB_EVENT_GET, ( WPARAM )hdbe, ( LPARAM )&dbei )) { DebugLog("YahooAuthDeny - Can't get db event!"); return 1; } - if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ){ + if ( dbei.eventType != EVENTTYPE_AUTHREQUEST ) { DebugLog("YahooAuthDeny - not Authorization event"); return 1; } - if ( strcmp( dbei.szModule, m_szModuleName )){ + if ( strcmp( dbei.szModule, m_szModuleName )) { DebugLog("YahooAuthDeny - wrong module?"); return 1; } @@ -289,7 +289,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) /* Need to remove the buddy from our Miranda Lists */ DBVARIANT dbv; - if (hContact != NULL && !DBGetContactSettingString( hContact, m_szModuleName, YAHOO_LOGINID, &dbv )){ + if (hContact != NULL && !DBGetContactSettingString( hContact, m_szModuleName, YAHOO_LOGINID, &dbv )) { char *u_reason; u_reason = mir_utf8encodeT(reason); @@ -720,7 +720,7 @@ int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) DebugLog("[YahooSetAwayMessage] Status: %s, Msg: %s",(char *) CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, status, 0), (char*) c); - if(!m_bLoggedIn){ + if (!m_bLoggedIn){ if (m_iStatus == ID_STATUS_OFFLINE) { DebugLog("[YahooSetAwayMessage] WARNING: WE ARE OFFLINE!"); mir_free(c); diff --git a/protocols/Yahoo/services.cpp b/protocols/Yahoo/services.cpp index 0245ca1d8d..77e99626ed 100644 --- a/protocols/Yahoo/services.cpp +++ b/protocols/Yahoo/services.cpp @@ -105,7 +105,7 @@ INT_PTR __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) return 0; } - if ( !DBGetContactSettingString(hContact, m_szModuleName, YAHOO_LOGINID, &dbv )){ + if ( !DBGetContactSettingString(hContact, m_szModuleName, YAHOO_LOGINID, &dbv )) { DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal); remove_buddy(dbv.pszVal, GetWord(hContact, "yprotoid", 0)); @@ -331,7 +331,7 @@ INT_PTR __cdecl CYahooProto::OnCalendarCommand( WPARAM wParam, LPARAM lParam ) //======================================================= INT_PTR __cdecl CYahooProto::OnRefreshCommand( WPARAM wParam, LPARAM lParam ) { - if ( !m_bLoggedIn ){ + if ( !m_bLoggedIn ) { ShowNotification(Translate("Yahoo Error"), Translate("You need to be connected to refresh your buddy list"), NIIF_ERROR); return 0; } diff --git a/protocols/Yahoo/util.cpp b/protocols/Yahoo/util.cpp index 08844f22f8..f259b12d33 100644 --- a/protocols/Yahoo/util.cpp +++ b/protocols/Yahoo/util.cpp @@ -314,7 +314,7 @@ INT_PTR __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) if (cws->value.type == DBVT_DELETED || (cws->value.type == DBVT_BYTE && cws->value.bVal == 0)) { DBVARIANT dbv; - if ( !DBGetContactSettingString( (HANDLE) wParam, m_szModuleName, YAHOO_LOGINID, &dbv )){ + if ( !DBGetContactSettingString( (HANDLE) wParam, m_szModuleName, YAHOO_LOGINID, &dbv )) { DebugLog("Adding Permanently %s to list.", dbv.pszVal); AddBuddy(dbv.pszVal,GetWord((HANDLE) wParam, "yprotoid", 0), "miranda", NULL); DBFreeVariant(&dbv); @@ -326,7 +326,7 @@ INT_PTR __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) DebugLog("DB Setting changed. YAHOO user's visible setting changed."); - if ( !DBGetContactSettingString( (HANDLE) wParam, m_szModuleName, YAHOO_LOGINID, &dbv )){ + if ( !DBGetContactSettingString( (HANDLE) wParam, m_szModuleName, YAHOO_LOGINID, &dbv )) { int iAdd = (ID_STATUS_OFFLINE == DBGetContactSettingWord((HANDLE) wParam, m_szModuleName, "ApparentMode", 0)); stealth(dbv.pszVal, iAdd); DBFreeVariant(&dbv); diff --git a/protocols/Yahoo/yahoo.cpp b/protocols/Yahoo/yahoo.cpp index 4383278e0d..f14a311d0a 100644 --- a/protocols/Yahoo/yahoo.cpp +++ b/protocols/Yahoo/yahoo.cpp @@ -238,12 +238,12 @@ void CYahooProto::AddBuddy( const char *who, int protocol, const char *group, co No refresh needed. */ - if ( !DBGetContactSettingString( NULL, m_szModuleName, "First Name", &dbv )){ + if ( !DBGetContactSettingString( NULL, m_szModuleName, "First Name", &dbv )) { fname = strdup(dbv.pszVal); DBFreeVariant(&dbv); } - if ( !DBGetContactSettingString( NULL, m_szModuleName, "Last Name", &dbv )){ + if ( !DBGetContactSettingString( NULL, m_szModuleName, "Last Name", &dbv )) { lname = strdup(dbv.pszVal); DBFreeVariant(&dbv); } @@ -627,7 +627,7 @@ void CYahooProto::ext_got_buddies(YList * buds) } YAHOO_DEBUGLOG(("[ext_got_buddies] Walking buddy list...")); - for(; buds; buds = buds->next) { + for (; buds; buds = buds->next) { HANDLE hContact; yahoo_buddy *bud = ( yahoo_buddy* )buds->data; @@ -979,7 +979,7 @@ void CYahooProto::ext_mail_notify(const char *from, const char *subj, int cnt) snprintf(z, sizeof(z), Translate("From: %s\nSubject: %s"), from, subj); } - if(!ShowPopup( title, z, "http://mail.yahoo.com" )) + if (!ShowPopup( title, z, "http://mail.yahoo.com" )) ShowNotification(title, z, NIIF_INFO); } } @@ -1239,7 +1239,7 @@ void CYahooProto::ext_send_http_request(enum yahoo_connection_type type, const c LOG(("[ext_send_http_request] type: %d, method: %s, url: %s, cookies: %s, content length: %ld", type, method, url, cookies, content_length)); - if(!url_to_host_port_path(url, host, &port, path)) + if (!url_to_host_port_path(url, host, &port, path)) return; fd = ext_connect(host, port, type); -- cgit v1.2.3