summaryrefslogtreecommitdiff
path: root/plugins/CountryFlags
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-19 19:35:42 +0000
commit4c814798c7bc7f6a0f92c21b027b26290622aa2f (patch)
tree9bbfb38bd639f352300aa16ff7c45f5a9b2dba6d /plugins/CountryFlags
parentf0f0cd088f1ec3a85abee825ddbc214f3f6b92c3 (diff)
SIZEOF replaced with more secure analog - _countof
git-svn-id: http://svn.miranda-ng.org/main/trunk@14270 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CountryFlags')
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp2
-rw-r--r--plugins/CountryFlags/src/icons.cpp8
-rw-r--r--plugins/CountryFlags/src/ip2country.cpp6
-rw-r--r--plugins/CountryFlags/src/utils.cpp8
4 files changed, 12 insertions, 12 deletions
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index cc80628b6c..5f887b2745 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -55,7 +55,7 @@ static void CALLBACK SetExtraImage(MCONTACT hContact)
ExtraIcon_Clear(hExtraIcon, hContact);
else {
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
+ mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
}
}
diff --git a/plugins/CountryFlags/src/icons.cpp b/plugins/CountryFlags/src/icons.cpp
index 8c4ad30328..c11f0b4b9d 100644
--- a/plugins/CountryFlags/src/icons.cpp
+++ b/plugins/CountryFlags/src/icons.cpp
@@ -70,7 +70,7 @@ static int __fastcall CountryNumberToBitmapIndex(int countryNumber)
}
/* binary search in index array */
- int low = 0, i, high = SIZEOF(BitmapIndexMap)-1;
+ int low = 0, i, high = _countof(BitmapIndexMap)-1;
if (countryNumber <= BitmapIndexMap[high])
while (low <= high) {
i = low+((high-low)/2);
@@ -146,7 +146,7 @@ HICON __fastcall LoadFlagIcon(int countryNumber)
szCountry = (char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER, countryNumber = 0xFFFF, 0);
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber); /* buffer safe */
return IcoLib_GetIcon(szId);
}
@@ -197,7 +197,7 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam)
POINT aptTriangle[3] = { 0 };
aptTriangle[1].y = bm.bmHeight-1;
aptTriangle[2].x = bm.bmWidth-1;
- HRGN hrgn = CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
+ HRGN hrgn = CreatePolygonRgn(aptTriangle,_countof(aptTriangle),WINDING);
if (hrgn != NULL) {
SelectClipRgn(hdc,hrgn);
DeleteObject(hrgn);
@@ -244,7 +244,7 @@ void InitIcons(void)
sid.description.a = (char*)countries[i].szName;
/* create identifier */
- mir_snprintf(szId, SIZEOF(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */
+ mir_snprintf(szId, _countof(szId), (countries[i].id == 0xFFFF) ? "%s0x%X" : "%s%i","flags_", countries[i].id); /* buffer safe */
int index = CountryNumberToBitmapIndex(countries[i].id);
/* create icon */
HICON hIcon = ImageList_GetIcon(himl,index,ILD_NORMAL);
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp
index 76976594ba..49dcc881b6 100644
--- a/plugins/CountryFlags/src/ip2country.cpp
+++ b/plugins/CountryFlags/src/ip2country.cpp
@@ -226,12 +226,12 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut)
/* convert */
for(i=0;i<nCountriesCount;i++) {
/* map different writings */
- for(j=0;j<SIZEOF(differentCountryNames);j++)
+ for(j=0;j<_countof(differentCountryNames);j++)
if (!mir_tstrcmpi(countries[i].szName,differentCountryNames[j].szMir)) {
buf=(char*)differentCountryNames[j].szCSV;
break;
}
- if (j == SIZEOF(differentCountryNames))
+ if (j == _countof(differentCountryNames))
buf=(char*)countries[i].szName;
/* check country */
if (!mir_strcmpi(pszCountry,buf)) {
@@ -246,7 +246,7 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut)
}
/* not in list */
if (i == nCountriesCount) {
- mir_snprintf(out, SIZEOF(out), "Unknown: %s-%s [%s, %s]\n", pszFrom, pszTo, pszTwo, pszCountry);
+ mir_snprintf(out, _countof(out), "Unknown: %s-%s [%s, %s]\n", pszFrom, pszTo, pszTwo, pszCountry);
OutputDebugStringA(out); /* all ascii */
}
}
diff --git a/plugins/CountryFlags/src/utils.cpp b/plugins/CountryFlags/src/utils.cpp
index 9c0d0c6596..958a99fb25 100644
--- a/plugins/CountryFlags/src/utils.cpp
+++ b/plugins/CountryFlags/src/utils.cpp
@@ -70,7 +70,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT,UINT_PTR idTimer,DWORD cur
callList=NULL;
}
#ifdef _DEBUG
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"buffered call: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"buffered call: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
OutputDebugStringA(szDbgLine);
#endif
CallFunctionAsync((void (CALLBACK *)(void*))pfnBuffProc,(void*)lParam); /* compatible */
@@ -83,7 +83,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd,UINT,UINT_PTR idTimer,DWORD cur
/* set next timer */
if (nCallListCount) {
#ifdef _DEBUG
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"next buffered timeout: %ums\n",uElapseNext); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"next buffered timeout: %ums\n",uElapseNext); /* all ascii */
OutputDebugStringA(szDbgLine);
#endif
idBufferedTimer=SetTimer(hwnd,idBufferedTimer,uElapseNext,BufferedProcTimer); /* will be reset */
@@ -130,10 +130,10 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula
#ifdef _DEBUG
{ char szDbgLine[256];
data->pszProcName=pszProcName;
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"buffered queue: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"buffered queue: %s(0x%X)\n",pszProcName,lParam); /* all ascii */
OutputDebugStringA(szDbgLine);
if (!idBufferedTimer) {
- mir_snprintf(szDbgLine,SIZEOF(szDbgLine),"next buffered timeout: %ums\n",uElapse); /* all ascii */
+ mir_snprintf(szDbgLine,_countof(szDbgLine),"next buffered timeout: %ums\n",uElapse); /* all ascii */
OutputDebugStringA(szDbgLine);
}
}