From b2fad485cd5b41744ef0cc4a02722c021afd926c Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Mon, 1 Dec 2014 00:07:01 +0000 Subject: ZeroMemory -> memset, few bugs fised git-svn-id: http://svn.miranda-ng.org/main/trunk@11184 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/modern_clcpaint.cpp | 12 +++++----- plugins/Clist_modern/src/modern_docking.cpp | 27 ++++++++++++---------- plugins/Clist_modern/src/modern_image_array.cpp | 2 +- plugins/Clist_modern/src/modern_row.cpp | 6 ++--- plugins/Clist_modern/src/modern_rowtemplateopt.cpp | 6 ++--- plugins/Clist_modern/src/modern_skinbutton.cpp | 6 ++--- 6 files changed, 31 insertions(+), 28 deletions(-) (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 441afca9d5..2149b965d5 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1888,12 +1888,12 @@ void CLCPaint::_DrawLines( HWND hWnd, ClcData *dat, HDC hdc, int paintMode, RECT // Store pos Drawing->pos_indent = free_row_rc.left; - ZeroMemory( &Drawing->pos_check, sizeof( Drawing->pos_check )); - ZeroMemory( &Drawing->pos_avatar, sizeof( Drawing->pos_avatar )); - ZeroMemory( &Drawing->pos_icon, sizeof( Drawing->pos_icon )); - ZeroMemory( &Drawing->pos_label, sizeof( Drawing->pos_label )); - ZeroMemory( &Drawing->pos_rename_rect, sizeof( Drawing->pos_rename_rect )); - ZeroMemory( &Drawing->pos_extra, sizeof( Drawing->pos_extra )); + memset(&Drawing->pos_check, 0, sizeof(Drawing->pos_check)); + memset(&Drawing->pos_avatar, 0, sizeof(Drawing->pos_avatar)); + memset(&Drawing->pos_icon, 0, sizeof(Drawing->pos_icon)); + memset(&Drawing->pos_label, 0, sizeof(Drawing->pos_label)); + memset(&Drawing->pos_rename_rect, 0, sizeof(Drawing->pos_rename_rect)); + memset(&Drawing->pos_extra, 0, sizeof(Drawing->pos_extra)); //**** Draw Background diff --git a/plugins/Clist_modern/src/modern_docking.cpp b/plugins/Clist_modern/src/modern_docking.cpp index 32aac83df5..5f61fb4cd4 100644 --- a/plugins/Clist_modern/src/modern_docking.cpp +++ b/plugins/Clist_modern/src/modern_docking.cpp @@ -74,7 +74,7 @@ static void Docking_AdjustPosition(HWND hwnd,RECT *rcDisplay,RECT *rc) { APPBARDATA abd; - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = hwnd; abd.uEdge = g_CluiData.fDocked == DOCKED_LEFT?ABE_LEFT:ABE_RIGHT; @@ -124,7 +124,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) g_CluiData.fDocked = (BOOL)db_get_b(NULL,"CList","Docked",0); if (IsWindowVisible(msg->hwnd) && !IsIconic(msg->hwnd)) { RECT rc, rcMonitor; - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; abd.lParam = 0; @@ -144,7 +144,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) ModernSkinButton_ReposButtons(msg->hwnd, SBRF_DO_NOT_DRAW,NULL); return 0; case WM_ACTIVATE: - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_ACTIVATE,&abd); @@ -155,9 +155,10 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) case WM_WINDOWPOSCHANGED: { - if (g_CluiData.fDocked) ModernSkinButton_ReposButtons( msg->hwnd,SBRF_DO_NOT_DRAW, NULL ); - return 0; - ZeroMemory(&abd,sizeof(abd)); + if (g_CluiData.fDocked) + ModernSkinButton_ReposButtons( msg->hwnd,SBRF_DO_NOT_DRAW, NULL ); + return 0; // XXX: check me!!! + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_WINDOWPOSCHANGED,&abd); @@ -186,7 +187,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) || (ptCursor.x >= rcMonitor.right-EDGESENSITIVITY)) && db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT)) { - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; abd.lParam = 0; @@ -255,10 +256,12 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) } case WM_SHOWWINDOW: { - if (msg->lParam) return 0; + if (msg->lParam) + return 0; BOOL toBeDocked = (BOOL)db_get_b(NULL,"CLUI","DockToSides",SETTING_DOCKTOSIDES_DEFAULT); - if ((msg->wParam && g_CluiData.fDocked < 0) || (!msg->wParam && g_CluiData.fDocked>0)) g_CluiData.fDocked = -g_CluiData.fDocked; - ZeroMemory(&abd,sizeof(abd)); + if ((msg->wParam && g_CluiData.fDocked < 0) || (!msg->wParam && g_CluiData.fDocked>0)) + g_CluiData.fDocked = -g_CluiData.fDocked; + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; if (msg->wParam) { @@ -306,7 +309,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) ((g_CluiData.fDocked == DOCKED_RIGHT || g_CluiData.fDocked == -DOCKED_RIGHT) && (short)LOWORD(msg->lParam) < 0)) { ReleaseCapture(); draggingTitle = 0; - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_REMOVE,&abd); @@ -345,7 +348,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) return TRUE; case WM_DESTROY: if (g_CluiData.fDocked>0) { - ZeroMemory(&abd,sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_REMOVE,&abd); diff --git a/plugins/Clist_modern/src/modern_image_array.cpp b/plugins/Clist_modern/src/modern_image_array.cpp index 5854bcdf0b..8f26cf3c77 100644 --- a/plugins/Clist_modern/src/modern_image_array.cpp +++ b/plugins/Clist_modern/src/modern_image_array.cpp @@ -72,7 +72,7 @@ static BOOL ImageArray_Alloc(LP_IMAGE_ARRAY_DATA iad, int size) return FALSE; } - ZeroMemory(iad->nodes, sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow); + memset(iad->nodes, 0, (sizeof(IMAGE_ARRAY_DATA_NODE) * size_grow)); } iad->nodes_allocated_size = size_grow; diff --git a/plugins/Clist_modern/src/modern_row.cpp b/plugins/Clist_modern/src/modern_row.cpp index a6bac28ed0..cbcb0265ef 100644 --- a/plugins/Clist_modern/src/modern_row.cpp +++ b/plugins/Clist_modern/src/modern_row.cpp @@ -79,7 +79,7 @@ ROWCELL *cppInitModernRow(ROWCELL ** tabAccess) { fsize = _filelength(_fileno(hFile)); tmplbuf = (char*)malloc(fsize+1); - ZeroMemory(tmplbuf, fsize+1); + memset(tmplbuf, 0, (fsize + 1)); for (i=0; i < fsize; i++) tmplbuf[i] = getc(hFile); tmplbuf[i] = 0; @@ -126,7 +126,7 @@ void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width) const ROWCELL * rowAddCell(ROWCELL* &link, int cont) { link = (ROWCELL*)malloc(sizeof(ROWCELL)); - ZeroMemory(link, sizeof(ROWCELL)); + memset(link, 0, sizeof(ROWCELL)); link->cont = cont; return link; } @@ -165,7 +165,7 @@ char * rowParserGetNextWord(char *tbuf, int &hbuf) int j = -1; - ZeroMemory(buf, 256); + memset(buf, 0, sizeof(buf)); while(tbuf[hbuf] != 0) { diff --git a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp index 5d5f3740ad..97be36e25a 100644 --- a/plugins/Clist_modern/src/modern_rowtemplateopt.cpp +++ b/plugins/Clist_modern/src/modern_rowtemplateopt.cpp @@ -225,7 +225,7 @@ void rowOptAddContainer(HWND htree, HTREEITEM hti) TreeView_SetItem(htree, &tviparent); int i=0; - ZeroMemory( rowOptTA, sizeof( rowOptTA )); + memset(rowOptTA, 0, sizeof(rowOptTA)); rowOptBuildTA(rowOptTmplRoot, (pROWCELL*)&rowOptTA, &i); } @@ -273,7 +273,7 @@ void rowOptDelContainer(HWND htree, HTREEITEM hti) { int i=0; - ZeroMemory( rowOptTA, sizeof( rowOptTA )); + memset(rowOptTA, 0, sizeof(rowOptTA)); rowOptBuildTA((pROWCELL)tvpi.lParam, (pROWCELL*)&rowOptTA, &i ); } @@ -383,7 +383,7 @@ INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM rowOptTmplRoot = NULL; rowParse(rowOptTmplRoot, rowOptTmplRoot, rowOptTmplStr, hbuf, seq, rowOptTA); seq = 0; - ZeroMemory( rowOptTA, sizeof( rowOptTA )); + memset(rowOptTA, 0, sizeof(rowOptTA)); rowOptBuildTA(rowOptTmplRoot, (pROWCELL*)&rowOptTA, &seq); rowOptFillRowTree(htree); diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index a340a544e2..51d9b64ef7 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -72,7 +72,7 @@ static HWND hwndToolTips = NULL; int ModernSkinButtonLoadModule() { WNDCLASSEX wc; - ZeroMemory(&wc, sizeof(wc)); + memset(&wc, 0, sizeof(wc)); wc.cbSize = sizeof(wc); wc.lpszClassName = _T(MODERNSKINBUTTONCLASS); wc.lpfnWndProc = ModernSkinButtonWndProc; @@ -384,7 +384,7 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM EnterCriticalSection(&csTips); if (hwndToolTips) { TOOLINFO ti; - ZeroMemory(&ti, sizeof(ti)); + memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND; ti.hwnd = bct->hwnd; @@ -505,7 +505,7 @@ HWND SetToolTip(HWND hwnd, TCHAR * tip) SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); } - ZeroMemory(&ti, sizeof(ti)); + memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND; ti.hwnd = hwnd; -- cgit v1.2.3