summaryrefslogtreecommitdiff
path: root/plugins/TabSRMM/src/chat
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-12-01 23:27:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-12-01 23:27:22 +0000
commit15b4d00e919d97015c208fff867862ef028995de (patch)
tree153c71d62dac1a17eaf469f52a6c2dfe9f7a28ae /plugins/TabSRMM/src/chat
parentcc15bc68febf4de6cd357ea9192de2e876ab290e (diff)
static mir_tstrncpy replaced with direct _tcsncpy_s calls
git-svn-id: http://svn.miranda-ng.org/main/trunk@11209 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TabSRMM/src/chat')
-rw-r--r--plugins/TabSRMM/src/chat/log.cpp14
-rw-r--r--plugins/TabSRMM/src/chat/options.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/services.cpp8
-rw-r--r--plugins/TabSRMM/src/chat/tools.cpp6
-rw-r--r--plugins/TabSRMM/src/chat/window.cpp12
5 files changed, 20 insertions, 26 deletions
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp
index e1b7fd5525..7129dc6361 100644
--- a/plugins/TabSRMM/src/chat/log.cpp
+++ b/plugins/TabSRMM/src/chat/log.cpp
@@ -616,15 +616,15 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced,
if (streamData->lin->ptszNick) {
if (g_Settings.bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
- mir_tstrncpy(szTemp, streamData->lin->ptszNick, 20);
- mir_tstrncpy(szTemp + 20, _T("..."), 4);
+ _tcsncpy_s(szTemp, 20, streamData->lin->ptszNick, _TRUNCATE);
+ _tcsncpy_s(szTemp + 20, 4, _T("..."), _TRUNCATE);
}
- else mir_tstrncpy(szTemp, streamData->lin->ptszNick, 511);
+ else _tcsncpy_s(szTemp, streamData->lin->ptszNick, _TRUNCATE);
if (g_Settings.bClickableNicks)
mir_sntprintf(szTemp2, SIZEOF(szTemp2), _T("~~++#%s#++~~"), szTemp);
else
- _tcscpy(szTemp2, szTemp);
+ _tcsncpy_s(szTemp2, szTemp, _TRUNCATE);
if (streamData->lin->ptszUserInfo && streamData->lin->iType != GC_EVENT_TOPIC)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%s (%s)"), szTemp2, streamData->lin->ptszUserInfo);
@@ -875,8 +875,8 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (g_Settings.bShowTime) {
TCHAR szTimeStamp[30], szOldTimeStamp[30];
- mir_tstrncpy(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), 30);
- mir_tstrncpy(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), 30);
+ _tcsncpy_s(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), _TRUNCATE);
+ _tcsncpy_s(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), _TRUNCATE);
if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || mir_tstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
@@ -898,7 +898,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData)
if (g_Settings.bLogClassicIndicators)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s", pszIndicator);
- mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299);
+ mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, SIZEOF(pszTemp));
p1 = _tcsstr(pszTemp, _T("%n"));
if (p1)
p1[1] = 's';
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp
index 376357d673..dc89da275f 100644
--- a/plugins/TabSRMM/src/chat/options.cpp
+++ b/plugins/TabSRMM/src/chat/options.cpp
@@ -219,14 +219,14 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM
mir_snprintf(str, SIZEOF(str), "Font%d", i);
if ((i == 17 && !strcmp(szMod, CHATFONT_MODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) {
lf->lfCharSet = SYMBOL_CHARSET;
- mir_tstrncpy(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName));
+ _tcsncpy_s(lf->lfFaceName, _T("Webdings"), _TRUNCATE);
}
else {
ptrT tszDefFace(db_get_tsa(NULL, szMod, str));
if (tszDefFace == NULL)
- mir_tstrcpy(lf->lfFaceName, fol[j].szDefFace);
+ _tcsncpy_s(lf->lfFaceName, fol[j].szDefFace, _TRUNCATE);
else
- mir_tstrncpy(lf->lfFaceName, tszDefFace, SIZEOF(lf->lfFaceName));
+ _tcsncpy_s(lf->lfFaceName, tszDefFace, _TRUNCATE);
}
}
}
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp
index ee7bf778b3..a34b7d0896 100644
--- a/plugins/TabSRMM/src/chat/services.cpp
+++ b/plugins/TabSRMM/src/chat/services.cpp
@@ -56,12 +56,10 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT
if (mir_tstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(contactName, newcontactname, SIZEOF(newcontactname));
- else {
- mir_tstrncpy(newcontactname, contactName, SIZEOF(newcontactname));
- newcontactname[127] = 0;
- }
+ else
+ _tcsncpy_s(newcontactname, contactName, _TRUNCATE);
}
- else mir_tstrncpy(newcontactname, _T("_U_"), SIZEOF(newcontactname));
+ else _tcsncpy_s(newcontactname, _T("_U_"), _TRUNCATE);
newData.item.pszText = newcontactname;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp
index 6a830c78fb..2803d8f87e 100644
--- a/plugins/TabSRMM/src/chat/tools.cpp
+++ b/plugins/TabSRMM/src/chat/tools.cpp
@@ -117,7 +117,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa
(pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
pcli->pfnGetContactDisplayName(hContact, 0));
- mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
+ _tcsncpy_s(pd.lptzText, TranslateTS(szBuf), _TRUNCATE);
pd.iSeconds = g_Settings.iPopupTimeout;
if (g_Settings.iPopupStyle == 2) {
@@ -549,10 +549,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
- mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
+ _tcsncpy_s(szTemp, TranslateT("&Message"), _TRUNCATE);
if (mir_tstrlen(szTemp) > 40)
- mir_tstrncpy(szTemp + 40, _T("..."), 4);
+ _tcsncpy_s(szTemp + 40, 4, _T("..."), _TRUNCATE);
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp
index a0e5e2e4f5..1d30b7af89 100644
--- a/plugins/TabSRMM/src/chat/window.cpp
+++ b/plugins/TabSRMM/src/chat/window.cpp
@@ -1993,10 +1993,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
if (mir_tstrlen(szNick) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(szNick, dat->newtitle, SIZEOF(dat->newtitle));
- else {
- mir_tstrncpy(dat->newtitle, szNick, SIZEOF(dat->newtitle));
- dat->newtitle[129] = 0;
- }
+ else
+ _tcsncpy_s(dat->newtitle, szNick, _TRUNCATE);
}
TCHAR szTemp[100];
@@ -2091,10 +2089,8 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar
else {
if (si->ptszStatusbarText)
mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText);
- else {
- mir_tstrncpy(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText));
- szFinalStatusBarText[511] = 0;
- }
+ else
+ _tcsncpy_s(szFinalStatusBarText, mi->ptszModDispName, _TRUNCATE);
}
SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 0, (LPARAM)szFinalStatusBarText);
UpdateStatusBar(dat);