From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ShellExt/src/main.cpp | 2 +- plugins/ShellExt/src/shlcom.cpp | 32 ++++++++++++++++---------------- plugins/ShellExt/src/shlext.cpp | 18 +++++++++--------- plugins/ShellExt/src/utils.cpp | 2 +- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'plugins/ShellExt/src') diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 24e1cdc736..c8e840cc48 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -128,7 +128,7 @@ STDAPI DllRegisterServer() TCHAR tszFileName[MAX_PATH]; GetModuleFileName(hInst, tszFileName, SIZEOF(tszFileName)); - if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(lstrlen(tszFileName)+1))) + if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(mir_tstrlen(tszFileName)+1))) return E_FAIL; if ( RegSetValueExA(kInprocServer, "ThreadingModel", 0, REG_SZ, (PBYTE)str4, sizeof(str4))) return E_FAIL; diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 2908263d46..5d200019bb 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -79,21 +79,21 @@ BOOL AddToList(TAddArgList& args) if (attr & FILE_ATTRIBUTE_DIRECTORY) { // add the directory - lstrcpyA(szBuf, args.szFile); + mir_strcpy(szBuf, args.szFile); args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR)); char *p = mir_strdup(szBuf); args.files[args.count] = p; args.count++; // tack on ending search token - lstrcatA(szBuf, "\\*"); + mir_strcat(szBuf, "\\*"); WIN32_FIND_DATAA fd; HANDLE hFind = FindFirstFileA(szBuf, &fd); while (true) { if (fd.cFileName[0] != '.') { - lstrcpyA(szBuf, args.szFile); - lstrcatA(szBuf, "\\"); - lstrcatA(szBuf, fd.cFileName); + mir_strcpy(szBuf, args.szFile); + mir_strcat(szBuf, "\\"); + mir_strcat(szBuf, fd.cFileName); // keep a copy of the current thing being processed szThis = args.szFile; args.szFile = szBuf; @@ -200,8 +200,8 @@ void ipcGetSkinIcons(THeaderIPC *ipch) spi.pid = GetCurrentProcessId(); while (protoCount > 0) { PROTOACCOUNT *pa = *pp; - lstrcpyA(szTmp, pa->szModuleName); - lstrcatA(szTmp, PS_GETCAPS); + mir_strcpy(szTmp, pa->szModuleName); + mir_strcat(szTmp, PS_GETCAPS); DWORD dwCaps = CallService(szTmp, PFLAGNUM_1, 0); if (dwCaps & PF1_FILESEND) { TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons)); @@ -315,9 +315,9 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) if (bGroupMode) { rc = db_get_s(pContacts[i].hContact, "CList", "Group", &dbv); if (!rc) - n = lstrlenA(dbv.pszVal) + 1; + n = mir_strlen(dbv.pszVal) + 1; } - int cch = lstrlenA(szContact) + 1; + int cch = mir_strlen(szContact) + 1; TSlotIPC *pct = ipcAlloc(ipch, cch + 1 + n); if (pct == NULL) { db_free(&dbv); @@ -326,7 +326,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // lie about the actual size of the TSlotIPC pct->cbStrSection = cch; LPSTR szSlot = LPSTR(pct) + sizeof(TSlotIPC); - lstrcpyA(szSlot, szContact); + mir_strcpy(szSlot, szContact); pct->fType = REQUEST_CONTACTS; pct->hContact = pContacts[i].hContact; pct->Status = pContacts[i].dwStatus; @@ -337,7 +337,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) szSlot += cch + 1; if (rc == 0) { pct->hGroup = murmur_hash(dbv.pszVal); - lstrcpyA(szSlot, dbv.pszVal); + mir_strcpy(szSlot, dbv.pszVal); db_free(&dbv); } else { @@ -415,15 +415,15 @@ void __stdcall ipcService(ULONG_PTR dwParam) // see if we have a custom string for 'Miranda' szMiranda = "Miranda"; - lstrcpynA(pMMT->MirandaName, szMiranda, sizeof(pMMT->MirandaName) - 1); + mir_strncpy(pMMT->MirandaName, szMiranda, sizeof(pMMT->MirandaName) - 1); // for the MRU menu szBuf = Translate("Recently"); - lstrcpynA(pMMT->MRUMenuName, szBuf, sizeof(pMMT->MRUMenuName) - 1); + mir_strncpy(pMMT->MRUMenuName, szBuf, sizeof(pMMT->MRUMenuName) - 1); // and a custom string for "clear entries" szBuf = Translate("Clear entries"); - lstrcpynA(pMMT->ClearEntries, szBuf, sizeof(pMMT->ClearEntries) - 1); + mir_strncpy(pMMT->ClearEntries, szBuf, sizeof(pMMT->ClearEntries) - 1); // if the group mode is on, check if they want the CList setting bool bGroupMode = (BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseGroups, BST_UNCHECKED)); @@ -449,7 +449,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) _itoa(iSlot, szGroupStr, 10); if ( db_get_s(0, "CListGroups", szGroupStr, &dbv) != 0) break; - pct = ipcAlloc(pMMT, lstrlenA(dbv.pszVal + 1) + 1); + pct = ipcAlloc(pMMT, mir_strlen(dbv.pszVal + 1) + 1); // first byte has flags, need null term if (pct != NULL) { if (pMMT->GroupsBegin == NULL) @@ -457,7 +457,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) pct->fType = REQUEST_GROUPS; pct->hContact = 0; szBuf = LPSTR(pct) + sizeof(TSlotIPC); // get the end of the slot - lstrcpyA(szBuf, dbv.pszVal + 1); + mir_strcpy(szBuf, dbv.pszVal + 1); pct->hGroup = 0; db_free(&dbv); // free the string } diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index ff8ba3d906..702f072fe4 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -169,7 +169,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum if (pct != NULL) { psd->cch = pct->cbStrSection - 1; // no null; psd->szText = (char*)HeapAlloc(hDllHeap, 0, pct->cbStrSection); - lstrcpyA(psd->szText, (char*)pct + sizeof(TSlotIPC)); + mir_strcpy(psd->szText, (char*)pct + sizeof(TSlotIPC)); psd->hContact = pct->hContact; psd->fTypes = dtContact; // find the protocol icon array to use && which status @@ -375,9 +375,9 @@ static void BuildMenus(TEnumData *lParam) // since it maybe Miranda\Blah\Blah and we have created the first node // which maybe Miranda, thus giving the wrong hash // since "Miranda" can be a group of it's own and a full path - q->cchGroup = lstrlenA(Token); + q->cchGroup = mir_strlen(Token); q->szGroup = (LPSTR)HeapAlloc(hDllHeap, 0, q->cchGroup + 1); - lstrcpyA(q->szGroup, Token); + mir_strcpy(q->szGroup, Token); q->dwItems = 0; } p = q; @@ -449,7 +449,7 @@ static void BuildMenus(TEnumData *lParam) // the IPC string pointer wont be around forever, must make a copy psd->cch = (int)strlen(lParam->ipch->MRUMenuName); psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1); - lstrcpynA(psd->szText, lParam->ipch->MRUMenuName, sizeof(lParam->ipch->MRUMenuName) - 1); + mir_strncpy(psd->szText, lParam->ipch->MRUMenuName, sizeof(lParam->ipch->MRUMenuName) - 1); mii.dwItemData = (LPARAM)psd; if (lParam->bOwnerDrawSupported && lParam->bShouldOwnerDraw) { @@ -486,13 +486,13 @@ static void BuildMenus(TEnumData *lParam) psd = (TMenuDrawInfo*)HeapAlloc(hDllHeap, 0, sizeof(TMenuDrawInfo)); psd->cch = (int)strlen(lParam->ipch->MirandaName); psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1); - lstrcpynA(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1); + mir_strncpy(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1); // there may not be a profile name pg = lParam->ipch->DataPtr; psd->szProfile = NULL; if (pg != NULL && pg->Status == STATUS_PROFILENAME) { psd->szProfile = (LPSTR)HeapAlloc(hDllHeap, 0, pg->cbStrSection); - lstrcpyA(psd->szProfile, LPSTR(UINT_PTR(pg) + sizeof(TSlotIPC))); + mir_strcpy(psd->szProfile, LPSTR(UINT_PTR(pg) + sizeof(TSlotIPC))); } // owner draw menus need ID's @@ -771,7 +771,7 @@ HRESULT RequestTransfer(TShellExt *Self, int idxCmd) THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0); if (pipch != NULL) { // create the name of the object to be signalled by the ST - lstrcpyA(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf))); + mir_strcpy(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf))); // create it HANDLE hReply = CreateEventA(NULL, false, false, pipch->SignalEventName); if (hReply != 0) { @@ -868,7 +868,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU GetTextExtentPoint32A(dwi->hDC, psd->szText, psd->cch, &tS); dwi->rcItem.left += tS.cx + 8; SetTextColor(dwi->hDC, GetSysColor(COLOR_GRAYTEXT)); - DrawTextA(dwi->hDC, psd->szProfile, lstrlenA(psd->szProfile), &dwi->rcItem, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); + DrawTextA(dwi->hDC, psd->szProfile, mir_strlen(psd->szProfile), &dwi->rcItem, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER); } } else { @@ -914,7 +914,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU dx += tS.cx; // main menu item? if (psd->szProfile != NULL) { - GetTextExtentPoint32A(hMemDC, psd->szProfile, lstrlenA(psd->szProfile), &tS); + GetTextExtentPoint32A(hMemDC, psd->szProfile, mir_strlen(psd->szProfile), &tS); dx += tS.cx; } // store it diff --git a/plugins/ShellExt/src/utils.cpp b/plugins/ShellExt/src/utils.cpp index 22e033fb42..1a71ca3fe8 100644 --- a/plugins/ShellExt/src/utils.cpp +++ b/plugins/ShellExt/src/utils.cpp @@ -20,7 +20,7 @@ void logA(const char *format, ...) UINT murmur_hash(const char *str) { - size_t len = lstrlenA(str); + size_t len = mir_strlen(str); // 'm' and 'r' are mixing constants generated offline. // They're not really 'magic', they just happen to work well. -- cgit v1.2.3