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/button/button.cpp | 2 +- src/modules/chat/chat_opts.cpp | 4 +- src/modules/chat/log.cpp | 16 +++--- src/modules/chat/manager.cpp | 6 +-- src/modules/chat/tools.cpp | 18 +++---- 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 +++++----- src/modules/database/dbini.cpp | 30 +++++------ src/modules/database/dbutils.cpp | 2 +- src/modules/findadd/findadd.cpp | 6 +-- src/modules/findadd/searchresults.cpp | 18 +++---- src/modules/fonts/FontOptions.cpp | 4 +- src/modules/fonts/services.cpp | 2 +- src/modules/icolib/skin2icons.cpp | 2 +- src/modules/icolib/skin2opts.cpp | 34 ++++++------ src/modules/langpack/langpack.cpp | 6 +-- src/modules/langpack/lpopts.cpp | 8 +-- src/modules/netlib/netlibhttp.cpp | 2 +- src/modules/netlib/netliblog.cpp | 10 ++-- src/modules/netlib/netlibopenconn.cpp | 6 +-- src/modules/netlib/netlibsecurity.cpp | 8 +-- src/modules/options/descbutton.cpp | 4 +- src/modules/plugins/pluginopts.cpp | 2 +- src/modules/protocols/protoaccs.cpp | 2 +- src/modules/protocols/protocols.cpp | 2 +- src/modules/protocols/protoopts.cpp | 8 +-- src/modules/skin/hotkey_opts.cpp | 4 +- src/modules/utils/bmpfilter.cpp | 98 +++++++++++++++++------------------ src/modules/utils/hyperlink.cpp | 2 +- src/modules/utils/openurl.cpp | 2 +- 38 files changed, 220 insertions(+), 220 deletions(-) (limited to 'src/modules') diff --git a/src/modules/button/button.cpp b/src/modules/button/button.cpp index efe2c397b2..61bd2d41bc 100644 --- a/src/modules/button/button.cpp +++ b/src/modules/button/button.cpp @@ -209,7 +209,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint) SIZE sz; TCHAR szText[MAX_PATH]; GetWindowText(ctl->hwnd, szText, SIZEOF(szText)); - GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz); + GetTextExtentPoint32(hdcMem, szText, mir_tstrlen(szText), &sz); int xOffset = (rcClient.right - rcClient.left - sz.cx)/2; int yOffset = (rcClient.bottom - rcClient.top - sz.cy)/2; diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index 428d1e72f8..720f643acf 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -122,7 +122,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) ptrT tszFace(db_get_tsa(NULL, CHATFONT_MODULE, str)); if (tszFace == NULL) - lstrcpy(lf->lfFaceName, FO.szDefFace); + mir_tstrcpy(lf->lfFaceName, FO.szDefFace); else _tcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE); } @@ -315,7 +315,7 @@ int OptionsInit(void) LOGFONT lf; LoadMsgDlgFont(18, &lf, NULL); - lstrcpy(lf.lfFaceName, _T("MS Shell Dlg")); + mir_tstrcpy(lf.lfFaceName, _T("MS Shell Dlg")); lf.lfUnderline = lf.lfItalic = lf.lfStrikeOut = 0; lf.lfHeight = -17; lf.lfWeight = FW_BOLD; diff --git a/src/modules/chat/log.cpp b/src/modules/chat/log.cpp index 1133a66d68..e77d2013d8 100644 --- a/src/modules/chat/log.cpp +++ b/src/modules/chat/log.cpp @@ -198,7 +198,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff } if (szTemp[0]) { - int iLen = lstrlenA(szTemp); + int iLen = mir_strlen(szTemp); memcpy(d, szTemp, iLen); d += iLen; } @@ -226,11 +226,11 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, TCHAR szTemp[512], szTemp2[512]; TCHAR* pszNick = NULL; if (streamData->lin->ptszNick) { - if (g_Settings->bLogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) { - lstrcpyn(szTemp2, streamData->lin->ptszNick, 20); - lstrcpyn(szTemp2 + 20, _T("..."), 4); + if (g_Settings->bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) { + mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 20); + mir_tstrncpy(szTemp2 + 20, _T("..."), 4); } - else lstrcpyn(szTemp2, streamData->lin->ptszNick, 511); + else mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 511); if (streamData->lin->ptszUserInfo) mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, streamData->lin->ptszUserInfo); @@ -384,8 +384,8 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings->bShowTime) { TCHAR szTimeStamp[30], szOldTimeStamp[30]; - lstrcpyn(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30); - lstrcpyn(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30); + mir_tstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30); + mir_tstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30); if (!g_Settings->bShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) { streamData->si->LastTime = lin->time; Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp); @@ -398,7 +398,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData) TCHAR pszTemp[300], *p1; Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1)); - lstrcpyn(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299); + mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299); p1 = _tcsstr(pszTemp, _T("%n")); if (p1) p1[1] = 's'; diff --git a/src/modules/chat/manager.cpp b/src/modules/chat/manager.cpp index 9028d3e02b..4f6666b99e 100644 --- a/src/modules/chat/manager.cpp +++ b/src/modules/chat/manager.cpp @@ -766,12 +766,12 @@ static char* SM_GetUsers(SESSION_INFO *si) } do { - int pLen = lstrlenA(p), nameLen = lstrlen(utemp->pszUID); + int pLen = mir_strlen(p), nameLen = mir_tstrlen(utemp->pszUID); if (pLen + nameLen + 2 > alloced) p = (char*)mir_realloc(p, alloced += 4096); WideCharToMultiByte(CP_ACP, 0, utemp->pszUID, -1, p + pLen, nameLen + 1, 0, 0); - lstrcpyA(p + pLen + nameLen, " "); + mir_strcpy(p + pLen + nameLen, " "); utemp = utemp->next; } while (utemp != NULL); @@ -1184,7 +1184,7 @@ static BOOL UM_SetStatusEx(USERINFO* pUserList, const TCHAR* pszText, int flags) if (s) { pTemp->iStatusEx = 0; if (s == pszText || s[-1] == cDelimiter) { - int len = lstrlen(pTemp->pszUID); + int len = mir_tstrlen(pTemp->pszUID); if (s[len] == cDelimiter || s[len] == '\0') pTemp->iStatusEx = (!bOnlyMe || bSetStatus) ? 1 : 0; } diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index 527b6307ac..160c3157b4 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -42,7 +42,7 @@ TCHAR* RemoveFormatting(const TCHAR *pszWord) return NULL; TCHAR *d = szTemp; - int cbLen = lstrlen(pszWord); + int cbLen = mir_tstrlen(pszWord); if (cbLen > SIZEOF(szTemp)) cbLen = SIZEOF(szTemp)-1; @@ -165,7 +165,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa { static TCHAR szBuf[4 * 1024]; - if (!fmt || fmt[0] == 0 || lstrlen(fmt) > 2000) + if (!fmt || fmt[0] == 0 || mir_tstrlen(fmt) > 2000) return 0; va_list marker; @@ -186,7 +186,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName, cli.pfnGetContactDisplayName(hContact, 0)); - lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); + mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE); pd.iSeconds = g_Settings->iPopupTimeout; if (g_Settings->iPopupStyle == 2) { @@ -469,7 +469,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) CreateDirectoryTreeT(tszFolder); TCHAR szTime[100]; - lstrcpyn(szTime, ci.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99); + mir_tstrncpy(szTime, ci.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99); FILE *hFile = _tfopen(si->pszLogFileName, _T("ab+")); if (hFile == NULL) @@ -480,11 +480,11 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce) if (bFileJustCreated) fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE if (gce->ptszNick) { - if (g_Settings->bLogLimitNames && lstrlen(gce->ptszNick) > 20) { - lstrcpyn(szTemp2, gce->ptszNick, 20); - lstrcpyn(szTemp2 + 20, _T("..."), 4); + if (g_Settings->bLogLimitNames && mir_tstrlen(gce->ptszNick) > 20) { + mir_tstrncpy(szTemp2, gce->ptszNick, 20); + mir_tstrncpy(szTemp2 + 20, _T("..."), 4); } - else lstrcpyn(szTemp2, gce->ptszNick, 511); + else mir_tstrncpy(szTemp2, gce->ptszNick, 511); if (gce->ptszUserInfo) mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, gce->ptszUserInfo); @@ -739,7 +739,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) rva[10].lptzValue = NULL; TCHAR tszTemp[MAX_PATH], *ptszVarPath; - if (g_Settings->pszLogDir[lstrlen(g_Settings->pszLogDir) - 1] == '\\') { + if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') { mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%s%s"), g_Settings->pszLogDir, _T("%userid%.log")); ptszVarPath = tszTemp; } 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; diff --git a/src/modules/database/dbini.cpp b/src/modules/database/dbini.cpp index d26209a8ac..76bab7ef88 100644 --- a/src/modules/database/dbini.cpp +++ b/src/modules/database/dbini.cpp @@ -74,7 +74,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa static bool IsInSpaceSeparatedList(const char *szWord, const char *szList) { const char *szItem, *szEnd; - int wordLen = lstrlenA(szWord); + int wordLen = mir_strlen(szWord); for (szItem = szList;;) { szEnd = strchr(szItem, ' '); @@ -111,9 +111,9 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM warnInfo = (warnSettingChangeInfo_t*)lParam; TranslateDialogDefault(hwndDlg); SetDlgItemText(hwndDlg, IDC_ININAME, warnInfo->szIniPath); - lstrcpyA(szSettingName, warnInfo->szSection); - lstrcatA(szSettingName, " / "); - lstrcatA(szSettingName, warnInfo->szName); + mir_strcpy(szSettingName, warnInfo->szSection); + mir_strcat(szSettingName, " / "); + mir_strcat(szSettingName, warnInfo->szName); SetDlgItemTextA(hwndDlg, IDC_SETTINGNAME, szSettingName); SetDlgItemTextA(hwndDlg, IDC_NEWVALUE, warnInfo->szValue); if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szSafeSections)) @@ -165,7 +165,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM SHFILEOPSTRUCT shfo = { 0 }; shfo.wFunc = FO_DELETE; shfo.pFrom = szIniPath; - szIniPath[lstrlen(szIniPath) + 1] = '\0'; + szIniPath[mir_tstrlen(szIniPath) + 1] = '\0'; shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; SHFileOperation(&shfo); } @@ -229,7 +229,7 @@ static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsaf if (fgets(szLine, sizeof(szLine), fp) == NULL) break; LBL_NewLine: - int lineLength = lstrlenA(szLine); + int lineLength = mir_strlen(szLine); while (lineLength && (BYTE)(szLine[lineLength - 1]) <= ' ') szLine[--lineLength] = '\0'; @@ -244,7 +244,7 @@ LBL_NewLine: if (szLine[1] == '!') szSection[0] = '\0'; else { - lstrcpynA(szSection, szLine + 1, min(sizeof(szSection), (int)(szEnd - szLine))); + mir_strncpy(szSection, szLine + 1, min(sizeof(szSection), (int)(szEnd - szLine))); switch (secur) { case 0: warnThisSection = false; @@ -267,7 +267,7 @@ LBL_NewLine: if (szLine[1] == '?') { DBCONTACTENUMSETTINGS dbces; dbces.pfnEnumProc = SettingsEnumProc; - lstrcpynA(szSection, szLine+2, min(sizeof(szSection), (int)(szEnd-szLine-1))); + mir_strncpy(szSection, szLine+2, min(sizeof(szSection), (int)(szEnd-szLine-1))); dbces.szModule = szSection; dbces.ofsSettings = 0; CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces); @@ -292,7 +292,7 @@ LBL_NewLine: continue; char szName[128]; - lstrcpynA(szName, szLine, min(sizeof(szName), (int)(szValue-szLine+1))); + mir_strncpy(szName, szLine, min(sizeof(szName), (int)(szValue-szLine+1))); szValue++; { warnSettingChangeInfo_t warnInfo; @@ -347,7 +347,7 @@ LBL_NewLine: case 'r': *pstr = '\r'; break; default: *pstr = pstr[1]; break; } - MoveMemory(pstr + 1, pstr + 2, lstrlenA(pstr + 2) + 1); + MoveMemory(pstr + 1, pstr + 2, mir_strlen(pstr + 2) + 1); } } case 'u': @@ -382,7 +382,7 @@ LBL_NewLine: int len; char *pszValue, *pszEnd; - PBYTE buf = (PBYTE)mir_alloc(lstrlenA(szValue + 1)); + PBYTE buf = (PBYTE)mir_alloc(mir_strlen(szValue + 1)); for (len = 0, pszValue = szValue + 1;; len++) { buf[len] = (BYTE)strtol(pszValue, &pszEnd, 0x10); if (pszValue == pszEnd) @@ -465,16 +465,16 @@ static void DoAutoExec(void) SHFILEOPSTRUCT shfo = { 0 }; shfo.wFunc = FO_DELETE; shfo.pFrom = szIniPath; - szIniPath[lstrlen(szIniPath) + 1] = 0; + szIniPath[mir_tstrlen(szIniPath) + 1] = 0; shfo.fFlags = FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_SILENT | FOF_ALLOWUNDO; SHFileOperation(&shfo); } else if (!lstrcmpi(szOnCompletion, _T("rename"))) { TCHAR szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH]; GetPrivateProfileString(_T("AutoExec"), _T("RenamePrefix"), _T("done_"), szRenamePrefix, SIZEOF(szRenamePrefix), mirandabootini); - lstrcpy(szNewPath, szFindPath); - lstrcat(szNewPath, szRenamePrefix); - lstrcat(szNewPath, fd.cFileName); + mir_tstrcpy(szNewPath, szFindPath); + mir_tstrcat(szNewPath, szRenamePrefix); + mir_tstrcat(szNewPath, fd.cFileName); MoveFile(szIniPath, szNewPath); } else if (!lstrcmpi(szOnCompletion, _T("ask"))) diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index e71d265bbe..c4ab423208 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -165,7 +165,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) char *buf = LPSTR(dbei->pBlob) + sizeof(DWORD); ptrT tszFileName(getEventString(dbei, buf)); ptrT tszDescription(getEventString(dbei, buf)); - ptrT &ptszText = (lstrlen(tszDescription) == 0) ? tszFileName : tszDescription; + ptrT &ptszText = (mir_tstrlen(tszDescription) == 0) ? tszFileName : tszDescription; switch (egt->datatype) { case DBVT_WCHAR: return (INT_PTR)ptszText.detouch(); diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp index 033ae492c0..f68c502ea2 100644 --- a/src/modules/findadd/findadd.cpp +++ b/src/modules/findadd/findadd.cpp @@ -341,7 +341,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, WM_GETFONT, 0, 0)); SIZE textSize; - GetTextExtentPoint32(hdc, TranslateT("Searching"), lstrlen(TranslateT("Searching")), &textSize); + GetTextExtentPoint32(hdc, TranslateT("Searching"), mir_tstrlen(TranslateT("Searching")), &textSize); int partWidth[3]; partWidth[0] = textSize.cx; @@ -380,7 +380,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, WM_GETFONT, 0, 0)); if (netProtoCount > 1) { cbei.pszText = TranslateT("All networks"); - GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize); + GetTextExtentPoint32(hdc, cbei.pszText, mir_tstrlen(cbei.pszText), &textSize); if (textSize.cx > cbwidth) cbwidth = textSize.cx; cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon_IconLibLoaded(dat->himlComboIcons, SKINICON_OTHER_SEARCHALL); @@ -399,7 +399,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP continue; cbei.pszText = pa->tszAccountName; - GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize); + GetTextExtentPoint32(hdc, cbei.pszText, mir_tstrlen(cbei.pszText), &textSize); if (textSize.cx > cbwidth) cbwidth = textSize.cx; diff --git a/src/modules/findadd/searchresults.cpp b/src/modules/findadd/searchresults.cpp index 19f8eae9cb..4386af1143 100644 --- a/src/modules/findadd/searchresults.cpp +++ b/src/modules/findadd/searchresults.cpp @@ -202,7 +202,7 @@ static void BeginSearchFailed(void * arg) protoName, protoName); mir_free((char*)arg); } - else lstrcpyn(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf)); + else mir_tstrncpy(buf, TranslateT("Could not search on any of the protocols, are you online?"), SIZEOF(buf)); MessageBox(0, buf, TranslateT("Problem with search"), MB_OK | MB_ICONERROR); } @@ -258,17 +258,17 @@ void SetStatusBarSearchInfo(HWND hwndStatus, struct FindAddDlgData *dat) if (dat->searchCount != 0) { int i; - lstrcpy(str, TranslateT("Searching")); + mir_tstrcpy(str, TranslateT("Searching")); for (i=0; i < dat->searchCount; i++) { PROTOACCOUNT *pa = Proto_GetAccount(dat->search[i].szProto); if (!pa) continue; - lstrcat(str, i ? _T(", ") : _T(" ")); - lstrcat(str, pa->tszAccountName); + mir_tstrcat(str, i ? _T(", ") : _T(" ")); + mir_tstrcat(str, pa->tszAccountName); } } - else lstrcpy(str, TranslateT("Idle")); + else mir_tstrcpy(str, TranslateT("Idle")); SendMessage(hwndStatus, SB_SETTEXT, 0, (LPARAM)str); } @@ -322,16 +322,16 @@ void SetStatusBarResultInfo(HWND hwndDlg) if (i) { if ((pa = Proto_GetAccount(subtotal[i].szProto)) == NULL) return; - lstrcat(str, _T(", ")); + mir_tstrcat(str, _T(", ")); } mir_sntprintf(substr, SIZEOF(substr), _T("%d %s"), subtotal[i].count, pa->tszAccountName); - lstrcat(str, substr); + mir_tstrcat(str, substr); } - lstrcat(str, _T(")")); + mir_tstrcat(str, _T(")")); } mir_free(subtotal); } - else lstrcpy(str, TranslateT("No users found")); + else mir_tstrcpy(str, TranslateT("No users found")); SendMessage(hwndStatus, SB_SETTEXT, 2, (LPARAM)str); } diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index e90f2cac8f..aad063d484 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -347,7 +347,7 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, int sectionLevel = 0; HTREEITEM hSection = NULL; - lstrcpy(itemName, groupName); + mir_tstrcpy(itemName, groupName); sectionName = itemName; while (sectionName) { @@ -751,7 +751,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, hoFont = (HFONT) SelectObject(hdc, (HFONT)SendDlgItemMessage(hwndDlg, mis->CtlID, WM_GETFONT, 0, 0)); SIZE fontSize; - GetTextExtentPoint32(hdc, itemName, lstrlen(itemName), &fontSize); + GetTextExtentPoint32(hdc, itemName, mir_tstrlen(itemName), &fontSize); if (hoFont) SelectObject(hdc, hoFont); if (hFont) DeleteObject(hFont); ReleaseDC( GetDlgItem(hwndDlg, mis->CtlID), hdc); diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 56b3300ede..9a46c10e37 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -306,7 +306,7 @@ static int sttRegisterFontWorker(FontIDW* font_id, int hLangpack) if (!lstrcmp(newItem->deffontsettings.szFace, _T("MS Shell Dlg"))) { LOGFONT lf; SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, FALSE); - lstrcpyn(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace)); + mir_tstrncpy(newItem->deffontsettings.szFace, lf.lfFaceName, SIZEOF(newItem->deffontsettings.szFace)); if (!newItem->deffontsettings.size) newItem->deffontsettings.size = lf.lfHeight; } diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 35e77a8e37..6a1b5ff9f0 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -353,7 +353,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR* path, int cxIcon, int cyI return NULL; TCHAR file[ MAX_PATH ]; - lstrcpyn(file, path, SIZEOF(file)); + mir_tstrncpy(file, path, SIZEOF(file)); TCHAR *comma = _tcsrchr(file, ','); int n; diff --git a/src/modules/icolib/skin2opts.cpp b/src/modules/icolib/skin2opts.cpp index c914501951..f3b538f6b3 100644 --- a/src/modules/icolib/skin2opts.cpp +++ b/src/modules/icolib/skin2opts.cpp @@ -49,7 +49,7 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon) if (!path) return (HICON)NULL; - lstrcpyn(file, path, SIZEOF(file)); + mir_tstrncpy(file, path, SIZEOF(file)); comma = _tcsrchr(file, ','); if (!comma) n = 0; @@ -150,7 +150,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive) { TCHAR path[ MAX_PATH ]; mir_sntprintf(path, SIZEOF(path), _T("%s,"), filename); - int suffIndx = lstrlen(path); + int suffIndx = mir_tstrlen(path); mir_cslock lck(csIconList); @@ -259,29 +259,29 @@ static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll) ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hParent; - lstrcpy(filter, TranslateT("Icon sets")); + mir_tstrcpy(filter, TranslateT("Icon sets")); if (bAll) - lstrcat(filter, _T(" (*.dll;*.icl;*.exe;*.ico)")); + mir_tstrcat(filter, _T(" (*.dll;*.icl;*.exe;*.ico)")); else - lstrcat(filter, _T(" (*.dll)")); + mir_tstrcat(filter, _T(" (*.dll)")); - pfilter = filter+lstrlen(filter)+1; + pfilter = filter+mir_tstrlen(filter)+1; if (bAll) - lstrcpy(pfilter, _T("*.DLL;*.ICL;*.EXE;*.ICO")); + mir_tstrcpy(pfilter, _T("*.DLL;*.ICL;*.EXE;*.ICO")); else - lstrcpy(pfilter, _T("*.DLL")); - - pfilter += lstrlen(pfilter) + 1; - lstrcpy(pfilter, TranslateT("All files")); - lstrcat(pfilter, _T(" (*)")); - pfilter += lstrlen(pfilter) + 1; - lstrcpy(pfilter, _T("*")); - pfilter += lstrlen(pfilter) + 1; + mir_tstrcpy(pfilter, _T("*.DLL")); + + pfilter += mir_tstrlen(pfilter) + 1; + mir_tstrcpy(pfilter, TranslateT("All files")); + mir_tstrcat(pfilter, _T(" (*)")); + pfilter += mir_tstrlen(pfilter) + 1; + mir_tstrcpy(pfilter, _T("*")); + pfilter += mir_tstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.lpstrDefExt = _T("dll"); - lstrcpyn(file, szFile, SIZEOF(file)); + mir_tstrncpy(file, szFile, SIZEOF(file)); ofn.lpstrFile = file; ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_DONTADDTORECENT; ofn.nMaxFile = MAX_PATH*2; @@ -707,7 +707,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM int sectionLevel = 0; hSection = NULL; - lstrcpy(itemName, sectionList[indx]->name); + mir_tstrcpy(itemName, sectionList[indx]->name); sectionName = itemName; while (sectionName) { diff --git a/src/modules/langpack/langpack.cpp b/src/modules/langpack/langpack.cpp index 30f9f1dcf7..f6110cbbdf 100644 --- a/src/modules/langpack/langpack.cpp +++ b/src/modules/langpack/langpack.cpp @@ -47,7 +47,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) continue; /* get data */ PathToAbsoluteT(_T("\\Languages\\"), tszFullPath); - lstrcat(tszFullPath, wfd.cFileName); + mir_tstrcat(tszFullPath, wfd.cFileName); LANGPACK_INFO pack; if (!LoadLangPackDescr(tszFullPath, &pack)) { @@ -69,14 +69,14 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam) if (callback != NULL) { LANGPACK_INFO pack; pack.Locale = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT); - lstrcpy(pack.tszLanguage, _T("English")); + mir_tstrcpy(pack.tszLanguage, _T("English")); pack.szAuthors = "Miranda NG Development Team"; pack.szAuthorEmail = "project-info@miranda-ng.org"; DWORD v = CallService(MS_SYSTEM_GETVERSION, 0, 0); pack.szLastModifiedUsing.Format("%d.%d.%d", ((v >> 24) & 0xFF), ((v >> 16) & 0xFF), ((v >> 8) & 0xFF)); /* file date */ if (GetModuleFileName(NULL, pack.tszFullPath, SIZEOF(pack.tszFullPath))) { - lstrcpy(pack.tszFileName, _T("default")); + mir_tstrcpy(pack.tszFileName, _T("default")); HANDLE hFile = CreateFile(pack.tszFileName, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (hFile != INVALID_HANDLE_VALUE) { GetFileTime(hFile, NULL, NULL, &pack.ftFileDate); diff --git a/src/modules/langpack/lpopts.cpp b/src/modules/langpack/lpopts.cpp index 29cf41df41..7b960b6a40 100644 --- a/src/modules/langpack/lpopts.cpp +++ b/src/modules/langpack/lpopts.cpp @@ -47,8 +47,8 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack) if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) { TCHAR *pszIncompat; pszIncompat = TranslateT("(incompatible)"); - szLocaleName[SIZEOF(szLocaleName) - lstrlen(pszIncompat) - 1] = 0; - lstrcat(lstrcat(szLocaleName, _T(" ")), pszIncompat); + szLocaleName[SIZEOF(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0; + mir_tstrcat(mir_tstrcat(szLocaleName, _T(" ")), pszIncompat); } SetDlgItemText(hwndDlg, IDC_LANGLOCALE, szLocaleName); } @@ -124,7 +124,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_LANGEMAIL: { char buf[512]; - lstrcpyA(buf, "mailto:"); + mir_strcpy(buf, "mailto:"); if (GetWindowTextA(GetDlgItem(hwndDlg, LOWORD(wParam)), &buf[7], SIZEOF(buf)-7)) CallService(MS_UTILS_OPENURL, FALSE, (LPARAM)buf); } @@ -167,7 +167,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP LANGPACK_INFO *pack = (LANGPACK_INFO*)ComboBox_GetItemData(hwndList, i); if (i == idx) { db_set_ts(NULL, "Langpack", "Current", pack->tszFileName); - lstrcpy(tszPath, pack->tszFullPath); + mir_tstrcpy(tszPath, pack->tszFullPath); pack->flags |= LPF_ENABLED; } else pack->flags &= ~LPF_ENABLED; diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index 87e1278f86..b7a529853b 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -1117,7 +1117,7 @@ next: if (chunked) { nlhrReply->headers[chunkhdr].szName = (char*)mir_realloc(nlhrReply->headers[chunkhdr].szName, 16); - lstrcpyA(nlhrReply->headers[chunkhdr].szName, "Content-Length"); + mir_strcpy(nlhrReply->headers[chunkhdr].szName, "Content-Length"); nlhrReply->headers[chunkhdr].szValue = (char*)mir_realloc(nlhrReply->headers[chunkhdr].szValue, 16); mir_snprintf(nlhrReply->headers[chunkhdr].szValue, 16, "%u", nlhrReply->dataLength); diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 330e8e3588..482aa33200 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -65,7 +65,7 @@ static void InitLog() } ptrT szBuf(db_get_tsa(NULL, "Netlib", "File")); - if (lstrlen(szBuf)) { + if (mir_tstrlen(szBuf)) { logOptions.tszUserFile = szBuf; TCHAR path[MAX_PATH]; @@ -172,9 +172,9 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa } _tcscpy(filter, TranslateT("All files")); _tcscat(filter, _T(" (*)")); - TCHAR *pfilter = filter + lstrlen(filter) + 1; + TCHAR *pfilter = filter + mir_tstrlen(filter) + 1; _tcscpy(pfilter, _T("*")); - pfilter = pfilter + lstrlen(pfilter) + 1; + pfilter = pfilter + mir_tstrlen(pfilter) + 1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.lpstrFile = str; @@ -189,7 +189,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) { MoveMemory(str + 1, str, ((SIZEOF(str) - 2) * sizeof(TCHAR))); str[0] = '"'; - lstrcat(str, _T("\"")); + mir_tstrcat(str, _T("\"")); } SetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str); } @@ -466,7 +466,7 @@ void NetlibDumpData(NetlibConnection *nlc, PBYTE buf, int len, int sent, int fla pszBuf += wsprintfA(pszBuf, "%02X%c", buf[line + col], ((col & 3) == 3 && col != 15) ? '-' : ' '); //!!!!!!!!!! // Fill out last line with blanks for (; col < 16; col++) { - lstrcpyA(pszBuf, " "); + mir_strcpy(pszBuf, " "); pszBuf += 3; } *pszBuf++ = ' '; diff --git a/src/modules/netlib/netlibopenconn.cpp b/src/modules/netlib/netlibopenconn.cpp index 79603015bd..100b7341c0 100644 --- a/src/modules/netlib/netlibopenconn.cpp +++ b/src/modules/netlib/netlibopenconn.cpp @@ -185,8 +185,8 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE int nUserLen, nPassLen; PBYTE pAuthBuf; - nUserLen = lstrlenA(nlu->settings.szProxyAuthUser); - nPassLen = lstrlenA(nlu->settings.szProxyAuthPassword); + nUserLen = mir_strlen(nlu->settings.szProxyAuthUser); + nPassLen = mir_strlen(nlu->settings.szProxyAuthPassword); pAuthBuf = (PBYTE)mir_alloc(3+nUserLen+nPassLen); pAuthBuf[0] = 1; //auth version pAuthBuf[1] = nUserLen; @@ -218,7 +218,7 @@ static int NetlibInitSocks5Connection(NetlibConnection *nlc, NetlibUser *nlu, NE if (nlc->dnsThroughProxy) { hostIP = inet_addr(nloc->szHost); if (hostIP == INADDR_NONE) - nHostLen = lstrlenA(nloc->szHost)+1; + nHostLen = mir_strlen(nloc->szHost)+1; else nHostLen = 4; } else { diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 404453c2d4..46fb1d0e06 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -331,11 +331,11 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* loginName = login; const TCHAR* domainName = _tcschr(login, '\\'); int domainLen = 0; - int loginLen = lstrlen(loginName); + int loginLen = mir_tstrlen(loginName); if (domainName != NULL) { loginName = domainName + 1; - loginLen = lstrlen(loginName); + loginLen = mir_tstrlen(loginName); domainLen = domainName - login; domainName = login; } @@ -343,13 +343,13 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, { loginName = login; loginLen = domainName - login; - domainLen = lstrlen(++domainName); + domainLen = mir_tstrlen(++domainName); } auth.User = (PWORD)loginName; auth.UserLength = loginLen; auth.Password = (PWORD)psw; - auth.PasswordLength = lstrlen(psw); + auth.PasswordLength = mir_tstrlen(psw); auth.Domain = (PWORD)domainName; auth.DomainLength = domainLen; auth.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; diff --git a/src/modules/options/descbutton.cpp b/src/modules/options/descbutton.cpp index 2e818ec135..d50f634d52 100644 --- a/src/modules/options/descbutton.cpp +++ b/src/modules/options/descbutton.cpp @@ -194,7 +194,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg textRect.top = DBC_BORDER_SIZE; textRect.bottom = dat->height - DBC_BORDER_SIZE; DrawText(tempDC, dat->lpzTitle, -1, &textRect, DT_TOP|DT_LEFT|DT_END_ELLIPSIS); - GetTextExtentPoint32(tempDC, dat->lpzTitle, lstrlen(dat->lpzTitle), &titleSize); + GetTextExtentPoint32(tempDC, dat->lpzTitle, mir_tstrlen(dat->lpzTitle), &titleSize); DeleteObject(SelectObject(tempDC, hfntSave)); } @@ -206,7 +206,7 @@ static LRESULT MDescButton_OnPaint(HWND hwndDlg, MDescButtonCtrl *dat, UINT msg textRect.top = DBC_BORDER_SIZE + titleSize.cy ? titleSize.cy + DBC_HSPACING : 0; textRect.bottom = dat->height - DBC_BORDER_SIZE; DrawText(tempDC, dat->lpzDescription, -1, &textRect, DT_TOP|DT_LEFT|DT_WORDBREAK|DT_END_ELLIPSIS); - GetTextExtentPoint32(tempDC, dat->lpzTitle, lstrlen(dat->lpzTitle), &titleSize); + GetTextExtentPoint32(tempDC, dat->lpzTitle, mir_tstrlen(dat->lpzTitle), &titleSize); } SelectObject(tempDC, hfntSave); diff --git a/src/modules/plugins/pluginopts.cpp b/src/modules/plugins/pluginopts.cpp index 2b299fba2a..85bdd336c4 100644 --- a/src/modules/plugins/pluginopts.cpp +++ b/src/modules/plugins/pluginopts.cpp @@ -529,7 +529,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case IDC_PLUGINURL: char buf[512]; char *p = &buf[7]; - lstrcpyA(buf, "mailto:"); + mir_strcpy(buf, "mailto:"); if (GetDlgItemTextA(hwndDlg, LOWORD(wParam), p, SIZEOF(buf) - 7)) CallService(MS_UTILS_OPENURL, 0, (LPARAM)(LOWORD(wParam) == IDC_PLUGINEMAIL ? buf : p)); break; diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp index 4067068cad..7ffec4f215 100644 --- a/src/modules/protocols/protoaccs.cpp +++ b/src/modules/protocols/protoaccs.cpp @@ -373,7 +373,7 @@ static INT_PTR stub33(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) static INT_PTR stub41(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam) { - lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); + mir_strncpy((char*)lParam, ppi->m_szModuleName, wParam); return 0; } diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 4cd162a278..ed8af42f0f 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -488,7 +488,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvT((char*)lParam)); return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam); case 34: return (INT_PTR)ppi->UserIsTyping(wParam, lParam); - case 35: lstrcpynA((char*)lParam, ppi->m_szModuleName, wParam); return 0; + case 35: mir_strncpy((char*)lParam, ppi->m_szModuleName, wParam); return 0; case 36: return ppi->m_iStatus; case 100: diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index 4b5c6eba6d..1024e945df 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -71,7 +71,7 @@ PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBasePr pa->szProtoName = mir_strdup(szBaseProto); // if the internal name is empty, generate new one - if (lstrlenA(szModuleName) == 0) { + if (mir_strlen(szModuleName) == 0) { char buf[100]; int count = 1; while (true) { @@ -109,7 +109,7 @@ struct AccFormDlgParam static bool FindAccountByName(const char *szModuleName) { - if (!lstrlenA(szModuleName)) + if (!mir_strlen(szModuleName)) return false; for (int i = 0; i < accounts.getCount(); i++) @@ -620,7 +620,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM if (lps->itemID == (unsigned)dat->iSelected) { SelectObject(lps->hDC, dat->hfntText); mir_sntprintf(text, size, _T("%s: %S"), TranslateT("Protocol"), acc->szProtoName); - length = lstrlen(text); + length = mir_tstrlen(text); DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS); GetTextExtentPoint32(lps->hDC, text, length, &sz); lps->rcItem.top += sz.cy + 2; @@ -653,7 +653,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM } else mir_sntprintf(text, size, TranslateT("Protocol is not loaded.")); - length = lstrlen(text); + length = mir_tstrlen(text); DrawText(lps->hDC, text, -1, &lps->rcItem, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_END_ELLIPSIS); GetTextExtentPoint32(lps->hDC, text, length, &sz); lps->rcItem.top += sz.cy + 2; diff --git a/src/modules/skin/hotkey_opts.cpp b/src/modules/skin/hotkey_opts.cpp index bd450805b8..2b5f8ac7f3 100644 --- a/src/modules/skin/hotkey_opts.cpp +++ b/src/modules/skin/hotkey_opts.cpp @@ -414,8 +414,8 @@ static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey) static void sttOptionsDrawTextChunk(HDC hdc, TCHAR *text, RECT *rc) { SIZE sz; - DrawText(hdc, text, lstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS); - GetTextExtentPoint32(hdc, text, lstrlen(text), &sz); + DrawText(hdc, text, mir_tstrlen(text), rc, DT_LEFT|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER|DT_WORD_ELLIPSIS); + GetTextExtentPoint32(hdc, text, mir_tstrlen(text), &sz); rc->left += sz.cx; } diff --git a/src/modules/utils/bmpfilter.cpp b/src/modules/utils/bmpfilter.cpp index 1c9f86a48d..47ef5b7178 100644 --- a/src/modules/utils/bmpfilter.cpp +++ b/src/modules/utils/bmpfilter.cpp @@ -41,7 +41,7 @@ static INT_PTR sttBitmapLoader(const TCHAR* ptszFileName) if (!PathToAbsoluteT(ptszFileName, szFilename)) mir_sntprintf(szFilename, SIZEOF(szFilename), _T("%s"), ptszFileName); - int filenameLen = lstrlen(szFilename); + int filenameLen = mir_tstrlen(szFilename); if (filenameLen > 4) { TCHAR* pszExt = szFilename + filenameLen - 4; @@ -143,41 +143,41 @@ static INT_PTR BmpFilterGetStrings(WPARAM wParam, LPARAM lParam) int bytesLeft = wParam; char *filter = (char*)lParam, *pfilter; - lstrcpynA(filter, Translate("All bitmaps"), bytesLeft); bytesLeft-=lstrlenA(filter); + mir_strncpy(filter, Translate("All bitmaps"), bytesLeft); bytesLeft-=mir_strlen(filter); strncat(filter, " (*.bmp;*.jpg;*.gif;*.png)", bytesLeft); - pfilter = filter+lstrlenA(filter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter = filter+mir_strlen(filter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + mir_strncpy(pfilter, Translate("Windows bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter); strncat(pfilter, " (*.bmp;*.rle)", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*.BMP;*.RLE", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*.BMP;*.RLE", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + mir_strncpy(pfilter, Translate("JPEG bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter); strncat(pfilter, " (*.jpg;*.jpeg)", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*.JPG;*.JPEG", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*.JPG;*.JPEG", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + mir_strncpy(pfilter, Translate("GIF bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter); strncat(pfilter, " (*.gif)", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*.GIF", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*.GIF", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + mir_strncpy(pfilter, Translate("PNG bitmaps"), bytesLeft); bytesLeft-=mir_strlen(pfilter); strncat(pfilter, " (*.png)", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*.PNG", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*.PNG", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, Translate("All files"), bytesLeft); bytesLeft-=lstrlenA(pfilter); + mir_strncpy(pfilter, Translate("All files"), bytesLeft); bytesLeft-=mir_strlen(pfilter); strncat(pfilter, " (*)", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpynA(pfilter, "*", bytesLeft); - pfilter+=lstrlenA(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_strncpy(pfilter, "*", bytesLeft); + pfilter+=mir_strlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); if (bytesLeft) *pfilter = '\0'; return 0; @@ -188,41 +188,41 @@ static INT_PTR BmpFilterGetStringsW(WPARAM wParam, LPARAM lParam) int bytesLeft = wParam; TCHAR *filter = (TCHAR*)lParam, *pfilter; - lstrcpyn(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft-=lstrlen(filter); + mir_tstrncpy(filter, TranslateT("All bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(filter); _tcsncat(filter, _T(" (*.bmp;*.jpg;*.gif;*.png)"), bytesLeft); - pfilter = filter+lstrlen(filter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter = filter+mir_tstrlen(filter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*.BMP;*.RLE;*.JPG;*.JPEG;*.GIF;*.PNG"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + mir_tstrncpy(pfilter, TranslateT("Windows bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter); _tcsncat(pfilter, _T(" (*.bmp;*.rle)"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*.BMP;*.RLE"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*.BMP;*.RLE"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + mir_tstrncpy(pfilter, TranslateT("JPEG bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter); _tcsncat(pfilter, _T(" (*.jpg;*.jpeg)"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*.JPG;*.JPEG"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*.JPG;*.JPEG"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + mir_tstrncpy(pfilter, TranslateT("GIF bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter); _tcsncat(pfilter, _T(" (*.gif)"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*.GIF"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*.GIF"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft-=lstrlen(pfilter); + mir_tstrncpy(pfilter, TranslateT("PNG bitmaps"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter); _tcsncat(pfilter, _T(" (*.png)"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*.PNG"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*.PNG"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, TranslateT("All files"), bytesLeft); bytesLeft-=lstrlen(pfilter); + mir_tstrncpy(pfilter, TranslateT("All files"), bytesLeft); bytesLeft-=mir_tstrlen(pfilter); _tcsncat(pfilter, _T(" (*)"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); - lstrcpyn(pfilter, _T("*"), bytesLeft); - pfilter+=lstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); + mir_tstrncpy(pfilter, _T("*"), bytesLeft); + pfilter+=mir_tstrlen(pfilter)+1; bytesLeft = wParam-(pfilter-filter); if (bytesLeft) *pfilter = '\0'; return 0; diff --git a/src/modules/utils/hyperlink.cpp b/src/modules/utils/hyperlink.cpp index 7eaba363de..9f075a7514 100644 --- a/src/modules/utils/hyperlink.cpp +++ b/src/modules/utils/hyperlink.cpp @@ -165,7 +165,7 @@ static LRESULT CALLBACK HyperlinkWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPA if (hdc == NULL) return 0; /* text change failed */ if (dat->hEnableFont != NULL) hPrevFont = (HFONT)SelectObject(hdc, dat->hEnableFont); if (dat->hEnableFont == NULL || hPrevFont != NULL) /* select failed? */ - if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, lstrlen((TCHAR*)lParam), &textSize)) + if (GetTextExtentPoint32(hdc, (TCHAR*)lParam, mir_tstrlen((TCHAR*)lParam), &textSize)) if (GetClientRect(hwnd, &rc)) { dat->rcText.top = 0; dat->rcText.bottom = dat->rcText.top+textSize.cy; diff --git a/src/modules/utils/openurl.cpp b/src/modules/utils/openurl.cpp index a4722f804f..7228182874 100644 --- a/src/modules/utils/openurl.cpp +++ b/src/modules/utils/openurl.cpp @@ -38,7 +38,7 @@ static void OpenURLThread(void *arg) return; //wack a protocol on it - size_t size = lstrlen(hUrlInfo->szUrl)+9; + size_t size = mir_tstrlen(hUrlInfo->szUrl)+9; TCHAR *szResult = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); if ((isalpha(hUrlInfo->szUrl[0]) && hUrlInfo->szUrl[1] == ':') || hUrlInfo->szUrl[0] == '\\') { mir_sntprintf(szResult, size, _T("file:///%s"), hUrlInfo->szUrl); -- cgit v1.2.3