From e3c1a6d3c8ca609923a87635d208472db2e384e6 Mon Sep 17 00:00:00 2001 From: Rozhuk Ivan Date: Sat, 13 Dec 2014 11:59:42 +0000 Subject: memmove -> memcpy in some cases, review req git-svn-id: http://svn.miranda-ng.org/main/trunk@11367 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MRA/src/MraAvatars.cpp | 4 ++-- protocols/MRA/src/MraFilesQueue.cpp | 14 +++++++------- protocols/MRA/src/MraMRIMProxy.cpp | 2 +- protocols/MRA/src/MraRTFMsg.cpp | 8 ++++---- protocols/MRA/src/Mra_functions.cpp | 14 +++++++------- 5 files changed, 21 insertions(+), 21 deletions(-) (limited to 'protocols/MRA') diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 0ddab4b217..2e92bd31d6 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -458,7 +458,7 @@ bool CMraProto::MraAvatarsGetContactTime(MCONTACT hContact, LPSTR lpszValueName, CMStringA szBuff; if (mraGetStringA(hContact, lpszValueName, szBuff)) if (InternetTimeGetTime(szBuff, itAvatarLastModifiedTimeLocal) == NO_ERROR) { - memmove(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); + memcpy(pstTime, &itAvatarLastModifiedTimeLocal.stTime, sizeof(SYSTEMTIME)); return true; } } @@ -474,7 +474,7 @@ void CMraProto::MraAvatarsSetContactTime(MCONTACT hContact, LPSTR lpszValueName, INTERNET_TIME itTime; if (pstTime) { itTime.lTimeZone = 0; - memmove(&itTime.stTime, pstTime, sizeof(SYSTEMTIME)); + memcpy(&itTime.stTime, pstTime, sizeof(SYSTEMTIME)); } else InternetTimeGetCurrentTime(&itTime); diff --git a/protocols/MRA/src/MraFilesQueue.cpp b/protocols/MRA/src/MraFilesQueue.cpp index 10b0678a9b..69f78f5899 100644 --- a/protocols/MRA/src/MraFilesQueue.cpp +++ b/protocols/MRA/src/MraFilesQueue.cpp @@ -241,7 +241,7 @@ size_t CMraProto::MraFilesQueueGetLocalAddressesList(LPSTR lpszBuff, size_t dwBu dwSelfExternalIP = ntohl(getDword("IP", 0)); if (dwSelfExternalIP) { - memmove(&btAddress, &dwSelfExternalIP, sizeof(DWORD)); + memcpy(&btAddress, &dwSelfExternalIP, sizeof(DWORD)); lpszCurPos += mir_snprintf(lpszCurPos, (dwBuffSize - ((size_t)lpszCurPos - (size_t)lpszBuff)), "%lu.%lu.%lu.%lu:%lu;", btAddress[0], btAddress[1], btAddress[2], btAddress[3], dwPort); } @@ -277,7 +277,7 @@ DWORD CMraProto::MraFilesQueueAccept(HANDLE hFilesQueueHandle, DWORD dwIDRequest MRA_FILES_THREADPROC_PARAMS *pmftpp = (MRA_FILES_THREADPROC_PARAMS*)mir_calloc(sizeof(MRA_FILES_THREADPROC_PARAMS)); dat->lpwszPath = (LPWSTR)mir_calloc((dwPathSize*sizeof(WCHAR))); dat->dwPathSize = dwPathSize; - memmove(dat->lpwszPath, lpwszPath, (dwPathSize*sizeof(WCHAR))); + memcpy(dat->lpwszPath, lpwszPath, (dwPathSize*sizeof(WCHAR))); if ((*(WCHAR*)(dat->lpwszPath + (dat->dwPathSize - 1))) != '\\') {// add slash at the end if needed (*(WCHAR*)(dat->lpwszPath + dat->dwPathSize)) = '\\'; @@ -542,13 +542,13 @@ HANDLE CMraProto::MraFilesQueueConnectIn(MRA_FILES_QUEUE_ITEM *dat) ShowFormattedErrorMessage(L"Files exchange: cant create listen soscket, will try connect to remonte host. Error", GetLastError()); //dwAddrListSize = 0; - memmove(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); + memcpy(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); dwAddrListSize = (sizeof(MRA_FILES_NULL_ADDRR)-1); } } // подставляем ложный адрес, чтобы точно не подключились и не слушаем порт else { - memmove(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); + memcpy(szAddrList, MRA_FILES_NULL_ADDRR, sizeof(MRA_FILES_NULL_ADDRR)); dwAddrListSize = (sizeof(MRA_FILES_NULL_ADDRR)-1); } @@ -777,8 +777,8 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) //pfts.currentFileTime; //as seconds since 1970 if ((dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen) < SIZEOF(wszFileName)) { - memmove(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR))); - memmove((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR))); + memcpy(wszFileName, dat->lpwszPath, (dat->dwPathSize*sizeof(WCHAR))); + memcpy((wszFileName + dat->dwPathSize), dat->pmfqfFiles[i].lpwszName, ((dat->pmfqfFiles[i].dwNameLen + 1)*sizeof(WCHAR))); wszFileName[dat->dwPathSize + dat->pmfqfFiles[i].dwNameLen] = 0; } else { @@ -794,7 +794,7 @@ void CMraProto::MraFilesQueueRecvThreadProc(LPVOID lpParameter) ProtoBroadcastAck(dat->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, (HANDLE)dat->dwIDRequest, 0); //dwBuffSizeUsed = (mir_snprintf((LPSTR)btBuff, SIZEOF(btBuff), "%s %S", MRA_FT_GET_FILE, dat->pmfqfFiles[i].lpwszName)+1); - memmove(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE)); + memcpy(btBuff, MRA_FT_GET_FILE, sizeof(MRA_FT_GET_FILE)); btBuff[(sizeof(MRA_FT_GET_FILE)-1)] = ' '; dwBuffSizeUsed = sizeof(MRA_FT_GET_FILE)+WideCharToMultiByte(MRA_CODE_PAGE, 0, dat->pmfqfFiles[i].lpwszName, dat->pmfqfFiles[i].dwNameLen, (LPSTR)(btBuff + sizeof(MRA_FT_GET_FILE)), (SIZEOF(btBuff) - sizeof(MRA_FT_GET_FILE)), NULL, NULL); btBuff[dwBuffSizeUsed] = 0; diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp index 689c560cb5..a5757eca9d 100644 --- a/protocols/MRA/src/MraMRIMProxy.cpp +++ b/protocols/MRA/src/MraMRIMProxy.cpp @@ -40,7 +40,7 @@ DWORD MraMrimProxySetData(HANDLE hMraMrimProxyData, const CMStringA &szEmail, DW if (!szAddresses.IsEmpty()) MraAddrListGetFromBuff(szAddresses, &pmmpd->malAddrList); if (pmguidSessionID) - memmove(&pmmpd->mguidSessionID, pmguidSessionID, sizeof(MRA_GUID)); + memcpy(&pmmpd->mguidSessionID, pmguidSessionID, sizeof(MRA_GUID)); SetEvent(pmmpd->hWaitHandle); return 0; diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp index 89e21c867a..ba61aae39f 100644 --- a/protocols/MRA/src/MraRTFMsg.cpp +++ b/protocols/MRA/src/MraRTFMsg.cpp @@ -161,7 +161,7 @@ DWORD MraSymbolsToRTFTags(DWORD dwFlags, LPSTR lpszMessage, size_t dwMessageSize dwMemPartToCopy = (lpszFounded[dwFirstFoundIndex]-lpszMessageCurPrev); if (lpszMessageConvertedMax > (lpszMessageConvertedCur+(dwMemPartToCopy+dwcRTFTagsCount[dwFirstFoundIndex]))) { MraTextToRTFData(lpszMessageCurPrev, dwMemPartToCopy, lpszMessageConvertedCur, (lpszMessageConvertedMax-lpszMessageConvertedCur), &i);lpszMessageConvertedCur += i; - memmove(lpszMessageConvertedCur, lpszRTFTags[dwFirstFoundIndex], dwcRTFTagsCount[dwFirstFoundIndex]);lpszMessageConvertedCur += dwcRTFTagsCount[dwFirstFoundIndex]; + memcpy(lpszMessageConvertedCur, lpszRTFTags[dwFirstFoundIndex], dwcRTFTagsCount[dwFirstFoundIndex]);lpszMessageConvertedCur += dwcRTFTagsCount[dwFirstFoundIndex]; lpszMessageCurPrev = (lpszFounded[dwFirstFoundIndex]+dwcSimbolsCount[dwFirstFoundIndex]); for (i = 0;i= (lpszMessageRTFCur+sizeof(PAR)+sizeof(CRLF)+2)) { - memmove(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1); - memmove(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1); - memmove(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2; + memcpy(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1); + memcpy(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1); + memcpy(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2; debugLogA("%s\n", szMessageRTF); return NO_ERROR; } diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index a0244d2a66..54b57e5a4e 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -217,7 +217,7 @@ bool DB_GetStaticStringW(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszValueN if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv) == 0) { dwReadedStringLen = mir_wstrlen(dbv.pwszVal); if (lpwszRetBuff && (dwRetBuffSize > dwReadedStringLen)) { - memmove(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated + memcpy(lpwszRetBuff, dbv.pszVal, (dwReadedStringLen*sizeof(WCHAR)));//include null terminated (*((WCHAR*)(lpwszRetBuff + dwReadedStringLen))) = 0; bRet = true; } @@ -289,7 +289,7 @@ bool DB_GetContactSettingBlob(MCONTACT hContact, LPCSTR lpszModule, LPCSTR lpszV if (db_get(hContact, lpszModule, lpszValueName, &dbv) == 0) { if (dbv.type == DBVT_BLOB) { if (dwRetBuffSize >= dbv.cpbVal) { - memmove(lpRet, dbv.pbVal, dbv.cpbVal); + memcpy(lpRet, dbv.pbVal, dbv.cpbVal); bRet = true; } if (pdwRetBuffSize) (*pdwRetBuffSize) = dbv.cpbVal; @@ -670,7 +670,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & if (getByte("TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) { strncpy(szServiceFunction, m_szModuleName, MAX_PATH); pszServiceFunctionName = szServiceFunction + strlen(m_szModuleName); - memmove(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX)); + memcpy(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX)); cle.pszService = szServiceFunction; } CallService(MS_CLIST_ADDEVENT, 0, (LPARAM)&cle); @@ -1239,7 +1239,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM)); if (prdsiItems) { dwPathLen = dwFolderLen; - memmove(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); + memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR))); if (szPath[(dwPathLen - 1)] != '\\') { szPath[dwPathLen] = '\\'; dwPathLen++; @@ -1259,7 +1259,7 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL) if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) { prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1); - memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR))); mir_tstrcat(szPath, _T("\\*.*")); dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen; @@ -1279,13 +1279,13 @@ DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD else {// file if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) { prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName); - memmove((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); + memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR))); dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen); if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen; if (lpszRetFilePathName && dwRetFilePathLen) { dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen); - memmove(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); + memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR))); } dwRetErrorCode = NO_ERROR; -- cgit v1.2.3