diff options
Diffstat (limited to 'plugins/WebView')
-rw-r--r-- | plugins/WebView/src/main.cpp | 4 | ||||
-rw-r--r-- | plugins/WebView/src/webview.cpp | 2 | ||||
-rw-r--r-- | plugins/WebView/src/webview_alerts.cpp | 48 | ||||
-rw-r--r-- | plugins/WebView/src/webview_cleanup.cpp | 2 | ||||
-rw-r--r-- | plugins/WebView/src/webview_datawnd.cpp | 18 | ||||
-rw-r--r-- | plugins/WebView/src/webview_getdata.cpp | 28 | ||||
-rw-r--r-- | plugins/WebView/src/webview_opts.cpp | 44 | ||||
-rw-r--r-- | plugins/WebView/src/webview_services.cpp | 26 |
8 files changed, 86 insertions, 86 deletions
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 3df115a69a..936ebef921 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -145,7 +145,7 @@ extern "C" int __declspec(dllexport) Load() // register netlib handle
char tempNdesc[50];
- mir_snprintf(tempNdesc, SIZEOF(tempNdesc), "%s connection settings", MODULENAME);
+ mir_snprintf(tempNdesc, _countof(tempNdesc), "%s connection settings", MODULENAME);
NETLIBUSER nlu = { sizeof(nlu) };
nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS;
@@ -231,7 +231,7 @@ extern "C" int __declspec(dllexport) Load() mi.flags |= CMIF_KEEPUNTRANSLATED;
TCHAR countername[100];
- mir_sntprintf(countername, SIZEOF(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_sntprintf(countername, _countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.position = 600090099;
mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
mi.pszContactOwner = NULL;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index e040bac561..d58f6cfe91 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -73,7 +73,7 @@ void ChangeMenuItemCountdown() mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
TCHAR countername[100];
- mir_sntprintf(countername,SIZEOF(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ mir_sntprintf(countername,_countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
mi.ptszName = countername;
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItemCountdown, (LPARAM)&mi);
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index feffb27c1f..5e1810cd89 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -116,7 +116,7 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) if( ((HANDLE)wParam) != NULL) {
DBVARIANT dbv;
db_get_ts(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
- mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, _countof(ppd.lptzContactName));
db_free(&dbv);
}
else mir_tstrcpy(ppd.lptzContactName, _T(MODULENAME));
@@ -126,9 +126,9 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) TCHAR *displaytext = (TCHAR*)lParam;
if ((mir_tstrlen(displaytext) == MAX_SECONDLINE) || (mir_tstrlen(displaytext) > MAX_SECONDLINE))
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext);
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), displaytext);
else if (mir_tstrlen(displaytext) < MAX_SECONDLINE)
- mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), displaytext);
+ mir_sntprintf(ppd.lptzText, _countof(ppd.lptzText), displaytext);
if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) {
ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg);
@@ -161,15 +161,15 @@ int OSDAlert(WPARAM hContact, LPARAM lParam) if (hContact != NULL) {
DBVARIANT dbv;
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
}
if (contactname[0] == 0)
- strncpy_s(contactname, SIZEOF(contactname), MODULENAME, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), MODULENAME, _TRUNCATE);
char *displaytext = (char*)lParam;
- mir_snprintf(newdisplaytext, SIZEOF(newdisplaytext), "%s: %s", contactname, Translate(displaytext));
+ mir_snprintf(newdisplaytext, _countof(newdisplaytext), "%s: %s", contactname, Translate(displaytext));
if (ServiceExists("OSD/Announce"))
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
@@ -188,11 +188,11 @@ int ErrorMsgs(WPARAM wParam, LPARAM lParam) TCHAR *ptszContactName = pcli->pfnGetContactDisplayName(hContact, 0);
if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s\n%s"), ptszContactName, displaytext);
+ mir_sntprintf(newdisplaytext, _countof(newdisplaytext), _T("%s\n%s"), ptszContactName, displaytext);
PUShowMessageT(newdisplaytext, SM_WARNING);
}
else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s: %s"), ptszContactName, TranslateTS(displaytext));
+ mir_sntprintf(newdisplaytext, _countof(newdisplaytext), _T("%s: %s"), ptszContactName, TranslateTS(displaytext));
CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
}
else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
@@ -220,7 +220,7 @@ void SaveToFile(MCONTACT hContact, char *truncated) char url[300]; url[0] = '\0';
DBVARIANT dbv;
if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) {
- strncpy_s(url, SIZEOF(url), dbv.pszVal, _TRUNCATE);
+ strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -237,10 +237,10 @@ void SaveToFile(MCONTACT hContact, char *truncated) time_t ftime = time(NULL);
struct tm *nTime = localtime(&ftime);
- mir_snprintf(timeprefix, SIZEOF(timeprefix), " %s ", Translate("Last updated on"));
+ mir_snprintf(timeprefix, _countof(timeprefix), " %s ", Translate("Last updated on"));
strftime(temptime1, 32, " %a, %b %d, %Y ", nTime);
strftime(temptime2, 32, " %I:%M %p.", nTime);
- mir_snprintf(timestring, SIZEOF(timestring), "(%s)%s\n%s,%s\n", MODULENAME, url, temptime1, temptime2);
+ mir_snprintf(timestring, _countof(timestring), "(%s)%s\n%s,%s\n", MODULENAME, url, temptime1, temptime2);
fputs(timestring, pfile);
fwrite(truncated, mir_strlen(truncated), 1, pfile);
@@ -272,7 +272,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&tempraw, 0, sizeof(tempraw));
memset(&raw, 0, sizeof(raw));
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ strncpy(tempraw, truncated, _countof(tempraw));
memset(&alertstring, 0, sizeof(alertstring));
memset(&Alerttempstring, 0, sizeof(Alerttempstring));
@@ -345,7 +345,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (eventIndex == 0) { // string present
if (!db_get_s(hContact, MODULENAME, ALERT_STRING_KEY, &tdbv)) {
- strncpy_s(alertstring, SIZEOF(alertstring), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(alertstring, _countof(alertstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
if ((strstr(tempraw, alertstring)) != 0) { // // ENDALERT EVENT:CHECK FOR STRING
@@ -357,7 +357,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn //
if ((!notpresent)) {
if (alertIndex == 0) { // popup
- mir_sntprintf(displaystring, SIZEOF(displaystring), _T("%s \"%S\" %s."), Translate("The string"), alertstring, Translate("has been found on the web page"));
+ mir_sntprintf(displaystring, _countof(displaystring), _T("%s \"%S\" %s."), Translate("The string"), alertstring, Translate("has been found on the web page"));
WAlertPopup(hContact, displaystring);
// contactlist name//
@@ -397,7 +397,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
}
else if (alertIndex == 3) {
- mir_sntprintf(displaystring, SIZEOF(displaystring), _T("%s \"%s\" %s."), TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
+ mir_sntprintf(displaystring, _countof(displaystring), _T("%s \"%s\" %s."), TranslateT("The string"), alertstring, TranslateT("has been found on the web page"));
WAlertOSD(hContact, displaystring);
// contactlist name//
@@ -421,14 +421,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn else if (eventIndex == 1) { // webpage changed
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
@@ -516,11 +516,11 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (eventIndex == 2) { // part of webpage changed
Alerttempstring[0] = Alerttempstring2[0] = 0;
if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &tdbv)) {
- strncpy_s(Alerttempstring, SIZEOF(Alerttempstring), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring, _countof(Alerttempstring), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
}
if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &tdbv)) {
- strncpy_s(Alerttempstring2, SIZEOF(Alerttempstring2), tdbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring2, _countof(Alerttempstring2), tdbv.pszVal, _TRUNCATE);
db_free(&tdbv);
}
@@ -633,14 +633,14 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn if (((strstr(tempraw, Alerttempstring)) != 0) && ((strstr(tempraw, Alerttempstring2)) != 0)) {
// TEST GET NAME FOR CACHE
TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50];
- GetModuleFileName(hInst, cachepath, SIZEOF(cachepath));
+ GetModuleFileName(hInst, cachepath, _countof(cachepath));
TCHAR *cacheend = _tcsrchr(cachepath, '\\');
cacheend++;
*cacheend = '\0';
- mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
+ mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s%S%S"), cachepath, MODULENAME, "cache\\");
CreateDirectory(cachedirectorypath, NULL);
- mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
+ mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s%S%S%S%S"), cachepath, MODULENAME, "cache\\", contactname, ".txt");
// file exists?
if ( _taccess(newcachepath, 0) != -1) {
if ((pcachefile = _tfopen(newcachepath, _T("r"))) == NULL)
@@ -802,7 +802,7 @@ void ReadFromFile(void *param) char contactname[100]; contactname[0] = 0;
if (!db_get_s(hContact, "CList", "MyHandle", &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index 67a4ee5a1d..11c7558f9c 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -788,7 +788,7 @@ void Removewhitespace(char *truncated) void Filter(char *truncated)
{
char tempraw[MAXSIZE1];
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ strncpy(tempraw, truncated, _countof(tempraw));
for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t'))
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 8857e78d1a..08c5d32ecd 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -58,13 +58,13 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara char *tempbuffer = (char*)malloc(len + 2);
GetDlgItemTextA(ParentHwnd, IDC_DATA, tempbuffer, len);
- strncpy(buff, tempbuffer, SIZEOF(buff));
+ strncpy(buff, tempbuffer, _countof(buff));
free(tempbuffer);
Filter(buff);
CharUpperBuffA(buff, (int)mir_strlen(buff));
- GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, SIZEOF(NewSearchstr));
+ GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, _countof(NewSearchstr));
CharUpperBuffA(NewSearchstr, (int)mir_strlen(NewSearchstr));
OLDstartposition = startposition;
@@ -125,8 +125,8 @@ static MCONTACT FindContactByUrl(HWND hwndDlg) TCHAR urltext[300], titlebartxt[300];
int contactcount = 0;
- GetDlgItemText(hwndDlg, IDC_OPEN_URL, urltext, SIZEOF(urltext));
- GetWindowText(hwndDlg, titlebartxt, SIZEOF(titlebartxt));
+ GetDlgItemText(hwndDlg, IDC_OPEN_URL, urltext, _countof(urltext));
+ GetWindowText(hwndDlg, titlebartxt, _countof(titlebartxt));
for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) {
ptrT db1( db_get_tsa(hContact, MODULENAME, URL_KEY));
@@ -165,11 +165,11 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA _tcsncpy_s(url, dbv.ptszVal, _TRUNCATE);
db_free(&dbv);
}
- SetDlgItemText(hwndDlg, IDC_OPEN_URL, FixButtonText(url, SIZEOF(url)));
+ SetDlgItemText(hwndDlg, IDC_OPEN_URL, FixButtonText(url, _countof(url)));
char preservename[100];
if (!db_get_s(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(preservename, SIZEOF(preservename), dbv.pszVal, _TRUNCATE);
+ strncpy_s(preservename, _countof(preservename), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
else preservename[0] = 0;
@@ -233,11 +233,11 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA HDC hdc = GetDC(GetDlgItem(hwndDlg, IDC_STATUSBAR));
SelectObject(hdc, (HFONT) SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, tszSizeString, SIZEOF(tszSizeString), &textSize);
+ GetTextExtentPoint32(hdc, tszSizeString, _countof(tszSizeString), &textSize);
int partWidth[2] = { textSize.cx, -1 };
ReleaseDC(GetDlgItem(hwndDlg, IDC_STATUSBAR), hdc);
- SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, SIZEOF(partWidth), (LPARAM)partWidth);
+ SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETPARTS, _countof(partWidth), (LPARAM)partWidth);
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0);
if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
@@ -337,7 +337,7 @@ INT_PTR CALLBACK DlgProcDisplayData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_OPEN_URL:
- GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, SIZEOF(url));
+ GetDlgItemText(hwndDlg, IDC_OPEN_URL, url, _countof(url));
CallService(MS_UTILS_OPENURL, OUF_TCHAR, (LPARAM)url);
db_set_w(wParam, MODULENAME, "Status", ID_STATUS_ONLINE);
break;
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index a542e21c0a..9e38568dfa 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -77,7 +77,7 @@ void GetData(void *param) }
if (!db_get_s(hContact, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
- strncpy_s(contactname, SIZEOF(contactname), dbv.pszVal, _TRUNCATE);
+ strncpy_s(contactname, _countof(contactname), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -87,17 +87,17 @@ void GetData(void *param) db_set_b(NULL, MODULENAME, HAS_CRASHED_KEY, 1);
if (!db_get_s(hContact, MODULENAME, START_STRING_KEY, &dbv)) {
- strncpy_s(tempstring, SIZEOF(tempstring), dbv.pszVal, _TRUNCATE);
+ strncpy_s(tempstring, _countof(tempstring), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, END_STRING_KEY, &dbv)) {
- strncpy_s(tempstring2, SIZEOF(tempstring2), dbv.pszVal, _TRUNCATE);
+ strncpy_s(tempstring2, _countof(tempstring2), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, URL_KEY, &dbv)) {
- strncpy_s(url, SIZEOF(url), dbv.pszVal, _TRUNCATE);
+ strncpy_s(url, _countof(url), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
@@ -287,9 +287,9 @@ void GetData(void *param) strftime(temptime, 128, "(%b %d,%H:%M:%S)", nTime);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", temptime, dbv.pszVal);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", temptime, dbv.pszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", dbv.pszVal, temptime);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", dbv.pszVal, temptime);
db_free(&dbv);
}
else {
@@ -307,20 +307,20 @@ void GetData(void *param) db_set_ts(hContact, MODULENAME, PRESERVE_NAME_KEY, dbv.ptszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 1)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", temptime, dbv.pszVal);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", temptime, dbv.pszVal);
if (db_get_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, 1) == 0)
- mir_snprintf(tstr, SIZEOF(tstr), "%s %s", dbv.pszVal, temptime);
+ mir_snprintf(tstr, _countof(tstr), "%s %s", dbv.pszVal, temptime);
db_free(&dbv);
}
ftime = time(NULL);
nTime = localtime(&ftime);
- strncpy_s(timeprefix, SIZEOF(timeprefix), Translate("Last updated on"), _TRUNCATE);
- strncpy_s(timeat, SIZEOF(timeat), Translate("at the time"), _TRUNCATE);
+ strncpy_s(timeprefix, _countof(timeprefix), Translate("Last updated on"), _TRUNCATE);
+ strncpy_s(timeat, _countof(timeat), Translate("at the time"), _TRUNCATE);
strftime(temptime1, 32, " %a, %b %d, %Y ", nTime);
strftime(temptime2, 32, " %I:%M %p.", nTime);
- mir_snprintf(timestring, SIZEOF(timestring), " %s %s%s%s", timeprefix, temptime1, timeat, temptime2);
+ mir_snprintf(timestring, _countof(timestring), " %s %s%s%s", timeprefix, temptime1, timeat, temptime2);
} // end download success
if (DownloadSuccess) {
@@ -334,15 +334,15 @@ void GetData(void *param) eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
if (eventIndex == 2) {
- strncpy(buff, truncated, SIZEOF(buff));
+ strncpy(buff, truncated, _countof(buff));
Filter(buff);
if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) {
- strncpy_s(Alerttempstring, SIZEOF(Alerttempstring), dbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring, _countof(Alerttempstring), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
if (!db_get_s(hContact, MODULENAME, ALRT_E_STRING_KEY, &dbv)) {
- strncpy_s(Alerttempstring2, SIZEOF(Alerttempstring2), dbv.pszVal, _TRUNCATE);
+ strncpy_s(Alerttempstring2, _countof(Alerttempstring2), dbv.pszVal, _TRUNCATE);
db_free(&dbv);
}
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index c2d73b811e..68626d4cb1 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -64,7 +64,7 @@ TCHAR* FixButtonText(TCHAR *url, size_t len) int posafter = (stringafter - buttontext) + 1;
strdel(stringafter, 1);
_tcsncpy_s(stringbefore, pos, buttontext, _TRUNCATE);
- mir_sntprintf(newbuttontext, SIZEOF(buttontext), _T("%s!!%s"), stringbefore, stringafter);
+ mir_sntprintf(newbuttontext, _countof(buttontext), _T("%s!!%s"), stringbefore, stringafter);
posafter = 0;
posbefore = 0;
@@ -202,7 +202,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR str3[512];
POPUPDATAT ppd = { 0 };
- GetDlgItemText(hdlg, IDC_DELAY, str3, SIZEOF(str3));
+ GetDlgItemText(hdlg, IDC_DELAY, str3, _countof(str3));
if (IsDlgButtonChecked(hdlg, IDC_POP_USECUSTCOLORS)) {
BGColour = (SendDlgItemMessage(hdlg, IDC_POP_BGCOLOUR, CPM_GETCOLOUR, 0, 0));
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) {
int popupdelayval = 0;
TCHAR str2[512];
- GetDlgItemText(hdlg, IDC_DELAY, str2, SIZEOF(str2));
+ GetDlgItemText(hdlg, IDC_DELAY, str2, _countof(str2));
popupdelayval = _ttol(str2);
db_set_dw(NULL, MODULENAME, POP_DELAY_KEY, popupdelayval);
@@ -315,10 +315,10 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l SetDlgItemText(hwndDlg, IDC_ALERT_TYPE, TranslateTS(AlertTypes[db_get_b(hContact, MODULENAME, ALRT_INDEX_KEY, 0)]));
SetDlgItemText(hwndDlg, IDC_EVENT_TYPE, TranslateTS(EventTypes[db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0)]));
- for (i = 0; i < SIZEOF(AlertTypes); i++)
+ for (i = 0; i < _countof(AlertTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(AlertTypes[i]));
- for (i = 0; i < SIZEOF(EventTypes); i++)
+ for (i = 0; i < _countof(EventTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(EventTypes[i]));
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) {
@@ -452,7 +452,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_BROWSE:
{
TCHAR szFileName[MAX_PATH];
- GetDlgItemText(hwndDlg, IDC_FILENAME, szFileName, SIZEOF(szFileName));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, szFileName, _countof(szFileName));
OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
@@ -461,7 +461,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ofn.lpstrFilter = _T("TEXT Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0\0");
ofn.lpstrFile = szFileName;
ofn.Flags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
- ofn.nMaxFile = SIZEOF(szFileName);
+ ofn.nMaxFile = _countof(szFileName);
ofn.nMaxFileTitle = MAX_PATH;
ofn.lpstrDefExt = _T("txt");
if (!GetSaveFileName(&ofn))
@@ -757,19 +757,19 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l break;
}
- GetDlgItemText(hwndDlg, IDC_FILENAME, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_FILENAME, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, FILE_KEY, buf);
db_set_b(hContact, MODULENAME, APPEND_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_APPEND));
db_set_b(hContact, MODULENAME, SAVE_AS_RAW_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SAVE_AS_RAW));
- GetDlgItemText(hwndDlg, IDC_ALERT_STRING, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_ALERT_STRING, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALERT_STRING_KEY, buf);
- GetDlgItemText(hwndDlg, IDC_START2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_START2, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, buf);
- GetDlgItemText(hwndDlg, IDC_END2, buf, SIZEOF(buf));
+ GetDlgItemText(hwndDlg, IDC_END2, buf, _countof(buf));
db_set_ts(hContact, MODULENAME, ALRT_E_STRING_KEY, buf);
db_set_b(hContact, MODULENAME, CONTACT_PREFIX_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_PREFIX));
@@ -929,10 +929,10 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR string[128];
hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_START, string, SIZEOF(string));
+ GetDlgItemText(hwndDlg, IDC_START, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, string);
- GetDlgItemText(hwndDlg, IDC_END, string, SIZEOF(string));
+ GetDlgItemText(hwndDlg, IDC_END, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_E_STRING_KEY, string);
db_set_w(hContact, MODULENAME, EVNT_INDEX_KEY, 2);
@@ -984,7 +984,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
}
- GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, SIZEOF(contactname));
+ GetDlgItemText(hwndDlg, IDC_SITE_NAME, contactname, _countof(contactname));
if (_tcschr(contactname, '\\') != NULL) {
MessageBox(NULL, TranslateT("Invalid symbol present in contact name."), _T(MODULENAME), MB_OK);
break;
@@ -1024,17 +1024,17 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- GetDlgItemText(hwndDlg, IDC_URL, url, SIZEOF(url));
+ GetDlgItemText(hwndDlg, IDC_URL, url, _countof(url));
db_set_ts(hContact, MODULENAME, URL_KEY, url);
db_set_ts(hContact, MODULENAME, "Homepage", url);
- GetDlgItemText(hwndDlg, IDC_START, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_START, str, _countof(str));
db_set_ts(hContact, MODULENAME, START_STRING_KEY, str);
- GetDlgItemText(hwndDlg, IDC_END, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_END, str, _countof(str));
db_set_ts(hContact, MODULENAME, END_STRING_KEY, str);
- GetDlgItemText(hwndDlg, IDC_SITE_NAME, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_SITE_NAME, str, _countof(str));
db_set_ts(hContact, "CList", "MyHandle", str);
db_set_b(hContact, MODULENAME, DBLE_WIN_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DBLE_WIN));
@@ -1043,7 +1043,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM db_set_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_CLEAN));
db_set_b(hContact, MODULENAME, RWSPACE_KEY, (BYTE)(SendDlgItemMessage(hwndDlg, IDC_RWSPACE, TBM_GETPOS, 0, 0)));
- SetDlgItemText(ParentHwnd, IDC_OPEN_URL, FixButtonText(url, SIZEOF(url)));
+ SetDlgItemText(ParentHwnd, IDC_OPEN_URL, FixButtonText(url, _countof(url)));
SetWindowText(ParentHwnd, str);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
@@ -1121,7 +1121,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara }
else SetDlgItemText(hwndDlg, IDC_TYPEFACE, Def_font_face);
- for (int i = 0; i < SIZEOF(fontSizes); i++)
+ for (int i = 0; i < _countof(fontSizes); i++)
SendDlgItemMessage(hwndDlg, IDC_FONTSIZE, CB_ADDSTRING, 0, (LPARAM)fontSizes[i]);
SendMessage(hwndDlg, M_FILLSCRIPTCOMBO, wParam, 0);
@@ -1176,7 +1176,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara HDC hdc = GetDC(hwndDlg);
lf.lfCharSet = DEFAULT_CHARSET;
- GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, SIZEOF(lf.lfFaceName));
+ GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, _countof(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0);
EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontScriptsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
@@ -1282,7 +1282,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara db_set_b(NULL, MODULENAME, DATA_POPUP_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DATAPOPUP));
TCHAR str[100];
- GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, SIZEOF(str));
+ GetDlgItemText(hwndDlg, IDC_TYPEFACE, str, _countof(str));
db_set_ts(NULL, MODULENAME, FONT_FACE_KEY, str);
db_set_b(NULL, MODULENAME, FONT_SIZE_KEY, (GetDlgItemInt(hwndDlg, IDC_FONTSIZE, NULL, FALSE)));
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 20196b0fd1..3bafe7c9b7 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -57,7 +57,7 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) else nick[0] = 0; - for (int i=0; i < SIZEOF(szInvalidChars); i++ ) { + for (int i=0; i < _countof(szInvalidChars); i++ ) { TCHAR *p = _tcschr(nick, szInvalidChars[i]); if (p != NULL) { WErrorPopup((MCONTACT)"ERROR", TranslateT("Invalid symbol present in contact name.")); @@ -81,16 +81,16 @@ int DBSettingChanged(WPARAM wParam, LPARAM lParam) // TEST GET NAME FOR CACHE TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(hInst, cachepath, SIZEOF(cachepath)); + GetModuleFileName(hInst, cachepath, _countof(cachepath)); TCHAR *cacheend = _tcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath); + mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath); CreateDirectory(cachedirectorypath, NULL); TCHAR newcachepath[MAX_PATH + 50], renamedcachepath[MAX_PATH + 50]; - mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, oldName); - mir_sntprintf(renamedcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, nick); + mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, oldName); + mir_sntprintf(renamedcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, nick); // file exists? if ( _taccess(newcachepath, 0) != -1) { @@ -119,14 +119,14 @@ int SiteDeleted(WPARAM wParam, LPARAM lParam) // TEST GET NAME FOR CACHE TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH], newcachepath[MAX_PATH + 50]; - GetModuleFileName(hInst, cachepath, SIZEOF(cachepath)); + GetModuleFileName(hInst, cachepath, _countof(cachepath)); TCHAR *cacheend = _tcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath); + mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\"), cachepath); CreateDirectory(cachedirectorypath, NULL); - mir_sntprintf(newcachepath, SIZEOF(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, contactName); + mir_sntprintf(newcachepath, _countof(newcachepath), _T("%s")_T(MODULENAME)_T("cache\\%s.txt"), cachepath, contactName); // file exists? if ( _taccess(newcachepath, 0) != -1) { FILE *pcachefile = _tfopen(newcachepath, _T("r")); @@ -144,12 +144,12 @@ INT_PTR OpenCacheDir(WPARAM, LPARAM) { //GET NAME FOR CACHE TCHAR cachepath[MAX_PATH], cachedirectorypath[MAX_PATH]; - GetModuleFileName(hInst, cachepath, SIZEOF(cachepath)); + GetModuleFileName(hInst, cachepath, _countof(cachepath)); TCHAR *cacheend = _tcsrchr(cachepath, '\\'); cacheend++; *cacheend = '\0'; - mir_sntprintf(cachedirectorypath, SIZEOF(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend); + mir_sntprintf(cachedirectorypath, _countof(cachedirectorypath), _T("%s")_T(MODULENAME)_T("cache\\%s"), cachepath, cacheend); if( _taccess(cachedirectorypath, 0) != 0) WErrorPopup((MCONTACT)"ERROR", TranslateT("Cache folder does not exist.")); @@ -172,7 +172,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam) return 0; TCHAR Cnick[200], *Oldnick; - _tcsncpy(Cnick, url, SIZEOF(Cnick)); + _tcsncpy(Cnick, url, _countof(Cnick)); if ((Oldnick = _tcsstr(Cnick, _T("://"))) != 0) Oldnick += 3; else @@ -324,7 +324,7 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) if (searchId != -1) return 0; // only one search at a time - mir_tstrncpy(sID, (TCHAR*)lParam, SIZEOF(sID)); + mir_tstrncpy(sID, (TCHAR*)lParam, _countof(sID)); searchId = 1; // create a thread for the ID search @@ -380,7 +380,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) //Convert url into a name for contact TCHAR Cnick[255]; if (psr->nick.t != NULL) - _tcsncpy(Cnick, psr->nick.t, SIZEOF(Cnick)); + _tcsncpy(Cnick, psr->nick.t, _countof(Cnick)); else Cnick[0] = 0; |