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 --- plugins/CountryFlags/countrylistext.c | 4 +-- plugins/CountryFlags/extraimg.c | 14 +++++----- plugins/CountryFlags/huffman.c | 48 +++++++++++++++++------------------ plugins/CountryFlags/icons.c | 2 +- plugins/CountryFlags/ip2country.c | 22 ++++++++-------- plugins/CountryFlags/main.c | 6 ++--- plugins/CountryFlags/utils.c | 10 ++++---- 7 files changed, 53 insertions(+), 53 deletions(-) (limited to 'plugins/CountryFlags') diff --git a/plugins/CountryFlags/countrylistext.c b/plugins/CountryFlags/countrylistext.c index 50978fdb97..6f234c7533 100644 --- a/plugins/CountryFlags/countrylistext.c +++ b/plugins/CountryFlags/countrylistext.c @@ -278,14 +278,14 @@ static int ServiceGetCountryByNumber(WPARAM wParam,LPARAM lParam) int i; UNREFERENCED_PARAMETER(lParam); for(i=0; iszModule,"Flags")) { + if ((HANDLE)wParam==NULL) { + if (!lstrcmpA(dbcws->szModule,"Flags")) { /* Extra Image */ - if(!lstrcmpA(dbcws->szSetting,"ShowExtraImgFlag") || + if (!lstrcmpA(dbcws->szSetting,"ShowExtraImgFlag") || !lstrcmpA(dbcws->szSetting,"ExtraImgFlagColumn") || !lstrcmpA(dbcws->szSetting,"UseUnknownFlag") || !lstrcmpA(dbcws->szSetting,"UseIpToCountry")) if(ServiceExists(MS_CLIST_EXTRA_SET_ICON)) CallFunctionBuffered(UpdateExtraImages,0,FALSE,EXTRAIMAGE_REFRESHDELAY); /* Status Icon */ - if(!lstrcmpA(dbcws->szSetting,"ShowStatusIconFlag") || + if (!lstrcmpA(dbcws->szSetting,"ShowStatusIconFlag") || !lstrcmpA(dbcws->szSetting,"UseUnknownFlag") || !lstrcmpA(dbcws->szSetting,"UseIpToCountry")) if(ServiceExists(MS_MSG_ADDICON)) @@ -413,7 +413,7 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam) } } /* user details update */ - else if(!lstrcmpA(dbcws->szSetting,"RealIP") || + else if (!lstrcmpA(dbcws->szSetting,"RealIP") || !lstrcmpA(dbcws->szSetting,"Country") || !lstrcmpA(dbcws->szSetting,"CompanyCountry")) { /* Extra Image */ diff --git a/plugins/CountryFlags/huffman.c b/plugins/CountryFlags/huffman.c index f05e82113e..b253f2d48f 100644 --- a/plugins/CountryFlags/huffman.c +++ b/plugins/CountryFlags/huffman.c @@ -124,7 +124,7 @@ static unsigned int _Huffman_ReadBit( huff_bitstream_t *stream ) /* Extract bit */ x = (*buf & (1<<(7-bit))) ? 1 : 0; bit = (bit+1) & 7; - if( !bit ) + if ( !bit ) { ++ buf; } @@ -179,13 +179,13 @@ static void _Huffman_WriteBits( huff_bitstream_t *stream, unsigned int x, /* Append bits */ mask = 1 << (bits-1); - for( count = 0; count < bits; ++ count ) + for ( count = 0; count < bits; ++ count ) { *buf = (unsigned char)((*buf & (0xff^(1<<(7-bit)))) + ((x & mask ? 1 : 0) << (7-bit))); x <<= 1; bit = (bit+1) & 7; - if( !bit ) + if ( !bit ) { ++ buf; } @@ -209,7 +209,7 @@ static void _Huffman_Hist( unsigned char *in, huff_sym_t *sym, int k; /* Clear/init histogram */ - for( k = 0; k < 256; ++ k ) + for ( k = 0; k < 256; ++ k ) { sym[k].Symbol = k; sym[k].Count = 0; @@ -218,7 +218,7 @@ static void _Huffman_Hist( unsigned char *in, huff_sym_t *sym, } /* Build histogram */ - for( k = size; k; -- k ) + for ( k = size; k; -- k ) { sym[*in ++].Count ++; } @@ -238,16 +238,16 @@ static void _Huffman_StoreTree( huff_encodenode_t *node, huff_sym_t *sym, unsigned int sym_idx; /* Is this a leaf node? */ - if( node->Symbol >= 0 ) + if ( node->Symbol >= 0 ) { /* Append symbol to tree description */ _Huffman_WriteBits( stream, 1, 1 ); _Huffman_WriteBits( stream, node->Symbol, 8 ); /* Find symbol index */ - for( sym_idx = 0; sym_idx < 256; ++ sym_idx ) + for ( sym_idx = 0; sym_idx < 256; ++ sym_idx ) { - if( sym[sym_idx].Symbol == node->Symbol ) break; + if ( sym[sym_idx].Symbol == node->Symbol ) break; } /* Store code info in symbol array */ @@ -282,9 +282,9 @@ static void _Huffman_MakeTree( huff_sym_t *sym, huff_bitstream_t *stream ) /* Initialize all leaf nodes */ num_symbols = 0; - for( k = 0; k < 256; ++ k ) + for ( k = 0; k < 256; ++ k ) { - if( sym[k].Count > 0 ) + if ( sym[k].Count > 0 ) { nodes[num_symbols].Symbol = sym[k].Symbol; nodes[num_symbols].Count = sym[k].Count; @@ -304,16 +304,16 @@ static void _Huffman_MakeTree( huff_sym_t *sym, huff_bitstream_t *stream ) /* Find the two lightest nodes */ node_1 = (huff_encodenode_t *) 0; node_2 = (huff_encodenode_t *) 0; - for( k = 0; k < next_idx; ++ k ) + for ( k = 0; k < next_idx; ++ k ) { - if( nodes[k].Count > 0 ) + if ( nodes[k].Count > 0 ) { - if( !node_1 || (nodes[k].Count <= node_1->Count) ) + if ( !node_1 || (nodes[k].Count <= node_1->Count) ) { node_2 = node_1; node_1 = &nodes[k]; } - else if( !node_2 || (nodes[k].Count <= node_2->Count) ) + else if ( !node_2 || (nodes[k].Count <= node_2->Count) ) { node_2 = &nodes[k]; } @@ -334,7 +334,7 @@ static void _Huffman_MakeTree( huff_sym_t *sym, huff_bitstream_t *stream ) /* Store the tree in the output stream, and in the sym[] array (the latter is used as a look-up-table for faster encoding) */ - if( root ) + if ( root ) { _Huffman_StoreTree( root, sym, stream, 0, 0 ); } @@ -367,7 +367,7 @@ static huff_decodenode_t * _Huffman_RecoverTree( huff_decodenode_t *nodes, this_node->ChildB = (huff_decodenode_t *) 0; /* Is this a leaf node? */ - if( _Huffman_ReadBit( stream ) ) + if ( _Huffman_ReadBit( stream ) ) { /* Get symbol from tree description and store in lead node */ this_node->Symbol = _Huffman_Read8Bits( stream ); @@ -409,7 +409,7 @@ int Huffman_Compress( unsigned char *in, unsigned char *out, unsigned int k, total_bytes, swaps, symbol; /* Do we have anything to compress? */ - if( insize < 1 ) return 0; + if ( insize < 1 ) return 0; /* Initialize bitstream */ _Huffman_InitBitstream( &stream, out ); @@ -424,9 +424,9 @@ int Huffman_Compress( unsigned char *in, unsigned char *out, do { swaps = 0; - for( k = 0; k < 255; ++ k ) + for ( k = 0; k < 255; ++ k ) { - if( sym[k].Symbol > sym[k+1].Symbol ) + if ( sym[k].Symbol > sym[k+1].Symbol ) { tmp = sym[k]; sym[k] = sym[k+1]; @@ -438,7 +438,7 @@ int Huffman_Compress( unsigned char *in, unsigned char *out, while( swaps ); /* Encode input stream */ - for( k = 0; k < insize; ++ k ) + for ( k = 0; k < insize; ++ k ) { symbol = in[k]; _Huffman_WriteBits( &stream, sym[symbol].Code, @@ -447,7 +447,7 @@ int Huffman_Compress( unsigned char *in, unsigned char *out, /* Calculate size of output data */ total_bytes = (int)(stream.BytePtr - out); - if( stream.BitPos > 0 ) + if ( stream.BitPos > 0 ) { ++ total_bytes; } @@ -476,7 +476,7 @@ void Huffman_Uncompress( unsigned char *in, unsigned char *out, unsigned char *buf; /* Do we have anything to decompress? */ - if( insize < 1 ) return; + if ( insize < 1 ) return; /* Initialize bitstream */ _Huffman_InitBitstream( &stream, in ); @@ -487,14 +487,14 @@ void Huffman_Uncompress( unsigned char *in, unsigned char *out, /* Decode input stream */ buf = out; - for( k = 0; k < outsize; ++ k ) + for ( k = 0; k < outsize; ++ k ) { /* Traverse tree until we find a matching leaf node */ node = root; while( node->Symbol < 0 ) { /* Get next node */ - if( _Huffman_ReadBit( &stream ) ) + if ( _Huffman_ReadBit( &stream ) ) node = node->ChildB; else node = node->ChildA; diff --git a/plugins/CountryFlags/icons.c b/plugins/CountryFlags/icons.c index 9611eb0b78..607308b57a 100644 --- a/plugins/CountryFlags/icons.c +++ b/plugins/CountryFlags/icons.c @@ -168,7 +168,7 @@ int FASTCALL CountryNumberToIndex(int countryNumber) static int ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) { /* return handle */ - if((BOOL)lParam) { + if ((BOOL)lParam) { if(phIconHandles==NULL) return (int)(HANDLE)NULL; return (int)phIconHandles[CountryNumberToIndex((int)wParam)]; } diff --git a/plugins/CountryFlags/ip2country.c b/plugins/CountryFlags/ip2country.c index eae267aaa0..b892fabb83 100644 --- a/plugins/CountryFlags/ip2country.c +++ b/plugins/CountryFlags/ip2country.c @@ -211,34 +211,34 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut) buf=strchr(pszCountry,'"'); *buf=pszTwo[2]='\0'; /* corrections */ - if(!lstrcmpi(pszCountry,"ANTARCTICA")) continue; - if(!lstrcmpi(pszCountry,"TIMOR-LESTE")) continue; - if(!lstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED")) + if (!lstrcmpi(pszCountry,"ANTARCTICA")) continue; + if (!lstrcmpi(pszCountry,"TIMOR-LESTE")) continue; + if (!lstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED")) lstrcpy(pszCountry,"ISRAEL"); - else if(!lstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS")) + else if (!lstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS")) lstrcpy(pszCountry,"UNITED STATES"); - else if(!lstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS")) + else if (!lstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS")) lstrcpy(pszCountry,"UNITED KINGDOM"); - else if(!lstrcmpi(pszTwo,"JE")) /* map error */ + else if (!lstrcmpi(pszTwo,"JE")) /* map error */ lstrcpy(pszCountry,"UNITED KINGDOM"); - else if(!lstrcmpi(pszTwo,"AX")) /* Åland Island belongs to Finland */ + else if (!lstrcmpi(pszTwo,"AX")) /* Åland Island belongs to Finland */ lstrcpy(pszCountry,"FINLAND"); - else if(!lstrcmpi(pszTwo,"ME")) + else if (!lstrcmpi(pszTwo,"ME")) lstrcpy(pszCountry,"MONTENEGRO"); - else if(!lstrcmpi(pszTwo,"RS") || !lstrcmpi(pszTwo,"CS")) + else if (!lstrcmpi(pszTwo,"RS") || !lstrcmpi(pszTwo,"CS")) lstrcpy(pszCountry,"SERBIA"); /* convert */ for(i=0;i=callList[i].uElapse) { + if ((uElapsed+USER_TIMER_MINIMUM)>=callList[i].uElapse) { /* call elapsed proc */ pfnBuffProc=callList[i].pfnBuffProc; lParam=callList[i].lParam; @@ -60,7 +60,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT msg,UINT idTimer,DWORD cur pszProcName=callList[i].pszProcName; #endif /* resize storage array */ - if((i+1)pszProcName=pszProcName; mir_snprintf(szDbgLine,sizeof(szDbgLine),"buffered queue: %s(0x%X)\n",pszProcName,lParam); /* all ascii */ OutputDebugStringA(szDbgLine); - if(!idBufferedTimer) { + if (!idBufferedTimer) { mir_snprintf(szDbgLine,sizeof(szDbgLine),"next buffered timeout: %ums\n",uElapse); /* all ascii */ OutputDebugStringA(szDbgLine); } -- cgit v1.2.3