diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/stdclist/src/clcfonts.cpp | 2 | ||||
-rw-r--r-- | src/core/stdfile/filerecvdlg.cpp | 4 | ||||
-rw-r--r-- | src/mir_core/langpack.cpp | 10 | ||||
-rw-r--r-- | src/mir_core/logger.cpp | 2 | ||||
-rw-r--r-- | src/mir_core/protos.cpp | 24 | ||||
-rw-r--r-- | src/modules/chat/chat_opts.cpp | 18 | ||||
-rw-r--r-- | src/modules/chat/chat_svc.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/clist.cpp | 2 | ||||
-rw-r--r-- | src/modules/chat/tools.cpp | 2 | ||||
-rw-r--r-- | src/modules/database/database.cpp | 4 | ||||
-rw-r--r-- | src/modules/metacontacts/meta_edit.cpp | 2 | ||||
-rw-r--r-- | src/modules/utils/path.cpp | 8 |
12 files changed, 40 insertions, 40 deletions
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index fe4c9c1e9a..3951ca6cc4 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -62,7 +62,7 @@ void RegisterCListFonts() pcli->pfnGetFontSetting(i, &lf, &fontid.deffontsettings.colour);
lf.lfHeight = -MulDiv(lf.lfHeight, GetDeviceCaps(hdc, LOGPIXELSY), 72);
- _tcsncpy_s(fontid.deffontsettings.szFace, SIZEOF(fontid.deffontsettings.szFace), lf.lfFaceName, _TRUNCATE);
+ _tcsncpy_s(fontid.deffontsettings.szFace, lf.lfFaceName, _TRUNCATE);
fontid.deffontsettings.charset = lf.lfCharSet;
fontid.deffontsettings.size = (char)lf.lfHeight;
fontid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0);
diff --git a/src/core/stdfile/filerecvdlg.cpp b/src/core/stdfile/filerecvdlg.cpp index c8dba320ee..f238a91199 100644 --- a/src/core/stdfile/filerecvdlg.cpp +++ b/src/core/stdfile/filerecvdlg.cpp @@ -134,7 +134,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
- _tcsncpy_s(tszTemp, SIZEOF(tszTemp), tszRecvPath, _TRUNCATE);
+ _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
@@ -180,7 +180,7 @@ void GetReceivedFilesDir(TCHAR *szDir, int cchDir) ptrT tszRecvPath(db_get_tsa(NULL, "SRFile", "RecvFilesDirAdv"));
if (tszRecvPath)
- _tcsncpy_s(tszTemp, SIZEOF(tszTemp), tszRecvPath, _TRUNCATE);
+ _tcsncpy_s(tszTemp, tszRecvPath, _TRUNCATE);
else
mir_sntprintf(tszTemp, SIZEOF(tszTemp), _T("%%mydocuments%%\\%s\\%%userid%%"), TranslateT("My received files"));
diff --git a/src/mir_core/langpack.cpp b/src/mir_core/langpack.cpp index 94ca9eff2e..435f7cb825 100644 --- a/src/mir_core/langpack.cpp +++ b/src/mir_core/langpack.cpp @@ -381,7 +381,7 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack) if (!PathIsAbsoluteT(ptszLangPack))
mir_sntprintf(tszFullPath, SIZEOF(tszFullPath), _T("%s\\%s"), g_tszRoot, ptszLangPack);
else
- _tcsncpy_s(tszFullPath, SIZEOF(tszFullPath), ptszLangPack, _TRUNCATE);
+ _tcsncpy_s(tszFullPath, ptszLangPack, _TRUNCATE);
// this lang is already loaded? nothing to do then
if (!lstrcmp(tszFullPath, langPack.tszFullPath))
@@ -397,9 +397,9 @@ MIR_CORE_DLL(int) LoadLangPack(const TCHAR *ptszLangPack) return 3;
// copy the full file name and extract a file name from it
- _tcsncpy_s(langPack.tszFullPath, SIZEOF(langPack.tszFullPath), tszFullPath, _TRUNCATE);
+ _tcsncpy_s(langPack.tszFullPath, tszFullPath, _TRUNCATE);
TCHAR *p = _tcsrchr(langPack.tszFullPath, '\\');
- _tcsncpy_s(langPack.tszFileName, SIZEOF(langPack.tszFullPath), (p == NULL) ? tszFullPath : p + 1, _TRUNCATE);
+ _tcsncpy_s(langPack.tszFileName, (p == NULL) ? tszFullPath : p + 1, _TRUNCATE);
CharLower(langPack.tszFileName);
FILE *fp = _tfopen(tszFullPath, _T("rt"));
@@ -429,9 +429,9 @@ MIR_CORE_DLL(int) LoadLangPackDescr(const TCHAR *ptszLangPack, LANGPACK_INFO *lp if (lpInfo == NULL)
return 1;
- _tcsncpy_s(lpInfo->tszFullPath, SIZEOF(lpInfo->tszFullPath), ptszLangPack, _TRUNCATE);
+ _tcsncpy_s(lpInfo->tszFullPath, ptszLangPack, _TRUNCATE);
TCHAR *p = _tcsrchr(lpInfo->tszFullPath, '\\');
- _tcsncpy_s(lpInfo->tszFileName, SIZEOF(lpInfo->tszFullPath), (p == NULL) ? ptszLangPack : p+1, _TRUNCATE);
+ _tcsncpy_s(lpInfo->tszFileName, (p == NULL) ? ptszLangPack : p+1, _TRUNCATE);
CharLower(lpInfo->tszFileName);
FILE *fp = _tfopen(ptszLangPack, _T("rt"));
diff --git a/src/mir_core/logger.cpp b/src/mir_core/logger.cpp index 4f4aa1a353..e129f48765 100644 --- a/src/mir_core/logger.cpp +++ b/src/mir_core/logger.cpp @@ -115,7 +115,7 @@ MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const TCHAR *ptszDescr, FILE *fp = _tfopen(ptszFile, _T("ab"));
if (fp == NULL) {
TCHAR tszPath[MAX_PATH];
- _tcsncpy_s(tszPath, SIZEOF(tszPath), ptszFile, _TRUNCATE);
+ _tcsncpy_s(tszPath, ptszFile, _TRUNCATE);
CreatePathToFileT(tszPath);
}
else fclose(fp);
diff --git a/src/mir_core/protos.cpp b/src/mir_core/protos.cpp index ce752450b5..b8cacdd8fb 100644 --- a/src/mir_core/protos.cpp +++ b/src/mir_core/protos.cpp @@ -85,8 +85,8 @@ MIR_CORE_DLL(INT_PTR) ProtoCallService(const char *szModule, const char *szServi return false;
char str[MAXMODULELABELLENGTH * 2];
- strncpy_s(str,szModule,strlen(szModule));
- strncat_s(str,szService,strlen(szService));
+ strncpy_s(str, szModule, _TRUNCATE);
+ strncat_s(str, szService, _TRUNCATE);
return CallService(str, wParam, lParam);
}
@@ -98,8 +98,8 @@ MIR_CORE_DLL(int) ProtoServiceExists(const char *szModule, const char *szService return false;
char str[MAXMODULELABELLENGTH * 2];
- strncpy_s(str, szModule, strlen(szModule));
- strncat_s(str, szService, strlen(szService));
+ strncpy_s(str, szModule, _TRUNCATE);
+ strncat_s(str, szService, _TRUNCATE);
return ServiceExists(str);
}
@@ -123,16 +123,16 @@ MIR_CORE_DLL(void) ProtoDestructor(PROTO_INTERFACE *pThis) MIR_CORE_DLL(void) ProtoCreateService(PROTO_INTERFACE *pThis, const char* szService, ProtoServiceFunc serviceProc)
{
char str[MAXMODULELABELLENGTH * 2];
- strncpy_s(str, pThis->m_szModuleName, strlen(pThis->m_szModuleName));
- strncat_s(str, szService, strlen(szService));
+ strncpy_s(str, pThis->m_szModuleName, _TRUNCATE);
+ strncat_s(str, szService, _TRUNCATE);
::CreateServiceFunctionObj(str, (MIRANDASERVICEOBJ)*(void**)&serviceProc, pThis);
}
MIR_CORE_DLL(void) ProtoCreateServiceParam(PROTO_INTERFACE *pThis, const char* szService, ProtoServiceFuncParam serviceProc, LPARAM lParam)
{
char str[MAXMODULELABELLENGTH * 2];
- strncpy_s(str, pThis->m_szModuleName, strlen(pThis->m_szModuleName));
- strncat_s(str, szService, strlen(szService));
+ strncpy_s(str, pThis->m_szModuleName, _TRUNCATE);
+ strncat_s(str, szService, _TRUNCATE);
::CreateServiceFunctionObjParam(str, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, pThis, lParam);
}
@@ -144,21 +144,21 @@ MIR_CORE_DLL(void) ProtoHookEvent(PROTO_INTERFACE *pThis, const char* szEvent, P MIR_CORE_DLL(HANDLE) ProtoCreateHookableEvent(PROTO_INTERFACE *pThis, const char* szName)
{
char str[MAXMODULELABELLENGTH * 2];
- strncpy_s(str, pThis->m_szModuleName, strlen(pThis->m_szModuleName));
- strncat_s(str, szName, strlen(szName));
+ strncpy_s(str, pThis->m_szModuleName, _TRUNCATE);
+ strncat_s(str, szName, _TRUNCATE);
return CreateHookableEvent(str);
}
MIR_CORE_DLL(void) ProtoForkThread(PROTO_INTERFACE *pThis, ProtoThreadFunc pFunc, void *param)
{
UINT threadID;
- CloseHandle((HANDLE)::mir_forkthreadowner((pThreadFuncOwner) *(void**)&pFunc, pThis, param, &threadID));
+ CloseHandle((HANDLE)::mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, pThis, param, &threadID));
}
MIR_CORE_DLL(HANDLE) ProtoForkThreadEx(PROTO_INTERFACE *pThis, ProtoThreadFunc pFunc, void *param, UINT* threadID)
{
UINT lthreadID;
- return (HANDLE)::mir_forkthreadowner((pThreadFuncOwner) *(void**)&pFunc, pThis, param, threadID ? threadID : <hreadID);
+ return (HANDLE)::mir_forkthreadowner((pThreadFuncOwner)*(void**)&pFunc, pThis, param, threadID ? threadID : <hreadID);
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/modules/chat/chat_opts.cpp b/src/modules/chat/chat_opts.cpp index ffcd82d6d9..428d1e72f8 100644 --- a/src/modules/chat/chat_opts.cpp +++ b/src/modules/chat/chat_opts.cpp @@ -124,7 +124,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (tszFace == NULL)
lstrcpy(lf->lfFaceName, FO.szDefFace);
else
- _tcsncpy_s(lf->lfFaceName, SIZEOF(lf->lfFaceName), tszFace, _TRUNCATE);
+ _tcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
}
}
@@ -136,13 +136,13 @@ void RegisterFonts(void) FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
- _tcsncpy_s(fontid.backgroundGroup, SIZEOF(fontid.backgroundGroup), g_szFontGroup, _TRUNCATE);
- _tcsncpy_s(fontid.group, SIZEOF(fontid.group), g_szFontGroup, _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundGroup, g_szFontGroup, _TRUNCATE);
+ _tcsncpy_s(fontid.group, g_szFontGroup, _TRUNCATE);
for (int i = 0; i < SIZEOF(fontOptionsList); i++, index++) {
FontOptionsList &FO = fontOptionsList[i];
strncpy(fontid.dbSettingsGroup, CHATFONT_MODULE, sizeof(fontid.dbSettingsGroup));
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), FO.szDescr, _TRUNCATE);
+ _tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE);
char idstr[10];
mir_snprintf(idstr, SIZEOF(idstr), "Font%d", index);
@@ -152,25 +152,25 @@ void RegisterFonts(void) switch (i) {
case 18:
case 19:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Nick list background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Nick list background"), _TRUNCATE);
break;
case 17:
if (g_iFontMode == FONTMODE_SKIP)
continue;
if (g_iFontMode == FONTMODE_USE) {
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Message typing area"), _TRUNCATE);
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Message background"), _TRUNCATE);
+ _tcsncpy_s(fontid.name, LPGENT("Message typing area"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Message background"), _TRUNCATE);
FO.defColour = RGB(0, 0, 40);
break;
}
- _tcsncpy_s(fontid.name, SIZEOF(fontid.name), LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
+ _tcsncpy_s(fontid.name, LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
FO.szDefFace = _T("Webdings");
FO.defColour = RGB(170, 170, 170);
FO.defCharset = SYMBOL_CHARSET;
// fall through
default:
- _tcsncpy_s(fontid.backgroundName, SIZEOF(fontid.backgroundName), LPGENT("Group chat log background"), _TRUNCATE);
+ _tcsncpy_s(fontid.backgroundName, LPGENT("Group chat log background"), _TRUNCATE);
break;
}
_tcsncpy(fontid.deffontsettings.szFace, FO.szDefFace, SIZEOF(fontid.deffontsettings.szFace));
diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index 211e913d83..7363c4b36f 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -232,7 +232,7 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam) if (si->iType == GCW_SERVER)
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("Server: %s"), si->ptszName);
else
- _tcsncpy_s(szTemp, SIZEOF(szTemp), si->ptszName, _TRUNCATE);
+ _tcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
si->hContact = ci.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
db_set_s(si->hContact, si->pszModule, "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
diff --git a/src/modules/chat/clist.cpp b/src/modules/chat/clist.cpp index a9e55d5fa6..d4de18e515 100644 --- a/src/modules/chat/clist.cpp +++ b/src/modules/chat/clist.cpp @@ -27,7 +27,7 @@ MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDi TCHAR pszGroup[50]; *pszGroup = '\0';
ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
if (groupName)
- _tcsncpy_s(pszGroup, SIZEOF(pszGroup), groupName, _TRUNCATE);
+ _tcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
_tcscpy(pszGroup, _T("Chat rooms"));
diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index dd74d42f1a..284753c0b4 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -744,7 +744,7 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime) // we have to reparse the filename
TCHAR *tszNow = ci.MakeTimeStamp(_T("%a%d%m%Y"), tTime); // once a day
if (_tcscmp(tszOldTimeStamp, tszNow)) {
- _tcsncpy_s(tszOldTimeStamp, 30, tszNow, _TRUNCATE);
+ _tcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
}
diff --git a/src/modules/database/database.cpp b/src/modules/database/database.cpp index 58112c2ac4..9ede9ce6e9 100644 --- a/src/modules/database/database.cpp +++ b/src/modules/database/database.cpp @@ -52,9 +52,9 @@ static void fillProfileName(const TCHAR* ptszFileName) else
p++;
- _tcsncpy_s(g_profileName, SIZEOF(g_profileName), p, _TRUNCATE);
+ _tcsncpy_s(g_profileName, p, _TRUNCATE);
- _tcsncpy_s(g_shortProfileName, SIZEOF(g_shortProfileName), p, _TRUNCATE);
+ _tcsncpy_s(g_shortProfileName, p, _TRUNCATE);
TCHAR *pos = _tcsrchr(g_shortProfileName, '.');
if (lstrcmpi(pos, _T(".dat")) == 0)
*pos = 0;
diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 51a8a4f3e9..20bbf3680d 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -97,7 +97,7 @@ static void FillContactList(HWND hList) SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem); // Enter text to SubItems
LvItem.iSubItem = 2; // protocol
- _tcsncpy_s(buff, SIZEOF(buff), (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
+ _tcsncpy_s(buff, (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
ListView_SetItem(hList, &LvItem);
}
else {
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 2a4bcaa530..0bd1e79383 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -178,7 +178,7 @@ static __forceinline char *GetPathVarX(char *, int code) switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, SIZEOF(szFullPath), tszAvatarRoot, _TRUNCATE);
+ _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
@@ -262,7 +262,7 @@ static __forceinline TCHAR *GetPathVarX(TCHAR *, int code) switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, SIZEOF(szFullPath), tszAvatarRoot, _TRUNCATE);
+ _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, SIZEOF(szFullPath), _T("%s\\%s\\AvatarCache"), g_profileDir, g_shortProfileName);
break;
@@ -434,7 +434,7 @@ static int OnFoldersChanged(WPARAM, LPARAM) TCHAR tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar));
+ _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
return 0;
}
@@ -444,7 +444,7 @@ void InitPathVar() if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
TCHAR tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, SIZEOF(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, SIZEOF(tszAvatarRoot), tmpVar, SIZEOF(tmpVar));
+ _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
}
}
|