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_nicer/src/CLUIFrames/cluiframes.cpp | 4 ++-- plugins/Clist_nicer/src/Docking.cpp | 16 ++++++++-------- plugins/Clist_nicer/src/alphablend.cpp | 2 +- plugins/Clist_nicer/src/clcitems.cpp | 10 +++++----- plugins/Clist_nicer/src/clcutils.cpp | 2 +- plugins/Clist_nicer/src/clistevents.cpp | 2 +- plugins/Clist_nicer/src/config.cpp | 2 +- plugins/Clist_nicer/src/extBackg.cpp | 20 ++++++++++---------- plugins/Clist_nicer/src/init.cpp | 4 ++-- plugins/Clist_nicer/src/viewmodes.cpp | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) (limited to 'plugins/Clist_nicer/src') diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index bc80f1ea3c..dfdce7c9a9 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -1551,7 +1551,7 @@ static int UpdateTBToolTip(int framepos) { TOOLINFO ti; - ZeroMemory(&ti, sizeof(ti)); + memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.lpszText = Frames[framepos].TitleBar.tooltip; ti.hinst = g_hInst; @@ -1736,7 +1736,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) if (Frames == NULL) { Frames = (FRAMEWND*)malloc(sizeof(FRAMEWND) * (MAX_FRAMES + 2)); - ZeroMemory(Frames, sizeof(FRAMEWND) * (MAX_FRAMES + 2)); + memset(Frames, 0, (sizeof(FRAMEWND) * (MAX_FRAMES + 2))); } memset(&Frames[nFramescount], 0, sizeof(FRAMEWND)); diff --git a/plugins/Clist_nicer/src/Docking.cpp b/plugins/Clist_nicer/src/Docking.cpp index c96e13b1e0..62e92dd013 100644 --- a/plugins/Clist_nicer/src/Docking.cpp +++ b/plugins/Clist_nicer/src/Docking.cpp @@ -66,7 +66,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 = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT; @@ -111,7 +111,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) docked = (int) (char) cfg::getByte("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; @@ -124,13 +124,13 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) } break; case WM_ACTIVATE: - ZeroMemory(&abd, sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_ACTIVATE, &abd); return 0; case WM_WINDOWPOSCHANGED: - ZeroMemory(&abd, sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; SHAppBarMessage(ABM_WINDOWPOSCHANGED, &abd); @@ -155,7 +155,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) TranslateT("Contact list docking"), MB_OK); return 0; } - ZeroMemory(&abd, sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; abd.lParam = 0; @@ -198,7 +198,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) return 0; if ((msg->wParam && docked < 0) || (!msg->wParam && docked > 0)) docked = -docked; - ZeroMemory(&abd, sizeof(abd)); + memset(&abd, 0, sizeof(abd)); abd.cbSize = sizeof(abd); abd.hWnd = msg->hwnd; if (msg->wParam) { @@ -246,7 +246,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) if (((docked == DOCKED_LEFT || docked == -DOCKED_LEFT) && (short) LOWORD(msg->lParam) > rc.right) || ((docked == DOCKED_RIGHT || docked == -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); @@ -272,7 +272,7 @@ int Docking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam) return TRUE; case WM_DESTROY: if (docked > 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_nicer/src/alphablend.cpp b/plugins/Clist_nicer/src/alphablend.cpp index 3be597cf6c..b7e9d2e304 100644 --- a/plugins/Clist_nicer/src/alphablend.cpp +++ b/plugins/Clist_nicer/src/alphablend.cpp @@ -210,7 +210,7 @@ void DrawAlpha(HDC hdcwnd, PRECT rc, DWORD basecolor, int alpha, DWORD basecolor if ( !hdc) return; - ZeroMemory(&bmi, sizeof(BITMAPINFO)); + memset(&bmi, 0, sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 94de708bef..2edc82614f 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -32,7 +32,7 @@ ClcContact* CreateClcContact( void ) { ClcContact* p = (ClcContact*)mir_alloc( sizeof( ClcContact )); if ( p != NULL ) { - ZeroMemory(p, sizeof(ClcContact)); + memset(p, 0, sizeof(ClcContact)); p->avatarLeft = p->extraIconRightBegin = p->xStatusIcon = -1; } return p; @@ -160,7 +160,7 @@ void RebuildEntireList(HWND hwnd, struct ClcData *dat) for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { if (style & CLS_SHOWHIDDEN || !CLVM_GetContactHiddenStatus(hContact, NULL, dat)) { - ZeroMemory((void *)&dbv, sizeof(dbv)); + memset(&dbv, 0, sizeof(dbv)); if (cfg::getTString(hContact, "CList", "Group", &dbv)) group = &dat->list; else { @@ -290,7 +290,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (p->bStatusMsgValid != STATUSMSG_NOTFOUND) { WORD infoTypeC2[12]; - ZeroMemory(infoTypeC2, sizeof(WORD) * 12); + memset(infoTypeC2, 0, sizeof(infoTypeC2)); int iLen = min(mir_wstrlen(p->statusMsg), 10); GetStringTypeW(CT_CTYPE2, p->statusMsg, iLen, infoTypeC2); p->dwCFlags &= ~ECF_RTLSTATUSMSG; @@ -350,7 +350,7 @@ void RTL_DetectAndSet(ClcContact *contact, MCONTACT hContact) DWORD iLen; TExtraCache *p; - ZeroMemory(infoTypeC2, sizeof(WORD) * 12); + memset(infoTypeC2, 0, sizeof(infoTypeC2)); if (contact == NULL) { szText = pcli->pfnGetContactDisplayName(hContact, 0); @@ -425,7 +425,7 @@ void LoadSkinItemToCache(TExtraCache *cEntry, const char *szProto) if (cfg::getByte(hContact, "EXTBK", "VALID", 0)) { if (cEntry->status_item == NULL) cEntry->status_item = reinterpret_cast(malloc(sizeof(StatusItems_t))); - ZeroMemory(cEntry->status_item, sizeof(StatusItems_t)); + memset(cEntry->status_item, 0, sizeof(StatusItems_t)); strcpy(cEntry->status_item->szName, "{--CONTACT--}"); // mark as "per contact" item cEntry->status_item->IGNORED = 0; diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index cbbc46ce79..3b0019626c 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -523,7 +523,7 @@ void BeginRenameSelection(HWND hwnd, struct ClcData *dat) { if ((contact->type == CLCIT_CONTACT && contact->pExtra->dwCFlags & ECF_RTLNICK) || (contact->type == CLCIT_GROUP && contact->isRtl)) { PARAFORMAT2 pf2; - ZeroMemory((void *)&pf2, sizeof(pf2)); + memset(&pf2, 0, sizeof(pf2)); pf2.cbSize = sizeof(pf2); pf2.dwMask = PFM_RTLPARA; pf2.wEffects = PFE_RTLPARA; diff --git a/plugins/Clist_nicer/src/clistevents.cpp b/plugins/Clist_nicer/src/clistevents.cpp index a06278dd20..bc6d99a40c 100644 --- a/plugins/Clist_nicer/src/clistevents.cpp +++ b/plugins/Clist_nicer/src/clistevents.cpp @@ -59,7 +59,7 @@ CListEvent* fnCreateEvent( void ) { CListEvent *p = reinterpret_cast(mir_alloc(sizeof(CListEvent))); if (p) - ZeroMemory(p, sizeof(CListEvent)); + memset(p, 0, sizeof(CListEvent)); return p; } diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 47f27e5623..5cda86fb36 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -228,7 +228,7 @@ void API::updateState() { BOOL result = FALSE; - ::ZeroMemory(&sysState, sizeof(TSysState)); + memset(&sysState, 0, sizeof(TSysState)); sysState.isThemed = IsThemeActive() ? true : false; diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 7344e6e6c6..318818105e 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -770,7 +770,7 @@ void IMG_ReadItem(const char *itemname, const char *szFileName) BOOL alloced = FALSE; char szDrive[MAX_PATH], szPath[MAX_PATH]; - ZeroMemory(&tmpItem, sizeof(ImageItem)); + memset(&tmpItem, 0, sizeof(ImageItem)); GetPrivateProfileStringA(itemname, "Glyph", "None", buffer, 500, szFileName); if (strcmp(buffer, "None")) { sscanf(buffer, "%d,%d,%d,%d", &tmpItem.glyphMetrics[0], &tmpItem.glyphMetrics[1], @@ -839,7 +839,7 @@ done_with_glyph: IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); - ZeroMemory(newItem, sizeof(ImageItem)); + memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; g_glyphItem = newItem; } @@ -852,7 +852,7 @@ done_with_glyph: ImageItem *pItem = g_ImageItems; newItem = reinterpret_cast(malloc(sizeof(ImageItem))); - ZeroMemory(newItem, sizeof(ImageItem)); + memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; if (g_ImageItems == NULL) @@ -879,7 +879,7 @@ done_with_glyph: COLORREF clr; newItem = reinterpret_cast(malloc(sizeof(ImageItem))); - ZeroMemory(newItem, sizeof(ImageItem)); + memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; g_CLUIImageItem = newItem; GetPrivateProfileStringA(itemname, "Colorkey", "e5e5e5", buffer, 500, szFileName); @@ -901,7 +901,7 @@ done_with_glyph: IMG_CreateItem(&tmpItem, szFinalName, hdc); if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) { newItem = reinterpret_cast(malloc(sizeof(ImageItem))); - ZeroMemory(newItem, sizeof(ImageItem)); + memset(newItem, 0, sizeof(ImageItem)); *newItem = tmpItem; p->imageItem = newItem; if (g_ImageItems == NULL) @@ -972,7 +972,7 @@ static void BTN_ReadItem(char *itemName, char *file) char szBuffer[1024]; ImageItem *imgItem = g_ImageItems; - ZeroMemory(&tmpItem, sizeof(tmpItem)); + memset(&tmpItem, 0, sizeof(tmpItem)); mir_snprintf(tmpItem.szName, sizeof(tmpItem.szName), "%s", &itemName[1]); tmpItem.width = GetPrivateProfileIntA(itemName, "Width", 16, file); tmpItem.height = GetPrivateProfileIntA(itemName, "Height", 16, file); @@ -1149,7 +1149,7 @@ static void BTN_ReadItem(char *itemName, char *file) // create it newItem = (ButtonItem *)malloc(sizeof(ButtonItem)); - ZeroMemory(newItem, sizeof(ButtonItem)); + memset(newItem, 0, sizeof(ButtonItem)); if (g_ButtonItems == NULL) { g_ButtonItems = newItem; *newItem = tmpItem; @@ -1197,7 +1197,7 @@ void IMG_LoadItems() IMG_DeleteItems(); char *szSections = reinterpret_cast(malloc(3002)); - ZeroMemory(szSections, 3002); + memset(szSections, 0, 3002); GetPrivateProfileSectionNamesA(szSections, 3000, szFileName); szSections[3001] = szSections[3000] = 0; @@ -1246,7 +1246,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) file[MAX_PATH - 1] = 0; ReadItem(&default_item, "%Default", file); - ZeroMemory(szSections, 3000); + memset(szSections, 0, 3000); p = szSections; GetPrivateProfileSectionNamesA(szSections, 3000, file); szSections[3001] = szSections[3000] = 0; @@ -1257,7 +1257,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) continue; } items = reinterpret_cast(realloc(items, i * sizeof(StatusItems_t))); - ZeroMemory(&items[i - 1], sizeof(StatusItems_t)); + memset(&items[i - 1], 0, sizeof(StatusItems_t)); this_item = &items[i - 1]; GetPrivateProfileStringA(p, "Proto", "", this_item->szName, 40, file); this_item->szName[39] = 0; diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index eebaf61c4f..d9b664c1ee 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -159,7 +159,7 @@ static int systemModulesLoaded(WPARAM wParam, LPARAM lParam) HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); cfg::dat.tabSRMM_Avail = ServiceExists("SRMsg_MOD/GetWindowFlags") ? TRUE : FALSE; - ZeroMemory((void *)overlayicons, sizeof(HICON) * 10); + memset(&overlayicons, 0, sizeof(overlayicons)); CLN_LoadAllIcons(1); return 0; @@ -181,7 +181,7 @@ extern "C" int __declspec(dllexport) CListInitialise() API::onInit(); RegisterCLUIFrameClasses(); - ZeroMemory((void *)&cfg::dat, sizeof(cfg::dat)); + memset(&cfg::dat, 0, sizeof(cfg::dat)); int iCount = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0); diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index b4a200fc46..4d8eb05820 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -1025,7 +1025,7 @@ void CreateViewModeFrame() RegisterClass(&wndclass); - ZeroMemory(&frame, sizeof(frame)); + memset(&frame, 0, sizeof(frame)); frame.cbSize = sizeof(frame); frame.tname = _T("View modes"); frame.TBtname = TranslateT("View modes"); -- cgit v1.2.3