diff options
Diffstat (limited to 'src')
59 files changed, 319 insertions, 319 deletions
diff --git a/src/core/stdauth/authdialogs.cpp b/src/core/stdauth/authdialogs.cpp index e8894a8aa6..99000a8663 100644 --- a/src/core/stdauth/authdialogs.cpp +++ b/src/core/stdauth/authdialogs.cpp @@ -193,7 +193,7 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)firstT);
else if (lastT[0])
off = mir_sntprintf(name, SIZEOF(name), _T("%s"), (TCHAR*)lastT);
- if (lstrlen(nickT)) {
+ if (mir_tstrlen(nickT)) {
if (off)
mir_sntprintf(name + off, SIZEOF(name) - off, _T(" (%s)"), (TCHAR*)nickT);
else
diff --git a/src/core/stdaway/sendmsg.cpp b/src/core/stdaway/sendmsg.cpp index d3ee3ea38e..53273ab9a6 100644 --- a/src/core/stdaway/sendmsg.cpp +++ b/src/core/stdaway/sendmsg.cpp @@ -131,10 +131,10 @@ static TCHAR* GetAwayMessage(int statusMode, char *szProto) GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, SIZEOF(substituteStr));
else continue;
- if (lstrlen(substituteStr) > 6)
- dbv.ptszVal = (TCHAR*)mir_realloc(dbv.ptszVal, (lstrlen(dbv.ptszVal) + 1 + lstrlen(substituteStr) - 6) * sizeof(TCHAR));
- MoveMemory(dbv.ptszVal + i + lstrlen(substituteStr), dbv.ptszVal + i + 6, (lstrlen(dbv.ptszVal) - i - 5) * sizeof(TCHAR));
- CopyMemory(dbv.ptszVal+i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 6)
+ dbv.ptszVal = (TCHAR*)mir_realloc(dbv.ptszVal, (mir_tstrlen(dbv.ptszVal) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ MoveMemory(dbv.ptszVal + i + mir_tstrlen(substituteStr), dbv.ptszVal + i + 6, (mir_tstrlen(dbv.ptszVal) - i - 5) * sizeof(TCHAR));
+ CopyMemory(dbv.ptszVal+i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
}
return dbv.ptszVal;
@@ -408,7 +408,7 @@ static INT_PTR CALLBACK DlgProcAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Default"), &dbv))
if (db_get_ts(NULL, "SRAway", StatusModeToDbSetting(statusModes[i], "Msg"), &dbv))
dbv.ptszVal = mir_tstrdup(GetDefaultMessage(statusModes[i]));
- lstrcpy(dat->info[j].msg, dbv.ptszVal);
+ mir_tstrcpy(dat->info[j].msg, dbv.ptszVal);
mir_free(dbv.ptszVal);
}
if (hLst)
diff --git a/src/core/stdchat/src/log.cpp b/src/core/stdchat/src/log.cpp index 0e5a94edb5..458183baf6 100644 --- a/src/core/stdchat/src/log.cpp +++ b/src/core/stdchat/src/log.cpp @@ -31,7 +31,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (lstrdat->buffer == NULL) {
lstrdat->bufferOffset = 0;
lstrdat->buffer = pci->Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = lstrlenA(lstrdat->buffer);
+ lstrdat->bufferLen = mir_strlen(lstrdat->buffer);
}
// give the RTF to the RE control
diff --git a/src/core/stdchat/src/options.cpp b/src/core/stdchat/src/options.cpp index 20fa87ee44..e7dbb03ab0 100644 --- a/src/core/stdchat/src/options.cpp +++ b/src/core/stdchat/src/options.cpp @@ -534,9 +534,9 @@ static INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPA LPITEMIDLIST idList = SHBrowseForFolder(&bi);
if (idList) {
SHGetPathFromIDList(idList, szDirectory);
- lstrcat(szDirectory, _T("\\"));
+ mir_tstrcat(szDirectory, _T("\\"));
PathToRelativeT(szDirectory, szTemp);
- SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, lstrlen(szTemp) > 1 ? szTemp : _T("Logs\\"));
+ SetDlgItemText(hwndDlg, IDC_LOGDIRECTORY, mir_tstrlen(szTemp) > 1 ? szTemp : _T("Logs\\"));
CoTaskMemFree(idList);
}
}
diff --git a/src/core/stdchat/src/tools.cpp b/src/core/stdchat/src/tools.cpp index 81d154ce41..61f4679a40 100644 --- a/src/core/stdchat/src/tools.cpp +++ b/src/core/stdchat/src/tools.cpp @@ -53,7 +53,7 @@ bool LoadMessageFont(LOGFONT *lf, COLORREF *colour) if (db_get_ts(NULL, "SRMM", str, &dbv))
_tcscpy(lf->lfFaceName, _T("Arial"));
else {
- lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, SIZEOF(str), "SRMFont%dSet", i);
@@ -146,10 +146,10 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText)
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("&Message %s"), pszWordText);
else
- lstrcpyn(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
+ mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
- if (lstrlen(szTemp) > 40)
- lstrcpy(szTemp + 40, _T("..."));
+ if (mir_tstrlen(szTemp) > 40)
+ mir_tstrcpy(szTemp + 40, _T("..."));
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/src/core/stdchat/src/window.cpp b/src/core/stdchat/src/window.cpp index b14db35b51..15d1e0e6d8 100644 --- a/src/core/stdchat/src/window.cpp +++ b/src/core/stdchat/src/window.cpp @@ -393,10 +393,10 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, end ++;
if ( dat->szTabSave[0] =='\0')
- lstrcpyn( dat->szTabSave, pszText+start, end-start+1 );
+ mir_tstrncpy( dat->szTabSave, pszText+start, end-start+1 );
pszSelName = (TCHAR *)mir_alloc( sizeof(TCHAR)*( end-start+1 ));
- lstrcpyn( pszSelName, pszText+start, end-start+1);
+ mir_tstrncpy( pszSelName, pszText+start, end-start+1);
pszName = pci->UM_FindUserAutoComplete(Parentsi->pUsers, dat->szTabSave, pszSelName);
if (pszName == NULL) {
pszName = dat->szTabSave;
@@ -1543,9 +1543,9 @@ END_REMOVETAB: int insertat;
TCHAR szTemp [30];
- lstrcpyn(szTemp, s1->ptszName, 21);
- if (lstrlen(s1->ptszName) >20)
- lstrcpyn(szTemp+20, _T("..."), 4);
+ mir_tstrncpy(szTemp, s1->ptszName, 21);
+ if (mir_tstrlen(s1->ptszName) >20)
+ mir_tstrncpy(szTemp+20, _T("..."), 4);
tci.mask = TCIF_TEXT|TCIF_PARAM ;
tci.pszText = szTemp;
@@ -1790,7 +1790,7 @@ END_REMOVETAB: }
SetTextColor(dis->hDC, ui->iStatusEx == 0?g_Settings.crUserListColor:g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
+ TextOut(dis->hDC, dis->rcItem.left+x_offset, dis->rcItem.top, ui->pszNick, (int)mir_tstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
if (si->pAccPropServicesForNickList) {
@@ -2136,9 +2136,9 @@ LABEL_SHOWWINDOW: tr.lpstrText = pszWord;
long iRes = SendMessage(GetDlgItem(hwndDlg, IDC_LOG), EM_GETTEXTRANGE, 0, (LPARAM)&tr);
if (iRes > 0) {
- int iLen = lstrlen(pszWord) - 1;
+ int iLen = (int)mir_tstrlen(pszWord)-1;
while (iLen >= 0 && _tcschr(szTrimString, pszWord[iLen])) {
- pszWord[iLen] = _T('\0');
+ pszWord[iLen] = 0;
iLen--;
} } }
@@ -2240,8 +2240,8 @@ LABEL_SHOWWINDOW: if (!OpenClipboard(hwndDlg))
break;
EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
- lstrcpy(( TCHAR* )GlobalLock(hData), tr.lpstrText);
+ hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1));
+ mir_tstrcpy(( TCHAR* )GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
@@ -2295,11 +2295,11 @@ LABEL_SHOWWINDOW: if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
- TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR)*(lstrlen(ui->pszUID) + 3));
+ TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR)*(mir_tstrlen(ui->pszUID) + 3));
if (start == 0)
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
+ mir_sntprintf(pszName, mir_tstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
else
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
+ mir_sntprintf(pszName, mir_tstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
SendMessage(GetDlgItem(hwndDlg, IDC_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
diff --git a/src/core/stdclist/src/clcpaint.cpp b/src/core/stdclist/src/clcpaint.cpp index 3bfb0597b2..d312d5ce4a 100644 --- a/src/core/stdclist/src/clcpaint.cpp +++ b/src/core/stdclist/src/clcpaint.cpp @@ -320,14 +320,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, lstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, mir_tstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
width = textSize.cx;
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
szCounts = pcli->pfnGetGroupCountsText(dat, group->cl.items[group->scanIndex]);
if (szCounts[0]) {
GetTextExtentPoint32A(hdcMem, " ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32A(hdcMem, szCounts, lstrlenA(szCounts), &countsSize);
+ GetTextExtentPoint32A(hdcMem, szCounts, mir_strlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -424,7 +424,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText));
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -440,7 +440,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, lstrlenA(szCounts));
+ TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, mir_strlen(szCounts));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
@@ -448,12 +448,12 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText), NULL);
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText), NULL);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText));
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
@@ -470,14 +470,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
rc.right = (clRect.right - clRect.left);
rc.bottom = rc.top;
- DrawText(hdcMem, szText, lstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
+ DrawText(hdcMem, szText, mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
TCHAR *szText = group->cl.items[group->scanIndex]->szText;
RECT rc;
- int qlen = lstrlen(dat->szQuickSearch);
+ int qlen = mir_tstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
diff --git a/src/core/stdemail/email.cpp b/src/core/stdemail/email.cpp index 23ae28da48..d73786d379 100644 --- a/src/core/stdemail/email.cpp +++ b/src/core/stdemail/email.cpp @@ -42,9 +42,9 @@ static INT_PTR SendEMailCommand(WPARAM hContact, LPARAM lParam) return 1;
}
}
- char *szUrl = (char*)mir_alloc(lstrlenA(dbv.pszVal)+8);
- lstrcpyA(szUrl, "mailto:");
- lstrcatA(szUrl, dbv.pszVal);
+ char *szUrl = (char*)mir_alloc(mir_strlen(dbv.pszVal)+8);
+ mir_strcpy(szUrl, "mailto:");
+ mir_strcat(szUrl, dbv.pszVal);
mir_free(dbv.pszVal);
forkthread(SendEmailThread, 0, szUrl);
return 0;
diff --git a/src/core/stdfile/file.cpp b/src/core/stdfile/file.cpp index 004eb72ccd..5e5b32da4d 100644 --- a/src/core/stdfile/file.cpp +++ b/src/core/stdfile/file.cpp @@ -98,7 +98,7 @@ static INT_PTR GetReceivedFilesFolder(WPARAM wParam, LPARAM lParam) TCHAR buf[MAX_PATH];
GetContactReceivedFilesDir(wParam, buf, MAX_PATH, TRUE);
char* dir = mir_t2a(buf);
- lstrcpynA((char*)lParam, dir, MAX_PATH);
+ mir_strncpy((char*)lParam, dir, MAX_PATH);
mir_free(dir);
return 0;
}
@@ -358,9 +358,9 @@ static void sttRecvCreateBlob(DBEVENTINFO &dbei, int fileCount, char **pszFiles, dbei.cbBlob = sizeof(DWORD);
for (int i = 0; i < fileCount; i++)
- dbei.cbBlob += lstrlenA(pszFiles[i]) + 1;
+ dbei.cbBlob += mir_strlen(pszFiles[i]) + 1;
- dbei.cbBlob += lstrlenA(szDescr) + 1;
+ dbei.cbBlob += mir_strlen(szDescr) + 1;
if ((dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob)) == 0)
return;
@@ -369,7 +369,7 @@ static void sttRecvCreateBlob(DBEVENTINFO &dbei, int fileCount, char **pszFiles, BYTE* p = dbei.pBlob + sizeof(DWORD);
for (int i = 0; i < fileCount; i++) {
strcpy((char*)p, pszFiles[i]);
- p += lstrlenA(pszFiles[i]) + 1;
+ p += mir_strlen(pszFiles[i]) + 1;
}
strcpy((char*)p, (szDescr == NULL) ? "" : szDescr);
}
diff --git a/src/core/stdfile/fileexistsdlg.cpp b/src/core/stdfile/fileexistsdlg.cpp index 1e604c2947..4bf7da405a 100644 --- a/src/core/stdfile/fileexistsdlg.cpp +++ b/src/core/stdfile/fileexistsdlg.cpp @@ -149,7 +149,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) TCHAR *pszExtension = _tcsrchr(pszFilename, '.');
if (pszExtension)
- lstrcpyn(szExtension, pszExtension + 1, SIZEOF(szExtension));
+ mir_tstrncpy(szExtension, pszExtension + 1, SIZEOF(szExtension));
else {
pszExtension = _T(".");
szExtension[0] = '\0';
@@ -166,7 +166,7 @@ void __cdecl LoadIconsAndTypesThread(void* param) else {
TCHAR szTypeName[MAX_PATH];
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, pszExtension, NULL, szTypeName, SIZEOF(szTypeName))) {
- lstrcat(szTypeName, _T("\\DefaultIcon"));
+ mir_tstrcat(szTypeName, _T("\\DefaultIcon"));
if (SRFile_GetRegValue(HKEY_CLASSES_ROOT, szTypeName, NULL, szIconFile, SIZEOF(szIconFile))) {
if (_tcsstr(szIconFile, _T("%1")))
SRFile_GetRegValue(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Icons"), _T("0"), szIconFile, SIZEOF(szIconFile));
@@ -244,7 +244,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_OPENFOLDER:
{
TCHAR szFile[MAX_PATH];
- lstrcpyn(szFile, fts->tszCurrentFile, SIZEOF(szFile));
+ mir_tstrncpy(szFile, fts->tszCurrentFile, SIZEOF(szFile));
TCHAR *pszLastBackslash = _tcsrchr(szFile, '\\');
if (pszLastBackslash)
*pszLastBackslash = '\0';
@@ -277,7 +277,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR filter[512], *pfilter;
TCHAR str[MAX_PATH];
- lstrcpyn(str, fts->tszCurrentFile, SIZEOF(str));
+ mir_tstrncpy(str, fts->tszCurrentFile, SIZEOF(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index 68e84dcf73..9509e14dda 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -38,7 +38,7 @@ static void GetLowestExistingDirName(const TCHAR *szTestDir, TCHAR *szExistingDi DWORD dwAttributes;
TCHAR *pszLastBackslash;
- lstrcpyn(szExistingDir, szTestDir, cchExistingDir);
+ mir_tstrncpy(szExistingDir, szTestDir, cchExistingDir);
while ((dwAttributes = GetFileAttributes(szExistingDir)) != INVALID_FILE_ATTRIBUTES && !(dwAttributes&FILE_ATTRIBUTE_DIRECTORY)) {
pszLastBackslash = _tcsrchr(szExistingDir, '\\');
if (pszLastBackslash == NULL) { *szExistingDir = '\0'; break; }
@@ -96,7 +96,7 @@ int BrowseForFolder(HWND hwnd, TCHAR *szPath) LPITEMIDLIST pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDList(pidlResult, szPath);
- lstrcat(szPath, _T("\\"));
+ mir_tstrcat(szPath, _T("\\"));
CoTaskMemFree(pidlResult);
}
return pidlResult != NULL;
@@ -123,9 +123,9 @@ static void patchDir(TCHAR *str, size_t strSize) mir_free(result);
}
- size_t len = lstrlen(str);
+ size_t len = mir_tstrlen(str);
if (len + 1 < strSize && str[len - 1] != '\\')
- lstrcpy(str + len, _T("\\"));
+ mir_tstrcpy(str + len, _T("\\"));
}
void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOOL patchVars)
@@ -170,7 +170,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO if (patchVars)
patchDir(tszTemp, SIZEOF(tszTemp));
RemoveInvalidPathChars(tszTemp);
- lstrcpyn(szDir, tszTemp, cchDir);
+ mir_tstrncpy(szDir, tszTemp, cchDir);
}
void GetReceivedFilesDir(TCHAR *szDir, int cchDir)
@@ -185,7 +185,7 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) patchDir(tszTemp, SIZEOF(tszTemp));
RemoveInvalidPathChars(tszTemp);
- lstrcpyn(szDir, tszTemp, cchDir);
+ mir_tstrncpy(szDir, tszTemp, cchDir);
}
INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -341,7 +341,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l GetDlgItemText(hwndDlg, IDC_FILEDIR, szRecvDir, SIZEOF(szRecvDir));
RemoveInvalidPathChars(szRecvDir);
GetContactReceivedFilesDir(NULL, szDefaultRecvDir, SIZEOF(szDefaultRecvDir), TRUE);
- if (_tcsnicmp(szRecvDir, szDefaultRecvDir, lstrlen(szDefaultRecvDir))) {
+ if (_tcsnicmp(szRecvDir, szDefaultRecvDir, mir_tstrlen(szDefaultRecvDir))) {
char idstr[32];
int i;
DBVARIANT dbv;
diff --git a/src/core/stdfile/filesenddlg.cpp b/src/core/stdfile/filesenddlg.cpp index b6fdfe2ec4..c207cb9ff0 100644 --- a/src/core/stdfile/filesenddlg.cpp +++ b/src/core/stdfile/filesenddlg.cpp @@ -53,11 +53,11 @@ static void SetFileListAndSizeControls(HWND hwndDlg, FileDlgData *dat) mir_sntprintf(str, SIZEOF(str), szFormat, fileCount, dirCount);
}
else if (fileCount) {
- lstrcpy(szFormat, TranslateT("%d files"));
+ mir_tstrcpy(szFormat, TranslateT("%d files"));
mir_sntprintf(str, SIZEOF(str), szFormat, fileCount);
}
else {
- lstrcpy(szFormat, TranslateT("%d directories"));
+ mir_tstrcpy(szFormat, TranslateT("%d directories"));
mir_sntprintf(str, SIZEOF(str), szFormat, dirCount);
}
SetDlgItemText(hwndDlg, IDC_FILE, str);
@@ -88,12 +88,12 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) // NULL separated list of all files
// fileOffset is the offset to the first file.
- fileOffset = lstrlen(buf) + 1;
+ fileOffset = mir_tstrlen(buf) + 1;
// Count number of files
pBuf = buf + fileOffset;
while (*pBuf) {
- pBuf += lstrlen(pBuf) + 1;
+ pBuf += mir_tstrlen(pBuf) + 1;
nNumberOfFiles++;
}
@@ -106,7 +106,7 @@ static void FilenameToFileList(HWND hwndDlg, FileDlgData* dat, const TCHAR *buf) nTemp = 0;
while (*pBuf) {
// Allocate space for path+filename
- int cbFileNameLen = lstrlen(pBuf);
+ int cbFileNameLen = mir_tstrlen(pBuf);
dat->files[nTemp] = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileOffset + cbFileNameLen + 1));
// Add path to filename and copy into array
@@ -147,11 +147,11 @@ void __cdecl ChooseFilesThread(void* param) }
TCHAR filter[128];
- lstrcpy(filter, TranslateT("All files"));
- lstrcat(filter, _T(" (*)"));
- TCHAR *pfilter = filter + lstrlen(filter) + 1;
- lstrcpy(pfilter, _T("*"));
- pfilter = filter + lstrlen(filter) + 1;
+ mir_tstrcpy(filter, TranslateT("All files"));
+ mir_tstrcat(filter, _T(" (*)"));
+ TCHAR *pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_tstrcpy(pfilter, _T("*"));
+ pfilter = filter + mir_tstrlen(filter) + 1;
pfilter[0] = '\0';
OPENFILENAME ofn = { 0 };
diff --git a/src/core/stdfile/filexferdlg.cpp b/src/core/stdfile/filexferdlg.cpp index 18c8e3b5a4..f5eeeec531 100644 --- a/src/core/stdfile/filexferdlg.cpp +++ b/src/core/stdfile/filexferdlg.cpp @@ -85,11 +85,11 @@ void FillSendData(FileDlgData *dat, DBEVENTINFO& dbei) char *szFileNames = Utf8EncodeT(dat->szFilenames), *szMsg = Utf8EncodeT(dat->szMsg); dbei.flags |= DBEF_UTF; - dbei.cbBlob = sizeof(DWORD) + lstrlenA(szFileNames) + lstrlenA(szMsg) + 2; + dbei.cbBlob = sizeof(DWORD) + mir_strlen(szFileNames) + mir_strlen(szMsg) + 2; dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob); *(PDWORD)dbei.pBlob = 0; - lstrcpyA((char*)dbei.pBlob + sizeof(DWORD), szFileNames); - lstrcpyA((char*)dbei.pBlob + sizeof(DWORD) + lstrlenA(szFileNames) + 1, szMsg); + mir_strcpy((char*)dbei.pBlob + sizeof(DWORD), szFileNames); + mir_strcpy((char*)dbei.pBlob + sizeof(DWORD) + mir_strlen(szFileNames) + 1, szMsg); mir_free(szFileNames), mir_free(szMsg); } @@ -109,7 +109,7 @@ static void __cdecl RunVirusScannerThread(struct virusscanthreadstartinfo *info) *pszReplace = 0; mir_sntprintf(szCmdLine, SIZEOF(szCmdLine), _T("%s\"%s\"%s"), dbv.ptszVal, info->szFile, pszReplace + 2); } - else lstrcpyn(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine)); + else mir_tstrncpy(szCmdLine, dbv.ptszVal, SIZEOF(szCmdLine)); PROCESS_INFORMATION pi; if (CreateProcess(NULL, szCmdLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { @@ -155,7 +155,7 @@ static void SetFilenameControls(HWND hwndDlg, FileDlgData *dat, PROTOFILETRANSFE dat->hIcon = shfi.hIcon; } else { - lstrcpyn(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg)); + mir_tstrncpy(msg, pcli->pfnGetContactDisplayName(fts->hContact, 0), SIZEOF(msg)); HICON hIcon = LoadSkinIcon(SKINICON_OTHER_DOWNARROW); dat->hIcon = CopyIcon(hIcon); IcoLib_ReleaseIcon(hIcon, NULL); @@ -310,7 +310,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR GetSensiblyFormattedSize((dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) / dat->bytesRecvedHistorySize, szSpeed, SIZEOF(szSpeed), 0, 1, NULL); if (dat->bytesRecvedHistory[0] == dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]) - lstrcpy(szTime, _T("??:??:??")); + mir_tstrcpy(szTime, _T("??:??:??")); else { li.QuadPart = BIGI(10000000)*(dat->transferStatus.currentFileSize - dat->transferStatus.currentFileProgress)*dat->bytesRecvedHistorySize / (dat->bytesRecvedHistory[0] - dat->bytesRecvedHistory[dat->bytesRecvedHistorySize - 1]); ft.dwHighDateTime = li.HighPart; ft.dwLowDateTime = li.LowPart; @@ -477,9 +477,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR { TCHAR *pszExtension, *pszFilename; if ((pszFilename = _tcsrchr(szOriginalFilename, '\\')) == NULL) pszFilename = szOriginalFilename; - if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + lstrlen(pszFilename); + if ((pszExtension = _tcsrchr(pszFilename + 1, '.')) == NULL) pszExtension = pszFilename + mir_tstrlen(pszFilename); if (pfr->szFilename) mir_free((TCHAR*)pfr->szFilename); - size_t size = (pszExtension - szOriginalFilename) + 21 + lstrlen(pszExtension); + size_t size = (pszExtension - szOriginalFilename) + 21 + mir_tstrlen(pszExtension); pfr->szFilename = (TCHAR*)mir_alloc(sizeof(TCHAR)*size); for (int i = 1;; i++) { mir_sntprintf((TCHAR*)pfr->szFilename, size, _T("%.*s (%u)%s"), pszExtension - szOriginalFilename, szOriginalFilename, i, pszExtension); diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 386d1af01c..50e3f35dc7 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -550,7 +550,7 @@ static int MessageDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL * HFONT hFont = (HFONT)SelectObject(hdc, (HFONT)SendMessage(GetDlgItem(hwndDlg, IDOK), WM_GETFONT, 0, 0));
SIZE textSize;
- GetTextExtentPoint32(hdc, buf, lstrlen(buf), &textSize);
+ GetTextExtentPoint32(hdc, buf, (int)mir_tstrlen(buf), &textSize);
urc->rcItem.right = urc->rcItem.left + textSize.cx + 10;
if ((g_dat.flags&SMF_SHOWBTNS) && urc->rcItem.right > urc->dlgNewSize.cx - dat->nLabelRight)
urc->rcItem.right = urc->dlgNewSize.cx - dat->nLabelRight;
@@ -1144,7 +1144,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP }
}
else
- lstrcpyn(newtitle, TranslateT("Message session"), SIZEOF(newtitle));
+ mir_tstrncpy(newtitle, TranslateT("Message session"), SIZEOF(newtitle));
TCHAR oldtitle[256];
GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index 1ed478bc73..6e37f4ab40 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -84,7 +84,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) if (db_get_ts(NULL, SRMMMOD, str, &dbv))
_tcscpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else {
- lstrcpyn(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName));
db_free(&dbv);
}
mir_snprintf(str, SIZEOF(str), "SRMFont%dSet", i);
diff --git a/src/core/stduihist/history.cpp b/src/core/stduihist/history.cpp index e6c97c1ade..96de2a056e 100644 --- a/src/core/stduihist/history.cpp +++ b/src/core/stduihist/history.cpp @@ -326,7 +326,7 @@ static INT_PTR CALLBACK DlgProcHistory(HWND hwndDlg, UINT msg, WPARAM wParam, LP TCHAR str[1024];
GetObjectDescription(&dbei, str, SIZEOF(str));
if (str[0]) {
- CharUpperBuff(str, lstrlen(str));
+ CharUpperBuff(str, mir_tstrlen(str));
if (_tcsstr(str, (const TCHAR*)lParam) != NULL) {
SendDlgItemMessage(hwndDlg, IDC_LIST, LB_SETCURSEL, index, 0);
SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_LIST, LBN_SELCHANGE), 0);
@@ -355,7 +355,7 @@ static INT_PTR CALLBACK DlgProcHistoryFind(HWND hwndDlg, UINT msg, WPARAM wParam TCHAR str[128];
HWND hwndParent = (HWND)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_FINDWHAT, str, SIZEOF(str));
- CharUpperBuff(str, lstrlen(str));
+ CharUpperBuff(str, mir_tstrlen(str));
SendMessage(hwndParent, DM_FINDNEXT, 0, (LPARAM)str);
return TRUE;
}
diff --git a/src/core/stdurl/urldialogs.cpp b/src/core/stdurl/urldialogs.cpp index 89ea13b76b..1e11c7b2c5 100644 --- a/src/core/stdurl/urldialogs.cpp +++ b/src/core/stdurl/urldialogs.cpp @@ -69,7 +69,7 @@ static void sttUpdateTitle(HWND hwndDlg, MCONTACT hContact) mir_sntprintf(newtitle, SIZEOF(newtitle), _T("%s %s (%s)"), pszNewTitleStart, contactName, szStatus);
}
}
- else lstrcpyn(newtitle, pszNewTitleStart, SIZEOF(newtitle));
+ else mir_tstrncpy(newtitle, pszNewTitleStart, SIZEOF(newtitle));
GetWindowText(hwndDlg, oldtitle, SIZEOF(oldtitle));
@@ -103,7 +103,7 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dbei.pBlob = (PBYTE)mir_alloc(dbei.cbBlob);
db_event_get(dat->hDbEvent, &dbei);
SetDlgItemTextA(hwndDlg, IDC_URL, (char*)dbei.pBlob);
- SetDlgItemTextA(hwndDlg, IDC_MSG, (char*)dbei.pBlob+lstrlenA((char*)dbei.pBlob)+1);
+ SetDlgItemTextA(hwndDlg, IDC_MSG, (char*)dbei.pBlob+mir_strlen((char*)dbei.pBlob)+1);
mir_free(dbei.pBlob);
db_event_markRead(dat->hContact, dat->hDbEvent);
@@ -179,8 +179,8 @@ INT_PTR CALLBACK DlgProcUrlRecv(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP { HGLOBAL hData;
if ( !OpenClipboard(hwndDlg)) break;
EmptyClipboard();
- hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(url)+1);
- lstrcpyA((char*)GlobalLock(hData), url);
+ hData = GlobalAlloc(GMEM_MOVEABLE, mir_strlen(url)+1);
+ mir_strcpy((char*)GlobalLock(hData), url);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
CloseClipboard();
@@ -550,9 +550,9 @@ INT_PTR CALLBACK DlgProcUrlSend(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP body = (char*)mir_alloc(bodySize);
GetDlgItemTextA(hwndDlg, IDC_MESSAGE, body, bodySize);
- dat->sendBuffer = (char*)mir_realloc(dat->sendBuffer, lstrlenA(url)+lstrlenA(body)+2);
- lstrcpyA(dat->sendBuffer, url);
- lstrcpyA(dat->sendBuffer+lstrlenA(url)+1, body);
+ dat->sendBuffer = (char*)mir_realloc(dat->sendBuffer, mir_strlen(url)+mir_strlen(body)+2);
+ mir_strcpy(dat->sendBuffer, url);
+ mir_strcpy(dat->sendBuffer+mir_strlen(url)+1, body);
dat->hAckEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, HM_EVENTSENT);
dat->hSendId = (HANDLE)CallContactService(dat->hContact, PSS_URL, 0, (LPARAM)dat->sendBuffer);
mir_free(url);
diff --git a/src/core/stduserinfo/contactinfo.cpp b/src/core/stduserinfo/contactinfo.cpp index 59d9bc93c3..1d78f2cc13 100644 --- a/src/core/stduserinfo/contactinfo.cpp +++ b/src/core/stduserinfo/contactinfo.cpp @@ -68,9 +68,9 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)lParam);
if (szText[0]) SetWindowText(hwndDlg, TranslateT("Edit phone number"));
TranslateDialogDefault(hwndDlg);
- if (lstrlenA(szText)>4 && !lstrcmpA(szText+lstrlenA(szText)-4, " SMS")) {
+ if (mir_strlen(szText)>4 && !lstrcmpA(szText+mir_strlen(szText)-4, " SMS")) {
CheckDlgButton(hwndDlg, IDC_SMS, BST_CHECKED);
- szText[lstrlenA(szText)-4] = '\0';
+ szText[mir_strlen(szText)-4] = '\0';
}
EnableWindow(GetDlgItem(hwndDlg, IDOK), szText[0]);
SendDlgItemMessage(hwndDlg, IDC_AREA, EM_LIMITTEXT, 31, 0);
@@ -91,13 +91,13 @@ static INT_PTR CALLBACK EditUserPhoneDlgProc(HWND hwndDlg, UINT msg, WPARAM wPar { char *szText = (char*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
int isValid = 1;
GetDlgItemTextA(hwndDlg, IDC_PHONE, szText, 252);
- if (lstrlenA(szText)<7 || szText[0] != '+') isValid = 0;
- if (isValid) isValid = (lstrlenA(szText+1) == (int)strspn(szText+1, "0123456789 ()-"));
+ if (mir_strlen(szText)<7 || szText[0] != '+') isValid = 0;
+ if (isValid) isValid = (mir_strlen(szText+1) == (int)strspn(szText+1, "0123456789 ()-"));
if ( !isValid) {
MessageBox(hwndDlg, TranslateT("The phone number should start with a + and consist of numbers, spaces, brackets and hyphens only."), TranslateT("Invalid phone number"), MB_OK);
break;
}
- if (IsDlgButtonChecked(hwndDlg, IDC_SMS)) lstrcatA(szText, " SMS");
+ if (IsDlgButtonChecked(hwndDlg, IDC_SMS)) mir_strcat(szText, " SMS");
}
//fall through
case IDCANCEL:
@@ -196,11 +196,11 @@ static int IsOverEmail(HWND hwndDlg, TCHAR* szEmail, int cchEmail) SelectObject(hdc, hEmailFont);
SIZE textSize;
- GetTextExtentPoint32(hdc, szText, lstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, mir_tstrlen(szText), &textSize);
ReleaseDC(hwndEmails, hdc);
if (hti.pt.x < rc.left+textSize.cx) {
if (szEmail && cchEmail)
- lstrcpyn(szEmail, szText, cchEmail);
+ mir_tstrncpy(szEmail, szText, cchEmail);
return 1;
}
return 0;
@@ -328,9 +328,9 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if ( !db_get_ts(hContact, szProto, "Cellular", &dbv)) {
lvi.pszText = TranslateT("Mobile");
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- if (lstrlenA(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+lstrlenA(dbv.pszVal)-4, " SMS")) {
+ if (mir_strlen(dbv.pszVal)>4 && !lstrcmpA(dbv.pszVal+mir_strlen(dbv.pszVal)-4, " SMS")) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y"));
- dbv.ptszVal[lstrlen(dbv.ptszVal)-4] = '\0';
+ dbv.ptszVal[mir_tstrlen(dbv.ptszVal)-4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -359,9 +359,9 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP lvi.pszText = idstr2;
mir_sntprintf(idstr2, SIZEOF(idstr2), TranslateT("Custom %d"), i+1);
ListView_InsertItem(GetDlgItem(hwndDlg, IDC_PHONES), &lvi);
- if (lstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+lstrlen(dbv.ptszVal)-4, _T(" SMS"))) {
+ if (mir_tstrlen(dbv.ptszVal)>4 && !lstrcmp(dbv.ptszVal+mir_tstrlen(dbv.ptszVal)-4, _T(" SMS"))) {
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 2, _T("y"));
- dbv.ptszVal[lstrlen(dbv.ptszVal)-4] = '\0';
+ dbv.ptszVal[mir_tstrlen(dbv.ptszVal)-4] = '\0';
}
ListView_SetItemText(GetDlgItem(hwndDlg, IDC_PHONES), lvi.iItem, 1, dbv.ptszVal);
db_free(&dbv);
@@ -493,7 +493,7 @@ INT_PTR CALLBACK ContactDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP DBVARIANT dbv;
mir_snprintf(idstr, SIZEOF(idstr), szIdTemplate, lvi.lParam);
if (db_get_s(hContact, "UserInfo", idstr, &dbv)) break;
- lstrcpynA(szText, dbv.pszVal, SIZEOF(szText));
+ mir_strncpy(szText, dbv.pszVal, SIZEOF(szText));
db_free(&dbv);
if (IDOK != DialogBoxParam(hInst, MAKEINTRESOURCE(nm->hdr.idFrom == IDC_PHONES?IDD_ADDPHONE:IDD_ADDEMAIL), hwndDlg, nm->hdr.idFrom == IDC_PHONES?EditUserPhoneDlgProc:EditUserEmailDlgProc, (LPARAM)szText))
break;
diff --git a/src/core/stduserinfo/stdinfo.cpp b/src/core/stduserinfo/stdinfo.cpp index 7cbaffdabb..3c407ee726 100644 --- a/src/core/stduserinfo/stdinfo.cpp +++ b/src/core/stduserinfo/stdinfo.cpp @@ -160,7 +160,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule default:
pstr = str;
- lstrcpyA(str, "???");
+ mir_strcpy(str, "???");
break;
}
}
@@ -514,7 +514,7 @@ static INT_PTR CALLBACK NotesDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
- lstrcpy(lf.lfFaceName, _T("Courier New"));
+ mir_tstrcpy(lf.lfFaceName, _T("Courier New"));
lf.lfCharSet = DEFAULT_CHARSET;
hFont = CreateFontIndirect(&lf);
SendDlgItemMessage(hwndDlg, IDC_ABOUT, WM_SETFONT, (WPARAM) hFont, MAKELPARAM(TRUE, 0));
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index edbacee4b2..7401c0d991 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -364,7 +364,7 @@ static int LoadLangDescr(LANGPACK_INFO &lpinfo, FILE *fp, char *line, int &start if (!lpinfo.tszLanguage[0] && (lpinfo.Locale == 0) || !GetLocaleInfo(lpinfo.Locale, LOCALE_SENGLANGUAGE, lpinfo.tszLanguage, sizeof(lpinfo.tszLanguage))) {
TCHAR *p = _tcschr(lpinfo.tszFileName, '_');
- lstrcpyn(lpinfo.tszLanguage, p != NULL ? p + 1 : lpinfo.tszFileName, sizeof(lpinfo.tszLanguage));
+ mir_tstrncpy(lpinfo.tszLanguage, p != NULL ? p + 1 : lpinfo.tszFileName, sizeof(lpinfo.tszLanguage));
p = _tcsrchr(lpinfo.tszLanguage, _T('.'));
if (p != NULL) *p = '\0';
}
diff --git a/src/mir_core/path.cpp b/src/mir_core/path.cpp index ef95c31468..fbc3cff04b 100644 --- a/src/mir_core/path.cpp +++ b/src/mir_core/path.cpp @@ -95,7 +95,7 @@ MIR_CORE_DLL(void) CreatePathToFile(char *szFilePath) MIR_CORE_DLL(int) CreateDirectoryTree(const char *szDir)
{
char szTestDir[MAX_PATH];
- lstrcpynA(szTestDir, szDir, SIZEOF(szTestDir));
+ mir_strncpy(szTestDir, szDir, SIZEOF(szTestDir));
DWORD dwAttributes = GetFileAttributesA(szTestDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
@@ -179,7 +179,7 @@ MIR_CORE_DLL(void) CreatePathToFileW(WCHAR *wszFilePath) MIR_CORE_DLL(int) CreateDirectoryTreeW(const WCHAR *szDir)
{
WCHAR szTestDir[MAX_PATH];
- lstrcpynW(szTestDir, szDir, SIZEOF(szTestDir));
+ mir_wstrncpy(szTestDir, szDir, SIZEOF(szTestDir));
DWORD dwAttributes = GetFileAttributesW(szTestDir);
if (dwAttributes != INVALID_FILE_ATTRIBUTES && (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
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);
|