From 46a53191c1ad11a41c948594e972568e62d155b4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 6 Jun 2012 13:58:20 +0000 Subject: minor code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@332 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/protocols/protoaccs.cpp | 2 +- src/modules/protocols/protochains.cpp | 34 +++++++++++++++++----------------- src/modules/protocols/protocols.cpp | 6 +++--- src/modules/protocols/protodir.cpp | 6 +++--- src/modules/protocols/protoopts.cpp | 7 +++---- 5 files changed, 27 insertions(+), 28 deletions(-) (limited to 'src/modules/protocols') diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 36176560e6..e865450967 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -606,7 +606,7 @@ void UnloadAccountsModule() if ( !bModuleInitialized ) return; - for( i=accounts.getCount()-1; i >= 0; i-- ) { + for ( i=accounts.getCount()-1; i >= 0; i-- ) { PROTOACCOUNT* pa = accounts[ i ]; UnloadAccount( pa, false, false ); accounts.remove(i); diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index a49cdee424..c8c1b3d5c6 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -79,7 +79,7 @@ static INT_PTR CallRecvChain(WPARAM wParam,LPARAM lParam) if ( wParam == (WPARAM)(-1)) return 1; //shouldn't happen - sanity check if ( wParam == 0 ) { //begin processing by finding end of chain - for( ;;wParam++ ) { + for ( ;;wParam++ ) { _itoa( wParam, str, 10 ); if ( DBGetContactSettingString( ccs->hContact, "_Filter", str, &dbv )) break; @@ -165,17 +165,17 @@ static INT_PTR Proto_IsProtoOnContact(WPARAM wParam,LPARAM lParam) if (!lParam) return 0; - if(!DBGetContactSettingString((HANDLE)wParam,"Protocol","p",&dbv)) { - if(!_stricmp((char*)lParam,dbv.pszVal)) { + if (!DBGetContactSettingString((HANDLE)wParam,"Protocol","p",&dbv)) { + if (!_stricmp((char*)lParam,dbv.pszVal)) { mir_free(dbv.pszVal); return -1; } mir_free(dbv.pszVal); } - for(i=0;;i++) { + for (i=0;;i++) { _itoa(i,str,10); - if(DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; - if(!strcmp((char*)lParam,dbv.pszVal)) { + if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; + if (!strcmp((char*)lParam,dbv.pszVal)) { mir_free(dbv.pszVal); return i+1; } @@ -202,25 +202,25 @@ static INT_PTR Proto_AddToContact(WPARAM wParam,LPARAM lParam) DBWriteContactSettingString((HANDLE)wParam,"Protocol","p",(char*)lParam); return 0; } - if(Proto_IsProtoOnContact(wParam,lParam)) return 1; + if (Proto_IsProtoOnContact(wParam,lParam)) return 1; { /* v:0.3.3 + PROTO FILTERS ARE NOW KEPT IN THEIR OWN DB MODULE! */ int i; char str[10],*lastProto; DBVARIANT dbv; - for(i=0;;i++) { + for (i=0;;i++) { _itoa(i,str,10); - if(DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; + if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) break; pdCompare = Proto_IsProtocolLoaded(( char* )dbv.pszVal ); mir_free(dbv.pszVal); - if(pdCompare==NULL) continue; - if(pd->type > pdCompare->type) break; + if (pdCompare==NULL) continue; + if (pd->type > pdCompare->type) break; } //put the new module at position i lastProto=mir_strdup((char*)lParam); - for(;;i++) { + for (;;i++) { _itoa(i,str,10); - if(DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { + if (DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { DBWriteContactSettingString((HANDLE)wParam,"_Filter",str,lastProto); mir_free(lastProto); break; @@ -240,13 +240,13 @@ static INT_PTR Proto_RemoveFromContact(WPARAM wParam,LPARAM lParam) char str[10]; i = Proto_IsProtoOnContact(wParam,lParam); - if(!i) return 1; - if(i==-1) + if (!i) return 1; + if (i==-1) DBDeleteContactSetting((HANDLE)wParam,"Protocol","p"); else { - for(i--;;i++) { //we have to decrease i, as Proto_IsOnContact returns +1 more number than read from database + for (i--;;i++) { //we have to decrease i, as Proto_IsOnContact returns +1 more number than read from database _itoa(i+1,str,10); - if(0!=DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { + if (0!=DBGetContactSettingString((HANDLE)wParam,"_Filter",str,&dbv)) { _itoa(i,str,10); DBDeleteContactSetting((HANDLE)wParam,"_Filter",str); break; diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 9d51b754ed..8916ff1512 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -329,7 +329,7 @@ char** __fastcall Proto_FilesMatrixA( wchar_t **files ) while( files[ count++ ] ); char** filesA = ( char** )mir_alloc( count * sizeof( char* )); - for( int i = 0; i < count; ++i ) + for ( int i = 0; i < count; ++i ) filesA[ i ] = mir_u2a( files[ i ] ); return filesA; @@ -343,7 +343,7 @@ static wchar_t** __fastcall Proto_FilesMatrixU( char **files ) while( files[ count++ ] ); wchar_t** filesU = ( wchar_t** )mir_alloc( count * sizeof( wchar_t* )); - for( int i = 0; i < count; ++i ) + for ( int i = 0; i < count; ++i ) filesU[ i ] = mir_a2u( files[ i ] ); return filesU; @@ -817,7 +817,7 @@ void UnloadProtocolsModule() } if ( protos.getCount() ) { - for( i=0; i < protos.getCount(); i++ ) { + for ( i=0; i < protos.getCount(); i++ ) { mir_free( protos[i]->szName); mir_free( protos[i] ); } diff --git a/src/modules/protocols/protodir.cpp b/src/modules/protocols/protodir.cpp index bb024d06c4..2311e1a1e2 100644 --- a/src/modules/protocols/protodir.cpp +++ b/src/modules/protocols/protodir.cpp @@ -75,7 +75,7 @@ int contactCacheCompare(void * a, void * b) int rc=0; // same protocol? rc = strcmp(x->proto, y->proto); - if ( rc == 0 ) { + if ( rc == 0 ) { // same id? id's might be missing if ( x->id && y->id ) rc = strcmp(x->id, y->id); } @@ -137,7 +137,7 @@ void contactDir_Contact_Add(contactDir * cd, HANDLE hContact, char * proto, char { // if a contact is gonna exist anywhere it's going to be in the ->protoCache which has a key of hContact // if id is not null then the contact should be indexed via the ->contactCache instead - if ( id == NULL ) { + if ( id == NULL ) { int index = 0; contactEntry e; e.hContact=hContact; @@ -184,7 +184,7 @@ void contactDir_Proto_Walk(contactDir * cd) dbvProto.pszVal = (char *) &buf; dbvProto.cchVal = SIZEOF(buf); // figure out what hContact/Protocol/p is - if ( CallService(MS_DB_CONTACT_GETSETTINGSTATIC,(WPARAM)hContact, (LPARAM)&gsProto) == 0 ) { + if ( CallService(MS_DB_CONTACT_GETSETTINGSTATIC,(WPARAM)hContact, (LPARAM)&gsProto) == 0 ) { contactDir_Contact_Add(cd, hContact, buf, NULL); } // find next diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 344166f2e4..c98445cfbd 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -173,7 +173,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg,UINT message, WPARAM wParam, rtrim( buf ); if ( buf[0] == 0 ) { int count = 1; - for( ;; ) { + for ( ;; ) { DBVARIANT dbv; mir_snprintf( buf, SIZEOF(buf), "%s_%d", pa->szProtoName, count++ ); if ( DBGetContactSettingString( NULL, buf, "AM_BaseProto", &dbv )) @@ -245,8 +245,7 @@ static void sttClickButton(HWND hwndDlg, int idcButton) static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - switch (msg) - { + switch (msg) { case WM_KEYDOWN: switch (wParam) { case VK_RETURN: @@ -254,7 +253,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return 0; case VK_ESCAPE: - SetWindowLongPtr(hwnd, GWLP_WNDPROC, GetWindowLongPtr(hwnd, GWLP_USERDATA)); + SetWindowLongPtr(hwnd, GWLP_WNDPROC, GetWindowLongPtr(hwnd, GWLP_USERDATA)); DestroyWindow(hwnd); return 0; } -- cgit v1.2.3