diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-23 17:49:58 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-05-23 17:49:58 +0000 |
commit | 6fcfba2c46a456677b5825a899469ba4e8905448 (patch) | |
tree | b4b6f6f9001b8609998a815ec1c7c92aa30b287e | |
parent | 24bed968f1e96aa4598d8dbe3a6e8a34dded3dc2 (diff) |
replace strncpy to mir_strncpy
git-svn-id: http://svn.miranda-ng.org/main/trunk@13785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
125 files changed, 307 insertions, 307 deletions
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 18659fec9c..021e718ee4 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -582,10 +582,10 @@ int CreateFrame() SendMessage(hwnd_plugin, WMU_INITIALIZE, 0, 0);
font_id.cbSize = sizeof(font_id);
- strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group));
- strncpy(font_id.name, LPGEN("Alarm reminders"), sizeof(font_id.name));
- strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup));
- strncpy(font_id.prefix, "Font", sizeof(font_id.prefix));
+ mir_strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group));
+ mir_strncpy(font_id.name, LPGEN("Alarm reminders"), sizeof(font_id.name));
+ mir_strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup));
+ mir_strncpy(font_id.prefix, "Font", sizeof(font_id.prefix));
font_id.order = 0;
FontRegister(&font_id);
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 97e20e9dc8..1140b09658 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -384,7 +384,7 @@ LRESULT CALLBACK ListenWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara if (!db_get_s(NULL, MOD_NAME, "password", &dbVar)) {
g_fPassRequested = true;
- strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
+ mir_strncpy(g_password, dbVar.pszVal, MAXPASSLEN);
db_free(&dbVar);
int res = DialogBox(g_hInstance, (MAKEINTRESOURCE(IDD_PASSDIALOGNEW)), GetForegroundWindow(), DlgStdInProc);
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.h b/plugins/ClientChangeNotify/src/CommonLibs/CString.h index b2a1c4accf..12e94ca80a 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/CString.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.h @@ -37,7 +37,7 @@ __inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpS __inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);}
__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);}
__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);}
-__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);}
+__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return mir_strncpy(lpString1, lpString2, Len);}
__inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);}
__inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);}
__inline LPWSTR My_strlwr(LPWSTR lpString) {return _wcslwr(lpString);}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index c066d54371..add59df1ed 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -2011,7 +2011,7 @@ void FS_RegisterFonts() { FontIDT fid = { sizeof(fid) }; _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group)); - strncpy(fid.dbSettingsGroup, "CLC", 5); + mir_strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; HDC hdc = GetDC(NULL); @@ -2032,7 +2032,7 @@ void FS_RegisterFonts() char idstr[10]; mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); - strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); + mir_strncpy(fid.prefix, idstr, SIZEOF(fid.prefix)); fid.order = i; FontRegisterT(&fid); } @@ -2042,34 +2042,34 @@ void FS_RegisterFonts() ColourIDT colourid = {0}; colourid.cbSize = sizeof(colourid); colourid.order = 0; - strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); + mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); - strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "BkColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); _tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); + mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); - strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); - strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); + mir_strncpy(colourid.dbSettingsGroup, "CLUI", sizeof(colourid.dbSettingsGroup)); + mir_strncpy(colourid.setting, "clr_frameborder", sizeof(colourid.setting)); _tcsncpy(colourid.name, LPGENT("Embedded frames border"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = RGB(40, 40, 40); diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index bf285973c1..2b82577b11 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -774,7 +774,7 @@ void IMG_ReadItem(const char *itemname, const char *szFileName) done_with_glyph:
- strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName));
+ mir_strncpy(tmpItem.szName, &itemname[1], sizeof(tmpItem.szName));
tmpItem.szName[sizeof(tmpItem.szName) - 1] = 0;
_splitpath(szFileName, szDrive, szPath, NULL, NULL);
mir_snprintf(szFinalName, SIZEOF(szFinalName), "%s\\%s\\%s", szDrive, szPath, buffer);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index d18dddb6d1..c168e671fe 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -447,7 +447,7 @@ void UpdateFilters() szBuf = (char *)malloc(iLen + 1);
SendDlgItemMessageA(clvmHwnd, IDC_VIEWMODES, LB_GETTEXT, clvm_curItem, (LPARAM)szBuf);
- strncpy(g_szModename, szBuf, sizeof(g_szModename));
+ mir_strncpy(g_szModename, szBuf, sizeof(g_szModename));
g_szModename[sizeof(g_szModename) - 1] = 0;
mir_snprintf(szTemp, SIZEOF(szTemp), Translate("Current view mode: %s"), g_szModename);
SetDlgItemTextA(clvmHwnd, IDC_CURVIEWMODE2, szTemp);
@@ -1051,7 +1051,7 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_PF", 246, name);
if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) {
if (mir_strlen(dbv.pszVal) >= 2) {
- strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
+ mir_strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0;
cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS;
}
@@ -1084,11 +1084,11 @@ void ApplyViewMode(const char *name) DWORD timerexpire;
mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_OPT", 246, name);
timerexpire = LOWORD(cfg::getDword(CLVM_MODULE, szSetting, 0));
- strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
+ mir_strncpy(cfg::dat.old_viewmode, cfg::dat.current_viewmode, 256);
cfg::dat.old_viewmode[255] = 0;
SetTimer(g_hwndViewModeFrame, TIMERID_VIEWMODEEXPIRE, timerexpire * 1000, NULL);
}
- strncpy(cfg::dat.current_viewmode, name, 256);
+ mir_strncpy(cfg::dat.current_viewmode, name, 256);
cfg::dat.current_viewmode[255] = 0;
if (cfg::dat.filterFlags & CLVM_USELASTMSG) {
diff --git a/plugins/CmdLine/MimCmd/src/commands.cpp b/plugins/CmdLine/MimCmd/src/commands.cpp index 2cbdfe7430..5154c0012b 100644 --- a/plugins/CmdLine/MimCmd/src/commands.cpp +++ b/plugins/CmdLine/MimCmd/src/commands.cpp @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. inline char *STRNCPY(char *output, const char *input, size_t size)
{
- char *res = strncpy(output, input, size);
+ char *res = mir_strncpy(output, input, size);
output[size - 1] = 0;
return res;
diff --git a/plugins/CmdLine/src/utils.cpp b/plugins/CmdLine/src/utils.cpp index b7dce2a279..c954533e01 100644 --- a/plugins/CmdLine/src/utils.cpp +++ b/plugins/CmdLine/src/utils.cpp @@ -134,7 +134,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0;
size_t tmp = mir_strlen(dbv.pszVal);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, dbv.pszVal, len);
+ mir_strncpy(szResult, dbv.pszVal, len);
szResult[len] = '\0';
mir_free(dbv.pszVal);
}
@@ -144,7 +144,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName {
size_t tmp = mir_strlen(szError);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, szError, len);
+ mir_strncpy(szResult, szError, len);
szResult[len] = '\0';
}
else{
@@ -440,7 +440,7 @@ RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, inline char *STRNCPY(char *output, const char *input, size_t size)
{
- char *res = strncpy(output, input, size);
+ char *res = mir_strncpy(output, input, size);
output[size - 1] = 0;
return res;
diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 8cd63e612a..145478a702 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -86,7 +86,7 @@ BOOL CALLBACK LoadedModulesFind64(LPCSTR ModuleName, DWORD64 ModuleBase, ULONG M if ((DWORD)(data->Offset - ModuleBase) < ModuleSize) {
const size_t len = SIZEOF(data->pModule->ModuleName);
- strncpy(data->pModule->ModuleName, ModuleName, len);
+ mir_strncpy(data->pModule->ModuleName, ModuleName, len);
data->pModule->ModuleName[len - 1] = 0;
data->pModule->BaseOfImage = ModuleBase;
diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index 7e331f37ce..8554586a42 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -170,7 +170,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) szRedirUrl = (char*)mir_realloc(szRedirUrl,
rlen + mir_strlen(nlhrReply->headers[i].szValue) * 3 + 1);
- strncpy(szRedirUrl, szUrl, rlen);
+ mir_strncpy(szRedirUrl, szUrl, rlen);
mir_strcpy(szRedirUrl + rlen, nlhrReply->headers[i].szValue);
nlhr.szUrl = szRedirUrl;
diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 1e580ba6a4..c58d9b8cae 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -127,7 +127,7 @@ void copyModuleMenuItem(char* module, MCONTACT hContact) {
ModuleAndContact *mac = (ModuleAndContact *)mir_calloc(sizeof(ModuleAndContact));
mac->hContact = hContact;
- strncpy(mac->module, module, 255);
+ mir_strncpy(mac->module, module, 255);
CreateDialogParamW(hInst, MAKEINTRESOURCEW(IDD_COPY_MOD), 0, copyModDlgProc, (LPARAM)mac);
}
\ No newline at end of file diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 9c07ce46b7..99877ae7ce 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -314,19 +314,19 @@ void importSettings(MCONTACT hContact, char *importstring) p2 = strrchr(&importstring[i], '}*');
if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szUID)) {
- strncpy(szUID, p1 + 1, p2 - p1 - 2);
+ mir_strncpy(szUID, p1 + 1, p2 - p1 - 2);
p1 = strrchr(&importstring[i], ')*<');
p2 = strrchr(&importstring[i], '>*{');
if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(uid)) {
- strncpy(uid, p1 + 1, p2 - p1 - 3);
+ mir_strncpy(uid, p1 + 1, p2 - p1 - 3);
p1 = strrchr(&importstring[i], ' *(');
p2 = strrchr(&importstring[i], ')*<');
if (p1 && p2 && p1 + 3 < p2 && p2 - p1 < SIZEOF(szProto)) {
- strncpy(szProto, p1 + 1, p2 - p1 - 3);
+ mir_strncpy(szProto, p1 + 1, p2 - p1 - 3);
char *protouid = (char*)CallProtoService(szProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);
if ((INT_PTR)protouid != CALLSERVICE_NOTFOUND) {
@@ -558,7 +558,7 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) if (!mir_tstrcmp(szFileNames, "") == 0) {
if ((DWORD)mir_strlen(szFileNames) < offset) {
index += offset;
- strncpy(szPath, szFileNames, offset);
+ mir_strncpy(szPath, szFileNames, offset);
mir_strcat(szPath, "\\");
}
diff --git a/plugins/DbEditorPP/src/headers.h b/plugins/DbEditorPP/src/headers.h index 425f14ec61..17f729c89b 100644 --- a/plugins/DbEditorPP/src/headers.h +++ b/plugins/DbEditorPP/src/headers.h @@ -76,7 +76,7 @@ extern MCONTACT hRestore; #define WM_FINDITEM (WM_USER + 1) // onyl for the main window, wparam is ItemIfno* lparam is 0
#define mir_strlen(ptr) ((ptr == NULL) ? 0 : (int)mir_strlen(ptr))
-#define mir_strncpy(dst, src, len) strncpy(dst, src, len)[len - 1] = 0;
+#define mir_strncpy(dst, src, len) mir_strncpy(dst, src, len)[len - 1] = 0;
#define mir_strcmp(ptr1, ptr2) ((ptr1 && ptr2) ? mir_strcmp(ptr1, ptr2) : 1) // (ptr1||ptr2)
#define ListView_SetItemTextW(hwndLV, i, iSubItem_, pszText_) \
diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index b8b97cec80..25c8a7e647 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -258,7 +258,7 @@ int DBGetContactSettingStringStatic(MCONTACT hContact, char *szModule, char *szS {
DBVARIANT dbv;
if (!db_get(hContact, szModule, szSetting, &dbv)) {
- strncpy(value, dbv.pszVal, maxLength);
+ mir_strncpy(value, dbv.pszVal, maxLength);
db_free(&dbv);
return 1;
}
@@ -313,7 +313,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha if (Value && length >= 10 && !GetSetting(hContact, szModule, szSetting, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
- strncpy(Value, dbv.pszVal, length);
+ mir_strncpy(Value, dbv.pszVal, length);
break;
case DBVT_DWORD:
_itoa(dbv.dVal, Value, 10);
@@ -330,7 +330,7 @@ int GetValue(MCONTACT hContact, const char *szModule, const char *szSetting, cha WCHAR *wc = (WCHAR *)_alloca(len * sizeof(WCHAR));
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, wc, len);
WideCharToMultiByte(CP_ACP, 0, wc, -1, sz, len, NULL, NULL);
- strncpy(Value, sz, length);
+ mir_strncpy(Value, sz, length);
break;
}
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index f53edeba5b..febfd93610 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -221,7 +221,7 @@ static int CountFiles( char *szItem ) ( 0 != mir_strcmp( fd.cFileName, ".." )) )
{
char szDirName[MAX_PATH];
- strncpy( szDirName, szItem, MAX_PATH - 1);
+ mir_strncpy( szDirName, szItem, MAX_PATH - 1);
if ( NULL != strstr( szItem, "*.*" ))
{
@@ -263,7 +263,7 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) ( 0 != mir_strcmp( fd.cFileName, ".." )) )
{
char szDirName[MAX_PATH];
- strncpy( szDirName, szItem, MAX_PATH - 1);
+ mir_strncpy( szDirName, szItem, MAX_PATH - 1);
if ( NULL != strstr( szItem, "*.*" ))
{
@@ -284,7 +284,7 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount ) size_t nSize = sizeof(char) * ( mir_strlen( szItem ) + mir_strlen( fd.cFileName ) + sizeof( char ));
char *szFile = (char*) malloc( nSize ) ;
- strncpy( szFile, szItem, nSize - 1);
+ mir_strncpy( szFile, szItem, nSize - 1);
if ( NULL != strstr( szFile, "*.*" ))
{
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 8a93846941..9799101748 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -628,7 +628,7 @@ void RegHotkey(MCONTACT hContact, HWND hwnd) DBVARIANT dbv;
if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return;
- strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
+ mir_strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
db_free( &dbv );
if (szBuf[0] != '\0') {
diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 4447fdece5..b8ec3c4ae9 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -109,7 +109,7 @@ INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) TCHAR buf[MAX_FOLDER_SIZE];
p->Expand(buf, SIZEOF(buf));
- strncpy(data->szPath, _T2A(buf), data->nMaxPathSize);
+ mir_strncpy(data->szPath, _T2A(buf), data->nMaxPathSize);
return 0;
}
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index b2b67837ee..74775c5f2f 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -493,7 +493,7 @@ bool bShowShareNewFileDlg(HWND hwndOwner, STFileShareInfo * pstNewShare) { *(end - (start - (pstNewShare->pszSrvPath+1)) ) = '\0';
int realPathLen = szRealDirectoryEnd - pstNewShare->pszRealPath;
- strncpy(szRealDirectoryEnd, pstNewShare->pszSrvPath+1,
+ mir_strncpy(szRealDirectoryEnd, pstNewShare->pszSrvPath+1,
pstNewShare->dwMaxRealPath - realPathLen - 1);
pstNewShare->pszRealPath[pstNewShare->dwMaxRealPath] = '\0';
@@ -792,7 +792,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara szServPath[0] = '/';
char* fileName = strrchr(szDropedFile, '\\');
if (fileName)
- strncpy(&szServPath[1], fileName+1, MAX_PATH-2);
+ mir_strncpy(&szServPath[1], fileName+1, MAX_PATH-2);
if (CallService(MS_HTTP_ADD_CHANGE_REMOVE, 0, (LPARAM)&stNewShare)) {
MessageBox(NULL, TranslateT("Failed to share new file"), MSG_BOX_TITEL, MB_OK);
@@ -1429,8 +1429,8 @@ void ShowPopupWindow(const char * pszName, const char * pszText, COLORREF ColorB POPUPDATAT *pclData = new POPUPDATAT;
memset(pclData, 0, sizeof(POPUPDATAT));
pclData->lchIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SHARE_NEW_FILE));
- strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !!
- strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1);
+ mir_strncpy(pclData->lpzContactName, pszName, sizeof(pclData->lpzContactName) - 1); // -1 so that there aways will be a null termination !!
+ mir_strncpy(pclData->lpzText, pszText, sizeof(pclData->lpzText) - 1);
pclData->colorBack = ColorBack;
//ppd.colorText = colorText;
pclData->PluginWindowProc = PopupWindowProc;
diff --git a/plugins/HTTPServer/src/HttpUser.cpp b/plugins/HTTPServer/src/HttpUser.cpp index e1398215bc..4c5604ea07 100644 --- a/plugins/HTTPServer/src/HttpUser.cpp +++ b/plugins/HTTPServer/src/HttpUser.cpp @@ -396,8 +396,8 @@ bool CLHttpUser::bProcessGetRequest(char * pszRequest, bool bIsGetCommand) { char* pszRealPath = pclCur->st.pszRealPath;
if (pclCur->bIsDirectory()) {
- strncpy(szRealPath, pclCur->st.pszRealPath, MAX_PATH);
- strncpy(szSrvPath, pclCur->st.pszSrvPath, MAX_PATH);
+ mir_strncpy(szRealPath, pclCur->st.pszRealPath, MAX_PATH);
+ mir_strncpy(szSrvPath, pclCur->st.pszSrvPath, MAX_PATH);
pszRealPath = szRealPath;
pszSrvPath = szSrvPath;
diff --git a/plugins/HTTPServer/src/IndexHTML.cpp b/plugins/HTTPServer/src/IndexHTML.cpp index a2ae11602f..3a0dc74c16 100644 --- a/plugins/HTTPServer/src/IndexHTML.cpp +++ b/plugins/HTTPServer/src/IndexHTML.cpp @@ -62,7 +62,7 @@ bool LoadIndexHTMLTemplate() { char szDestBuf[10000];
char* pszDestBuf = szDestBuf;
- strncpy(pszBuf, szPluginPath, SIZEOF(szBuf)-1);
+ mir_strncpy(pszBuf, szPluginPath, SIZEOF(szBuf)-1);
mir_strncat(pszBuf, szIndexHTMLTemplateFile, SIZEOF(szBuf) - mir_strlen(szBuf));
HANDLE hFile = CreateFile(pszBuf, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
@@ -139,7 +139,7 @@ bool LoadIndexHTMLTemplate() { do {
if (*pszBuf == ',') {
*pszBuf = ':';
- strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH);
+ mir_strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH);
pszDestBuf += MAX_PARAM_LENGTH;
pszParameterBegin = pszBuf + 1;
@@ -152,7 +152,7 @@ bool LoadIndexHTMLTemplate() { break;
*pszBuf = ':';
- strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH);
+ mir_strncpy(pszDestBuf, pszParameterBegin, MAX_PARAM_LENGTH);
pszDestBuf += MAX_PARAM_LENGTH;
*pcParamCount = iParamCount;
@@ -283,7 +283,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, // check if directory exists
char szMask[MAX_PATH];
- strncpy(szMask, pszRealPath, MAX_PATH- 1);
+ mir_strncpy(szMask, pszRealPath, MAX_PATH- 1);
mir_strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask));
WIN32_FIND_DATAA fdFindFileData;
@@ -319,14 +319,14 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, bool bEvenOdd = 0;
bool bKnownFileType = false;
- strncpy(szBuffer, pszSrvPath, SIZEOF(szBuffer)-1);
+ mir_strncpy(szBuffer, pszSrvPath, SIZEOF(szBuffer)-1);
char* pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
*pszTemp = '\0';
pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
- strncpy(szName, pszTemp + 1, SIZEOF(szName)-1);
+ mir_strncpy(szName, pszTemp + 1, SIZEOF(szName)-1);
if (szName[0] == '\0')
mir_strcpy(szName, "my Miranda Webserver");
@@ -470,7 +470,7 @@ bool bCreateIndexHTML(const char * pszRealPath, const char * pszIndexPath, } else {
for (byte i = 0; i < iParamCount; i++) {
char szParam[MAX_PARAM_LENGTH+1];
- strncpy(szParam, pszParam, MAX_PARAM_LENGTH);
+ mir_strncpy(szParam, pszParam, MAX_PARAM_LENGTH);
szParam[MAX_PARAM_LENGTH] = '\0';
char* pszTmp = strchr(szParam, ':');
if (pszTmp)
diff --git a/plugins/HTTPServer/src/IndexXML.cpp b/plugins/HTTPServer/src/IndexXML.cpp index 7de9c2cc8b..d24f76a03e 100644 --- a/plugins/HTTPServer/src/IndexXML.cpp +++ b/plugins/HTTPServer/src/IndexXML.cpp @@ -32,7 +32,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, char* pszSign = strchr(pszSrc, pszReplace);
if (pszSign) {
- strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1);
+ mir_strncpy(szBuffer, pszSrc, SIZEOF(szBuffer)-1);
do {
mir_strcpy(szBuffer + (pszSign - pszSrc), pszNew);
@@ -41,7 +41,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, } while (pszSign = strchr(pszSrc, pszReplace));
- strncpy(pszSrc, szBuffer, MaxLength);
+ mir_strncpy(pszSrc, szBuffer, MaxLength);
pszSrc[MaxLength-1] = '\0';
}
@@ -64,7 +64,7 @@ static void ReplaceSign(char* pszSrc, int MaxLength, const char pszReplace, bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath,
const char * pszSrvPath, DWORD dwRemoteIP) {
char szMask[MAX_PATH+1];
- strncpy(szMask, pszRealPath, MAX_PATH);
+ mir_strncpy(szMask, pszRealPath, MAX_PATH);
mir_strncat(szMask, "*", SIZEOF(szMask) - mir_strlen(szMask));
WIN32_FIND_DATAA fdFindFileData;
@@ -89,20 +89,20 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, DWORD dwBytesWritten = 0;
// Generate Dirname
- strncpy(szBuffer, pszSrvPath, BUFFER_SIZE);
+ mir_strncpy(szBuffer, pszSrvPath, BUFFER_SIZE);
char* pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
*pszTemp = '\0';
pszTemp = strrchr(szBuffer, '/');
if (pszTemp)
- strncpy(szFileName, pszTemp + 1, MAX_PATH);
+ mir_strncpy(szFileName, pszTemp + 1, MAX_PATH);
// Write Header
WriteFile(hFile, szXmlHeader1, sizeof(szXmlHeader1) - 1, &dwBytesWritten, NULL);
// check if a index.xsl exists in the same directory otherwise use the global
- strncpy(szMask, pszRealPath, MAX_PATH);
+ mir_strncpy(szMask, pszRealPath, MAX_PATH);
mir_strncat(szMask, "index.xsl", SIZEOF(szMask) - mir_strlen(szMask));
HANDLE hFileExists = CreateFile(szMask, GENERIC_READ,
@@ -110,10 +110,10 @@ bool bCreateIndexXML(const char * pszRealPath, const char * pszIndexPath, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFileExists == INVALID_HANDLE_VALUE) {
- strncpy(szBuffer, "/index.xsl", BUFFER_SIZE);
+ mir_strncpy(szBuffer, "/index.xsl", BUFFER_SIZE);
} else {
CloseHandle(hFileExists);
- strncpy(szBuffer, "index.xsl", BUFFER_SIZE);
+ mir_strncpy(szBuffer, "index.xsl", BUFFER_SIZE);
}
WriteFile(hFile, szBuffer, (DWORD)mir_strlen(szBuffer), &dwBytesWritten, NULL);
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index 8d9e6aa737..4446898024 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -144,13 +144,13 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod today = mktime(&tm_today);
if (dwFlags & SMF_LOG_USERELATIVEDATE && check >= today) {
- strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1);
+ mir_strncpy(szResult, Translate("Today"), SIZEOF(szResult)-1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
}
else if (dwFlags & SMF_LOG_USERELATIVEDATE && check > (today - 86400)) {
- strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1);
+ mir_strncpy(szResult, Translate("Yesterday"), SIZEOF(szResult)-1);
if (mode == 0) {
mir_strcat(szResult, ",");
}
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 6b1c50d224..3c37db3363 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -217,7 +217,7 @@ void RegisterProtocol(char *proto, TCHAR *account) size_t id = proto_items.size();
proto_items.resize(id+1);
- strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto));
+ mir_strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto));
proto_items[id].proto[SIZEOF(proto_items[id].proto)-1] = 0;
mir_tstrncpy(proto_items[id].account, account, SIZEOF(proto_items[id].account));
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index c8683feba1..a7a421f5af 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -118,7 +118,7 @@ STATUS LNPUBLIC __stdcall EMCallBack (EMRECORD * pData) retPassword = VARARG_GET (pArgs, char *);
fileName = VARARG_GET (pArgs, char *);
ownerName = VARARG_GET (pArgs, char *);
- strncpy(retPassword, settingPassword, mir_strlen(settingPassword)); //set our password
+ mir_strncpy(retPassword, settingPassword, mir_strlen(settingPassword)); //set our password
retPassword[mir_strlen(settingPassword)]='\0';
*retLength = (DWORD)mir_strlen(retPassword);//and his length
return ERR_BSAFE_EXTERNAL_PASSWORD;
@@ -1394,7 +1394,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM lParam) //gives name to protocol module
INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, PLUGINNAME, wParam);
+ mir_strncpy((char*)lParam, PLUGINNAME, wParam);
return 0;
}
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index 91631104cf..a98d9f33bf 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -301,7 +301,7 @@ int StatusMsgExists(MCONTACT hContact) if (statusMsg[i].flag & 8)
mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
else
- strncpy(par, statusMsg[i].name, SIZEOF(par)-1);
+ mir_strncpy(par, statusMsg[i].name, SIZEOF(par)-1);
LPSTR msg = db_get_sa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
@@ -607,7 +607,7 @@ INT_PTR onCopyID(WPARAM wparam, LPARAM lparam) mir_snprintf(buffer, SIZEOF(buffer), "%s: %s", szProto, szID);
}
else
- strncpy(buffer, szID, SIZEOF(buffer)-1);
+ mir_strncpy(buffer, szID, SIZEOF(buffer)-1);
CopyToClipboard((HWND)lparam, buffer, 0);
if (CTRL_IS_PRESSED && bPopupService)
@@ -632,7 +632,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam, LPARAM lparam) if (statusMsg[i].flag & 8)
mir_snprintf(par, SIZEOF(par), "%s/%s", module, statusMsg[i].name);
else
- strncpy(par, statusMsg[i].name, SIZEOF(par) - 1);
+ mir_strncpy(par, statusMsg[i].name, SIZEOF(par) - 1);
LPTSTR msg = db_get_tsa(hContact, (statusMsg[i].module) ? statusMsg[i].module : module, par);
if (msg) {
diff --git a/plugins/MirOTR/src/dbfilter.cpp b/plugins/MirOTR/src/dbfilter.cpp index b3078c0c8d..55ca91add0 100644 --- a/plugins/MirOTR/src/dbfilter.cpp +++ b/plugins/MirOTR/src/dbfilter.cpp @@ -90,7 +90,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, options.prefix, prefixlen); + mir_strncpy(newmsg, options.prefix, prefixlen); mir_strncat(newmsg, msg, alloclen - mir_strlen(newmsg)); // append additional data if (datalen) { @@ -129,7 +129,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen+datalen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, prefix, prefixlen); + mir_strncpy(newmsg, prefix, prefixlen); mir_strncat(newmsg, msg, alloclen + datalen - mir_strlen(newmsg)); wchar_t *p = (wchar_t*) newmsg + (msglen + prefixlen + 1); wcsncpy(p, prefixw, prefixlenw); @@ -157,7 +157,7 @@ int OnDatabaseEventPreAdd(WPARAM hContact, LPARAM lParam) newmsg = (char*)mir_alloc(alloclen+datalen); memset(newmsg, 0, alloclen+datalen); - strncpy(newmsg, prefix, prefixlen); + mir_strncpy(newmsg, prefix, prefixlen); mir_strncat(newmsg, msg, msglen - mir_strlen(newmsg)); mir_free(prefix); // append additional data diff --git a/plugins/MirOTR/src/striphtml.cpp b/plugins/MirOTR/src/striphtml.cpp index a7d84b69c4..58f57c0c87 100644 --- a/plugins/MirOTR/src/striphtml.cpp +++ b/plugins/MirOTR/src/striphtml.cpp @@ -9,7 +9,7 @@ void starttag_cb (void *cbdata, ekhtml_string_t *tag, ekhtml_attr_t *attrs) { case 'A':
for(ekhtml_attr_t *attr=attrs; attr; attr=attr->next) {
if (_strnicmp(attr->name.str, "href", attr->name.len)==0) {
- data->stack.push(strncpy((char*)mir_calloc(attr->val.len+1), attr->val.str, attr->val.len));
+ data->stack.push(mir_strncpy((char*)mir_calloc(attr->val.len+1), attr->val.str, attr->val.len));
break;
}
}
diff --git a/plugins/NewAwaySysMod/src/CString.h b/plugins/NewAwaySysMod/src/CString.h index b2a1c4accf..12e94ca80a 100644 --- a/plugins/NewAwaySysMod/src/CString.h +++ b/plugins/NewAwaySysMod/src/CString.h @@ -37,7 +37,7 @@ __inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpS __inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);}
__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);}
__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);}
-__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);}
+__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return mir_strncpy(lpString1, lpString2, Len);}
__inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);}
__inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);}
__inline LPWSTR My_strlwr(LPWSTR lpString) {return _wcslwr(lpString);}
diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 872fa7b141..e282fe17b1 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2246,8 +2246,8 @@ void InitCheck() ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; - strncpy(cap.name, "GPG Key AutoExchange", MAX_CAPNAME); - strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); + mir_strncpy(cap.name, "GPG Key AutoExchange", MAX_CAPNAME); + mir_strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); for(int i = 0; i < count; i++) if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) @@ -2261,8 +2261,8 @@ void InitCheck() ICQ_CUSTOMCAP cap; cap.cbSize = sizeof(ICQ_CUSTOMCAP); cap.hIcon = 0; - strncpy(cap.name, "GPG Encrypted FileTransfers", MAX_CAPNAME); - strncpy(cap.caps, "GPGFileTransfer", sizeof(cap.caps)); + mir_strncpy(cap.name, "GPG Encrypted FileTransfers", MAX_CAPNAME); + mir_strncpy(cap.caps, "GPGFileTransfer", sizeof(cap.caps)); for(int i = 0; i < count; i++) if( ProtoServiceExists(accounts[i]->szProtoName, PS_ICQ_ADDCAPABILITY)) diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 3c6f993507..5cd4560bf6 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -538,7 +538,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) if(uin) { if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { ICQ_CUSTOMCAP cap = {0}; - strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); + mir_strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); if(ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) { CallContactService(ccs->hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); return 0; @@ -835,7 +835,7 @@ int HookSendMsg(WPARAM w, LPARAM l) if(bDebugLog) debuglog<<std::string(time_str()+": info(autoexchange, icq): checking for autoexchange icq capability, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))); ICQ_CUSTOMCAP cap = {0}; - strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); + mir_strncpy(cap.caps, "GPGAutoExchange", sizeof(cap.caps)); if( ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, hContact, (LPARAM)&cap)) { if(bDebugLog) debuglog<<std::string(time_str()+": info(autoexchange, icq): sending key requiest, name: "+toUTF8((TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR))); @@ -917,7 +917,7 @@ int HookSendMsg(WPARAM w, LPARAM l) if(!(dbei->flags & DBEF_SENT) && db_mc_isMeta((MCONTACT)w)) { char tmp[29]; - strncpy(tmp, (char*)dbei->pBlob, 27); + mir_strncpy(tmp, (char*)dbei->pBlob, 27); tmp[28] = '\0'; if(strstr(tmp, "-----BEGIN PGP MESSAGE-----")) { diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index a4d4077ac8..55cc45a1a2 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -544,7 +544,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) if( ProtoServiceExists(proto, PS_ICQ_CHECKCAPABILITY)) { supported_proto = true; ICQ_CUSTOMCAP cap = {0}; - strncpy(cap.caps, "GPGFileTransfer",sizeof(cap.caps)); + mir_strncpy(cap.caps, "GPGFileTransfer",sizeof(cap.caps)); if( ProtoCallService(proto, PS_ICQ_CHECKCAPABILITY, (WPARAM)ccs->hContact, (LPARAM)&cap)) cap_found = true; } diff --git a/plugins/Non-IM Contact/src/namereplacing.cpp b/plugins/Non-IM Contact/src/namereplacing.cpp index 3028cf5f2c..40d6b050fd 100644 --- a/plugins/Non-IM Contact/src/namereplacing.cpp +++ b/plugins/Non-IM Contact/src/namereplacing.cpp @@ -46,8 +46,8 @@ int findWordInString(const char* line, const char* string, int* lengthOfWord, in {
unsigned int i, j = 0;
char word[64] = "", OpenDivider[8], CloseDivider[8];
- strncpy(OpenDivider, "(\"", sizeof(OpenDivider));
- strncpy(CloseDivider, "\")", sizeof(CloseDivider));
+ mir_strncpy(OpenDivider, "(\"", sizeof(OpenDivider));
+ mir_strncpy(CloseDivider, "\")", sizeof(CloseDivider));
/* get the word we r looking for */
if (!strncmp(string, OpenDivider, mir_strlen(OpenDivider))) {
for (i = 2; strncmp(&string[i], CloseDivider, mir_strlen(CloseDivider)); i++) {
@@ -455,8 +455,8 @@ int stringReplacer(const char* oldString, char* newString, MCONTACT hContact) char *fileContents[MAXLINES] = { NULL }, tempString[MAX_STRING_LENGTH];
// setup the variable names
- strncpy(newString, "", sizeof(newString));
- strncpy(var_file, "file(", sizeof(var_file));
+ mir_strncpy(newString, "", sizeof(newString));
+ mir_strncpy(var_file, "file(", sizeof(var_file));
while ((positionInOldString < (int)mir_strlen(oldString)) && (oldString[positionInOldString] != '\0')) {
// load the file... must be first
diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 20ac2bab12..7706a76dcf 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -232,7 +232,7 @@ void RegisterFontServiceFonts() _tcsncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group));
_tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) );
- strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE;
HDC hDC = GetDC(NULL);
@@ -243,7 +243,7 @@ void RegisterFontServiceFonts() {
fontid.order = i;
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
- strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix));
_tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name));
fontid.deffontsettings.colour = fontOptionsList[i].defColour;
@@ -262,7 +262,7 @@ void RegisterFontServiceFonts() colorid.cbSize = sizeof(ColourIDT);
_tcsncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group));
- strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
+ mir_strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup));
colorid.flags = 0;
for (int i = 0; i < SIZEOF(colourOptionsList); i++)
@@ -270,7 +270,7 @@ void RegisterFontServiceFonts() colorid.order = i;
_tcsncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name));
colorid.defcolour = colourOptionsList[i].defColour;
- strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting));
+ mir_strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting));
ColourRegisterT(&colorid);
}
diff --git a/plugins/NotesAndReminders/src/reminders.cpp b/plugins/NotesAndReminders/src/reminders.cpp index 49a8530db7..8af81e76ec 100644 --- a/plugins/NotesAndReminders/src/reminders.cpp +++ b/plugins/NotesAndReminders/src/reminders.cpp @@ -801,7 +801,7 @@ BOOL CheckRemindersAndStart(void) char* S2 = strchr(g_RemindSMS, '@');
char* S1 = (char*)malloc(S2 - g_RemindSMS);
- strncpy(S1, g_RemindSMS, S2 - g_RemindSMS);
+ mir_strncpy(S1, g_RemindSMS, S2 - g_RemindSMS);
S1[S2 - g_RemindSMS]= 0x0;
S2++;
Send(S1, S2, pReminder->Reminder ? pReminder->Reminder : "", NULL);
diff --git a/plugins/RemovePersonalSettings/src/rps.cpp b/plugins/RemovePersonalSettings/src/rps.cpp index d15119b7f9..06082185ae 100644 --- a/plugins/RemovePersonalSettings/src/rps.cpp +++ b/plugins/RemovePersonalSettings/src/rps.cpp @@ -553,7 +553,7 @@ void DeleteFileOrFolder(const char *name) WIN32_FIND_DATAA findData;
HANDLE hwnd = FindFirstFileA(name, &findData);
if (hwnd != INVALID_HANDLE_VALUE) {
- strncpy(tmp, name, sizeof(tmp)-1);
+ mir_strncpy(tmp, name, sizeof(tmp)-1);
strTmp = strrchr(tmp,'\\');
if(strTmp != NULL) {
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 9bf514bd3d..c854ba09d8 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -108,14 +108,14 @@ void RegisterFontServiceFonts() FontIDT fid = { sizeof(fid) };
_tcsncpy_s(fid.group, LPGENT("Messaging"), _TRUNCATE);
_tcsncpy_s(fid.backgroundGroup, LPGENT("Messaging"), _TRUNCATE);
- strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(fid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID;
for (int i = 0; i < SIZEOF(fontOptionsList); i++) {
fid.order = i;
char szTemp[100];
mir_snprintf(szTemp, SIZEOF(szTemp), "SRMFont%d", i);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
+ mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].defColour;
fid.deffontsettings.size = fontOptionsList[i].defSize;
@@ -128,7 +128,7 @@ void RegisterFontServiceFonts() ColourIDT cid = { sizeof(cid) };
_tcsncpy_s(cid.group, LPGENT("Messaging"), _TRUNCATE);
- strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(cid.dbSettingsGroup, SRMMMOD, SIZEOF(fid.dbSettingsGroup));
cid.flags = 0;
for (int i = 0; i < SIZEOF(colourOptionsList); i++) {
cid.order = i;
@@ -138,7 +138,7 @@ void RegisterFontServiceFonts() else
cid.defcolour = colourOptionsList[i].defColour;
- strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting));
+ mir_strncpy(cid.setting, colourOptionsList[i].szSettingName, SIZEOF(cid.setting));
ColourRegisterT(&cid);
}
}
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index eca5257814..6a5044482a 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -28,7 +28,7 @@ LPSTR myDBGetStringDecode(MCONTACT hContact, const char *szModule, const char *s if (!val) return NULL;
size_t len = mir_strlen(val) + 64;
char *buf = (LPSTR)mir_alloc(len);
- strncpy(buf, val, len); mir_free(val);
+ mir_strncpy(buf, val, len); mir_free(val);
return buf;
}
@@ -36,7 +36,7 @@ int myDBWriteStringEncode(MCONTACT hContact, const char *szModule, const char *s {
int len = (int)mir_strlen(val) + 64;
char *buf = (LPSTR)alloca(len);
- strncpy(buf, val, len);
+ mir_strncpy(buf, val, len);
int ret = db_set_s(hContact, szModule, szSetting, buf);
return ret;
}
diff --git a/plugins/SecureIM/src/crypt_lists.cpp b/plugins/SecureIM/src/crypt_lists.cpp index 28557fd1af..29db82daed 100644 --- a/plugins/SecureIM/src/crypt_lists.cpp +++ b/plugins/SecureIM/src/crypt_lists.cpp @@ -30,7 +30,7 @@ void loadSupportedProtocols() SupPro *p = (SupPro*)mir_calloc(sizeof(SupPro));
p->name = mir_strdup(protos[i]->szModuleName);
if (szNames && p->name) {
- char tmp[128]; strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp));
+ char tmp[128]; mir_strncpy(tmp, p->name, sizeof(tmp) - 1); mir_strncat(tmp, ":", SIZEOF(tmp) - mir_strlen(tmp));
LPSTR szName = strstr(szNames, tmp);
if (szName) {
szName = strchr(szName, ':');
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index 6d3362a52a..a3b37f6819 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -130,11 +130,11 @@ static int onModulesLoaded(WPARAM, LPARAM) else {
LPSTR tmp = db_get_sa(0, MODULENAME, "pgpPubRing");
if (tmp) {
- strncpy(PubRingPath, tmp, sizeof(PubRingPath));
+ mir_strncpy(PubRingPath, tmp, sizeof(PubRingPath));
mir_free(tmp);
}
if (tmp = db_get_sa(0, MODULENAME, "pgpSecRing")) {
- strncpy(SecRingPath, tmp, sizeof(SecRingPath));
+ mir_strncpy(SecRingPath, tmp, sizeof(SecRingPath));
mir_free(tmp);
}
if (PubRingPath[0] && SecRingPath[0]) {
@@ -163,11 +163,11 @@ static int onModulesLoaded(WPARAM, LPARAM) LPSTR tmp = db_get_sa(0, MODULENAME, "gpgExec");
if (tmp) {
- strncpy(gpgexec, tmp, sizeof(gpgexec)-1);
+ mir_strncpy(gpgexec, tmp, sizeof(gpgexec)-1);
mir_free(tmp);
}
if (tmp = db_get_sa(0, MODULENAME, "gpgHome")) {
- strncpy(gpghome, tmp, sizeof(gpghome)-1);
+ mir_strncpy(gpghome, tmp, sizeof(gpghome)-1);
mir_free(tmp);
}
diff --git a/plugins/SecureIM/src/options.cpp b/plugins/SecureIM/src/options.cpp index 157ac96f8d..5f95f66817 100644 --- a/plugins/SecureIM/src/options.cpp +++ b/plugins/SecureIM/src/options.cpp @@ -1400,14 +1400,14 @@ void setListViewIcon(HWND hLV, UINT iItem, pUinKey ptr) void setListViewMode(HWND hLV, UINT iItem, UINT iMode)
{
char tmp[256];
- strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1);
+ mir_strncpy(tmp, Translate(sim231[iMode]), sizeof(tmp)-1);
LV_SetItemTextA(hLV, iItem, 2, tmp);
}
void setListViewStatus(HWND hLV, UINT iItem, UINT iStatus)
{
char tmp[128];
- strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1);
+ mir_strncpy(tmp, Translate(sim232[iStatus]), sizeof(tmp)-1);
LV_SetItemTextA(hLV, iItem, 3, tmp);
}
@@ -1421,7 +1421,7 @@ UINT getListViewPSK(HWND hLV, UINT iItem) void setListViewPSK(HWND hLV, UINT iItem, UINT iStatus)
{
char str[128];
- strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1);
+ mir_strncpy(str, (iStatus) ? Translate(sim206) : "-", sizeof(str)-1);
LV_SetItemTextA(hLV, iItem, 4, str);
}
@@ -1435,7 +1435,7 @@ UINT getListViewPUB(HWND hLV, UINT iItem) void setListViewPUB(HWND hLV, UINT iItem, UINT iStatus)
{
char str[128];
- strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1);
+ mir_strncpy(str, (iStatus) ? Translate(sim233) : "-", sizeof(str)-1);
LV_SetItemTextA(hLV, iItem, 4, str);
LPSTR sha = NULL;
diff --git a/plugins/SecureIM/src/svcs_proto.cpp b/plugins/SecureIM/src/svcs_proto.cpp index e254f7b81e..bdfe43dfcd 100644 --- a/plugins/SecureIM/src/svcs_proto.cpp +++ b/plugins/SecureIM/src/svcs_proto.cpp @@ -865,7 +865,7 @@ int __cdecl onProtoAck(WPARAM wParam, LPARAM lParam) LPSTR p = strrchr(file_out, '.');
LPSTR x = strrchr(file_out, '\\');
if (p > x) {
- strncpy(buf, p, sizeof(buf)-1);
+ mir_strncpy(buf, p, sizeof(buf)-1);
pos = p;
}
for (int i = 1; i < 10000; i++) {
diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index ce2391d99e..c8421bf359 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -642,7 +642,7 @@ int UpdateValues(WPARAM hContact, LPARAM lparam) if (p == NULL) {
p = (logthread_info*)mir_calloc(sizeof(logthread_info));
p->hContact = hContact;
- strncpy(p->sProtoName, cws->szModule, MAXMODULELABELLENGTH);
+ mir_strncpy(p->sProtoName, cws->szModule, MAXMODULELABELLENGTH);
arContacts.insert(p);
mir_forkthread(waitThread, p);
}
@@ -697,7 +697,7 @@ int ModeChange(WPARAM wparam, LPARAM lparam) db_set_dw(NULL, "UserOnline", ack->szModule, GetTickCount());
if (!Miranda_Terminated() && IsWatchedProtocol(ack->szModule)) {
logthread_info *info = (logthread_info *)malloc(sizeof(logthread_info));
- strncpy(info->sProtoName, courProtoName, MAXMODULELABELLENGTH);
+ mir_strncpy(info->sProtoName, courProtoName, MAXMODULELABELLENGTH);
info->hContact = 0;
info->currStatus = 0;
diff --git a/plugins/Sessions/Src/Utils.cpp b/plugins/Sessions/Src/Utils.cpp index 87afd484ab..11b40bf93c 100644 --- a/plugins/Sessions/Src/Utils.cpp +++ b/plugins/Sessions/Src/Utils.cpp @@ -137,7 +137,7 @@ void AddInSessionOrder(MCONTACT hContact, int mode, int ordernum, int writemode) len = 20;
char *temp2 = (char*)_alloca(len - 1);
- strncpy(temp2, szValue, len - 2);
+ mir_strncpy(temp2, szValue, len - 2);
temp2[len - 2] = '\0';
char *temp = (char*)_alloca(len + 1);
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 9162be6f97..7ad7daf798 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -69,13 +69,13 @@ void log2file(const char *fmt, ...) HANDLE hFile = CreateFileA("simplestatusmsg.log", GENERIC_WRITE, FILE_SHARE_READ, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
SetFilePointer(hFile, 0, 0, FILE_END);
- strncpy(szText, "[\0", SIZEOF(szText));
+ mir_strncpy(szText, "[\0", SIZEOF(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
GetTimeFormatA(LOCALE_USER_DEFAULT, 0, NULL, NULL, szText, SIZEOF(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
- strncpy(szText, "] \0", SIZEOF(szText));
+ mir_strncpy(szText, "] \0", SIZEOF(szText));
va_start(va, fmt);
mir_vsnprintf(szText + mir_strlen(szText), SIZEOF(szText) - mir_strlen(szText), fmt, va);
@@ -83,7 +83,7 @@ void log2file(const char *fmt, ...) WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
- strncpy(szText, "\n\0", SIZEOF(szText));
+ mir_strncpy(szText, "\n\0", SIZEOF(szText));
WriteFile(hFile, szText, (DWORD)mir_strlen(szText), &dwBytesWritten, NULL);
CloseHandle(hFile);
diff --git a/plugins/SmileyAdd/src/dlgboxsubclass.cpp b/plugins/SmileyAdd/src/dlgboxsubclass.cpp index fb3ecbb303..6b0179125e 100644 --- a/plugins/SmileyAdd/src/dlgboxsubclass.cpp +++ b/plugins/SmileyAdd/src/dlgboxsubclass.cpp @@ -305,7 +305,7 @@ static void MsgWndDetect(HWND hwndDlg, MCONTACT hContact, msgData* datm) // Get the protocol for this contact to display correct smileys.
char *protonam = GetContactProto(DecodeMetaContact(dat.hContact));
if (protonam) {
- strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName));
+ mir_strncpy(dat.ProtocolName, protonam, sizeof(dat.ProtocolName));
dat.ProtocolName[sizeof(dat.ProtocolName)-1] = 0;
}
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index 338b84d279..46138ce186 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -98,7 +98,7 @@ bool InternetDownloadFile(const char *szUrl, char* szDest, HANDLE &hHttpDwnl) szRedirUrl = (char*)mir_realloc(szRedirUrl, rlen + mir_strlen(nlhrReply->headers[i].szValue)*3 + 1);
- strncpy(szRedirUrl, szUrl, rlen);
+ mir_strncpy(szRedirUrl, szUrl, rlen);
mir_strcpy(szRedirUrl+rlen, nlhrReply->headers[i].szValue);
nlhr.szUrl = szRedirUrl;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index ba907461ab..8c1f901f5d 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -908,7 +908,7 @@ int AddContactTextBox(MCONTACT hContact, HWND hwnd, char *name, BOOL srmm, HWND dlg->hContact = hContact;
dlg->hwnd = hwnd;
- strncpy(dlg->name, name, sizeof(dlg->name));
+ mir_strncpy(dlg->name, name, sizeof(dlg->name));
dlg->enabled = db_get_b(dlg->hContact, MODULE_NAME, dlg->name, 1);
dlg->srmm = srmm;
diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 668b2cceea..2242d866f9 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -802,7 +802,7 @@ static void CheckContinueslyFunction(void *) while ((*end != ' ') && (*end != '\0')) end++; memset(host, '\0', sizeof(host)); - strncpy(host, start, end - start); + mir_strncpy(host, start, end - start); hostent = gethostbyname(host); if (hostent != NULL) { addr = (DWORD *)(*hostent->h_addr_list); diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 5becbc5910..38df7808a1 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -494,13 +494,13 @@ void RegisterFontServiceFonts() fid.cbSize = sizeof(FontIDT);
cid.cbSize = sizeof(ColourIDT);
- strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
for (int i = 0; i < SIZEOF(IM_fontOptionsList); i++) {
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
LoadMsgDlgFont(FONTSECTION_IM, i, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
+ mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
@@ -563,7 +563,7 @@ void RegisterFontServiceFonts() for (int i = 0; i < IPFONTCOUNT; i++) {
LoadMsgDlgFont(FONTSECTION_IP, i + 100, &lf, &fontOptionsList[i].colour, FONTMODULE);
mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i + 100);
- strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
+ mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix));
fid.order = i + 100;
_tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name));
fid.deffontsettings.colour = fontOptionsList[i].colour;
@@ -582,12 +582,12 @@ void RegisterFontServiceFonts() }
_tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group));
- strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup));
+ mir_strncpy(cid.dbSettingsGroup, CHAT_MODULE, SIZEOF(cid.dbSettingsGroup));
for (int i = 0; i <= 7; i++) {
mir_snprintf(szTemp, SIZEOF(szTemp), "NickColor%d", i);
_tcsncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name));
cid.order = i + 1;
- strncpy(cid.setting, szTemp, SIZEOF(cid.setting));
+ mir_strncpy(cid.setting, szTemp, SIZEOF(cid.setting));
switch (i) {
case 5:
cid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
@@ -613,14 +613,14 @@ void RegisterFontServiceFonts() ColourRegisterT(&cid);
// static colors (info panel, tool bar background etc...)
- strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
- strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(fid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(cid.dbSettingsGroup, FONTMODULE, SIZEOF(fid.dbSettingsGroup));
for (int i = 0; i < SIZEOF(_clrs); i++) {
cid.order = _clrs[i].order;
_tcsncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name));
- strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting));
+ mir_strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting));
if (_clrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff);
else
@@ -628,14 +628,14 @@ void RegisterFontServiceFonts() ColourRegisterT(&cid);
}
- strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup));
+ mir_strncpy(cid.dbSettingsGroup, SRMSGMOD_T, SIZEOF(fid.dbSettingsGroup));
// text and background colors for tabs
for (int i = 0; i < SIZEOF(_tabclrs); i++) {
cid.order = _tabclrs[i].order;
_tcsncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group));
_tcsncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name));
- strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting));
+ mir_strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting));
if (_tabclrs[i].def & 0xff000000)
cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff);
else
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 16cf2b8b38..be469c5842 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -813,7 +813,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) cf2.crTextColor = inputcharcolor; cf2.bCharSet = lf.lfCharSet; cf2.crBackColor = dat->inputbg; - strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + mir_strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = 0; cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -830,7 +830,7 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.crTextColor = inputcharcolor; cf2.bCharSet = lf.lfCharSet; - strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE-1); + mir_strncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE-1); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0) | (lf.lfUnderline ? CFE_UNDERLINE : 0) | (lf.lfStrikeOut ? CFE_STRIKEOUT : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index bcc649242e..0cb77c3e32 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -325,14 +325,14 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) CSendLaterJob *job = new CSendLaterJob;
- strncpy(job->szId, szSetting, 20);
+ mir_strncpy(job->szId, szSetting, 20);
job->szId[19] = 0;
job->hContact = hContact;
job->created = atol(&szSetting[1]);
size_t iLen = mir_strlen(szOrig_Utf);
job->sendBuffer = reinterpret_cast<char *>(mir_alloc(iLen + 1));
- strncpy(job->sendBuffer, szOrig_Utf, iLen);
+ mir_strncpy(job->sendBuffer, szOrig_Utf, iLen);
job->sendBuffer[iLen] = 0;
// construct conventional send buffer
@@ -345,7 +345,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) job->pBuf = (PBYTE)mir_calloc(required);
- strncpy((char*)job->pBuf, szAnsi, iLen);
+ mir_strncpy((char*)job->pBuf, szAnsi, iLen);
job->pBuf[iLen] = 0;
if (szWchar)
wcsncpy((wchar_t*)&job->pBuf[iLen + 1], szWchar, mir_wstrlen(szWchar));
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index a0825801b6..46280b0072 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -817,7 +817,7 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename) GetPrivateProfileString(m_szName, _T("Image"), _T("None"), buffer, 500, szFilename);
if (mir_tstrcmp(buffer, _T("None")) || m_dwFlags & IMAGE_GLYPH) {
szFinalName = new TCHAR[MAX_PATH];
- //strncpy(m_szName, &m_szName[1], sizeof(m_szName));
+ //mir_strncpy(m_szName, &m_szName[1], sizeof(m_szName));
//m_szName[sizeof(m_szName) - 1] = 0;
_tsplitpath(szFilename, szDrive, szPath, NULL, NULL);
mir_sntprintf(szFinalName, MAX_PATH, _T("%s\\%s%s"), szDrive, szPath, buffer);
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index a6ac7e8cd9..6fd7cbf805 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -314,11 +314,11 @@ SortedList *ReplaceSmileys(const TCHAR *text, int text_size, const char *protoco char smileyProto[64];
if (protocol == NULL)
- strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
+ mir_strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
else if (mir_strcmp(protocol, META_PROTO) == 0)
- strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
+ mir_strncpy(smileyProto, "tipper", sizeof(smileyProto) - 1);
else
- strncpy(smileyProto, protocol, sizeof(smileyProto) - 1);
+ mir_strncpy(smileyProto, protocol, sizeof(smileyProto) - 1);
// Parse it!
SMADD_BATCHPARSE2 sp = { 0 };
diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 85ca77b699..14d46e1855 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -69,7 +69,7 @@ void CreateDefaultItems() DSListNode *ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode));
_tcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN);
ds_node->ds.type = subst->type;
- strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN);
+ mir_strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN);
ds_node->ds.iTranslateFuncId = subst->iTranslateFuncId;
ds_node->next = opt.dsList;
opt.dsList = ds_node;
@@ -110,7 +110,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
ds->szModuleName[0] = 0;
if (!db_get(0, MODULE_ITEMS, setting, &dbv)) {
- strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN);
+ mir_strncpy(ds->szModuleName, dbv.pszVal, MODULE_NAME_LEN);
ds->szModuleName[MODULE_NAME_LEN - 1] = 0;
db_free(&dbv);
}
@@ -118,7 +118,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) mir_snprintf(setting, SIZEOF(setting), "Setting%d", index);
ds->szSettingName[0] = 0;
if (!db_get(0, MODULE_ITEMS, setting, &dbv)) {
- strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN);
+ mir_strncpy(ds->szSettingName, dbv.pszVal, SETTING_NAME_LEN);
ds->szSettingName[SETTING_NAME_LEN - 1] = 0;
db_free(&dbv);
}
@@ -910,10 +910,10 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA _tcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1);
if (ds_value->ds.type == DVT_DB && subst->szModuleName)
- strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1);
+ mir_strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1);
if (subst->szSettingName)
- strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN - 1);
+ mir_strncpy(ds_value->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN - 1);
ds_value->ds.iTranslateFuncId = subst->iTranslateFuncId;
diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 1396836639..11fa12f1e5 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -338,9 +338,9 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (iXstatus) { char szIconProto[64]; if (mir_strcmp(szProto, META_PROTO) != 0) - strncpy(szIconProto, szProto, sizeof(szIconProto) - 1); + mir_strncpy(szIconProto, szProto, sizeof(szIconProto) - 1); else if (!db_get_s(pwd->hContact, szProto, "XStatusProto", &dbv)) { - strncpy(szIconProto, dbv.pszVal, sizeof(szIconProto) - 1); + mir_strncpy(szIconProto, dbv.pszVal, sizeof(szIconProto) - 1); db_free(&dbv); } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index e1ab66d706..ffd7b749ce 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -74,7 +74,7 @@ void CTooltipNotify::RegisterFonts() {
FontIDT fontId = { sizeof(fontId) };
_tcsncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-1);
- strncpy(fontId.dbSettingsGroup, MODULENAME, SIZEOF(fontId.dbSettingsGroup)-1);
+ mir_strncpy(fontId.dbSettingsGroup, MODULENAME, SIZEOF(fontId.dbSettingsGroup)-1);
fontId.flags = FIDF_DEFAULTVALID;
fontId.deffontsettings.colour = DEF_SETTING_TXTCOLOR;
fontId.deffontsettings.size = -MulDiv(DEF_SETTING_FONT_SIZE, DEF_LOGPIXELSY, 72);
@@ -86,19 +86,19 @@ void CTooltipNotify::RegisterFonts() ColourIDT colorId = { sizeof(colorId) };
_tcsncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-1);
- strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1);
+ mir_strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1);
colorId.flags = 0;
colorId.defcolour = DEF_SETTING_BGCOLOR;
colorId.order = 0;
for (int i=0; i<SIZEOF(s_fontTable); i++) {
_tcsncpy(fontId.name, s_fontTable[i].name, SIZEOF(fontId.name)-1);
- strncpy(fontId.prefix, s_fontTable[i].fontPrefix, SIZEOF(fontId.prefix)-1);
+ mir_strncpy(fontId.prefix, s_fontTable[i].fontPrefix, SIZEOF(fontId.prefix)-1);
_tcsncpy(fontId.backgroundName, s_fontTable[i].name, SIZEOF(fontId.backgroundName)-1);
::FontRegisterT(&fontId);
_tcsncpy(colorId.name, s_fontTable[i].name, SIZEOF(colorId.name)-1);
- strncpy(colorId.setting, s_fontTable[i].clrPrefix, SIZEOF(colorId.setting)-1);
+ mir_strncpy(colorId.setting, s_fontTable[i].clrPrefix, SIZEOF(colorId.setting)-1);
::ColourRegisterT(&colorId);
}
}
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 22caa0e3c2..ec486f50fb 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -455,10 +455,10 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) rq.hDC = hdc;
rq.rcDestRect = rect;
rq.rcClipRect = rect;
- strncpy(rq.szObjectID, "Main,ID=EventArea", sizeof(rq.szObjectID));
+ mir_strncpy(rq.szObjectID, "Main,ID=EventArea", sizeof(rq.szObjectID));
if (CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0))
{
- strncpy(rq.szObjectID, "Main,ID=StatusBar", sizeof(rq.szObjectID));
+ mir_strncpy(rq.szObjectID, "Main,ID=StatusBar", sizeof(rq.szObjectID));
CallService(MS_SKIN_DRAWGLYPH, (WPARAM)&rq, 0);
}
}
diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index 5391b1bcf4..127892a965 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -70,7 +70,7 @@ static void __bcopy(D *dest, const O *orig, size_t len) template<>
static void __bcopy(char *dest, const char *orig, size_t len)
{
- strncpy(dest, orig, len);
+ mir_strncpy(dest, orig, len);
}
template<>
diff --git a/plugins/Variables/src/parse_inet.cpp b/plugins/Variables/src/parse_inet.cpp index c1c6f405ac..d0f128d731 100644 --- a/plugins/Variables/src/parse_inet.cpp +++ b/plugins/Variables/src/parse_inet.cpp @@ -41,7 +41,7 @@ static TCHAR *parseUrlEnc(ARGUMENTSINFO *ai) char hex[8];
memmove(res + cur + 3, res + cur + 1, mir_strlen(res + cur + 1) + 1);
mir_snprintf(hex, SIZEOF(hex), "%%%x", *(res + cur));
- strncpy(res + cur, hex, mir_strlen(hex));
+ mir_strncpy(res + cur, hex, mir_strlen(hex));
cur += mir_strlen(hex);
}
@@ -64,7 +64,7 @@ static TCHAR *parseUrlDec(ARGUMENTSINFO *ai) if ((*(res + cur) == '%') && (mir_strlen(res + cur) >= 3)) {
char hex[8];
memset(hex, '\0', sizeof(hex));
- strncpy(hex, res + cur + 1, 2);
+ mir_strncpy(hex, res + cur + 1, 2);
*(res + cur) = (char)strtol(hex, NULL, 16);
memmove(res + cur + 1, res + cur + 3, mir_strlen(res + cur + 3) + 1);
}
diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 9e636102dd..d28e24549e 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -351,7 +351,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) if (Line[1] != '/') { // if it is not a footer (for old ini)
// save the group name
Temp = (char *)mir_alloc(mir_strlen(Line)+10);
- strncpy(Temp, Line+1, chop-Line-1);
+ mir_strncpy(Temp, Line+1, chop-Line-1);
Temp[chop-Line-1] = 0;
wfree(&Group);
wSetData(&Group, Temp);
@@ -381,7 +381,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) // get the string before '=' (ValName) and after '=' (Value)
ValName = (char *)mir_alloc(mir_strlen(Line)+1);
- strncpy(ValName, Line, Value-Line);
+ mir_strncpy(ValName, Line, Value-Line);
ValName[Value-Line] = 0;
Value++;
ConvertBackslashes(Value);
diff --git a/plugins/Weather/src/weather_svcs.cpp b/plugins/Weather/src/weather_svcs.cpp index b485257601..73bd25a76b 100644 --- a/plugins/Weather/src/weather_svcs.cpp +++ b/plugins/Weather/src/weather_svcs.cpp @@ -90,7 +90,7 @@ INT_PTR WeatherGetCaps(WPARAM wParam, LPARAM lParam) // protocol service function to get weather protocol name
INT_PTR WeatherGetName(WPARAM wParam,LPARAM lParam)
{
- strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1);
+ mir_strncpy((char*)lParam,WEATHERPROTOTEXT,wParam-1);
*((char*)lParam + wParam-1) = 0;
return 0;
}
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index feffb27c1f..ed6169c3d9 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -272,7 +272,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn memset(&tempraw, 0, sizeof(tempraw));
memset(&raw, 0, sizeof(raw));
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ mir_strncpy(tempraw, truncated, SIZEOF(tempraw));
memset(&alertstring, 0, sizeof(alertstring));
memset(&Alerttempstring, 0, sizeof(Alerttempstring));
@@ -562,7 +562,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn disalertpos = 0;
//write selected data to string
- strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos));
+ mir_strncpy(raw, &tempraw[statalertpos], (statalertposend - statalertpos));
raw[(statalertposend - statalertpos)] = '\0';
}
} // end putting data into string
@@ -760,7 +760,7 @@ int ProcessAlerts(MCONTACT hContact, char *truncated, char *tstr, char *contactn }
}
}
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
return wasAlert;
}
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index 67a4ee5a1d..b645cb5e5d 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -386,7 +386,7 @@ void CodetoSymbol(char *truncated) }
truncated[(position + counter) - 1] = Characters[n];
- strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1);
+ mir_strncpy(&truncated[position], &truncated[position + mir_strlen(CharacterCodes[n])] - 1, mir_strlen(&truncated[position]) - 1);
} // end does character code exist?
if (recpos == position)
@@ -407,7 +407,7 @@ void EraseBlock(char *truncated) char* tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
// ///////////////////////////
@@ -584,7 +584,7 @@ void EraseBlock(char *truncated) positionStart = 0;
positionEnd = 0;
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -597,7 +597,7 @@ void EraseSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
// //////
while (true) {
@@ -625,7 +625,7 @@ void EraseSymbols(char *truncated) recpos = position;
}
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -640,7 +640,7 @@ void NumSymbols(char *truncated) char *tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
while (true) {
Sleep(1); // avoid 100% CPU
@@ -678,7 +678,7 @@ void NumSymbols(char *truncated) recpos = position;
}
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -687,7 +687,7 @@ void FastTagFilter(char *truncated) {
char *tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
for (int counter = 0; counter < mir_strlen(tempraw); counter++) {
if (tempraw[counter] == '<') {
@@ -703,7 +703,7 @@ void FastTagFilter(char *truncated) }
}
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -715,7 +715,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) char *tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
switch (AmountWspcRem) {
case 1:
@@ -745,7 +745,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) tempraw[counter] = ' ';
} // end for
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -754,13 +754,13 @@ void RemoveTabs(char *truncated) {
char *tempraw = (char*)malloc(MAXSIZE1);
if (truncated)
- strncpy(tempraw, truncated, MAXSIZE1);
+ mir_strncpy(tempraw, truncated, MAXSIZE1);
for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if (tempraw[counter] == '\t')
tempraw[counter] = ' ';
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
free(tempraw);
}
@@ -779,7 +779,7 @@ void Removewhitespace(char *truncated) counter2++;
pos2 = counter2;
- strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1);
+ mir_strncpy(&truncated[pos1], &truncated[pos2], mir_strlen(&truncated[pos1]) - 1);
} // end if
} // end for
}
@@ -788,11 +788,11 @@ void Removewhitespace(char *truncated) void Filter(char *truncated)
{
char tempraw[MAXSIZE1];
- strncpy(tempraw, truncated, SIZEOF(tempraw));
+ mir_strncpy(tempraw, truncated, SIZEOF(tempraw));
for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t'))
- strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1);
+ mir_strncpy(&tempraw[counter], &tempraw[counter + 1], mir_strlen(&tempraw[counter]) - 1);
- strncpy(truncated, tempraw, mir_strlen(truncated));
+ mir_strncpy(truncated, tempraw, mir_strlen(truncated));
}
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index 8857e78d1a..eaa1728cc3 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -58,7 +58,7 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara char *tempbuffer = (char*)malloc(len + 2);
GetDlgItemTextA(ParentHwnd, IDC_DATA, tempbuffer, len);
- strncpy(buff, tempbuffer, SIZEOF(buff));
+ mir_strncpy(buff, tempbuffer, SIZEOF(buff));
free(tempbuffer);
Filter(buff);
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index a542e21c0a..3c01680add 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -225,7 +225,7 @@ void GetData(void *param) }
dispos = 0;
- strncpy(raw, &truncated2[statpos], MallocSize);
+ mir_strncpy(raw, &truncated2[statpos], MallocSize);
raw[MallocSize] = '\0';
trunccount = 0;
@@ -334,7 +334,7 @@ void GetData(void *param) eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
if (eventIndex == 2) {
- strncpy(buff, truncated, SIZEOF(buff));
+ mir_strncpy(buff, truncated, SIZEOF(buff));
Filter(buff);
if (!db_get_s(hContact, MODULENAME, ALRT_S_STRING_KEY, &dbv)) {
diff --git a/plugins/WhenWasIt/src/utils.cpp b/plugins/WhenWasIt/src/utils.cpp index 42bf4be905..5d78e81a7b 100644 --- a/plugins/WhenWasIt/src/utils.cpp +++ b/plugins/WhenWasIt/src/utils.cpp @@ -94,14 +94,14 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) {
char buffer[32] = { 0 };
mir_strcpy(buffer, "0x");
- strncpy(buffer + 2, inData, HEX_SIZE);
+ mir_strncpy(buffer + 2, inData, HEX_SIZE);
sscanf(buffer, "%x", &size);
outData = (unsigned char*)new char[size * 2];
char *tmp = inData + HEX_SIZE;
buffer[4] = '\0'; //mark the end of the string
for (UINT i = 0; i < size; i++) {
- strncpy(buffer + 2, &tmp[i * 2], 2);
+ mir_strncpy(buffer + 2, &tmp[i * 2], 2);
sscanf(buffer, "%x", &outData[i]);
}
}
@@ -116,7 +116,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0;
size_t tmp = mir_strlen(dbv.pszVal);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, dbv.pszVal, len);
+ mir_strncpy(szResult, dbv.pszVal, len);
szResult[len] = '\0';
mir_free(dbv.pszVal);
}
@@ -125,7 +125,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName if (szError) {
size_t tmp = mir_strlen(szError);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, szError, len);
+ mir_strncpy(szResult, szError, len);
szResult[len] = '\0';
}
else szResult[0] = '\0';
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index ece3465f5f..efece9892f 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -1073,7 +1073,7 @@ ULONGLONG MimeDateToFileTime(char *datein) if (datein) { char tmp[64]; while (datein[0] == ' ') datein++; // eat leading spaces - strncpy(tmp, datein, 63); tmp[63] = 0; + mir_strncpy(tmp, datein, 63); tmp[63] = 0; if (atoi(tmp)) { // Parseable integer on DayOfWeek field? Buggy mime date. day = tmp; } diff --git a/plugins/YAMN/src/mails/decode.cpp b/plugins/YAMN/src/mails/decode.cpp index 6ca2a0238b..8b18a509f8 100644 --- a/plugins/YAMN/src/mails/decode.cpp +++ b/plugins/YAMN/src/mails/decode.cpp @@ -495,7 +495,7 @@ void ConvertCodedStringToUnicode(char *stream,WCHAR **storeto,DWORD cp,int mode) finderend--;
}
char *oneWordEncoded = new char[finderend-finder+1];
- strncpy(oneWordEncoded,finder,finderend-finder);
+ mir_strncpy(oneWordEncoded,finder,finderend-finder);
oneWordEncoded[finderend-finder]=0;
switch(Encoding)
{
diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index ad9083f5b9..1212ec0e30 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -438,7 +438,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) if (NULL==(Item->Next=new struct CMimeItem)) break; // Cant create new item?!
Item=Item->Next;
Item->Next=NULL;//just in case;
- Item->name=new char[5]; strncpy(Item->name,"Body",5);
+ Item->name=new char[5]; mir_strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
mir_strncpy(Item->value,prev1,prev2-prev1-1);
}
diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index a87eafb9a6..62849bc75b 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -205,7 +205,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) char *szBuf = szUtfMsg.str;
for (int i=0; i < iPartCount; i++, szBuf += cbPortion) {
char *szMsgPart = (char*)mir_alloc(cbPortion+1);
- strncpy(szMsgPart, szBuf, cbPortion);
+ mir_strncpy(szMsgPart, szBuf, cbPortion);
szMsgPart[cbPortion] = 0;
HANDLE hMsgProc = (HANDLE)CallContactService(hForwardTo, PSS_MESSAGE, 0, (LPARAM)szMsgPart);
diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index f13cc4ee2d..a8e3742819 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -117,7 +117,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) {
char buffer[32] = {0};
mir_strcpy(buffer, "0x");
- strncpy(buffer + 2, inData, HEX_SIZE);
+ mir_strncpy(buffer + 2, inData, HEX_SIZE);
sscanf(buffer, "%x", &size);
outData = (unsigned char*)new char[size*2];
UINT i;
@@ -126,7 +126,7 @@ void HexToBin(char *inData, ULONG &size, LPBYTE &outData) buffer[4] = '\0'; //mark the end of the string
for (i = 0; i < size; i++)
{
- strncpy(buffer + 2, &tmp[i * 2], 2);
+ mir_strncpy(buffer + 2, &tmp[i * 2], 2);
sscanf(buffer, "%x", &outData[i]);
}
i = size;
@@ -143,7 +143,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName res = 0;
int tmp = (int)mir_strlen(dbv.pszVal);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, dbv.pszVal, len);
+ mir_strncpy(szResult, dbv.pszVal, len);
szResult[len] = '\0';
mir_free(dbv.pszVal);
}
@@ -153,7 +153,7 @@ int GetStringFromDatabase(MCONTACT hContact, char *szModule, char *szSettingName {
int tmp = (int)mir_strlen(szError);
len = (tmp < size - 1) ? tmp : size - 1;
- strncpy(szResult, szError, len);
+ mir_strncpy(szResult, szError, len);
szResult[len] = '\0';
}
else{
diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index dae6100000..edfaff270d 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -87,7 +87,7 @@ int AddDebugLogMessageA(const char* fmt, ...) #ifdef MODULENAME
mir_snprintf(szFinal, SIZEOF(szFinal), "%s: %s", MODULENAME, szText);
#else
- strncpy(szFinal, szText, SIZEOF(szFinal));
+ mir_strncpy(szFinal, szText, SIZEOF(szFinal));
#endif
res = WriteToDebugLogA(szFinal);
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 2bf2907cf4..6d4bfcb17d 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -207,7 +207,7 @@ int gg_decodehosts(char *var, GGHOST *hosts, int max) // Insert new item
hosts[hp].hostname[127] = 0;
- strncpy(hosts[hp].hostname, hostname, 127);
+ mir_strncpy(hosts[hp].hostname, hostname, 127);
hosts[hp].port = portname ? atoi(portname) : 443;
hp ++;
diff --git a/protocols/Gadu-Gadu/src/dynstuff.cpp b/protocols/Gadu-Gadu/src/dynstuff.cpp index 4d21ed7eb0..e84273f6a3 100644 --- a/protocols/Gadu-Gadu/src/dynstuff.cpp +++ b/protocols/Gadu-Gadu/src/dynstuff.cpp @@ -247,7 +247,7 @@ int string_append_n(string_t s, const char *str, int count) string_realloc(s, s->len + count);
s->str[s->len + count] = 0;
- strncpy(s->str + s->len, str, count);
+ mir_strncpy(s->str + s->len, str, count);
s->len += count;
@@ -480,7 +480,7 @@ char **array_make(const char *string, const char *sep, int max, int trim, int qu } else {
for (q = p, len = 0; *q && (last || !strchr(sep, *q)); q++, len++);
token = (char*)calloc(1, len + 1);
- strncpy(token, p, len);
+ mir_strncpy(token, p, len);
token[len] = 0;
p = q;
}
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 3d23d0a9a5..bfa4e99c50 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -269,7 +269,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc->tick = tick;
- strncpy(filename, local_dcc->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -300,7 +300,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- strncpy(filename, local_dcc->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc->file_info.filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -499,7 +499,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
PROTOFILETRANSFERSTATUS pfts;
local_dcc7->tick = tick;
- strncpy(filename, local_dcc7->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc7->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -530,7 +530,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (local_dcc7->file_fd != -1)
{
PROTOFILETRANSFERSTATUS pfts;
- strncpy(filename, local_dcc7->folder, sizeof(filename));
+ mir_strncpy(filename, local_dcc7->folder, sizeof(filename));
mir_strncat(filename, (char*)local_dcc7->filename, sizeof(filename) - mir_strlen(filename));
memset(&pfts, 0, sizeof(PROTOFILETRANSFERSTATUS));
pfts.cbSize = sizeof(PROTOFILETRANSFERSTATUS);
@@ -666,7 +666,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) {
struct gg_dcc *dcc = (struct gg_dcc *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
- strncpy(fileName, path, sizeof(fileName));
+ mir_strncpy(fileName, path, sizeof(fileName));
mir_strncat(fileName, (char*)dcc->file_info.filename, sizeof(fileName) - mir_strlen(fileName));
dcc->folder = _strdup((char *) path);
dcc->tick = 0;
@@ -708,7 +708,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer;
char fileName[MAX_PATH], *path = mir_t2a(szPath);
int iFtRemoveRes;
- strncpy(fileName, path, sizeof(fileName));
+ mir_strncpy(fileName, path, sizeof(fileName));
mir_strncat(fileName, (char*)dcc7->filename, sizeof(fileName) - mir_strlen(fileName));
dcc7->folder = _strdup((char *) path);
dcc7->tick = 0;
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 45fd51745f..7196ed4b3c 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -436,7 +436,7 @@ void gg_debughandler(int level, const char *format, va_list ap) char *nl = strrchr(szFormat, '\n');
if (nl) *nl = 0;
- strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
+ mir_strncpy(szText + PREFIXLEN, "[libgadu] \0", sizeof(szText) - PREFIXLEN);
char prefix[6];
mir_snprintf(prefix, SIZEOF(prefix), "%lu", GetCurrentThreadId());
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 2ca709ae01..2b903179bb 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -119,7 +119,7 @@ char *strndup(char *str, int c) {
char *ret = (char*)malloc(c + 1);
ret[c] = 0;
- strncpy(ret, str, c);
+ mir_strncpy(ret, str, c);
return ret;
}
@@ -174,7 +174,7 @@ void GGPROTO::parsecontacts(char *contacts) if (n && n != p)
{
strPhone = (char*)malloc((n - p) + 5);
- strncpy(strPhone, p, (n - p));
+ mir_strncpy(strPhone, p, (n - p));
mir_strcpy((strPhone + (n - p)), " SMS"); // Add SMS postfix
}
p = (n + 1);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index d0f442d872..09b79b9b44 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -42,7 +42,7 @@ char *gg_status2db(int status, const char *suffix) case ID_STATUS_OUTTOLUNCH: prefix = "Otl"; break;
default: return NULL;
}
- strncpy(str, prefix, sizeof(str));
+ mir_strncpy(str, prefix, sizeof(str));
mir_strncat(str, suffix, sizeof(str) - mir_strlen(str));
return str;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index 2fcf36d31d..85df02f089 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -132,7 +132,7 @@ int GGPROTO::gettoken(GGTOKEN *token) }
// Return token id
- strncpy(dat.id, t->tokenid, sizeof(dat.id));
+ mir_strncpy(dat.id, t->tokenid, sizeof(dat.id));
dat.width = t->width;
dat.height = t->height;
@@ -154,8 +154,8 @@ int GGPROTO::gettoken(GGTOKEN *token) return FALSE;
// Fillup patterns
- strncpy(token->id, dat.id, sizeof(token->id));
- strncpy(token->val, dat.val, sizeof(token->val));
+ mir_strncpy(token->id, dat.id, sizeof(token->id));
+ mir_strncpy(token->val, dat.val, sizeof(token->val));
return TRUE;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index a5fcae5ee3..1dd223b08a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -126,7 +126,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!gg->getString(GG_KEY_EMAIL, &dbv_email))
{
- strncpy(email, dbv_email.pszVal, sizeof(email));
+ mir_strncpy(email, dbv_email.pszVal, sizeof(email));
db_free(&dbv_email);
}
diff --git a/protocols/ICQCorp/src/services.cpp b/protocols/ICQCorp/src/services.cpp index d4c8379d75..48bc68d16e 100644 --- a/protocols/ICQCorp/src/services.cpp +++ b/protocols/ICQCorp/src/services.cpp @@ -47,7 +47,7 @@ static INT_PTR icqGetCaps(WPARAM wParam, LPARAM lParam) static INT_PTR icqGetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, Translate(protoName), wParam);
+ mir_strncpy((char*)lParam, Translate(protoName), wParam);
return 0;
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 3a5974df1a..a94f366290 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -612,7 +612,7 @@ char* __fastcall null_strcpy(char *dest, const char *src, size_t maxlen) return NULL;
if (src && src[0]) {
- strncpy(dest, src, maxlen);
+ mir_strncpy(dest, src, maxlen);
dest[maxlen] = '\0';
}
else
diff --git a/protocols/JabberG/src/jabber_menu.cpp b/protocols/JabberG/src/jabber_menu.cpp index 79335a9182..6aeab1a831 100644 --- a/protocols/JabberG/src/jabber_menu.cpp +++ b/protocols/JabberG/src/jabber_menu.cpp @@ -602,7 +602,7 @@ INT_PTR __cdecl CJabberProto::OnMenuBookmarkAdd(WPARAM hContact, LPARAM) void CJabberProto::MenuInit()
{
char text[200];
- strncpy(text, m_szModuleName, sizeof(text)-1);
+ mir_strncpy(text, m_szModuleName, sizeof(text)-1);
char* tDest = text + mir_strlen(text);
CLISTMENUITEM mi = { sizeof(mi) };
@@ -825,7 +825,7 @@ void CJabberProto::GlobalMenuInit() // Hotkeys
char text[200];
- strncpy(text, m_szModuleName, sizeof(text) - 1);
+ mir_strncpy(text, m_szModuleName, sizeof(text) - 1);
char* tDest = text + mir_strlen(text);
HOTKEYDESC hkd = { sizeof(hkd) };
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp index d2f84ff04f..483f1f488f 100644 --- a/protocols/MRA/src/Mra_functions.cpp +++ b/protocols/MRA/src/Mra_functions.cpp @@ -669,7 +669,7 @@ void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA & cle.ptszTooltip = szStatusText;
if (getByte("TrayIconNewMailClkToInbox", MRA_DEFAULT_TRAYICON_NEW_MAIL_CLK_TO_INBOX)) {
- strncpy(szServiceFunction, m_szModuleName, MAX_PATH);
+ mir_strncpy(szServiceFunction, m_szModuleName, MAX_PATH);
pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
memcpy(pszServiceFunctionName, MRA_GOTO_INBOX, sizeof(MRA_GOTO_INBOX));
cle.pszService = szServiceFunction;
diff --git a/protocols/MRA/src/Mra_menus.cpp b/protocols/MRA/src/Mra_menus.cpp index 6f349e9d0d..f4c6136ca4 100644 --- a/protocols/MRA/src/Mra_menus.cpp +++ b/protocols/MRA/src/Mra_menus.cpp @@ -278,7 +278,7 @@ int CMraProto::MraRebuildContactMenu(WPARAM hContact, LPARAM) int CMraProto::MraRebuildStatusMenu(WPARAM, LPARAM)
{
CHAR szServiceFunction[MAX_PATH * 2], *pszServiceFunctionName, szValueName[MAX_PATH];
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ mir_strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
TCHAR szItem[MAX_PATH + 64];
@@ -326,7 +326,7 @@ HGENMENU CMraProto::CListCreateMenu(LONG lPosition, LONG lPopupPosition, BOOL bI return NULL;
char szServiceFunction[MAX_PATH];
- strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
+ mir_strncpy(szServiceFunction, m_szModuleName, sizeof(szServiceFunction));
char *pszServiceFunctionName = szServiceFunction + mir_strlen(m_szModuleName);
CLISTMENUITEM mi = { sizeof(mi) };
diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index 4e9b439eb7..da9fd4f2b4 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -50,7 +50,7 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID));
parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL);
info->netId = atoi(szNet);
- strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
+ mir_strncpy(info->szEmail, szEmail, sizeof(info->szEmail));
TCHAR szName[512];
InterlockedIncrement(&m_chatID);
@@ -123,7 +123,7 @@ void CMsnProto::MSN_ChatStart(ezxml_t xmli) if (!gcu) {
gcu = new GCUserItem;
info->mJoinedContacts.insert(gcu);
- strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
+ mir_strncpy(gcu->WLID, mri, sizeof(gcu->WLID));
}
mir_tstrcpy(gcu->role, _A2T(role));
diff --git a/protocols/MSN/src/msn_libstr.cpp b/protocols/MSN/src/msn_libstr.cpp index 78e9c66584..bf45995a0f 100644 --- a/protocols/MSN/src/msn_libstr.cpp +++ b/protocols/MSN/src/msn_libstr.cpp @@ -411,6 +411,6 @@ time_t MsnTSToUnixtime(const char *pszTS) char szTS[16];
if (!*pszTS) return time(NULL);
- strncpy(szTS, pszTS, 10);
+ mir_strncpy(szTS, pszTS, 10);
return (time_t)atoi(szTS);
}
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index fbaa187a5c..6a50f7dcd4 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -100,7 +100,7 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH newThread->mCaller = 3;
newThread->mIncomingBoundPort = sb;
newThread->mIncomingPort = nlb.wPort;
- strncpy(newThread->mCookie, dc->callId, sizeof(newThread->mCookie));
+ mir_strncpy(newThread->mCookie, dc->callId, sizeof(newThread->mCookie));
newThread->mInitialContactWLID = mir_strdup(ft->p2p_dest);
newThread->startThread(&CMsnProto::p2p_filePassiveThread, this);
diff --git a/protocols/Sametime/src/options.cpp b/protocols/Sametime/src/options.cpp index f9a2ee775f..b1a15f850a 100644 --- a/protocols/Sametime/src/options.cpp +++ b/protocols/Sametime/src/options.cpp @@ -363,15 +363,15 @@ void CSametimeProto::LoadOptions() DBVARIANT dbv;
if (!db_get_utf(0, m_szModuleName, "ServerName", &dbv)) {
- strncpy(options.server_name, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.server_name, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
if (!db_get_utf(0, m_szModuleName, "stid", &dbv)) {
- strncpy(options.id, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.id, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
if (!db_get_utf(0, m_szModuleName, "Password", &dbv)) {
- strncpy(options.pword, dbv.pszVal, LSTRINGLEN);
+ mir_strncpy(options.pword, dbv.pszVal, LSTRINGLEN);
db_free(&dbv);
}
diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index 708be8481f..627b9a7d56 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -44,7 +44,7 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO */
INT_PTR CSametimeProto::GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, m_szModuleName, wParam);
+ mir_strncpy((char*)lParam, m_szModuleName, wParam);
return 0;
}
diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index debe054ec3..0fd6d87e72 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -687,11 +687,11 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code for (; ri; ri = ri->next) {
mri = ((mwResolveResult *)ri->data)->matches;
for (; mri; mri = mri->next) {
- strncpy(mcsr.psr.stid, ((mwResolveMatch *)mri->data)->id, 256);
+ mir_strncpy(mcsr.psr.stid, ((mwResolveMatch *)mri->data)->id, 256);
mcsr.psr.stid[255] = 0;
MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.stid, -1, mcsr.pszFields[0], 512);
- strncpy(mcsr.psr.name, ((mwResolveMatch *)mri->data)->name, 256);
+ mir_strncpy(mcsr.psr.name, ((mwResolveMatch *)mri->data)->name, 256);
mcsr.psr.name[255] = 0;
MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.name, -1, mcsr.pszFields[1], 512);
diff --git a/protocols/SkypeClassic/src/filexfer.cpp b/protocols/SkypeClassic/src/filexfer.cpp index 313af9a315..5a8ff3df76 100644 --- a/protocols/SkypeClassic/src/filexfer.cpp +++ b/protocols/SkypeClassic/src/filexfer.cpp @@ -366,7 +366,7 @@ BOOL FXHandleMessage(const char *pszMsg) if (!pTok)
return FALSE;
- strncpy(args.szNum, pszMsg, pTok - pszMsg);
+ mir_strncpy(args.szNum, pszMsg, pTok - pszMsg);
pszMsg = pTok + 1;
if (!(pTok = strchr(pszMsg, ' '))) return FALSE;
pTok++;
@@ -374,7 +374,7 @@ BOOL FXHandleMessage(const char *pszMsg) return FALSE;
ft_args *pargs = (ft_args*)malloc(sizeof(args));
if (!pargs) return TRUE;
- strncpy(args.szArg, pTok, sizeof(args.szArg));
+ mir_strncpy(args.szArg, pTok, sizeof(args.szArg));
memcpy(pargs, &args, sizeof(args));
pthread_create((pThreadFunc)FXHandleMessageThread, pargs);
return TRUE;
diff --git a/protocols/SkypeClassic/src/skype.cpp b/protocols/SkypeClassic/src/skype.cpp index 147b467ecc..14a4363533 100644 --- a/protocols/SkypeClassic/src/skype.cpp +++ b/protocols/SkypeClassic/src/skype.cpp @@ -1387,7 +1387,7 @@ void MessageListProcessingThread(char *str) { // Frst we need to sort the message timestamps
for ((token = strtok_r(str+1, ", ", &nextoken)); token; token = strtok_r(NULL, ", ", &nextoken)) {
if (args = (fetchmsg_arg*)calloc(1, sizeof(fetchmsg_arg) + sizeof(DWORD))) {
- strncpy(args->msgnum, token, sizeof(args->msgnum)-1);
+ mir_strncpy(args->msgnum, token, sizeof(args->msgnum)-1);
args->getstatus = TRUE;
args->bIsRead = *str;
args->bDontMarkSeen = *str;
@@ -2163,7 +2163,7 @@ LRESULT APIENTRY WndProc(HWND hWndDlg, UINT message, UINT wParam, LONG lParam) // If new message is available, fetch it
ptr[0] = 0;
if (!(args = (fetchmsg_arg *)calloc(1, sizeof(*args)))) break;
- strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum)-1);
+ mir_strncpy(args->msgnum, pMsgNum, sizeof(args->msgnum)-1);
args->getstatus = FALSE;
//args->bIsRead = strncmp(ptr+8, "READ", 4) == 0;
pthread_create((pThreadFunc)FetchMessageThreadSync, args);
@@ -2467,7 +2467,7 @@ void RetrieveUserAvatar(void *param) // Got it
MoveFileExA(pszTempFile, AvatarFile, MOVEFILE_REPLACE_EXISTING);
AI.format = PA_FORMAT_JPEG;
- strncpy(AI.filename, AvatarFile,SIZEOF(AI.filename)-1);
+ mir_strncpy(AI.filename, AvatarFile,SIZEOF(AI.filename)-1);
ack.hProcess = (HANDLE)&AI;
}
diff --git a/protocols/SkypeClassic/src/skypeapi.cpp b/protocols/SkypeClassic/src/skypeapi.cpp index ad6bc71967..e86658e69f 100644 --- a/protocols/SkypeClassic/src/skypeapi.cpp +++ b/protocols/SkypeClassic/src/skypeapi.cpp @@ -518,7 +518,7 @@ char *SkypeRcvMsg(char *what, time_t st, MCONTACT hContact, DWORD maxwait) // isn't using the ID anymore, so we have to save the ID as new identifier for message recognition
pCurMsg+=iLenWhat;
if ((pMsg = strchr (pCurMsg, ' ')) && (pMsg=strchr (pMsg+1, ' ')))
- strncpy (msgid, pCurMsg, pMsg-pCurMsg);
+ mir_strncpy (msgid, pCurMsg, pMsg-pCurMsg);
else if (strncmp (pCurMsg, "ERROR", 5) == 0) bIsError = TRUE;
}
@@ -1171,7 +1171,7 @@ INT_PTR SkypeSetAvatar(WPARAM wParam, LPARAM lParam) { // Backup old file
if (hasOldAvatar)
{
- strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
+ mir_strncpy(OldAvatarFile, dbv.pszVal, sizeof(OldAvatarFile)-4);
OldAvatarFile[sizeof(OldAvatarFile)-5] = '\0';
mir_strcat(OldAvatarFile, "_old");
DeleteFileA(OldAvatarFile);
diff --git a/protocols/SkypeClassic/src/skypeopt.cpp b/protocols/SkypeClassic/src/skypeopt.cpp index 358a95e153..fb35c5f483 100644 --- a/protocols/SkypeClassic/src/skypeopt.cpp +++ b/protocols/SkypeClassic/src/skypeopt.cpp @@ -611,12 +611,12 @@ INT_PTR CALLBACK OptionsDefaultDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L db_set_b (NULL, SKYPE_PROTONAME, "secondary", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SECONDARY)));
GetDlgItemTextA(hwndDlg,IDC_COMMANDLINE,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
+ mir_strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "CommandLine", szRelativePath);
GetDlgItemTextA(hwndDlg,IDC_DATAPATH,text,SIZEOF(text));
- strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
+ mir_strncpy(szRelativePath, text, sizeof(szRelativePath)-1);
CallService (MS_UTILS_PATHTORELATIVE, (WPARAM)text, (LPARAM)szRelativePath);
db_set_s(NULL, SKYPE_PROTONAME, "datapath", szRelativePath);
diff --git a/protocols/SkypeClassic/src/skypeprofile.cpp b/protocols/SkypeClassic/src/skypeprofile.cpp index 045a5b7d78..b796a96667 100644 --- a/protocols/SkypeClassic/src/skypeprofile.cpp +++ b/protocols/SkypeClassic/src/skypeprofile.cpp @@ -105,7 +105,7 @@ static void LoadSaveSkype(SkypeProfile *pstProf, BOOL bSet) if (astSettings[i].cType == sizeof(char)) {
char *pBuf;
if (utf8_decode (ptr, &pBuf) != -1) {
- strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
+ mir_strncpy ((char*)astSettings[i].lpDest, pBuf, astSettings[i].iSize);
free (pBuf);
}
} else {
diff --git a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c index 200b79632a..0802788e10 100644 --- a/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c +++ b/protocols/SkypeClassic/src/skypeproxy/skypeproxy.c @@ -520,7 +520,7 @@ int main(int argc, char *argv[]) { }
for (i=0;i<argc;i++) {
if (!mir_strcmpi(argv[i], "-i") && argc>i+1)
- strncpy(BindIP, argv[i+1], sizeof(BindIP));
+ mir_strncpy(BindIP, argv[i+1], sizeof(BindIP));
if (!mir_strcmpi(argv[i], "-p") && argc>i+1)
if (!(BindPort=atoi(argv[i+1]))) {
OUTPUT("ERROR: Cannot convert port to int. bye..");
diff --git a/protocols/SkypeClassic/src/skypesvc.cpp b/protocols/SkypeClassic/src/skypesvc.cpp index fae8b8cd3b..e893721e42 100644 --- a/protocols/SkypeClassic/src/skypesvc.cpp +++ b/protocols/SkypeClassic/src/skypesvc.cpp @@ -147,7 +147,7 @@ INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam) {
if (lParam)
{
- strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
+ mir_strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
return 0; // Success
}
return 1; // Failure
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index e87fcac01d..e82ddbc75f 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -214,7 +214,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) if (end == NULL) {
end = resp->headers[i].szValue + mir_strlen(resp->headers[i].szValue);
}
- strncpy(cookie, start, (end - start));
+ mir_strncpy(cookie, start, (end - start));
break;
}
}
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index 71ad60185f..fb58de29c0 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -578,7 +578,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) if (numFiles == 1) {
if ((p=TlenXmlGetAttrValue(node, "n")) != NULL) {
p = TlenTextDecode(p);
- strncpy(szFilename, p, sizeof(szFilename)-1);
+ mir_strncpy(szFilename, p, sizeof(szFilename)-1);
mir_free(p);
} else {
mir_strcpy(szFilename, Translate("1 File"));
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index cb72d33849..51499497f3 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -334,7 +334,7 @@ static HANDLE TlenP2PBindSocks4(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) return NULL;
}
in.S_un.S_addr = *(PDWORD)(buf+4);
- strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
+ mir_strncpy(sb->szHost, inet_ntoa(in), sizeof(sb->szHost)-1);
sb->wPort = htons(*(PWORD)(buf+2));
ft->s = s;
forkthread((void (__cdecl *)(void*))TlenFileBindSocks4Thread, 0, ft);
@@ -463,11 +463,11 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft) if (db_get_b(NULL, proto->m_szModuleName, "FileProxyAuth", FALSE)) {
sb.useAuth = TRUE;
if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyUsername", &dbv)) {
- strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1);
+ mir_strncpy(sb.szUser, dbv.pszVal, sizeof(sb.szUser)-1);
db_free(&dbv);
}
if (!db_get_s(NULL, proto->m_szModuleName, "FileProxyPassword", &dbv)) {
- strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1);
+ mir_strncpy(sb.szPassword, dbv.pszVal, sizeof(sb.szPassword)-1);
db_free(&dbv);
}
}
diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index 705b4ca150..487302c7fd 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -55,7 +55,7 @@ DWORD_PTR TlenProtocol::GetCaps(int type, MCONTACT hContact) INT_PTR TlenProtocol::GetName(WPARAM wParam, LPARAM lParam)
{
- strncpy((char*)lParam, m_szModuleName, wParam);
+ mir_strncpy((char*)lParam, m_szModuleName, wParam);
return 0;
}
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index f614b0a323..c8aef49d25 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -130,7 +130,7 @@ void __cdecl TlenServerThread(ThreadData *info) DBVARIANT dbv;
if (!db_get(NULL, info->proto->m_szModuleName, "LoginName", &dbv)) {
- strncpy(info->username, dbv.pszVal, sizeof(info->username));
+ mir_strncpy(info->username, dbv.pszVal, sizeof(info->username));
info->username[sizeof(info->username)-1] = '\0';
_strlwr(info->username);
db_set_s(NULL, info->proto->m_szModuleName, "LoginName", info->username);
@@ -143,7 +143,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (loginErr == 0) {
if (!db_get(NULL, info->proto->m_szModuleName, "LoginServer", &dbv)) {
- strncpy(info->server, dbv.pszVal, sizeof(info->server));
+ mir_strncpy(info->server, dbv.pszVal, sizeof(info->server));
info->server[sizeof(info->server)-1] = '\0';
_strlwr(info->server);
db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
@@ -168,7 +168,7 @@ void __cdecl TlenServerThread(ThreadData *info) CloseHandle(hEventPasswdDlg);
if (onlinePassword[0] != (char) -1) {
- strncpy(info->password, onlinePassword, sizeof(info->password));
+ mir_strncpy(info->password, onlinePassword, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
}
else {
@@ -178,7 +178,7 @@ void __cdecl TlenServerThread(ThreadData *info) }
else {
if (!db_get(NULL, info->proto->m_szModuleName, "Password", &dbv)) {
- strncpy(info->password, dbv.pszVal, sizeof(info->password));
+ mir_strncpy(info->password, dbv.pszVal, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
db_free(&dbv);
}
@@ -211,7 +211,7 @@ void __cdecl TlenServerThread(ThreadData *info) db_set_s(NULL, info->proto->m_szModuleName, "jid", jidStr);
if (!db_get(NULL, info->proto->m_szModuleName, "ManualHost", &dbv)) {
- strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
+ mir_strncpy(info->manualHost, dbv.pszVal, sizeof(info->manualHost));
info->manualHost[sizeof(info->manualHost)-1] = '\0';
db_free(&dbv);
}
@@ -227,7 +227,7 @@ void __cdecl TlenServerThread(ThreadData *info) if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
- strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1);
+ mir_strncpy(info->proto->threadData->avatarHash, dbv.pszVal, sizeof(info->proto->threadData->avatarHash)-1);
db_free(&dbv);
}
info->avatarFormat = db_get_dw(NULL, info->proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
@@ -587,7 +587,7 @@ static void TlenProcessAvatar(XmlNode* node, ThreadData *info) XmlNode *aNode = TlenXmlGetChild(node, "a");
if (tokenNode != NULL) {
char *token = tokenNode->text;
- strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1);
+ mir_strncpy(info->avatarToken, token, sizeof(info->avatarToken)-1);
}
if (aNode != NULL) {
if (TlenProcessAvatarNode(info->proto, node, NULL)) {
diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index f315a3e177..61bde3433d 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -85,7 +85,7 @@ char *TlenResourceFromJID(const char *jid2) if (p != NULL && p[1] != '\0') {
p++;
if ((nick=(char *) mir_alloc(1+mir_strlen(jid)-(p-jid))) != NULL) {
- strncpy(nick, p, mir_strlen(jid)-(p-jid));
+ mir_strncpy(nick, p, mir_strlen(jid)-(p-jid));
nick[mir_strlen(jid)-(p-jid)] = '\0';
}
}
@@ -107,7 +107,7 @@ char *TlenNickFromJID(const char *jid2) p = strchr(jid, '/');
if (p != NULL) {
if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
+ mir_strncpy(nick, jid, p-jid);
nick[p-jid] = '\0';
}
}
@@ -128,7 +128,7 @@ char *TlenLoginFromJID(const char *jid2) p = strchr(jid, '/');
if (p != NULL) {
if ((nick=(char *) mir_alloc((p-jid)+1)) != NULL) {
- strncpy(nick, jid, p-jid);
+ mir_strncpy(nick, jid, p-jid);
nick[p-jid] = '\0';
}
}
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index 70bf723c23..1c4149c8ae 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -1016,7 +1016,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ mir_strncpy(jid, from, SIZEOF(jid) - 1);
}
ignore = !IsAuthorized(proto, jid);
ask = true;
@@ -1029,7 +1029,7 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) db_free(&dbv);
}
else {
- strncpy(jid, from, SIZEOF(jid) - 1);
+ mir_strncpy(jid, from, SIZEOF(jid) - 1);
}
ask = !IsAuthorized(proto, jid);
ignore = false;
diff --git a/protocols/Tlen/src/tlen_xml.cpp b/protocols/Tlen/src/tlen_xml.cpp index 408df2ab3a..5939c65d58 100644 --- a/protocols/Tlen/src/tlen_xml.cpp +++ b/protocols/Tlen/src/tlen_xml.cpp @@ -126,18 +126,18 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) } else { if (*(p+1) == '/') { // closing tag - strncpy(tag, p+2, r-(p+2)); + mir_strncpy(tag, p+2, r-(p+2)); tag[r-(p+2)] = '\0'; elemType = ELEM_CLOSE; } else { if (*(r-1) == '/') { // single open/close tag - strncpy(tag, p+1, r-(p+1)-1); + mir_strncpy(tag, p+1, r-(p+1)-1); tag[r-(p+1)-1] = '\0'; elemType = ELEM_OPENCLOSE; } else { - strncpy(tag, p+1, r-(p+1)); + mir_strncpy(tag, p+1, r-(p+1)); tag[r-(p+1)] = '\0'; elemType = ELEM_OPEN; } @@ -147,7 +147,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) // TlenLog("ATTR_MAX_LEN too small, ignore current tag"); } else { - strncpy(attr, r, q-r); + mir_strncpy(attr, r, q-r); if ((q-r)>0 && attr[q-r-1] == '/') { attr[q-r-1] = '\0'; elemType = ELEM_OPENCLOSE; @@ -171,7 +171,7 @@ int TlenXmlParse(XmlState *xmlState, char *buffer, int datalen) for (q=p+1; q<eob && *q != '<'; q++); if (q < eob) { // found starting bracket of the next element str = (char *) mir_alloc(q-p+1); - strncpy(str, p, q-p); + mir_strncpy(str, p, q-p); str[q-p] = '\0'; TlenXmlProcessElem(xmlState, ELEM_TEXT, str, NULL); mir_free(str); @@ -220,7 +220,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p == '\0') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -228,7 +228,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p != '=') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); continue; @@ -242,7 +242,7 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) if (*p == '\0') { a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = mir_strdup(""); break; @@ -263,10 +263,10 @@ static void TlenXmlParseAttr(XmlNode *node, char *text) } a->name = (char *) mir_alloc(klen+1); - strncpy(a->name, kstart, klen); + mir_strncpy(a->name, kstart, klen); a->name[klen] = '\0'; a->value = (char *) mir_alloc(vlen+1); - strncpy(a->value, vstart, vlen); + mir_strncpy(a->value, vstart, vlen); a->value[vlen] = '\0'; } } diff --git a/protocols/Xfire/src/client.cpp b/protocols/Xfire/src/client.cpp index 024cfc16d9..4e0e7d1321 100644 --- a/protocols/Xfire/src/client.cpp +++ b/protocols/Xfire/src/client.cpp @@ -92,7 +92,7 @@ using namespace std; struct sockaddr_in sa;
int iLen = sizeof(sa);
getsockname(socket->m_sock, (SOCKADDR*)&sa, &iLen);
- strncpy(this->localaddr,inet_ntoa(sa.sin_addr), sizeof(this->localaddr)-1);
+ mir_strncpy(this->localaddr,inet_ntoa(sa.sin_addr), sizeof(this->localaddr)-1);
this->llocaladdr=inet_addr(this->localaddr);
packetReader->setSocket(socket);
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 0978600aaf..c6509ee017 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -2833,7 +2833,7 @@ MCONTACT handlingBuddys(BuddyListEntry *entry, int clan, char*group, BOOL dontsc GameServerQuery_query gsqq = { 0 };
gsqq.port = gameob->port;
gsqq.xfiregameid = entry->game;
- strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
+ mir_strncpy(gsqq.ip, temp, SIZEOF(gsqq.ip)-1);
CallService("GameServerQuery/Query", (WPARAM)entry, (LPARAM)&gsqq);
}
}
@@ -3395,7 +3395,7 @@ INT_PTR GetAvatarInfo(WPARAM wParam, LPARAM lParam) { DBVARIANT dbv;
if (!db_get(pai->hContact, "ContactPhoto", "File", &dbv))
{
- strncpy(pai->filename, dbv.pszVal, sizeof(pai->filename)-1);
+ mir_strncpy(pai->filename, dbv.pszVal, sizeof(pai->filename)-1);
db_free(&dbv);
}
else
diff --git a/protocols/Xfire/src/searching4games.cpp b/protocols/Xfire/src/searching4games.cpp index 01fb52f082..81bd3e9427 100644 --- a/protocols/Xfire/src/searching4games.cpp +++ b/protocols/Xfire/src/searching4games.cpp @@ -67,7 +67,7 @@ BOOL CheckPath(char*ppath, char*pathwildcard = NULL) {
char temp[XFIRE_MAX_STATIC_STRING_LEN];
- strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
+ mir_strncpy(temp, ppath,XFIRE_MAX_STATIC_STRING_LEN-1);
*(temp + mir_strlen(temp) - 1) = 0;
mir_strncat(temp, wfd.cFileName, SIZEOF(temp) - mir_strlen(temp));
mir_strncat(temp, "\\", SIZEOF(temp) - mir_strlen(temp));
diff --git a/protocols/Xfire/src/services.cpp b/protocols/Xfire/src/services.cpp index 380308cc14..2955dc85fc 100644 --- a/protocols/Xfire/src/services.cpp +++ b/protocols/Xfire/src/services.cpp @@ -58,7 +58,7 @@ INT_PTR GetMyAvatar(WPARAM wparam, LPARAM lparam) { if (!db_get(NULL, protocolname, "MyAvatarFile", &dbv))
{
- strncpy((char*)wparam, dbv.pszVal, (int)lparam);
+ mir_strncpy((char*)wparam, dbv.pszVal, (int)lparam);
db_free(&dbv);
return 0;
}
diff --git a/protocols/Xfire/src/tools.cpp b/protocols/Xfire/src/tools.cpp index 05658e1ac8..0b4ccc956d 100644 --- a/protocols/Xfire/src/tools.cpp +++ b/protocols/Xfire/src/tools.cpp @@ -211,7 +211,7 @@ char* GetLaunchPath(char*launch) if (launch == NULL) return temp; - strncpy(temp, launch, XFIRE_MAX_STATIC_STRING_LEN -1); + mir_strncpy(temp, launch, XFIRE_MAX_STATIC_STRING_LEN -1); while (*p != 0 && *f != 0) { diff --git a/protocols/Xfire/src/variables.cpp b/protocols/Xfire/src/variables.cpp index 70f167e933..dd1d038f30 100644 --- a/protocols/Xfire/src/variables.cpp +++ b/protocols/Xfire/src/variables.cpp @@ -23,7 +23,7 @@ char* Varxfiregame(ARGUMENTSINFO *ai) DBVARIANT dbv3;
if (!db_get(ai->fi->hContact, protocolname, "RGame", &dbv3))
{
- strncpy(temp, dbv3.pszVal, 255);
+ mir_strncpy(temp, dbv3.pszVal, 255);
db_free(&dbv3);
return mir_strdup(temp);
}
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index 58c9089d4d..a2a20516cd 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -289,7 +289,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) if (GetStringUtf(hContact, "Nick", &dbv))
return NULL;
- strncpy(nick, dbv.pszVal, sizeof(nick)-1);
+ mir_strncpy(nick, dbv.pszVal, sizeof(nick)-1);
db_free(&dbv);
return nick;
}
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index b5b65f8d40..510b6b2abf 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -363,7 +363,7 @@ static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam) UINT blockSize;
VerQueryValue(pVerInfo, _T("\\StringFileInfo\\000004b0\\ProductVersion"), (LPVOID*)&productVersion, &blockSize);
- strncpy((char*)lParam, _T2A(productVersion), wParam);
+ mir_strncpy((char*)lParam, _T2A(productVersion), wParam);
#if defined(_WIN64)
strcat_s((char*)lParam, wParam, " x64");
#endif
diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 48b31036a2..28390d4b66 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -286,30 +286,30 @@ static void OnLoadSettings() static void RegisterFonts()
{
ColourIDT colourid = { sizeof(colourid) };
- strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
+ mir_strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup));
_tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group));
- strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Group chat log background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list background"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_WINDOW);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list lines"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER);
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
+ mir_strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), SIZEOF(colourid.name));
colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
ColourRegisterT(&colourid);
diff --git a/src/core/stdclist/src/clcfonts.cpp b/src/core/stdclist/src/clcfonts.cpp index 02ae7b298e..07e823d998 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -53,7 +53,7 @@ void RegisterCListFonts() {
FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS;
- strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup));
_tcsncpy(fontid.group, LPGENT("Contact list"), SIZEOF(fontid.group));
HDC hdc = GetDC(NULL);
@@ -74,7 +74,7 @@ void RegisterCListFonts() char idstr[10];
mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i);
- strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, idstr, SIZEOF(fontid.prefix));
fontid.order = i;
FontRegisterT(&fontid);
}
@@ -84,27 +84,27 @@ void RegisterCListFonts() ColourIDT colourid = { 0 };
colourid.cbSize = sizeof(ColourIDT);
colourid.order = 0;
- strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
+ mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup));
- strncpy(colourid.setting, "BkColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "BkColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name));
_tcsncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group));
colourid.defcolour = CLCDEFAULT_BKCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR;
ColourRegisterT(&colourid);
- strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting));
+ mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting));
_tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name));
colourid.order = 1;
colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR;
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 2e7ef5de9e..91b1f170b4 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -282,7 +282,7 @@ static INT_PTR GetProfilePath(WPARAM wParam, LPARAM lParam) return 1;
char *dst = (char*)lParam;
- strncpy(dst, _T2A(g_profileDir), wParam);
+ mir_strncpy(dst, _T2A(g_profileDir), wParam);
dst[wParam-1] = 0;
return 0;
}
@@ -295,7 +295,7 @@ static INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) char *dst = (char*)lParam;
char *tmp = makeFileName(g_profileName);
- strncpy(dst, tmp, wParam);
+ mir_strncpy(dst, tmp, wParam);
mir_free(tmp);
dst[wParam-1] = 0;
diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 6efdc67f7d..45f79e0713 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -149,7 +149,7 @@ static BOOL ExportSettings(HWND hwndDlg, const TCHAR *filename, OBJLIST<FontInte mir_snprintf(buff, SIZEOF(buff), "\n[%s]", F.dbSettingsGroup);
if (mir_strcmp(buff, header) != 0) {
- strncpy(header, buff, SIZEOF(header));
+ mir_strncpy(header, buff, SIZEOF(header));
WriteLine(out, buff);
}
diff --git a/src/modules/fonts/FontService.cpp b/src/modules/fonts/FontService.cpp index 166110f2a8..d8f6dac156 100644 --- a/src/modules/fonts/FontService.cpp +++ b/src/modules/fonts/FontService.cpp @@ -90,22 +90,22 @@ int LoadFontserviceModule(void) // create generic fonts
FontIDT fontid = { sizeof(fontid) };
- strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
+ mir_strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
_tcsncpy_s(fontid.group, LPGENT("General"), _TRUNCATE);
_tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
- strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Header", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
- strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Generic", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
_tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
- strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
+ mir_strncpy(fontid.prefix, "Small", SIZEOF(fontid.prefix));
FontRegisterT(&fontid);
// do last for silly dyna plugin
diff --git a/src/modules/metacontacts/meta_services.cpp b/src/modules/metacontacts/meta_services.cpp index f550d4edbd..3d50e8a455 100644 --- a/src/modules/metacontacts/meta_services.cpp +++ b/src/modules/metacontacts/meta_services.cpp @@ -83,7 +83,7 @@ INT_PTR Meta_GetName(WPARAM wParam, LPARAM lParam) {
char *name = (char *)Translate(META_PROTO);
size_t size = min(mir_strlen(name), wParam - 1); // copy only the first size bytes.
- if (strncpy((char *)lParam, name, size) == NULL)
+ if (mir_strncpy((char *)lParam, name, size) == NULL)
return 1;
((char *)lParam)[size] = '\0';
return 0;
@@ -243,7 +243,7 @@ INT_PTR Meta_SendMessage(WPARAM wParam, LPARAM lParam) tfap->hContact = ccs->hContact;
tfap->hEvent = hEvent;
tfap->id = 10;
- strncpy(tfap->msg, Translate("No online contacts found."), SIZEOF(tfap->msg) - 1);
+ mir_strncpy(tfap->msg, Translate("No online contacts found."), SIZEOF(tfap->msg) - 1);
CloseHandle(mir_forkthread(sttFakeAckFail, (void*)tfap));
SetEvent(hEvent);
diff --git a/src/modules/netlib/netlibhttp.cpp b/src/modules/netlib/netlibhttp.cpp index cd7a173f1a..a30a15f2bf 100644 --- a/src/modules/netlib/netlibhttp.cpp +++ b/src/modules/netlib/netlibhttp.cpp @@ -583,7 +583,7 @@ INT_PTR NetlibHttpSendRequest(WPARAM wParam, LPARAM lParam) nlc->szNewUrl = (char*)mir_realloc(nlc->szNewUrl, rlen + mir_strlen(tmpUrl) * 3 + 1);
- strncpy(nlc->szNewUrl, pszFullUrl, rlen);
+ mir_strncpy(nlc->szNewUrl, pszFullUrl, rlen);
mir_strcpy(nlc->szNewUrl + rlen, tmpUrl);
pszFullUrl = nlc->szNewUrl;
pszUrl = NULL;
diff --git a/src/modules/netlib/netlibsock.cpp b/src/modules/netlib/netlibsock.cpp index e53e73bd89..5aaea3613a 100644 --- a/src/modules/netlib/netlibsock.cpp +++ b/src/modules/netlib/netlibsock.cpp @@ -237,7 +237,7 @@ void NetlibGetConnectionInfo(NetlibConnection* nlc, NETLIBCONNINFO *connInfo) connInfo->dwIpv4 = sin.si_family == AF_INET ? htonl(sin.Ipv4.sin_addr.s_addr) : 0;
char *szTmp = NetlibAddressToString(&sin);
- strncpy(connInfo->szIpPort, szTmp, sizeof(connInfo->szIpPort));
+ mir_strncpy(connInfo->szIpPort, szTmp, sizeof(connInfo->szIpPort));
connInfo->szIpPort[sizeof(connInfo->szIpPort) - 1] = 0;
mir_free(szTmp);
}
diff --git a/src/modules/netlib/netlibupnp.cpp b/src/modules/netlib/netlibupnp.cpp index 2e3445126f..54fc04d640 100644 --- a/src/modules/netlib/netlibupnp.cpp +++ b/src/modules/netlib/netlibupnp.cpp @@ -147,7 +147,7 @@ static bool txtParseParam(char* szData, char* presearch, while (*(cp1-1) == ' ' && cp1 > cp) --cp1;
len = min((size_t)(cp1 - cp), size-1);
- strncpy(param, cp, len);
+ mir_strncpy(param, cp, len);
param[len] = 0;
return true;
@@ -171,7 +171,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) if (szHost != NULL) {
sz = pport - phost + 1;
if (sz > 256) sz = 256;
- strncpy(szHost, phost, sz);
+ mir_strncpy(szHost, phost, sz);
szHost[sz - 1] = 0;
}
@@ -185,7 +185,7 @@ void parseURL(char* szUrl, char* szHost, unsigned short* sPort, char* szPath) }
if (szPath != NULL) {
- strncpy(szPath, ppath, 256);
+ mir_strncpy(szPath, ppath, 256);
szPath[255] = 0;
}
}
@@ -514,7 +514,7 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) size_t ctlLen;
txtParseParam(szData, NULL, "<URLBase>", "</URLBase>", szTemp, sizeof(szTemp));
- strncpy(szCtlUrl, szTemp[0] ? szTemp : szUrl, sizeof(szCtlUrl));
+ mir_strncpy(szCtlUrl, szTemp[0] ? szTemp : szUrl, sizeof(szCtlUrl));
szCtlUrl[sizeof(szCtlUrl) - 1] = 0;
mir_snprintf(szTemp, SIZEOF(szTemp), search_device, szDev);
@@ -541,11 +541,11 @@ static bool getUPnPURLs(char* szUrl, size_t sizeUrl) size_t ctlCLen = mir_strlen(szCtlUrl);
rpth = szCtlUrl + ctlCLen;
if (ctlCLen != 0 && *(rpth - 1) != '/')
- strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen);
+ mir_strncpy(rpth++, "/", sizeof(szCtlUrl) - ctlCLen);
}
ctlLen = sizeof(szCtlUrl) - (rpth - szCtlUrl);
- strncpy(rpth, szUrl, ctlLen);
+ mir_strncpy(rpth, szUrl, ctlLen);
szCtlUrl[sizeof(szCtlUrl) - 1] = 0;
}
else {
diff --git a/src/modules/protocols/protochains.cpp b/src/modules/protocols/protochains.cpp index be760d9877..b664922f49 100644 --- a/src/modules/protocols/protochains.cpp +++ b/src/modules/protocols/protochains.cpp @@ -34,7 +34,7 @@ static int GetProtocolP(MCONTACT hContact, char *szBuf, int cbLen) DBCachedContact *cc = currDb->m_cache->GetCachedContact(hContact);
if (cc && cc->szProto != NULL) {
- strncpy(szBuf, cc->szProto, cbLen);
+ mir_strncpy(szBuf, cc->szProto, cbLen);
szBuf[cbLen - 1] = 0;
return 0;
}
diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 3564e357f0..91b8dba050 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -109,7 +109,7 @@ static __forceinline int _xcscmp(const char *s1, const char *s2) { return mir_st static __forceinline int _xcsncmp(const char *s1, const char *s2, size_t n) { return strncmp(s1, s2, n); }
static __forceinline size_t _xcslen(const char *s1) { return mir_strlen(s1); }
static __forceinline char *_xcscpy(char *s1, const char *s2) { return mir_strcpy(s1, s2); }
-static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return strncpy(s1, s2, n); }
+static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return mir_strncpy(s1, s2, n); }
static __forceinline char *_xstrselect(char *, char *s1, TCHAR *s2) { return s1; }
static __forceinline char *_itox(char *, int a) { return itoa(a, (char *)mir_alloc(sizeof(char)*20), 10); }
static __forceinline char *mir_a2x(char *, char *s) { return mir_strdup(s); }
|