summaryrefslogtreecommitdiff
path: root/plugins/QuickReplies
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/QuickReplies
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/QuickReplies')
-rw-r--r--plugins/QuickReplies/src/events.cpp16
-rw-r--r--plugins/QuickReplies/src/options.cpp20
2 files changed, 18 insertions, 18 deletions
diff --git a/plugins/QuickReplies/src/events.cpp b/plugins/QuickReplies/src/events.cpp
index 67476f6f6a..8b45833498 100644
--- a/plugins/QuickReplies/src/events.cpp
+++ b/plugins/QuickReplies/src/events.cpp
@@ -52,8 +52,8 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
Icon_Register(hInstance, "TabSRMM/Quick Replies", &icon, 1);
char buttonNameTranslated[32], buttonName[32];
- mir_snprintf(buttonNameTranslated, SIZEOF(buttonNameTranslated), "%s %x", Translate("Button"), iNumber + 1);
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonNameTranslated, _countof(buttonNameTranslated), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
@@ -81,20 +81,20 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
LIST<wchar_t> replyList(1);
CustomButtonClickData *cbcd = (CustomButtonClickData *)lParam;
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
if (mir_strcmp(cbcd->pszModule, buttonName))
return 0;
if (cbcd->dwButtonId != iNumber)
return 1;
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_w(NULL, MODULE, key, 0);
{
if (count == 0 || cbcd->flags & BBCF_RIGHTBUTTON)
{
- mir_snprintf(buttonName, SIZEOF(buttonName), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), "%s %x", Translate("Button"), iNumber + 1);
OPENOPTIONSDIALOG ood = {0};
ood.cbSize = sizeof(ood);
@@ -109,7 +109,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
wchar_t *value = db_get_wsa(NULL, MODULE, key);
if (!value)
@@ -137,7 +137,7 @@ int OnButtonPressed(WPARAM wParam, LPARAM lParam)
SendMessage(hEdit, EM_REPLACESEL, TRUE, (LPARAM)replyList[index - 1]);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
if ((BYTE)db_get_b(NULL, MODULE, key, 1) || cbcd->flags & BBCF_CONTROLPRESSED)
SendMessage(cbcd->hwndFrom, WM_COMMAND, IDOK, 0);
}
@@ -156,7 +156,7 @@ int OnPreShutdown(WPARAM wParam, LPARAM lParam)
if (ServiceExists(MS_BB_REMOVEBUTTON))
{
char buttonName[32];
- mir_snprintf(buttonName, SIZEOF(buttonName), MODULE" %x", iNumber + 1);
+ mir_snprintf(buttonName, _countof(buttonName), MODULE" %x", iNumber + 1);
BBButton bbd = {0};
bbd.cbSize = sizeof(BBButton);
diff --git a/plugins/QuickReplies/src/options.cpp b/plugins/QuickReplies/src/options.cpp
index 75e177ab93..3b773487fc 100644
--- a/plugins/QuickReplies/src/options.cpp
+++ b/plugins/QuickReplies/src/options.cpp
@@ -43,7 +43,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd,UINT msg,WPARAM wParam
SendMessage(hwnd, EM_GETSEL, (WPARAM) & end, (LPARAM) (PDWORD) NULL);
SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);
SendMessage(hwnd, EM_GETSEL, (WPARAM) & start, (LPARAM) (PDWORD) NULL);
- GetWindowText(hwnd, text, SIZEOF(text));
+ GetWindowText(hwnd, text, _countof(text));
memmove(text + start, text + end, sizeof(WCHAR) * (mir_wstrlen(text) + 1 - end));
SetWindowText(hwnd, text);
SendMessage(hwnd, EM_SETSEL, start, start);
@@ -71,15 +71,15 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
mir_subclassWindow(GetDlgItem(hwndDlg, IDC_REPLIES), MessageEditSubclassProc);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
CheckDlgButton(hwndDlg, IDC_IMMEDIATELY, db_get_w(NULL, MODULE, key, 1) ? BST_CHECKED : BST_UNCHECKED);
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_w(NULL, MODULE, key, 0);
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
wchar_t *value = db_get_wsa(NULL, MODULE, key);
if (value)
{
@@ -117,12 +117,12 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int count = 0;
wchar_t *tszReplies;
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
count = db_get_b(NULL, MODULE, key, 0);
for (int i = 0; i < count; i++)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, i);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, i);
db_unset(NULL, MODULE, key);
}
@@ -139,17 +139,17 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int pos = -1, prev = 0;
while ((pos = replies.Find(_T("\r\n"), prev)) != -1)
{
- mir_snprintf(key, SIZEOF(key), "Reply_%x_%x", iNumber, count++);
+ mir_snprintf(key, _countof(key), "Reply_%x_%x", iNumber, count++);
db_set_ws(NULL, MODULE, key, replies.Mid(prev, pos - prev).GetBuffer());
prev = pos + 2;
}
}
mir_free(tszReplies);
- mir_snprintf(key, SIZEOF(key), "RepliesCount_%x", iNumber);
+ mir_snprintf(key, _countof(key), "RepliesCount_%x", iNumber);
db_set_w(NULL, MODULE, key, count);
- mir_snprintf(key, SIZEOF(key), "ImmediatelySend_%x", iNumber);
+ mir_snprintf(key, _countof(key), "ImmediatelySend_%x", iNumber);
db_set_b(NULL, MODULE, key, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IMMEDIATELY));
return TRUE;
@@ -169,7 +169,7 @@ INT_PTR CALLBACK DlgProcOptionsPage(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR
int OnOptInitialized(WPARAM wParam, LPARAM lParam)
{
char tabName[32];
- mir_snprintf(tabName, SIZEOF(tabName), "%s %x", Translate("Button"), iNumber + 1);
+ mir_snprintf(tabName, _countof(tabName), "%s %x", Translate("Button"), iNumber + 1);
OPTIONSDIALOGPAGE odp = { 0 };
odp.pszGroup = LPGEN("Message sessions");