summaryrefslogtreecommitdiff
path: root/plugins/SendScreenshotPlus/src
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/SendScreenshotPlus/src
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/SendScreenshotPlus/src')
-rw-r--r--plugins/SendScreenshotPlus/src/CSend.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/UAboutForm.cpp2
-rw-r--r--plugins/SendScreenshotPlus/src/UMainForm.cpp18
-rw-r--r--plugins/SendScreenshotPlus/src/ctrl_button.cpp6
-rw-r--r--plugins/SendScreenshotPlus/src/dlg_msgbox.cpp10
5 files changed, 21 insertions, 21 deletions
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp
index 60a9880d06..8ab4a7063d 100644
--- a/plugins/SendScreenshotPlus/src/CSend.cpp
+++ b/plugins/SendScreenshotPlus/src/CSend.cpp
@@ -166,7 +166,7 @@ INT_PTR CALLBACK CSend::ResultDialogProc(HWND hwndDlg,UINT uMsg,WPARAM wParam,LP
memcpy(tmp+len,_T("[/img][/url]"),13*sizeof(TCHAR)); len+=12;
}
}else
- len=GetDlgItemText(hwndDlg,edtID,tmp,SIZEOF(tmp));
+ len=GetDlgItemText(hwndDlg,edtID,tmp,_countof(tmp));
int retries=3;
do{
if(!OpenClipboard(hwndDlg)){
@@ -382,12 +382,12 @@ void CSend::DB_EventAdd(WORD EventType)
void CSend::Error(LPCTSTR pszFormat, ...) {
TCHAR tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszMsg, SIZEOF(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
+ mir_sntprintf(tszMsg, _countof(tszMsg),_T("%s - %s") ,_T(SZ_SENDSS), TranslateT("Error"));
mir_free(m_ErrorTitle), m_ErrorTitle = mir_tstrdup(tszMsg);
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
mir_free(m_ErrorMsg), m_ErrorMsg = mir_tstrdup(tszMsg);
diff --git a/plugins/SendScreenshotPlus/src/UAboutForm.cpp b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
index 19981fe00b..8e0eb9e5ef 100644
--- a/plugins/SendScreenshotPlus/src/UAboutForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UAboutForm.cpp
@@ -199,7 +199,7 @@ void TfrmAbout::btnPageClick() {
TCHAR newTitle[128];
TCHAR* pszPlug = mir_a2t(__PLUGIN_NAME);
TCHAR* pszVer = mir_a2t(__VERSION_STRING_DOTS);
- mir_sntprintf(newTitle,SIZEOF(newTitle), _T("%s - %s\nv%s"), pszPlug, title , pszVer);
+ mir_sntprintf(newTitle,_countof(newTitle), _T("%s - %s\nv%s"), pszPlug, title , pszVer);
mir_free(pszPlug);
mir_free(pszVer);
SetDlgItemText(m_hWnd, IDC_HEADERBAR, newTitle);
diff --git a/plugins/SendScreenshotPlus/src/UMainForm.cpp b/plugins/SendScreenshotPlus/src/UMainForm.cpp
index 407a953d9a..23a20bc874 100644
--- a/plugins/SendScreenshotPlus/src/UMainForm.cpp
+++ b/plugins/SendScreenshotPlus/src/UMainForm.cpp
@@ -68,7 +68,7 @@ INT_PTR CALLBACK TfrmMain::DlgProc_CaptureTabPage(HWND hDlg, UINT uMsg, WPARAM w
if(HIWORD(wParam)==BN_CLICKED && LOWORD(wParam)==ID_btnExplore){ /// local file tab
OPENFILENAME ofn={sizeof(OPENFILENAME)};
TCHAR filename[MAX_PATH];
- GetDlgItemText(hDlg,ID_edtSize,filename,SIZEOF(filename));
+ GetDlgItemText(hDlg,ID_edtSize,filename,_countof(filename));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hDlg;
ofn.lpstrFilter = _T("Images\0*.png;*.jpg;*.jpeg;*.bmp;*.gif;*.tif;*.tiff\0");
@@ -235,7 +235,7 @@ void TfrmMain::wmInitdialog(WPARAM wParam, LPARAM lParam) {
if(m_MonitorCount >1) {
TCHAR tszTemp[120];
for(size_t mon=0; mon<m_MonitorCount; ++mon) { /// @todo : fix format for non MSVC compilers
- mir_sntprintf(tszTemp, SIZEOF(tszTemp),_T("%Iu. %s%s"),
+ mir_sntprintf(tszTemp, _countof(tszTemp),_T("%Iu. %s%s"),
mon+1, TranslateT("Monitor"),
(m_Monitors[mon].dwFlags & MONITORINFOF_PRIMARY) ? TranslateT(" (primary)") : _T("")
);
@@ -775,7 +775,7 @@ void TfrmMain::btnCaptureClick() {
if(m_opt_tabCapture==1) m_hTargetWindow=GetDesktopWindow();
else if(m_opt_tabCapture==2){
TCHAR filename[MAX_PATH];
- GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, SIZEOF(filename));
+ GetDlgItemText(m_hwndTabPage, ID_edtSize, filename, _countof(filename));
FILE* fp=_wfopen(filename,_T("rb"));
if(!fp){
TCHAR *err = TranslateT("Select a file");
@@ -910,8 +910,8 @@ void TfrmMain::edtSizeUpdate(HWND hWnd, BOOL ClientArea, HWND hTarget, UINT Ctrl
_itot(rect.right - rect.left, B, 10);
// _itot_s(rect.bottom - rect.top, H, 16, 10);
_itot(rect.bottom - rect.top, H, 10);
- mir_tstrncat(B, _T("x"), SIZEOF(B) - mir_tstrlen(B));
- mir_tstrncat(B, H, SIZEOF(B) - mir_tstrlen(B));
+ mir_tstrncat(B, _T("x"), _countof(B) - mir_tstrlen(B));
+ mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B));
SetDlgItemText(hTarget, Ctrl, B);
}
@@ -921,8 +921,8 @@ void TfrmMain::edtSizeUpdate(RECT rect, HWND hTarget, UINT Ctrl) {
_itot(ABS(rect.right - rect.left), B, 10);
// _itot_s(ABS(rect.bottom - rect.top), H, 16, 10);
_itot(ABS(rect.bottom - rect.top), H, 10);
- mir_tstrncat(B, _T("x"), SIZEOF(B) - mir_tstrlen(B));
- mir_tstrncat(B, H, SIZEOF(B) - mir_tstrlen(B));
+ mir_tstrncat(B, _T("x"), _countof(B) - mir_tstrlen(B));
+ mir_tstrncat(B, H, _countof(B) - mir_tstrlen(B));
SetDlgItemText(hTarget, Ctrl, B);
}
@@ -953,7 +953,7 @@ INT_PTR TfrmMain::SaveScreenshot(FIBITMAP* dib) {
mir_tstradd(pszFileDesc, TranslateT("for Client area "));
}
mir_tstradd(pszFileDesc, TranslateT("of \""));
- GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, SIZEOF(winText));
+ GetDlgItemText(m_hwndTabPage, ID_edtCaption, winText, _countof(winText));
mir_tstradd(pszFileDesc, winText);
if(m_opt_tabCapture==1)
mir_tstradd(pszFileDesc, _T("\""));
@@ -1105,7 +1105,7 @@ void TfrmMain::FormClose() {
bool bCanDelete=m_opt_btnDeleteAfterSend;
if(m_opt_tabCapture==2){ /// existing file
TCHAR description[1024];
- GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, SIZEOF(description));
+ GetDlgItemText(m_hwndTabPage, ID_edtCaption, description, _countof(description));
if(!IsWindowEnabled(GetDlgItem(m_hWnd,ID_chkDesc)) || !m_opt_btnDesc)
*description='\0';
if(m_cSend) {
diff --git a/plugins/SendScreenshotPlus/src/ctrl_button.cpp b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
index 5a6911d71b..4a217d2430 100644
--- a/plugins/SendScreenshotPlus/src/ctrl_button.cpp
+++ b/plugins/SendScreenshotPlus/src/ctrl_button.cpp
@@ -192,7 +192,7 @@ static void __fastcall PaintThemeButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClien
RECT sizeText;
HFONT hOldFont;
- ccText = GetWindowTextW(ctl->hwnd, wszText, SIZEOF(wszText));
+ ccText = GetWindowTextW(ctl->hwnd, wszText, _countof(wszText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -301,7 +301,7 @@ static void __fastcall PaintButton(BTNCTRL *ctl, HDC hdcMem, LPRECT rcClient)
SIZE sizeText;
HFONT hOldFont;
- ccText = GetWindowText(ctl->hwnd, szText, SIZEOF(szText));
+ ccText = GetWindowText(ctl->hwnd, szText, _countof(szText));
if (ccText > 0) {
hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
@@ -548,7 +548,7 @@ static LRESULT CALLBACK Button_WndProc(HWND hwndBtn, UINT uMsg, WPARAM wParam, L
case BUTTONTRANSLATE:
{
TCHAR szButton[MAX_PATH];
- GetWindowText(bct->hwnd, szButton, SIZEOF(szButton));
+ GetWindowText(bct->hwnd, szButton, _countof(szButton));
SetWindowText(bct->hwnd, TranslateTS(szButton));
}
break;
diff --git a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
index 9fc6ec2705..82ff842cdb 100644
--- a/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
+++ b/plugins/SendScreenshotPlus/src/dlg_msgbox.cpp
@@ -511,8 +511,8 @@ static INT_PTR CALLBACK MsgBoxPop(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lP
pd.lchContact = NULL; //(HANDLE)wParam;
// icon
pd.lchIcon = MsgLoadIcon(pMsgBox);
- mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, SIZEOF(pd.lptzContactName));
- mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, pMsgBox->ptszTitle, _countof(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, pMsgBox->ptszMsg, _countof(pd.lptzText));
// CALLBAC Proc
pd.PluginWindowProc = PopupProc;
@@ -680,7 +680,7 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = { 0 };
@@ -703,11 +703,11 @@ INT_PTR CALLBACK MsgBox(HWND hParent, UINT uType, LPCTSTR pszTitle, LPCTSTR pszI
INT_PTR CALLBACK MsgErr(HWND hParent, LPCTSTR pszFormat, ...)
{
TCHAR tszTitle[MAX_SECONDLINE], tszMsg[MAX_SECONDLINE];
- mir_sntprintf(tszTitle, SIZEOF(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
+ mir_sntprintf(tszTitle, _countof(tszMsg), _T("%s - %s"), _T(MODNAME), TranslateT("Error"));
va_list vl;
va_start(vl, pszFormat);
- mir_vsntprintf(tszMsg, SIZEOF(tszMsg), TranslateTS(pszFormat), vl);
+ mir_vsntprintf(tszMsg, _countof(tszMsg), TranslateTS(pszFormat), vl);
va_end(vl);
MSGBOX mb = {0};