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 --- .../src/ex_import/classExImContactBase.cpp | 14 +++++++------- .../src/ex_import/dlg_ExImOpenSaveFile.cpp | 13 +++++-------- plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 25 deletions(-) (limited to 'plugins/UserInfoEx/src/ex_import') diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp index bc44363ab4..5d34c90513 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactBase.cpp @@ -38,7 +38,7 @@ CExImContactBase::CExImContactBase() _pszAMPro = NULL; _pszUIDKey = NULL; _dbvUIDHash = NULL; - ZeroMemory(&_dbvUID, sizeof(DBVARIANT)); + memset(&_dbvUID, 0, sizeof(DBVARIANT)); _hContact = INVALID_CONTACT_ID; _isNewContact = FALSE; } @@ -60,7 +60,7 @@ CExImContactBase::~CExImContactBase() MIR_FREE(_pszAMPro); MIR_FREE(_pszUIDKey); db_free(&_dbvUID); - ZeroMemory(&_dbvUID, sizeof(DBVARIANT)); + memset(&_dbvUID, 0, sizeof(DBVARIANT)); } /** @@ -88,7 +88,7 @@ BYTE CExImContactBase::fromDB(MCONTACT hContact) MIR_FREE(_pszGroup); MIR_FREE(_pszUIDKey); db_free(&_dbvUID); - ZeroMemory(&_dbvUID, sizeof(DBVARIANT)); + memset(&_dbvUID, 0, sizeof(DBVARIANT)); // OWNER if (!_hContact) return TRUE; @@ -171,7 +171,7 @@ BYTE CExImContactBase::fromIni(LPSTR& row) MIR_FREE(_pszGroup); MIR_FREE(_pszUIDKey); db_free(&_dbvUID); - ZeroMemory(&_dbvUID, sizeof(DBVARIANT)); + memset(&_dbvUID, 0, sizeof(DBVARIANT)); _dbvUIDHash = 0; // read uid value @@ -303,7 +303,7 @@ void CExImContactBase::toIni(FILE* file, int modCount) // Proto loadet - GetContactName(hContact,pszProto,0) LPSTR pszCI = NULL; CONTACTINFO ci; - ZeroMemory(&ci, sizeof(ci)); + memset(&ci, 0, sizeof(ci)); ci.cbSize = sizeof(ci); ci.hContact = _hContact; @@ -438,7 +438,7 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) r = (LPSTR)mir_alloc((baselen + 8)); if (r == NULL) return NULL; - ZeroMemory((r + baselen), 8); + memset((r + baselen), 0, 8); ptr = r; if (bPrependType) { // Allways true. ptr[0] = 'n'; @@ -455,7 +455,7 @@ LPSTR CExImContactBase::uid2String(BYTE bPrependType) r = (LPSTR)mir_alloc(baselen); if (r == NULL) return NULL; - ZeroMemory(r, baselen); + memset(r, 0, baselen); ptr = r; if (bPrependType) { // XXX dead code. ptr[0] = 'n'; diff --git a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp index a809ad1a18..803afccde9 100644 --- a/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp +++ b/plugins/UserInfoEx/src/ex_import/dlg_ExImOpenSaveFile.cpp @@ -114,8 +114,6 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara // miranda button switch (tbb->idCommand) { case 41063: - ZeroMemory(szBtnText, sizeof(szBtnText)); - mir_tstrncpy(szBtnText, TranslateT("Miranda NG"), SIZEOF(szBtnText)); iString = SendMessage(hWnd, TB_ADDSTRING, NULL, (LPARAM)szBtnText); if (iString != -1) tbb->iString = iString; @@ -124,7 +122,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara if (hWndToolTip) { TOOLINFO ti; - ZeroMemory(&ti, sizeof(ti)); + memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.hwnd = hWnd; ti.lpszText = TranslateT("Shows Miranda's installation directory."); @@ -143,7 +141,7 @@ static LRESULT CALLBACK PlacesBarSubclassProc(HWND hWnd, UINT uMsg, WPARAM wPara if (hWndToolTip) { TOOLINFO ti; - ZeroMemory(&ti, sizeof(ti)); + memset(&ti, 0, sizeof(ti)); ti.cbSize = sizeof(ti); ti.hwnd = hWnd; ti.lpszText = TranslateT("Shows the directory with all your Miranda's profiles."); @@ -202,10 +200,9 @@ static UINT_PTR CALLBACK OpenSaveFileDialogHook(HWND hDlg, UINT uMsg, WPARAM wPa **/ static void GetInitialDir(LPSTR pszInitialDir) { - CHAR szRelative[MAX_PATH]; - - ZeroMemory(szRelative, sizeof(szRelative)); + char szRelative[MAX_PATH]; + szRelative[0] = 0; // is some standard path defined if (!db_get_static(0, MODNAME, "vCardPath", szRelative, SIZEOF(szRelative))) { if (!PathToAbsolute(szRelative, pszInitialDir)) @@ -248,7 +245,7 @@ static void SaveInitialDir(LPSTR pszInitialDir) **/ static void InitOpenFileNameStruct(OPENFILENAMEA *pofn, HWND hWndParent, LPCSTR pszTitle, LPCSTR pszFilter, LPSTR pszInitialDir, LPSTR pszFile) { - ZeroMemory(pofn, sizeof(OPENFILENAME)); + memset(pofn, 0, sizeof(OPENFILENAME)); pofn->hwndOwner = hWndParent; pofn->lpstrTitle = pszTitle; diff --git a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp index bd6011c4d2..ffc2423ca2 100644 --- a/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp +++ b/plugins/UserInfoEx/src/ex_import/svc_ExImport.cpp @@ -39,8 +39,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO LPSTR temp = 0; cchFileName--; - - ZeroMemory(pszFileName, cchFileName); + pszFileName[0] = 0; switch (ExImContact->Typ) { case EXIM_ALL: @@ -83,6 +82,7 @@ static void DisplayNameToFileName(lpExImParam ExImContact, LPSTR pszFileName, WO cchFileName--; } mir_free(temp); + pszFileName[0] = 0; } LPCSTR FilterString(lpExImParam ExImContact) @@ -210,7 +210,7 @@ if (ExImContact->Typ == EXIM_ACCOUNT || INT_PTR svcExIm_MainExport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&ExIm, 0, sizeof(ExIm)); ExIm.hContact = INVALID_CONTACT_ID; ExIm.Typ = EXIM_ALL; return SvcExImport_Export(&ExIm, (HWND)lParam); @@ -219,7 +219,7 @@ INT_PTR svcExIm_MainExport_Service(WPARAM wParam, LPARAM lParam) INT_PTR svcExIm_MainImport_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&ExIm, 0, sizeof(ExIm)); ExIm.hContact = INVALID_CONTACT_ID; ExIm.Typ = EXIM_ALL; return SvcExImport_Import(&ExIm, (HWND)lParam); @@ -232,7 +232,7 @@ INT_PTR svcExIm_MainImport_Service(WPARAM wParam, LPARAM lParam) INT_PTR svcExIm_ContactExport_Service(WPARAM hContact, LPARAM lParam) { ExImParam ExIm; - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&ExIm, 0, sizeof(ExIm)); ExIm.hContact = hContact; ExIm.Typ = EXIM_CONTACT; return SvcExImport_Export(&ExIm, (HWND)lParam); @@ -241,7 +241,7 @@ INT_PTR svcExIm_ContactExport_Service(WPARAM hContact, LPARAM lParam) INT_PTR svcExIm_ContactImport_Service(WPARAM hContact, LPARAM lParam) { ExImParam ExIm; - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&ExIm, 0, sizeof(ExIm)); ExIm.hContact = hContact; ExIm.Typ = EXIM_CONTACT; return SvcExImport_Import(&ExIm, (HWND)lParam); @@ -266,9 +266,9 @@ INT_PTR svcExIm_Group_Service(WPARAM wParam, LPARAM lParam) ExImParam ExIm; INT_PTR hItem = 0, hRoot = 0, hParent = 0; TCHAR tszGroup[120], tszItem[120]; - ZeroMemory(&tszGroup, sizeof(tszGroup)); - ZeroMemory(&tszItem, sizeof(tszItem)); - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&tszGroup, 0, sizeof(tszGroup)); + memset(&tszItem, 0, sizeof(tszItem)); + memset(&ExIm, 0, sizeof(ExIm)); LPTSTR ptszGroup = tszGroup; LPTSTR ptszItem = tszItem; @@ -329,7 +329,7 @@ typedef struct INT_PTR svcExIm_Account_Service(WPARAM wParam, LPARAM lParam) { ExImParam ExIm; - ZeroMemory(&ExIm, sizeof(ExIm)); + memset(&ExIm, 0, sizeof(ExIm)); HWND hClist = (HWND)CallService(MS_CLUI_GETHWNDTREE,0,0); lpStatusMenuExecParam smep = (lpStatusMenuExecParam) CallService(MO_MENUITEMGETOWNERDATA, (WPARAM) lParam, NULL); ExIm.pszName = mir_strdup(smep->proto); -- cgit v1.2.3