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 --- src/modules/clist/clc.cpp | 20 ++++++++++---------- src/modules/clist/clcfiledrop.cpp | 10 +++++----- src/modules/clist/clcitems.cpp | 16 ++++++++-------- src/modules/clist/clcmsgs.cpp | 10 +++++----- src/modules/clist/clcutils.cpp | 8 ++++---- src/modules/clist/clisttray.cpp | 16 ++++++++-------- src/modules/clist/clui.cpp | 12 ++++++------ src/modules/clist/cluiservices.cpp | 8 ++++---- src/modules/clist/genmenuopt.cpp | 4 ++-- src/modules/clist/groups.cpp | 28 ++++++++++++++-------------- 10 files changed, 66 insertions(+), 66 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp index e6914a6089..eba07e1068 100644 --- a/src/modules/clist/clc.cpp +++ b/src/modules/clist/clc.cpp @@ -410,7 +410,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, int i, nameLen, eq; //check name of group and ignore message if just being expanded/collapsed if (cli.pfnFindItem(hwnd, dat, groupId | HCONTACT_ISGROUP, &contact, &group, NULL)) { - lstrcpy(szFullName, contact->szText); + mir_tstrcpy(szFullName, contact->szText); while (group->parent) { for (i=0; i < group->parent->cl.count; i++) if (group->parent->cl.items[i]->group == group) @@ -420,12 +420,12 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; } group = group->parent; - nameLen = lstrlen(group->cl.items[i]->szText); - if (lstrlen(szFullName) + 1 + nameLen > SIZEOF(szFullName)) { + nameLen = mir_tstrlen(group->cl.items[i]->szText); + if (mir_tstrlen(szFullName) + 1 + nameLen > SIZEOF(szFullName)) { szFullName[0] = '\0'; break; } - memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(lstrlen(szFullName) + 1)); + memmove(szFullName + 1 + nameLen, szFullName, sizeof(TCHAR)*(mir_tstrlen(szFullName) + 1)); memcpy(szFullName, group->cl.items[i]->szText, sizeof(TCHAR)*nameLen); szFullName[nameLen] = '\\'; } @@ -581,7 +581,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); dat->needsResort = 1; SortClcByTimer(hwnd); break; @@ -592,7 +592,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, contact->proto = GetContactProto(wParam); cli.pfnInvalidateDisplayNameCacheEntry(wParam); - lstrcpyn(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, cli.pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); SortClcByTimer(hwnd); break; @@ -803,7 +803,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, if (wParam == 27) //escape dat->szQuickSearch[0] = 0; else if (wParam == '\b' && dat->szQuickSearch[0]) - dat->szQuickSearch[lstrlen(dat->szQuickSearch) - 1] = '\0'; + dat->szQuickSearch[mir_tstrlen(dat->szQuickSearch) - 1] = '\0'; else if (wParam < ' ') break; else if (wParam == ' ' && dat->szQuickSearch[0] == '\0' && GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_CHECKBOXES) { @@ -828,7 +828,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, TCHAR szNew[2]; szNew[0] = (TCHAR) wParam; szNew[1] = '\0'; - if (lstrlen(dat->szQuickSearch) >= SIZEOF(dat->szQuickSearch) - 1) { + if (mir_tstrlen(dat->szQuickSearch) >= SIZEOF(dat->szQuickSearch) - 1) { MessageBeep(MB_OK); break; } @@ -845,7 +845,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, dat->selection = index; else { MessageBeep(MB_OK); - dat->szQuickSearch[ lstrlen(dat->szQuickSearch) - 1] = '\0'; + dat->szQuickSearch[ mir_tstrlen(dat->szQuickSearch) - 1] = '\0'; cli.pfnSaveStateAndRebuildList(hwnd, dat); } cli.pfnInvalidateRect(hwnd, NULL, FALSE); @@ -1189,7 +1189,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, break; if (contact->type == CLCIT_GROUP) { //dropee is a group TCHAR szNewName[120]; - lstrcpyn(szNewName, contact->szText, SIZEOF(szNewName)); + mir_tstrncpy(szNewName, contact->szText, SIZEOF(szNewName)); cli.pfnRenameGroup(contact->groupId, szNewName); } else if (contact->type == CLCIT_CONTACT) //dropee is a contact diff --git a/src/modules/clist/clcfiledrop.cpp b/src/modules/clist/clcfiledrop.cpp index 57945bbedf..c3ee8a0980 100644 --- a/src/modules/clist/clcfiledrop.cpp +++ b/src/modules/clist/clcfiledrop.cpp @@ -184,15 +184,15 @@ static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR *szFil WIN32_FIND_DATA fd; HANDLE hFind; TCHAR szPath[MAX_PATH]; - lstrcpy(szPath, szFilename); - lstrcat(szPath, _T("\\*")); + mir_tstrcpy(szPath, szFilename); + mir_tstrcat(szPath, _T("\\*")); if (hFind = FindFirstFile(szPath, &fd)) { do { if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T(".."))) continue; - lstrcpy(szPath, szFilename); - lstrcat(szPath, _T("\\")); - lstrcat(szPath, fd.cFileName); + mir_tstrcpy(szPath, szFilename); + mir_tstrcat(szPath, _T("\\")); + mir_tstrcat(szPath, fd.cFileName); AddToFileList(pppFiles, totalCount, szPath); } while (FindNextFile(hFind, &fd)); FindClose(hFind); diff --git a/src/modules/clist/clcitems.cpp b/src/modules/clist/clcitems.cpp index 5e78b3e00c..ca54079ade 100644 --- a/src/modules/clist/clcitems.cpp +++ b/src/modules/clist/clcitems.cpp @@ -53,11 +53,11 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD do { pBackslash = _tcschr(pNextField, '\\'); if (pBackslash == NULL) { - lstrcpyn(szThisField, pNextField, SIZEOF(szThisField)); + mir_tstrncpy(szThisField, pNextField, SIZEOF(szThisField)); pNextField = NULL; } else { - lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1)); + mir_tstrncpy(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1)); pNextField = pBackslash + 1; } compareResult = 1; @@ -89,7 +89,7 @@ ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD return NULL; i = cli.pfnAddItemToGroup(group, i); group->cl.items[i]->type = CLCIT_GROUP; - lstrcpyn(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText)); + mir_tstrncpy(group->cl.items[i]->szText, szThisField, SIZEOF(group->cl.items[i]->szText)); group->cl.items[i]->groupId = (WORD) (pNextField ? 0 : groupId); group->cl.items[i]->group = (ClcGroup *) mir_alloc(sizeof(ClcGroup)); group->cl.items[i]->group->parent = group; @@ -167,7 +167,7 @@ int fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText) group->cl.items[i]->type = CLCIT_INFO; group->cl.items[i]->flags = (BYTE) flags; group->cl.items[i]->hContact = (MCONTACT)++iInfoItemUniqueHandle; - lstrcpyn(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText)); + mir_tstrncpy(group->cl.items[i]->szText, pszText, SIZEOF(group->cl.items[i]->szText)); return i; } @@ -205,7 +205,7 @@ int fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact) DWORD idleMode = szProto != NULL ? db_get_dw(hContact, szProto, "IdleTS", 0) : 0; if (idleMode) group->cl.items[i]->flags |= CONTACTF_IDLE; - lstrcpyn(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText)); + mir_tstrncpy(group->cl.items[i]->szText, cli.pfnGetContactDisplayName(hContact, 0), SIZEOF(group->cl.items[i]->szText)); ClcCacheEntry *p = cli.pfnGetCacheEntry(hContact); if (p != NULL) @@ -264,7 +264,7 @@ void fnAddContactToTree(HWND hwnd, struct ClcData *dat, MCONTACT hContact, int u } if (!lstrcmp(szGroupName, dbv.ptszVal)) break; - len = lstrlen(szGroupName); + len = mir_tstrlen(szGroupName); if (!_tcsncmp(szGroupName, dbv.ptszVal, len) && dbv.ptszVal[len] == '\\') cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1); } @@ -333,7 +333,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem) if (group->scanIndex == group->cl.count) break; if (group->cl.items[i]->type == CLCIT_GROUP) { - int len = lstrlen(group->cl.items[i]->szText); + int len = mir_tstrlen(group->cl.items[i]->szText); if (!_tcsncmp(group->cl.items[i]->szText, dbv.ptszVal + nameOffset, len) && (dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) { group->totalMembers--; @@ -535,7 +535,7 @@ static void SortGroup(struct ClcData *dat, ClcGroup *group, int useInsertionSort if (prevContactOnline) { i = cli.pfnAddItemToGroup(group, i); group->cl.items[i]->type = CLCIT_DIVIDER; - lstrcpy(group->cl.items[i]->szText, TranslateT("Offline")); + mir_tstrcpy(group->cl.items[i]->szText, TranslateT("Offline")); } break; } diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp index c2bfae6ae4..151fbeb261 100644 --- a/src/modules/clist/clcmsgs.cpp +++ b/src/modules/clist/clcmsgs.cpp @@ -185,16 +185,16 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR return dat->groupIndent; case CLM_GETISEARCHSTRING: - lstrcpy((TCHAR*) lParam, dat->szQuickSearch); - return lstrlen(dat->szQuickSearch); + mir_tstrcpy((TCHAR*) lParam, dat->szQuickSearch); + return mir_tstrlen(dat->szQuickSearch); case CLM_GETITEMTEXT: { ClcContact *contact; if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) return 0; - lstrcpy((TCHAR*) lParam, contact->szText); - return lstrlen(contact->szText); + mir_tstrcpy((TCHAR*) lParam, contact->szText); + return mir_tstrlen(contact->szText); } case CLM_GETITEMTYPE: @@ -436,7 +436,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR ClcContact *contact; if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL)) break; - lstrcpyn(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, (TCHAR*)lParam, SIZEOF(contact->szText)); cli.pfnSortCLC(hwnd, dat, 1); cli.pfnInvalidateRect(hwnd, NULL, FALSE); break; diff --git a/src/modules/clist/clcutils.cpp b/src/modules/clist/clcutils.cpp index f3f76a29e0..3e7b82b370 100644 --- a/src/modules/clist/clcutils.cpp +++ b/src/modules/clist/clcutils.cpp @@ -165,7 +165,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * HFONT hFont = (HFONT)SelectObject(hdc, dat->fontInfo[hitcontact->type == CLCIT_GROUP ? FONTID_GROUPS : FONTID_CONTACTS].hFont); SIZE textSize; - GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize); + GetTextExtentPoint32(hdc, hitcontact->szText, mir_tstrlen(hitcontact->szText), &textSize); int width = textSize.cx; if (hitcontact->type == CLCIT_GROUP) { char *szCounts; @@ -174,7 +174,7 @@ int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact * GetTextExtentPoint32A(hdc, " ", 1, &textSize); width += textSize.cx; SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont); - GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize); + GetTextExtentPoint32A(hdc, szCounts, mir_strlen(szCounts), &textSize); width += textSize.cx; } } @@ -354,7 +354,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat) int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk) { ClcGroup *group = &dat->list; - int testlen = lstrlen(text); + int testlen = mir_tstrlen(text); group->scanIndex = 0; for (;;) { @@ -691,7 +691,7 @@ void fnGetFontSetting(int i, LOGFONT* lf, COLORREF* colour) mir_snprintf(idstr, SIZEOF(idstr), "Font%dName", i); ptrT tszFace(db_get_tsa(NULL, "CLC", idstr)); if (tszFace) - lstrcpy(lf->lfFaceName, tszFace); + mir_tstrcpy(lf->lfFaceName, tszFace); mir_snprintf(idstr, SIZEOF(idstr), "Font%dCol", i); *colour = db_get_dw(NULL, "CLC", idstr, *colour); diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp index 45f31f0e1a..4edff9c697 100644 --- a/src/modules/clist/clisttray.cpp +++ b/src/modules/clist/clisttray.cpp @@ -139,7 +139,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto) } else mir_sntprintf(cli.szTip, MAX_TIP_SIZE, _T("%s%s%s %s"), szPrefix, szSeparator, pa->tszAccountName, szStatus); } - else lstrcpyn(cli.szTip, szPrefix, MAX_TIP_SIZE); + else mir_tstrncpy(cli.szTip, szPrefix, MAX_TIP_SIZE); } else { if (mToolTipTrayTips) { @@ -182,7 +182,7 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, int s cli.pfnTrayIconMakeTooltip(NULL, cli.trayIcon[i].szProto); if (!mToolTipTrayTips) - lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); + mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); Shell_NotifyIcon(NIM_ADD, &nid); @@ -342,7 +342,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer mir_free(cli.trayIcon[i].ptszToolTip); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); if (!mToolTipTrayTips) - lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); + mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); Shell_NotifyIcon(NIM_MODIFY, &nid); if (cli.trayIconCount == 1) @@ -364,7 +364,7 @@ int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPrefer mir_free(cli.trayIcon[i].ptszToolTip); cli.trayIcon[i].ptszToolTip = mir_tstrdup(cli.szTip); if (!mToolTipTrayTips) - lstrcpyn(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); + mir_tstrncpy(nid.szTip, cli.szTip, SIZEOF(nid.szTip)); Shell_NotifyIcon(NIM_MODIFY, &nid); if (cli.trayIconCount == 1) @@ -816,8 +816,8 @@ int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) nid.hWnd = cli.hwndContactList; nid.uID = iconId; nid.uFlags = NIF_INFO; - lstrcpynW(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo)); - lstrcpynW(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle)); + mir_wstrncpy(nid.szInfo, msn->tszInfo, SIZEOF(nid.szInfo)); + mir_wstrncpy(nid.szInfoTitle, msn->tszInfoTitle, SIZEOF(nid.szInfoTitle)); nid.szInfo[SIZEOF(nid.szInfo) - 1] = 0; nid.szInfoTitle[SIZEOF(nid.szInfoTitle) - 1] = 0; nid.uTimeout = msn->uTimeout; @@ -830,8 +830,8 @@ int fnCListTrayNotify(MIRANDASYSTRAYNOTIFY* msn) nid.hWnd = cli.hwndContactList; nid.uID = iconId; nid.uFlags = NIF_INFO; - lstrcpynA(nid.szInfo, msn->szInfo, sizeof(nid.szInfo)); - lstrcpynA(nid.szInfoTitle, msn->szInfoTitle, sizeof(nid.szInfoTitle)); + mir_strncpy(nid.szInfo, msn->szInfo, sizeof(nid.szInfo)); + mir_strncpy(nid.szInfoTitle, msn->szInfoTitle, sizeof(nid.szInfoTitle)); nid.uTimeout = msn->uTimeout; nid.dwInfoFlags = msn->dwInfoFlags; return Shell_NotifyIconA(NIM_MODIFY, &nid) == 0; diff --git a/src/modules/clist/clui.cpp b/src/modules/clist/clui.cpp index ee0884e97d..b3be884dbc 100644 --- a/src/modules/clist/clui.cpp +++ b/src/modules/clist/clui.cpp @@ -279,9 +279,9 @@ int LoadCLUIModule(void) RegisterClassEx(&wndclass); if (db_get_ts(NULL, "CList", "TitleText", &dbv)) - lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF(titleText)); + mir_tstrncpy(titleText, _T(MIRANDANAME), SIZEOF(titleText)); else { - lstrcpyn(titleText, dbv.ptszVal, SIZEOF(titleText)); + mir_tstrncpy(titleText, dbv.ptszVal, SIZEOF(titleText)); db_free(&dbv); } @@ -1009,16 +1009,16 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM else tszName[0] = 0; - GetTextExtentPoint32(dis->hDC, tszName, lstrlen(tszName), &textSize); - TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, lstrlen(tszName)); + GetTextExtentPoint32(dis->hDC, tszName, mir_tstrlen(tszName), &textSize); + TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, tszName, mir_tstrlen(tszName)); x += textSize.cx; } if (showOpts & 4) { TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0); if (!szStatus) szStatus = _T(""); - GetTextExtentPoint32(dis->hDC, szStatus, lstrlen(szStatus), &textSize); - TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, lstrlen(szStatus)); + GetTextExtentPoint32(dis->hDC, szStatus, mir_tstrlen(szStatus), &textSize); + TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, mir_tstrlen(szStatus)); } } else if (dis->CtlType == ODT_MENU) { diff --git a/src/modules/clist/cluiservices.cpp b/src/modules/clist/cluiservices.cpp index 50ef0e2953..2579de60bc 100644 --- a/src/modules/clist/cluiservices.cpp +++ b/src/modules/clist/cluiservices.cpp @@ -182,15 +182,15 @@ void fnCluiProtocolStatusChanged(int, const char*) else tszName[0] = 0; - if (showOpts & 4 && lstrlen(tszName) < SIZEOF(tszName)-1) - lstrcat(tszName, _T(" ")); - GetTextExtentPoint32(hdc, tszName, lstrlen(tszName), &textSize); + if (showOpts & 4 && mir_tstrlen(tszName) < SIZEOF(tszName)-1) + mir_tstrcat(tszName, _T(" ")); + GetTextExtentPoint32(hdc, tszName, mir_tstrlen(tszName), &textSize); x += textSize.cx; x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room } if (showOpts & 4) { TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL,cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0); - GetTextExtentPoint32(hdc, modeDescr, lstrlen(modeDescr), &textSize); + GetTextExtentPoint32(hdc, modeDescr, mir_tstrlen(modeDescr), &textSize); x += textSize.cx; x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room } diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index ddf6ffcc4d..79e461b6c4 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -454,7 +454,7 @@ static int handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) int retVal = CDRF_NEWFONT; if (tvi.iImage == -1) { SIZE sz; - GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &sz); + GetTextExtentPoint32(pNMTVCD->nmcd.hdc, tvi.pszText, mir_tstrlen(tvi.pszText), &sz); RECT rc; if (sz.cx+3 > pNMTVCD->nmcd.rc.right - pNMTVCD->nmcd.rc.left) @@ -467,7 +467,7 @@ static int handleCustomDraw(HWND hWndTreeView, LPNMTVCUSTOMDRAW pNMTVCD) SetBkColor(pNMTVCD->nmcd.hdc, pNMTVCD->clrTextBk); FillRect(pNMTVCD->nmcd.hdc, &rc, br); DeleteObject(br); - DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, lstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT|DT_VCENTER|DT_NOPREFIX); + DrawText(pNMTVCD->nmcd.hdc, tvi.pszText, mir_tstrlen(tvi.pszText), &pNMTVCD->nmcd.rc, DT_LEFT|DT_VCENTER|DT_NOPREFIX); retVal |= CDRF_SKIPDEFAULT; } diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp index f80dd51820..e27699662a 100644 --- a/src/modules/clist/groups.cpp +++ b/src/modules/clist/groups.cpp @@ -84,10 +84,10 @@ static INT_PTR CreateGroupInternal(INT_PTR iParent, const TCHAR *ptszName) mir_sntprintf(newBaseName, SIZEOF(newBaseName), _T("%s\\%s"), dbv.ptszVal + 1, grpName); mir_free(dbv.pszVal); } - else lstrcpyn(newBaseName, grpName, SIZEOF(newBaseName)); + else mir_tstrncpy(newBaseName, grpName, SIZEOF(newBaseName)); _itoa(newId, str, 10); - lstrcpyn(newName + 1, newBaseName, SIZEOF(newName) - 1); + mir_tstrncpy(newName + 1, newBaseName, SIZEOF(newName) - 1); if (ptszName) { i = GroupNameExists(newBaseName, -1); if (i) newId = i - 1; @@ -140,7 +140,7 @@ static INT_PTR GetGroupName2(WPARAM wParam, LPARAM lParam) _itoa(wParam - 1, idstr, 10); if (db_get_s(NULL, "CListGroups", idstr, &dbv)) return (INT_PTR) (char *) NULL; - lstrcpynA(name, dbv.pszVal + 1, SIZEOF(name)); + mir_strncpy(name, dbv.pszVal + 1, SIZEOF(name)); if ((DWORD *) lParam != NULL) *(DWORD *) lParam = dbv.pszVal[0]; db_free(&dbv); @@ -157,7 +157,7 @@ TCHAR* fnGetGroupName(int idx, DWORD* pdwFlags) if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) return NULL; - lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name)); + mir_tstrncpy(name, dbv.ptszVal + 1, SIZEOF(name)); if (pdwFlags != NULL) *pdwFlags = dbv.ptszVal[0]; db_free(&dbv); @@ -185,7 +185,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) _itoa(wParam - 1, str, 10); if (db_get_ts(NULL, "CListGroups", str, &dbv)) return 1; - lstrcpyn(name, dbv.ptszVal + 1, SIZEOF(name)); + mir_tstrncpy(name, dbv.ptszVal + 1, SIZEOF(name)); db_free(&dbv); if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) { @@ -197,7 +197,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) SetCursor(LoadCursor(NULL, IDC_WAIT)); //must remove setting from all child contacts too //children are demoted to the next group up, not deleted. - lstrcpy(szNewParent, name); + mir_tstrcpy(szNewParent, name); pszLastBackslash = _tcsrchr(szNewParent, '\\'); if (pszLastBackslash) pszLastBackslash[0] = '\0'; @@ -245,7 +245,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) TCHAR szNewName[256]; int len; - len = lstrlen(name); + len = mir_tstrlen(name); for (i=0;; i++) { _itoa(i, str, 10); if (db_get_ts(NULL, "CListGroups", str, &dbv)) @@ -254,7 +254,7 @@ static INT_PTR DeleteGroup(WPARAM wParam, LPARAM) if (szNewParent[0]) mir_sntprintf(szNewName, SIZEOF(szNewName), _T("%s\\%s"), szNewParent, dbv.ptszVal + len + 2); else - lstrcpyn(szNewName, dbv.ptszVal + len + 2, SIZEOF(szNewName)); + mir_tstrncpy(szNewName, dbv.ptszVal + len + 2, SIZEOF(szNewName)); cli.pfnRenameGroup(i + 1, szNewName); } db_free(&dbv); @@ -286,9 +286,9 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) if (db_get_ts(NULL, "CListGroups", idstr, &dbv)) return 1; str[0] = dbv.pszVal[0] & 0x7F; - lstrcpyn(oldName, dbv.ptszVal + 1, SIZEOF(oldName)); + mir_tstrncpy(oldName, dbv.ptszVal + 1, SIZEOF(oldName)); db_free(&dbv); - lstrcpyn(str + 1, szName, SIZEOF(str) - 1); + mir_tstrncpy(str + 1, szName, SIZEOF(str) - 1); db_set_ts(NULL, "CListGroups", idstr, str); //must rename setting in all child contacts too @@ -307,7 +307,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) TCHAR szNewName[256]; int len, i; - len = lstrlen(oldName); + len = mir_tstrlen(oldName); for (i=0;; i++) { if (i == groupId) continue; @@ -327,7 +327,7 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move) TCHAR *pszLastBackslash; int i; - lstrcpyn(str, szName, SIZEOF(str)); + mir_tstrncpy(str, szName, SIZEOF(str)); pszLastBackslash = _tcsrchr(str, '\\'); if (pszLastBackslash != NULL) { *pszLastBackslash = '\0'; @@ -488,11 +488,11 @@ static INT_PTR BuildGroupMenu(WPARAM, LPARAM) do { pBackslash = _tcschr(pNextField, '\\'); if (pBackslash == NULL) { - lstrcpyn(szThisField, pNextField, SIZEOF(szThisField)); + mir_tstrncpy(szThisField, pNextField, SIZEOF(szThisField)); pNextField = NULL; } else { - lstrcpyn(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1)); + mir_tstrncpy(szThisField, pNextField, min(SIZEOF(szThisField), pBackslash - pNextField + 1)); pNextField = pBackslash + 1; } compareResult = 1; -- cgit v1.2.3