summaryrefslogtreecommitdiff
path: root/plugins/CountryFlags
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-02 20:55:18 +0000
commit78c0815c4118fe24ab78cce2dc48a6232dcd824a (patch)
tree8512c50df70b8dd80c919e88ade3419207c95956 /plugins/CountryFlags
parentce816d83a8c75808e0eb06832592bffefe4a8dc4 (diff)
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CountryFlags')
-rw-r--r--plugins/CountryFlags/countrylistext.c4
-rw-r--r--plugins/CountryFlags/extraimg.c14
-rw-r--r--plugins/CountryFlags/huffman.c48
-rw-r--r--plugins/CountryFlags/icons.c2
-rw-r--r--plugins/CountryFlags/ip2country.c22
-rw-r--r--plugins/CountryFlags/main.c6
-rw-r--r--plugins/CountryFlags/utils.c10
7 files changed, 53 insertions, 53 deletions
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; i<SIZEOF(countries); ++i)
- if((int)wParam==countries[i].id)
+ if ((int)wParam==countries[i].id)
return (int)countries[i].szName;
return (int)(char*)NULL;
}
static int ServiceGetCountryList(WPARAM wParam,LPARAM lParam)
{
- if((int*)wParam==NULL || (void*)lParam==NULL) return 1;
+ if ((int*)wParam==NULL || (void*)lParam==NULL) return 1;
*(int*)wParam=SIZEOF(countries);
*(struct CountryListEntry**)lParam=countries;
return 0;
diff --git a/plugins/CountryFlags/extraimg.c b/plugins/CountryFlags/extraimg.c
index cd50cc2ccb..1fec5f0b5f 100644
--- a/plugins/CountryFlags/extraimg.c
+++ b/plugins/CountryFlags/extraimg.c
@@ -253,7 +253,7 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam)
msgwi.hContact=(HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
while(msgwi.hContact!=NULL) {
/* is a message window opened for this contact? */
- if(!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState&MSG_WINDOW_STATE_EXISTS) {
+ if (!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState&MSG_WINDOW_STATE_EXISTS) {
countryNumber=ServiceDetectContactOriginCountry((WPARAM)msgwi.hContact,0);
if(fShow) SetStatusIcon(msgwi.hContact,countryNumber);
else UnsetStatusIcon(msgwi.hContact,countryNumber);
@@ -340,7 +340,7 @@ static int CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARA
{ BOOL checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG);
EnableWindow(GetDlgItem(hwndDlg,IDC_TEXT_EXTRAIMGFLAGCOLUMN),checked);
EnableWindow(GetDlgItem(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN),checked);
- if(!checked) checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
+ if (!checked) checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG),checked);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY),checked);
return TRUE;
@@ -395,17 +395,17 @@ static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam)
static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
{
DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam;
- if((HANDLE)wParam==NULL) {
- if(!lstrcmpA(dbcws->szModule,"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<nCountriesCount;i++) {
/* map different writings */
for(j=0;j<SIZEOF(differentCountryNames);j++)
- if(!lstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
+ if (!lstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
buf=(char*)differentCountryNames[j].szCSV;
break;
}
if(j==SIZEOF(differentCountryNames))
buf=(char*)countries[i].szName;
/* check country */
- if(!lstrcmpiA(pszCountry,buf)) {
+ if (!lstrcmpiA(pszCountry,buf)) {
dwOut=(DWORD)atoi(pszFrom);
AppendToByteBuffer(&buffer,(void*)&dwOut,sizeof(DWORD));
dwOut=(DWORD)atoi(pszTo);
diff --git a/plugins/CountryFlags/main.c b/plugins/CountryFlags/main.c
index 9db6655e33..ce4666a1b4 100644
--- a/plugins/CountryFlags/main.c
+++ b/plugins/CountryFlags/main.c
@@ -67,7 +67,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1],*p;
HANDLE hFile;
- if(!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
+ if (!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
return;
p=_tcsrchr(szFileFrom,_T('\\'));
if(p!=NULL) *(++p)=0;
@@ -77,7 +77,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
if(hFile==INVALID_HANDLE_VALUE) return;
CloseHandle(hFile);
- if(!GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
+ if (!GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
return;
p=_tcsrchr(szFileTo,_T('\\'));
if(p!=NULL) *(++p)=0;
@@ -85,7 +85,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
CreateDirectory(szFileTo,NULL);
lstrcat(szFileTo,pszFileName); /* buffer safe */
- if(!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) {
+ if (!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) {
DeleteFile(szFileTo);
MoveFile(szFileFrom,szFileTo);
}
diff --git a/plugins/CountryFlags/utils.c b/plugins/CountryFlags/utils.c
index d71b0acde3..0614927a1a 100644
--- a/plugins/CountryFlags/utils.c
+++ b/plugins/CountryFlags/utils.c
@@ -52,7 +52,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT msg,UINT idTimer,DWORD cur
for(i=0;i<nCallListCount;++i) {
/* find elapsed procs */
uElapsed=currentTick-callList[i].startTick; /* wraparound works */
- if((uElapsed+USER_TIMER_MINIMUM)>=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)<nCallListCount)
+ if ((i+1)<nCallListCount)
MoveMemory(&callList[i],&callList[i+1],((nCallListCount-i-1)*sizeof(struct BufferedCallData)));
--nCallListCount;
--i; /* reiterate current */
@@ -78,7 +78,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT msg,UINT idTimer,DWORD cur
CallFunctionAsync((void (CALLBACK *)(void*))pfnBuffProc,(void*)lParam); /* compatible */
}
/* find next timer delay */
- else if((callList[i].uElapse-uElapsed)<uElapseNext)
+ else if ((callList[i].uElapse-uElapsed)<uElapseNext)
uElapseNext=callList[i].uElapse-uElapsed;
}
@@ -111,7 +111,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula
/* find existing */
for(i=0;i<nCallListCount;++i)
if(callList[i].pfnBuffProc==pfnBuffProc)
- if(!fAccumulateSameParam || callList[i].lParam==lParam) {
+ if (!fAccumulateSameParam || callList[i].lParam==lParam) {
data=&callList[i];
break;
}
@@ -134,7 +134,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula
data->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);
}