From 9cadeadaff74b37df1c2896e653a80b3ce4c86f6 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sat, 23 May 2015 18:08:26 +0000 Subject: replace _tcsncpy to mir_tstrncpy git-svn-id: http://svn.miranda-ng.org/main/trunk@13786 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/cache.cpp | 2 +- plugins/AVS/src/utils.cpp | 2 +- plugins/Alarms/src/frame.cpp | 2 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 12 ++--- plugins/BuddyExpectator/src/options.cpp | 6 +-- plugins/ChangeKeyboardLayout/src/options.cpp | 4 +- .../ChangeKeyboardLayout/src/text_operations.cpp | 8 +-- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 4 +- plugins/Clist_nicer/src/clcitems.cpp | 4 +- plugins/Clist_nicer/src/clui.cpp | 16 +++--- plugins/Clist_nicer/src/viewmodes.cpp | 2 +- plugins/ConnectionNotify/src/debug.cpp | 6 +-- plugins/ConnectionNotify/src/netstat.cpp | 4 +- plugins/DbChecker/src/main.cpp | 2 +- plugins/Exchange/src/MirandaExchange.cpp | 2 +- plugins/Exchange/src/utils.cpp | 14 +++--- plugins/FTPFileYM/src/manager.cpp | 2 +- plugins/FloatingContacts/src/main.cpp | 2 +- plugins/FloatingContacts/src/thumbs.cpp | 2 +- plugins/Folders/src/services.cpp | 2 +- plugins/Folders/src/utils.cpp | 4 +- plugins/IEView/src/TemplateHTMLBuilder.cpp | 4 +- plugins/MenuItemEx/src/main.cpp | 4 +- plugins/MirOTR/src/utils.cpp | 8 +-- .../MirandaG15/src/LCDFramework/CLCDTextObject.cpp | 2 +- plugins/NewEventNotify/src/popup.cpp | 10 ++-- plugins/NewXstatusNotify/src/indsnd.cpp | 4 +- plugins/NewXstatusNotify/src/main.cpp | 12 ++--- plugins/NewXstatusNotify/src/options.cpp | 18 +++---- plugins/NewXstatusNotify/src/popup.cpp | 4 +- plugins/NewXstatusNotify/src/utils.cpp | 4 +- plugins/NewXstatusNotify/src/xstatus.cpp | 6 +-- plugins/New_GPG/src/main.cpp | 4 +- plugins/New_GPG/src/options.cpp | 2 +- plugins/New_GPG/src/utilities.cpp | 6 +-- plugins/NotesAndReminders/src/options.cpp | 18 +++---- plugins/NotifyAnything/src/main.cpp | 4 +- plugins/Nudge/src/nudge.cpp | 12 ++--- plugins/Scriver/src/infobar.cpp | 4 +- plugins/Scriver/src/msgdialog.cpp | 2 +- plugins/Scriver/src/msgoptions.cpp | 10 ++-- plugins/Scriver/src/utils.cpp | 4 +- plugins/SeenPlugin/src/options.cpp | 4 +- plugins/SeenPlugin/src/utils.cpp | 32 ++++++------ plugins/Spamotron/src/options.cpp | 10 ++-- plugins/StatusPlugins/KeepStatus/keepstatus.cpp | 4 +- plugins/StatusPlugins/KeepStatus/options.cpp | 4 +- plugins/StatusPlugins/StartupStatus/profiles.cpp | 4 +- plugins/TabSRMM/src/chat/options.cpp | 58 +++++++++++----------- plugins/TabSRMM/src/chat/services.cpp | 2 +- plugins/TabSRMM/src/container.cpp | 2 +- plugins/TabSRMM/src/controls.cpp | 2 +- plugins/TabSRMM/src/eventpopups.cpp | 6 +-- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/msgdlgutils.cpp | 4 +- plugins/TabSRMM/src/msglog.cpp | 4 +- plugins/TabSRMM/src/msgs.cpp | 4 +- plugins/TabSRMM/src/selectcontainer.cpp | 2 +- plugins/TabSRMM/src/utils.cpp | 4 +- plugins/TipperYM/src/options.cpp | 28 +++++------ plugins/TipperYM/src/popwin.cpp | 4 +- plugins/TipperYM/src/subst.cpp | 16 +++--- plugins/TipperYM/src/translations.cpp | 12 ++--- plugins/TooltipNotify/src/TooltipNotify.cpp | 18 +++---- plugins/TrafficCounter/src/TrafficCounter.cpp | 4 +- plugins/TrafficCounter/src/misc.cpp | 6 +-- plugins/UserGuide/src/main.cpp | 6 +-- plugins/Variables/src/parse_alias.cpp | 2 +- plugins/Variables/src/parse_str.cpp | 18 +++---- plugins/Variables/src/parse_system.cpp | 6 +-- plugins/Variables/src/variables.cpp | 4 +- plugins/Weather/src/weather_addstn.cpp | 10 ++-- plugins/Weather/src/weather_contacts.cpp | 10 ++-- plugins/Weather/src/weather_data.cpp | 36 +++++++------- plugins/Weather/src/weather_info.cpp | 2 +- plugins/Weather/src/weather_ini.cpp | 2 +- plugins/Weather/src/weather_opt.cpp | 22 ++++---- plugins/Weather/src/weather_popup.cpp | 8 +-- plugins/Weather/src/weather_update.cpp | 6 +-- plugins/Weather/src/weather_userinfo.cpp | 2 +- plugins/WebView/src/webview_services.cpp | 4 +- plugins/WhenWasIt/src/notifiers.cpp | 4 +- plugins/WhenWasIt/src/services.cpp | 4 +- plugins/WhoUsesMyFiles/src/wumfplug.cpp | 2 +- plugins/XSoundNotify/src/Common.h | 2 +- plugins/XSoundNotify/src/dialog.cpp | 2 +- plugins/XSoundNotify/src/options.cpp | 2 +- plugins/YAMN/src/main.cpp | 2 +- plugins/YAPP/src/services.cpp | 2 +- plugins/YAPP/src/yapp_history_dlg.cpp | 4 +- plugins/YARelay/src/main.cpp | 4 +- plugins/YahooGroups/src/utils.cpp | 2 +- plugins/helpers/gen_helpers.cpp | 2 +- plugins/wbOSD/src/events.cpp | 2 +- protocols/AimOscar/src/services.cpp | 2 +- protocols/FacebookRM/src/avatars.cpp | 2 +- protocols/GTalkExt/src/handlers.cpp | 2 +- protocols/Gadu-Gadu/src/image.cpp | 6 +-- protocols/Gadu-Gadu/src/import.cpp | 18 +++---- protocols/IRCG/src/options.cpp | 2 +- protocols/IcqOscarJ/src/icqosc_svcs.cpp | 2 +- protocols/MSN/src/msn_chat.cpp | 4 +- protocols/Sametime/src/userlist.cpp | 10 ++-- protocols/SkypeWeb/src/skype_avatars.cpp | 4 +- protocols/Steam/src/steam_avatars.cpp | 2 +- protocols/Tlen/src/tlen_opt.cpp | 4 +- protocols/Tlen/src/tlen_thread.cpp | 4 +- protocols/Tox/src/tox_transfer.cpp | 2 +- protocols/Twitter/src/connection.cpp | 4 +- protocols/Twitter/src/ui.cpp | 4 +- protocols/VKontakte/src/vk_avatars.cpp | 4 +- protocols/Yahoo/src/avatar.cpp | 2 +- src/core/stdchat/src/main.cpp | 12 ++--- src/core/stdclist/src/clcfonts.cpp | 14 +++--- src/core/stdfile/src/fileexistsdlg.cpp | 2 +- src/core/stdfile/src/filerecvdlg.cpp | 4 +- src/core/stdmsg/src/msgoptions.cpp | 2 +- src/core/stduihist/src/history.cpp | 4 +- src/modules/netlib/netlibsecurity.cpp | 2 +- src/modules/utils/path.cpp | 2 +- 120 files changed, 386 insertions(+), 386 deletions(-) diff --git a/plugins/AVS/src/cache.cpp b/plugins/AVS/src/cache.cpp index d14200ac06..07e5538213 100644 --- a/plugins/AVS/src/cache.cpp +++ b/plugins/AVS/src/cache.cpp @@ -129,7 +129,7 @@ void NotifyMetaAware(MCONTACT hContact, CacheNode *node, AVATARCACHEENTRY *ace) cacn.cbSize = sizeof(CONTACTAVATARCHANGEDNOTIFICATION); cacn.hContact = hContact; cacn.format = node->pa_format; - _tcsncpy(cacn.filename, node->szFilename, MAX_PATH); + mir_tstrncpy(cacn.filename, node->szFilename, MAX_PATH); cacn.filename[MAX_PATH - 1] = 0; // Get hash diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index fefbfd0596..cb3d281f8c 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -149,7 +149,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) ace->bmHeight = 0; ace->bmWidth = 0; ace->lpDIBSection = NULL; - _tcsncpy(ace->szFilename, tszFilename, MAX_PATH); + mir_tstrncpy(ace->szFilename, tszFilename, MAX_PATH); ace->szFilename[MAX_PATH - 1] = 0; if (ace->hbmPic == 0) return -1; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 021e718ee4..0fbf4f8b71 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -153,7 +153,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (len > 511) len = 511; while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) { len--; - _tcsncpy(titlebuff, alarm.szTitle, len); + mir_tstrncpy(titlebuff, alarm.szTitle, len); titlebuff[len] = 0; mir_tstrcat(titlebuff, _T("...")); GetTextExtentPoint32(dis->hDC,titlebuff,(int)mir_tstrlen(titlebuff),&textSize); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index f9f9a45d0a..f201c24f26 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -267,8 +267,8 @@ void ReturnNotify(MCONTACT hContact, TCHAR *message) POPUPDATAT ppd = { 0 }; ppd.lchContact = hContact; ppd.lchIcon = hIcon; - _tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, message, MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, message, MAX_SECONDLINE); if (!options.iUsePopupColors) { ppd.colorBack = options.iPopupColorBack; ppd.colorText = options.iPopupColorFore; @@ -305,8 +305,8 @@ void GoneNotify(MCONTACT hContact, TCHAR *message) POPUPDATAT ppd = { 0 }; ppd.lchContact = hContact; ppd.lchIcon = hIcon; - _tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, message, MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, message, MAX_SECONDLINE); if (!options.iUsePopupColors) { ppd.colorBack = options.iPopupColorBack; ppd.colorText = options.iPopupColorFore; @@ -495,8 +495,8 @@ int SettingChanged(WPARAM hContact, LPARAM lParam) ppd.lchContact = hContact; ppd.lchIcon = Skin_GetIcon("enabled_icon"); - _tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE); if (!options.iUsePopupColors) { ppd.colorBack = options.iPopupColorBack; ppd.colorText = options.iPopupColorFore; diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp index d936da7738..46037f326e 100644 --- a/plugins/BuddyExpectator/src/options.cpp +++ b/plugins/BuddyExpectator/src/options.cpp @@ -325,10 +325,10 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP ppd.lchContact = NULL; ppd.lchIcon = hIcon; - _tcsncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzContactName, TranslateT("Contact name"), MAX_CONTACTNAME); TCHAR szPreviewText[250]; mir_sntprintf(szPreviewText, SIZEOF(szPreviewText), TranslateT("has returned after being absent since %d days"), rand() % 30); - _tcsncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzText, szPreviewText, MAX_SECONDLINE); // Get current popups colors options if (IsDlgButtonChecked(hwndDlg, IDC_COLORS_POPUP)) @@ -346,7 +346,7 @@ static INT_PTR CALLBACK PopupOptionsFrameProc(HWND hwndDlg, UINT uMsg, WPARAM wP CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NO_HISTORY); - _tcsncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzText, TranslateT("You awaited this contact!"), MAX_SECONDLINE); ppd.lchIcon = Skin_GetIcon("enabled_icon"); CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&ppd, APF_NO_HISTORY); diff --git a/plugins/ChangeKeyboardLayout/src/options.cpp b/plugins/ChangeKeyboardLayout/src/options.cpp index a7dc262382..89398096aa 100644 --- a/plugins/ChangeKeyboardLayout/src/options.cpp +++ b/plugins/ChangeKeyboardLayout/src/options.cpp @@ -354,8 +354,8 @@ INT_PTR CALLBACK DlgPopupsProcOptions(HWND hWnd, UINT uiMessage, WPARAM wParam, POPUPDATAT_V2 pdtData = { 0 }; pdtData.cbSize = sizeof(pdtData); - _tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME); - _tcsncpy(pdtData.lptzText, _T("Ghbdtn? rfr ltkf&"), MAX_SECONDLINE); + mir_tstrncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME); + mir_tstrncpy(pdtData.lptzText, _T("Ghbdtn? rfr ltkf&"), MAX_SECONDLINE); switch(poOptionsTemp.bColourType) { case PPC_POPUP: diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 644edb9bc9..04cc68afcf 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -301,7 +301,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) ptszInText = (LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR)); iRes = GetWindowText(hTextWnd, ptszTemp, MaxTextSize); if (!IsBadStringPtr(ptszInText, MaxTextSize) && (iRes > 0)) { - _tcsncpy(ptszInText, &ptszTemp[crSelection.cpMin], crSelection.cpMax - crSelection.cpMin); + mir_tstrncpy(ptszInText, &ptszTemp[crSelection.cpMin], crSelection.cpMax - crSelection.cpMin); ptszInText[crSelection.cpMax - crSelection.cpMin] = 0; } else { @@ -375,7 +375,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (WindowType == WTYPE_Edit) { ptrT ptszTemp((LPTSTR)mir_alloc(MaxTextSize*sizeof(TCHAR))); - _tcsncpy(ptszTemp, &ptszInText[crTemp.cpMin], crTemp.cpMax - crTemp.cpMin); + mir_tstrncpy(ptszTemp, &ptszInText[crTemp.cpMin], crTemp.cpMax - crTemp.cpMin); ptszTemp[crTemp.cpMax - crTemp.cpMin] = 0; mir_tstrcpy(ptszInText, ptszTemp); @@ -450,8 +450,8 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) POPUPDATAT_V2 pdtData = { 0 }; pdtData.cbSize = sizeof(pdtData); - _tcsncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME); - _tcsncpy(pdtData.lptzText, ptszPopupText, MAX_SECONDLINE); + mir_tstrncpy(pdtData.lptzContactName, TranslateT(ModuleName), MAX_CONTACTNAME); + mir_tstrncpy(pdtData.lptzText, ptszPopupText, MAX_SECONDLINE); switch (poOptions.bColourType) { case PPC_POPUP: diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index 09fb832fe5..30b3e2d92c 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -167,8 +167,8 @@ void ShowPopup(SHOWPOPUP_DATA *sd) ppd.lchIcon = LoadSkinnedProtoIcon(szProto, db_get_w(sd->hContact, szProto, "Status", ID_STATUS_OFFLINE)); pdata->hIcon = NULL; } - _tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)sd->hContact, GCDNF_TCHAR), lengthof(ppd.lptzContactName) - 1); - _tcsncpy(ppd.lptzText, PopupText, lengthof(ppd.lptzText) - 1); + mir_tstrncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)sd->hContact, GCDNF_TCHAR), lengthof(ppd.lptzContactName) - 1); + mir_tstrncpy(ppd.lptzText, PopupText, lengthof(ppd.lptzText) - 1); ppd.colorBack = (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_DEFBGCOLOUR) ? 0 : sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_BGCOLOUR)); ppd.colorText = (sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_DEFTEXTCOLOUR) ? 0 : sd->PopupOptPage->GetValue(IDC_POPUPOPTDLG_TEXTCOLOUR)); ppd.PluginWindowProc = PopupWndProc; diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 1d610cd65d..7bc81f8864 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -265,7 +265,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) size_t iLen = mir_tstrlen(dbv.ptszVal); p->bStatusMsgValid = STATUSMSG_XSTATUSNAME; p->statusMsg = (TCHAR *)realloc(p->statusMsg, (iLen + 2) * sizeof(TCHAR)); - _tcsncpy(p->statusMsg, dbv.ptszVal, iLen + 1); + mir_tstrncpy(p->statusMsg, dbv.ptszVal, iLen + 1); } else { int xStatus; @@ -282,7 +282,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (!CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst)) { TCHAR *szwXstatusName = TranslateTS(xStatusName); p->statusMsg = (TCHAR *)realloc(p->statusMsg, (mir_tstrlen(szwXstatusName) + 2) * sizeof(TCHAR)); - _tcsncpy(p->statusMsg, szwXstatusName, mir_tstrlen(szwXstatusName) + 1); + mir_tstrncpy(p->statusMsg, szwXstatusName, mir_tstrlen(szwXstatusName) + 1); p->bStatusMsgValid = STATUSMSG_XSTATUSNAME; } } diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index add59df1ed..0b166c5937 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -2010,7 +2010,7 @@ static clistFontDescr[] = { void FS_RegisterFonts() { FontIDT fid = { sizeof(fid) }; - _tcsncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group)); + mir_tstrncpy(fid.group, LPGENT("Contact list"), SIZEOF(fid.group)); mir_strncpy(fid.dbSettingsGroup, "CLC", 5); fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS | FIDF_APPENDNAME | FIDF_SAVEPOINTSIZE; @@ -2028,7 +2028,7 @@ void FS_RegisterFonts() fid.flags &= ~FIDF_CLASSMASK; fid.flags |= clistFontDescr[i].iMask; - _tcsncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name)); + mir_tstrncpy(fid.name, clistFontDescr[i].tszName, SIZEOF(fid.name)); char idstr[10]; mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); @@ -2045,32 +2045,32 @@ void FS_RegisterFonts() mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); 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)); + mir_tstrncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); 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)); + mir_tstrncpy(colourid.name, LPGENT("Embedded frames border"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = RGB(40, 40, 40); ColourRegisterT(&colourid); diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index c168e671fe..5126d10f0c 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -1060,7 +1060,7 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, SIZEOF(szSetting), "%c%s_GF", 246, name); if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) { if (mir_tstrlen(dbv.ptszVal) >= 2) { - _tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter)); + mir_tstrncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter)); cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0; cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS; } diff --git a/plugins/ConnectionNotify/src/debug.cpp b/plugins/ConnectionNotify/src/debug.cpp index b35421de9e..8e09246b6d 100644 --- a/plugins/ConnectionNotify/src/debug.cpp +++ b/plugins/ConnectionNotify/src/debug.cpp @@ -28,7 +28,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) { TCHAR* s = va_arg(argptr, TCHAR *); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, s); - _tcsncpy(format, OutMsg, _countof(OutMsg)); + mir_tstrncpy(format, OutMsg, _countof(OutMsg)); j = (int)mir_tstrlen(format); mir_tstrcat(format, _T(" ")); break; @@ -38,7 +38,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) { char c = (char)va_arg(argptr, int); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, c); - _tcsncpy(format, OutMsg, _countof(OutMsg)); + mir_tstrncpy(format, OutMsg, _countof(OutMsg)); j = (int)mir_tstrlen(format); mir_tstrcat(format, _T(" ")); break; @@ -48,7 +48,7 @@ void _OutputDebugString(TCHAR* lpOutputString, ...) { int d = va_arg(argptr, int); mir_sntprintf(OutMsg, SIZEOF(OutMsg), format, d); - _tcsncpy(format, OutMsg, _countof(OutMsg)); + mir_tstrncpy(format, OutMsg, _countof(OutMsg)); j = (int)mir_tstrlen(format); mir_tstrcat(format, _T(" ")); break; diff --git a/plugins/ConnectionNotify/src/netstat.cpp b/plugins/ConnectionNotify/src/netstat.cpp index 8f0eaa2155..14d21733b3 100644 --- a/plugins/ConnectionNotify/src/netstat.cpp +++ b/plugins/ConnectionNotify/src/netstat.cpp @@ -42,14 +42,14 @@ struct CONNECTION *GetConnectionsTable() IpAddr.S_un.S_addr = (ULONG)pTcpTable->table[i].dwLocalAddr; //_snprintf(newConn->strIntIp,_countof(newConn->strIntIp),"%d.%d.%d.%d",IpAddr.S_un.S_un_b.s_b1,IpAddr.S_un.S_un_b.s_b2,IpAddr.S_un.S_un_b.s_b3,IpAddr.S_un.S_un_b.s_b4); TCHAR *strIntIp = mir_a2t(inet_ntoa(IpAddr)); - _tcsncpy(newConn->strIntIp, strIntIp, SIZEOF(newConn->strIntIp) - 1); + mir_tstrncpy(newConn->strIntIp, strIntIp, SIZEOF(newConn->strIntIp) - 1); mir_free(strIntIp); } if (pTcpTable->table[i].dwRemoteAddr) { IpAddr.S_un.S_addr = (u_long)pTcpTable->table[i].dwRemoteAddr; TCHAR *strExtIp = mir_a2t(inet_ntoa(IpAddr)); - _tcsncpy(newConn->strExtIp, strExtIp, SIZEOF(newConn->strExtIp) - 1); + mir_tstrncpy(newConn->strExtIp, strExtIp, SIZEOF(newConn->strExtIp) - 1); mir_free(strExtIp); } newConn->state = pTcpTable->table[i].dwState; diff --git a/plugins/DbChecker/src/main.cpp b/plugins/DbChecker/src/main.cpp index c7f1149dde..b385b5465c 100644 --- a/plugins/DbChecker/src/main.cpp +++ b/plugins/DbChecker/src/main.cpp @@ -73,7 +73,7 @@ static INT_PTR CheckProfile(WPARAM wParam, LPARAM lParam) bLaunchMiranda = lParam != 0; bAutoExit = lParam == 2; bServiceMode = false; - _tcsncpy(opts.filename, (TCHAR*)wParam, SIZEOF(opts.filename)); + mir_tstrncpy(opts.filename, (TCHAR*)wParam, SIZEOF(opts.filename)); return DialogBox(hInst, MAKEINTRESOURCE(IDD_WIZARD), NULL, WizardDlgProc); } diff --git a/plugins/Exchange/src/MirandaExchange.cpp b/plugins/Exchange/src/MirandaExchange.cpp index 52a21e8a18..6b4a6996e5 100644 --- a/plugins/Exchange/src/MirandaExchange.cpp +++ b/plugins/Exchange/src/MirandaExchange.cpp @@ -435,7 +435,7 @@ HRESULT CMirandaExchange::InitializeAndLogin( LPCTSTR szUsername, LPCTSTR szPass TCHAR szPID[20]; _tstrtime(szPID); - _tcsncpy(szPIDandName, m_szUsername, SIZEOF(szPIDandName)-1); + mir_tstrncpy(szPIDandName, m_szUsername, SIZEOF(szPIDandName)-1); mir_tstrncat(szPIDandName, szPID, SIZEOF(szPIDandName) - mir_tstrlen(szPIDandName)); hr = CreateProfile(szPIDandName); diff --git a/plugins/Exchange/src/utils.cpp b/plugins/Exchange/src/utils.cpp index e89a170732..0186ea9a07 100644 --- a/plugins/Exchange/src/utils.cpp +++ b/plugins/Exchange/src/utils.cpp @@ -95,15 +95,15 @@ char *BinToHex(int size, PBYTE data) void HexToBin(TCHAR *inData, ULONG &size, LPBYTE &outData) { TCHAR buffer[32] = {0}; - _tcsncpy(buffer, _T("0x"),_countof(_T("0x"))); - _tcsncpy(buffer + 2, inData, HEX_SIZE); + mir_tstrncpy(buffer, _T("0x"),_countof(_T("0x"))); + mir_tstrncpy(buffer + 2, inData, HEX_SIZE); _stscanf(buffer, _T("%x"), &size); outData = (unsigned char*)new char[size*2]; TCHAR *tmp = inData + HEX_SIZE; buffer[4] = '\0'; //mark the end of the string for (UINT i = 0; i < size; i++) { - _tcsncpy(buffer + 2, &tmp[i * 2], 2); + mir_tstrncpy(buffer + 2, &tmp[i * 2], 2); _stscanf(buffer, _T("%x"), &outData[i]); } } @@ -118,7 +118,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, res = 0; int tmp = mir_tstrlen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; - _tcsncpy(szResult, dbv.ptszVal, len); + mir_tstrncpy(szResult, dbv.ptszVal, len); szResult[len] = '\0'; mir_free(dbv.ptszVal); } @@ -126,7 +126,7 @@ int GetStringFromDatabase(char *szSettingName, TCHAR *szError, TCHAR *szResult, res = 1; int tmp = mir_tstrlen(szError); len = (tmp < size - 1) ? tmp : size - 1; - _tcsncpy(szResult, szError, len); + mir_tstrncpy(szResult, szError, len); szResult[len] = '\0'; } return res; @@ -225,7 +225,7 @@ void _popupUtil(TCHAR* szMsg) { POPUPDATAT ppd = {0}; ppd.lchIcon = hiMailIcon; - _tcsncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME-1); - _tcsncpy(ppd.lptzText, szMsg,MAX_SECONDLINE-1); + mir_tstrncpy(ppd.lptzContactName, _T("Exchange notifier"), MAX_CONTACTNAME-1); + mir_tstrncpy(ppd.lptzText, szMsg,MAX_SECONDLINE-1); PUAddPopupT(&ppd); //show a popup to tell the user what we're doing. } diff --git a/plugins/FTPFileYM/src/manager.cpp b/plugins/FTPFileYM/src/manager.cpp index 7e5fa09bae..aee1a962f8 100644 --- a/plugins/FTPFileYM/src/manager.cpp +++ b/plugins/FTPFileYM/src/manager.cpp @@ -422,7 +422,7 @@ INT_PTR CALLBACK Manager::ManagerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, { if (item->stzToolTip[0]) { - _tcsncpy(tvInfoTip->pszText, item->stzToolTip, tvInfoTip->cchTextMax - 1); + mir_tstrncpy(tvInfoTip->pszText, item->stzToolTip, tvInfoTip->cchTextMax - 1); tvInfoTip->pszText[tvInfoTip->cchTextMax - 1] = 0; } } diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 9799101748..3ca1983040 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -413,7 +413,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM case WM_REFRESH_CONTACT: if (pThumb) { - _tcsncpy( pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR ), USERNAME_LEN - 1); + mir_tstrncpy( pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR ), USERNAME_LEN - 1); pThumb->RefreshContactStatus((int)lParam); pThumb->ResizeThumb(); } diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp index e5ea984121..d7bd378618 100644 --- a/plugins/FloatingContacts/src/thumbs.cpp +++ b/plugins/FloatingContacts/src/thumbs.cpp @@ -757,7 +757,7 @@ ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, MCONTACT hContact) return NULL; ThumbInfo *pThumb = new ThumbInfo; - _tcsncpy( pThumb->ptszName, ptszName, USERNAME_LEN - 1); + mir_tstrncpy( pThumb->ptszName, ptszName, USERNAME_LEN - 1); pThumb->hContact = hContact; pThumb->hwnd = hwnd; diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index b8ec3c4ae9..008daa2254 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -39,7 +39,7 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size) input = mir_tstrdup(format); TCHAR *core_result = Utils_ReplaceVarsT(input); - _tcsncpy(szResult, core_result, size); + mir_tstrncpy(szResult, core_result, size); mir_free(core_result); diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index 4b3a310871..90670505a1 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -186,7 +186,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz if (db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) { size_t tmp = mir_tstrlen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; - _tcsncpy(szResult, dbv.ptszVal, len); + mir_tstrncpy(szResult, dbv.ptszVal, len); szResult[len] = '\0'; db_free(&dbv); return 0; @@ -194,7 +194,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz size_t tmp = mir_tstrlen(szError); len = (tmp < size - 1) ? tmp : size - 1; - _tcsncpy(szResult, szError, len); + mir_tstrncpy(szResult, szError, len); szResult[len] = '\0'; return 1; } diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index e63cfd2203..3253e522d2 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -137,9 +137,9 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0; today = mktime(&tm_today); if (dwFlags & Options::LOG_RELATIVE_DATE && check >= today) - _tcsncpy(str, TranslateT("Today"), SIZEOF(str)); + mir_tstrncpy(str, TranslateT("Today"), SIZEOF(str)); else if (dwFlags & Options::LOG_RELATIVE_DATE && check > (today - 86400)) - _tcsncpy(str, TranslateT("Yesterday"), SIZEOF(str)); + mir_tstrncpy(str, TranslateT("Yesterday"), SIZEOF(str)); else { dbtts.szFormat = (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d"); CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM)& dbtts); diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index a98d9f33bf..79ee852e4c 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -215,8 +215,8 @@ void ShowPopup(char* szText, TCHAR* tszText, MCONTACT hContact) ppd.lchIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); ppd.lchContact = hContact; - _tcsncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME - 1); - _tcsncpy(ppd.lptzText, text, MAX_SECONDLINE - 1); + mir_tstrncpy(ppd.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME - 1); + mir_tstrncpy(ppd.lptzText, text, MAX_SECONDLINE - 1); ppd.iSeconds = -1; PUAddPopupT(&ppd); diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index 5e9715e256..9d59edd5ab 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -184,12 +184,12 @@ void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const MCONTA ppd.lchIcon = NULL; if(line1 && line2) { - _tcsncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); - _tcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); + mir_tstrncpy( ppd.lptzContactName, line1, MAX_CONTACTNAME-1 ); + mir_tstrncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); } else if(line1) - _tcsncpy( ppd.lptzText, line1, MAX_SECONDLINE-1 ); + mir_tstrncpy( ppd.lptzText, line1, MAX_SECONDLINE-1 ); else if(line2) - _tcsncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); + mir_tstrncpy( ppd.lptzText, line2, MAX_SECONDLINE-1 ); ppd.iSeconds = timeout; diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp index 9d49c40aa8..a109624ea4 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDTextObject.cpp @@ -110,7 +110,7 @@ void CLCDTextObject::SetFontFaceName(tstring strFontName) memset(&lf, 0, sizeof(lf)); GetObject(m_hFont, sizeof(LOGFONT), &lf); - _tcsncpy(lf.lfFaceName, strFontName.c_str(), LF_FACESIZE); + mir_tstrncpy(lf.lfFaceName, strFontName.c_str(), LF_FACESIZE); SetFont(lf); } diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 26abadd88b..429611e13f 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -490,12 +490,12 @@ int PopupShow(PLUGIN_OPTIONS* pluginOptions, MCONTACT hContact, MEVENT hEvent, U // if hContact is NULL, && hEvent is NULL then popup is only Test if ((hContact == NULL) && (hEvent == NULL)) { - _tcsncpy(pudw.lptzContactName, TranslateT("Plugin Test"), MAX_CONTACTNAME); - _tcsncpy(pudw.lptzText, TranslateTS(sampleEvent), MAX_SECONDLINE); + mir_tstrncpy(pudw.lptzContactName, TranslateT("Plugin Test"), MAX_CONTACTNAME); + mir_tstrncpy(pudw.lptzText, TranslateTS(sampleEvent), MAX_SECONDLINE); } else { // get the needed event data - _tcsncpy(pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); - _tcsncpy(pudw.lptzText, ptrT(GetEventPreview(&dbe)), MAX_SECONDLINE); + mir_tstrncpy(pudw.lptzContactName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR), MAX_CONTACTNAME); + mir_tstrncpy(pudw.lptzText, ptrT(GetEventPreview(&dbe)), MAX_SECONDLINE); } PopupCount++; @@ -573,7 +573,7 @@ int PopupUpdate(MCONTACT hContact, MEVENT hEvent) TCHAR timestamp[MAX_DATASIZE]; TCHAR formatTime[MAX_DATASIZE]; if (pdata->pluginOptions->bShowDate) - _tcsncpy(formatTime, _T("%Y.%m.%d"), SIZEOF(formatTime)); + mir_tstrncpy(formatTime, _T("%Y.%m.%d"), SIZEOF(formatTime)); else if (pdata->pluginOptions->bShowTime) mir_tstrncat(formatTime, _T(" %H:%M"), SIZEOF(formatTime) - mir_tstrlen(formatTime)); time_t localTime = dbe.timestamp; diff --git a/plugins/NewXstatusNotify/src/indsnd.cpp b/plugins/NewXstatusNotify/src/indsnd.cpp index 011873b9e9..874f12db84 100644 --- a/plugins/NewXstatusNotify/src/indsnd.cpp +++ b/plugins/NewXstatusNotify/src/indsnd.cpp @@ -171,11 +171,11 @@ INT_PTR CALLBACK DlgProcSoundUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA lvi.iItem = ListView_InsertItem(hList, &lvi); if (!db_get_ts(hContact, MODULE, StatusList[i].lpzSkinSoundName, &dbv)) { - _tcsncpy(buff, dbv.ptszVal, SIZEOF(buff)-1); + mir_tstrncpy(buff, dbv.ptszVal, SIZEOF(buff)-1); db_free(&dbv); } else - _tcsncpy(buff, TranslateT(DEFAULT_SOUND), SIZEOF(buff)-1); + mir_tstrncpy(buff, TranslateT(DEFAULT_SOUND), SIZEOF(buff)-1); ListView_SetItemText(hList, lvi.iItem, 1, buff); } diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 90acfb1646..0bc711d4c3 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -289,18 +289,18 @@ void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stz if (opt.UseAlternativeText) { switch (GetGender(hContact)) { case GENDER_MALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); + mir_tstrncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT); break; case GENDER_FEMALE: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); + mir_tstrncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT); break; case GENDER_UNSPECIFIED: - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); + mir_tstrncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT); break; } } else - _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); + mir_tstrncpy(stzStatusText, StatusList[Index(newStatus)].lpzStandardText, MAX_STATUSTEXT); if (opt.ShowPreviousStatus) { TCHAR buff[MAX_STATUSTEXT]; @@ -328,7 +328,7 @@ void PlayChangeSound(MCONTACT hContact, const char *name) DBVARIANT dbv; TCHAR stzSoundFile[MAX_PATH] = { 0 }; if (!db_get_ts(hContact, MODULE, name, &dbv)) { - _tcsncpy(stzSoundFile, dbv.ptszVal, SIZEOF(stzSoundFile)-1); + mir_tstrncpy(stzSoundFile, dbv.ptszVal, SIZEOF(stzSoundFile)-1); db_free(&dbv); } @@ -686,7 +686,7 @@ int ProcessStatusMessage(DBCONTACTWRITESETTING *cws, MCONTACT hContact) if (opt.PSMsgTruncate && (opt.PSMsgLen > 0) && smi.newstatusmsg && (mir_tstrlen(smi.newstatusmsg) > opt.PSMsgLen)) { TCHAR buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(smi.newstatusmsg); - _tcsncpy(buff, smi.newstatusmsg, opt.PSMsgLen); + mir_tstrncpy(buff, smi.newstatusmsg, opt.PSMsgLen); buff[opt.PSMsgLen] = 0; mir_tstrcat(buff, _T("...")); replaceStrT(smi.newstatusmsg, buff); diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp index 1952dd4e2f..eb29293ab5 100644 --- a/plugins/NewXstatusNotify/src/options.cpp +++ b/plugins/NewXstatusNotify/src/options.cpp @@ -381,13 +381,13 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM { TCHAR str[MAX_SECONDLINE] = { 0 }; for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) { - _tcsncpy(str, _T(""), SIZEOF(str)); + mir_tstrncpy(str, _T(""), SIZEOF(str)); if (opt.ShowStatus) { if (opt.UseAlternativeText == 1) - _tcsncpy(str, StatusList[Index(i)].lpzUStatusText, SIZEOF(str)); + mir_tstrncpy(str, StatusList[Index(i)].lpzUStatusText, SIZEOF(str)); else - _tcsncpy(str, StatusList[Index(i)].lpzStandardText, SIZEOF(str)); + mir_tstrncpy(str, StatusList[Index(i)].lpzStandardText, SIZEOF(str)); if (opt.ShowPreviousStatus) { TCHAR buff[MAX_STATUSTEXT]; @@ -405,9 +405,9 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ShowChangePopup(NULL, LoadSkinnedProtoIcon(NULL, i), i, str); } - _tcsncpy(str, TranslateT("This is extra status"), SIZEOF(str)); + mir_tstrncpy(str, TranslateT("This is extra status"), SIZEOF(str)); ShowChangePopup(NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str); - _tcsncpy(str, TranslateT("This is status message"), SIZEOF(str)); + mir_tstrncpy(str, TranslateT("This is status message"), SIZEOF(str)); ShowChangePopup(NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str); return FALSE; @@ -731,17 +731,17 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA char protoname[MAX_PATH] = { 0 }; mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgChanged", protos[i]->szModuleName); if (db_get_ts(NULL, MODULE, protoname, &dbVar)) - _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg)); + mir_tstrncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg)); else { - _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg)); + mir_tstrncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg)); db_free(&dbVar); } mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgRemoved", protos[i]->szModuleName); if (db_get_ts(NULL, MODULE, protoname, &dbVar)) - _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved)); + mir_tstrncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved)); else { - _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved)); + mir_tstrncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved)); db_free(&dbVar); } diff --git a/plugins/NewXstatusNotify/src/popup.cpp b/plugins/NewXstatusNotify/src/popup.cpp index 8410aea172..42758dd08f 100644 --- a/plugins/NewXstatusNotify/src/popup.cpp +++ b/plugins/NewXstatusNotify/src/popup.cpp @@ -36,7 +36,7 @@ void ShowChangePopup(MCONTACT hContact, HICON hIcon, WORD newStatus, const TCHAR } _tcsncpy_s(ppd.lptzContactName, buf, _TRUNCATE); - _tcsncpy(ppd.lptzText, stzText, SIZEOF(ppd.lptzText)); + mir_tstrncpy(ppd.lptzText, stzText, SIZEOF(ppd.lptzText)); switch (opt.Colors) { case POPUP_COLOR_OWN: @@ -87,7 +87,7 @@ static int AwayMsgHook(WPARAM, LPARAM lParam, LPARAM pObj) if (pstzLast) mir_sntprintf(stzText, SIZEOF(stzText), _T("%s\n%s"), pstzLast, tszStatus); else - _tcsncpy(stzText, tszStatus, SIZEOF(stzText)); + mir_tstrncpy(stzText, tszStatus, SIZEOF(stzText)); SendMessage(pdp->hWnd, WM_SETREDRAW, FALSE, 0); PUChangeTextT(pdp->hWnd, stzText); SendMessage(pdp->hWnd, WM_SETREDRAW, TRUE, 0); diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index 7dd1e9dc58..b32069b5cf 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -45,12 +45,12 @@ int DBGetStringDefault(MCONTACT hContact, const char *szModule, const char *szSe { DBVARIANT dbv; if (!db_get_ts(hContact, szModule, szSetting, &dbv)) { - _tcsncpy(setting, dbv.ptszVal, size); + mir_tstrncpy(setting, dbv.ptszVal, size); db_free(&dbv); return 0; } - _tcsncpy(setting, defaultValue, size); + mir_tstrncpy(setting, defaultValue, size); return 1; } diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index e39af13d61..86aaac6084 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -192,7 +192,7 @@ void ShowXStatusPopup(XSTATUSCHANGE *xsc) if (opt.PXMsgTruncate && (opt.PXMsgLen > 0) && xsc->stzText && (mir_tstrlen(xsc->stzText) > opt.PXMsgLen)) { TCHAR buff[MAX_TEXT_LEN + 3]; copyText = mir_tstrdup(xsc->stzText); - _tcsncpy(buff, xsc->stzText, opt.PXMsgLen); + mir_tstrncpy(buff, xsc->stzText, opt.PXMsgLen); buff[opt.PXMsgLen] = 0; mir_tstrcat(buff, _T("...")); replaceStrT(xsc->stzText, buff); @@ -436,7 +436,7 @@ TCHAR* GetIcqXStatus(MCONTACT hContact, char *szProto, char *szValue, TCHAR *buf if ((mir_strcmp(szValue, "XStatusName") == 0) && dbv.ptszVal[0] == 0) GetDefaultXstatusName(statusID, szProto, buff, bufflen); else - _tcsncpy(buff, dbv.ptszVal, bufflen); + mir_tstrncpy(buff, dbv.ptszVal, bufflen); buff[bufflen - 1] = 0; db_free(&dbv); @@ -454,7 +454,7 @@ TCHAR* GetJabberAdvStatusText(MCONTACT hContact, char *szProto, char *szSlot, ch mir_snprintf(szSetting, SIZEOF(szSetting), "%s/%s/%s", szProto, szSlot, szValue); if (!db_get_ts(hContact, "AdvStatus", szSetting, &dbv)) { - _tcsncpy(buff, dbv.ptszVal, bufflen); + mir_tstrncpy(buff, dbv.ptszVal, bufflen); buff[bufflen - 1] = 0; db_free(&dbv); } diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index e282fe17b1..a0d0d2b547 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2050,7 +2050,7 @@ void InitCheck() if(!home_dir_access || !temp_access || !gpg_valid) { TCHAR buf[4096]; - _tcsncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf)); + mir_tstrncpy(buf, gpg_valid?TranslateT("GPG binary is set and valid (this is good).\n"):TranslateT("GPG binary unset or invalid (plugin will not work).\n"), SIZEOF(buf)); mir_tstrncat(buf, home_dir_access?TranslateT("Home dir write access granted (this is good).\n"):TranslateT("Home dir has no write access (plugin most probably will not work).\n"), SIZEOF(buf) - mir_tstrlen(buf)); mir_tstrncat(buf, temp_access?TranslateT("Temp dir write access granted (this is good).\n"):TranslateT("Temp dir has no write access (plugin should work, but may have some problems, file transfers will not work)."), SIZEOF(buf) - mir_tstrlen(buf)); if(!gpg_valid) @@ -2302,7 +2302,7 @@ void ImportKey() DWORD exitcode; { ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcsncpy(tmp2, ptmp, MAX_PATH-1); + mir_tstrncpy(tmp2, ptmp, MAX_PATH-1); mir_free(ptmp); mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index 3973d1cd39..d68030b79c 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -903,7 +903,7 @@ static INT_PTR CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam { MCONTACT hcnt = db_mc_tryMeta(hContact); ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcsncpy(tmp2, ptmp, MAX_PATH-1); + mir_tstrncpy(tmp2, ptmp, MAX_PATH-1); mir_free(ptmp); mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index 55cc45a1a2..a12d88d256 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -61,14 +61,14 @@ void GetFilePath(TCHAR *WindowTittle, char *szSetting, TCHAR *szExt, TCHAR *szEx ofn.lStructSize=CDSIZEOF_STRUCT(OPENFILENAME,lpTemplateName); ofn.Flags=OFN_EXPLORER; ofn.lpstrTitle=TranslateW(WindowTittle); - _tcsncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1); + mir_tstrncpy(filter,TranslateW(szExtDesc), SIZEOF(filter)-1); pfilter=filter+mir_tstrlen(filter)+1; mir_tstrcpy(pfilter, szExt); pfilter[mir_tstrlen(pfilter)+1] = '\0'; pfilter[mir_tstrlen(pfilter)+2] = '\0'; ofn.lpstrFilter=filter; tmp = UniGetContactSettingUtf(0, szGPGModuleName, szSetting, _T("")); - _tcsncpy(str, tmp, SIZEOF(str)-1); + mir_tstrncpy(str, tmp, SIZEOF(str)-1); mir_free(tmp); if(mir_tstrlen(str)< 2) str[0] = '\0'; @@ -1859,7 +1859,7 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) DWORD exitcode; { ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); - _tcsncpy(tmp2, ptmp, MAX_PATH-1); + mir_tstrncpy(tmp2, ptmp, MAX_PATH-1); mir_free(ptmp); mir_tstrncat(tmp2, _T("\\"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); mir_tstrncat(tmp2, _T("temporary_exported.asc"), SIZEOF(tmp2) - mir_tstrlen(tmp2)); diff --git a/plugins/NotesAndReminders/src/options.cpp b/plugins/NotesAndReminders/src/options.cpp index 7706a76dcf..5cf90eee22 100644 --- a/plugins/NotesAndReminders/src/options.cpp +++ b/plugins/NotesAndReminders/src/options.cpp @@ -230,8 +230,8 @@ void RegisterFontServiceFonts() FontIDT fontid = {0}; fontid.cbSize = sizeof(FontIDT); - _tcsncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group)); - _tcsncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) ); + mir_tstrncpy(fontid.group, _T(SECTIONNAME), SIZEOF(fontid.group)); + mir_tstrncpy(fontid.backgroundGroup, _T(SECTIONNAME), SIZEOF(fontid.backgroundGroup) ); mir_strncpy(fontid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_SAVEPOINTSIZE; @@ -244,7 +244,7 @@ void RegisterFontServiceFonts() fontid.order = i; mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); mir_strncpy(fontid.prefix, szTemp, SIZEOF(fontid.prefix)); - _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); + mir_tstrncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); fontid.deffontsettings.colour = fontOptionsList[i].defColour; fontid.deffontsettings.size = (char)-MulDiv(fontOptionsList[i].defSize, nFontScale, 72); @@ -252,8 +252,8 @@ void RegisterFontServiceFonts() fontid.deffontsettings.style = fontOptionsList[i].defStyle; fontid.deffontsettings.charset = MsgDlgGetFontDefaultCharset(fontOptionsList[i].szDefFace); - _tcsncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace)); - _tcsncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fontid.backgroundName)); + mir_tstrncpy(fontid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fontid.deffontsettings.szFace)); + mir_tstrncpy(fontid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fontid.backgroundName)); FontRegisterT(&fontid); } @@ -261,14 +261,14 @@ void RegisterFontServiceFonts() ColourIDT colorid = {0}; colorid.cbSize = sizeof(ColourIDT); - _tcsncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group)); + mir_tstrncpy(colorid.group, _T(SECTIONNAME), SIZEOF(colorid.group)); mir_strncpy(colorid.dbSettingsGroup, MODULENAME, SIZEOF(fontid.dbSettingsGroup)); colorid.flags = 0; for (int i = 0; i < SIZEOF(colourOptionsList); i++) { colorid.order = i; - _tcsncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name)); + mir_tstrncpy(colorid.name, colourOptionsList[i].szName, SIZEOF(colorid.name)); colorid.defcolour = colourOptionsList[i].defColour; mir_strncpy(colorid.setting, colourOptionsList[i].szSettingName, SIZEOF(colorid.setting)); @@ -284,8 +284,8 @@ void LoadNRFont(int i, LOGFONT *lf, COLORREF *colour) FontIDT fontid = {0}; fontid.cbSize = sizeof(fontid); - _tcsncpy(fontid.group, LPGENT(SECTIONNAME), SIZEOF(fontid.group)); - _tcsncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); + mir_tstrncpy(fontid.group, LPGENT(SECTIONNAME), SIZEOF(fontid.group)); + mir_tstrncpy(fontid.name, fontOptionsList[i].szDescr, SIZEOF(fontid.name)); COLORREF col = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)lf); diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index 07354e9c59..02ca99515e 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -489,8 +489,8 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA int showMessage(const popup_t &msg) { POPUPDATAT ppd = { 0 }; - _tcsncpy(ppd.lptzText, strip(msg.message).c_str(), MAX_SECONDLINE); - _tcsncpy(ppd.lptzContactName, msg.contact.c_str(), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, strip(msg.message).c_str(), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, msg.contact.c_str(), MAX_CONTACTNAME); ppd.colorBack = msg.background; ppd.colorText = msg.foreground; ppd.lchIcon = getIcon(msg.icon); diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp index 75dc07b063..7fe7c5dc9c 100644 --- a/plugins/Nudge/src/nudge.cpp +++ b/plugins/Nudge/src/nudge.cpp @@ -82,19 +82,19 @@ void CNudgeElement::Load(void) mir_snprintf(SectionName,SIZEOF(SectionName),"%s-recText", ProtocolName); if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) { - _tcsncpy(this->recText, dbv.ptszVal, TEXT_LEN); + mir_tstrncpy(this->recText, dbv.ptszVal, TEXT_LEN); if (_tcsclen(this->recText) < 1) - _tcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN); + mir_tstrncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN); db_free(&dbv); } - else _tcsncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN); + else mir_tstrncpy(this->recText, TranslateT("You received a nudge"), TEXT_LEN); mir_snprintf(SectionName, SIZEOF(SectionName), "%s-senText", ProtocolName); if (!db_get_ts(NULL, MODULENAME, SectionName, &dbv)) { - _tcsncpy(this->senText, dbv.ptszVal, TEXT_LEN); + mir_tstrncpy(this->senText, dbv.ptszVal, TEXT_LEN); if (_tcsclen(this->senText) < 1) - _tcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN); + mir_tstrncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN); db_free(&dbv); } - else _tcsncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN); + else mir_tstrncpy(this->senText, TranslateT("You sent a nudge"), TEXT_LEN); } diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index 301ab1f909..9ff8429067 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -37,7 +37,7 @@ void SetupInfobar(InfobarWindowData* idat) cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + mir_tstrncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -51,7 +51,7 @@ void SetupInfobar(InfobarWindowData* idat) cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + mir_tstrncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 52840bd307..27451b78b3 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -1107,7 +1107,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + mir_tstrncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index c854ba09d8..25f4cb7bc1 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -116,13 +116,13 @@ void RegisterFontServiceFonts() char szTemp[100]; mir_snprintf(szTemp, SIZEOF(szTemp), "SRMFont%d", i); mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); - _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); + mir_tstrncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].defColour; fid.deffontsettings.size = fontOptionsList[i].defSize; fid.deffontsettings.style = fontOptionsList[i].defStyle; fid.deffontsettings.charset = DEFAULT_CHARSET; - _tcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace)); - _tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, SIZEOF(fid.deffontsettings.szFace)); + mir_tstrncpy(fid.backgroundName, fontOptionsList[i].szBkgName, SIZEOF(fid.backgroundName)); FontRegisterT(&fid); } @@ -132,7 +132,7 @@ void RegisterFontServiceFonts() cid.flags = 0; for (int i = 0; i < SIZEOF(colourOptionsList); i++) { cid.order = i; - _tcsncpy(cid.name, colourOptionsList[i].szName, SIZEOF(cid.name)); + mir_tstrncpy(cid.name, colourOptionsList[i].szName, SIZEOF(cid.name)); if (colourOptionsList[i].systemColor != -1) cid.defcolour = GetSysColor(colourOptionsList[i].systemColor); else @@ -192,7 +192,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (tszFace == NULL) mir_tstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else - _tcsncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName)); + mir_tstrncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName)); mir_snprintf(str, SIZEOF(str), "%s%dSet", "SRMFont", i); lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET); diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 1d4e9b829f..24148f7077 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -199,8 +199,8 @@ TCHAR* limitText(TCHAR *text, int limit) size_t len = mir_tstrlen(text); if (len > g_dat.limitNamesLength) { TCHAR *ptszTemp = (TCHAR*)mir_alloc(sizeof(TCHAR) * (limit + 4)); - _tcsncpy(ptszTemp, text, limit + 1); - _tcsncpy(ptszTemp + limit, _T("..."), 4); + mir_tstrncpy(ptszTemp, text, limit + 1); + mir_tstrncpy(ptszTemp + limit, _T("..."), 4); return ptszTemp; } return text; diff --git a/plugins/SeenPlugin/src/options.cpp b/plugins/SeenPlugin/src/options.cpp index 1c010e02c8..8d42ef154c 100644 --- a/plugins/SeenPlugin/src/options.cpp +++ b/plugins/SeenPlugin/src/options.cpp @@ -93,10 +93,10 @@ INT_PTR CALLBACK OptsPopupsDlgProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lp ppd.lchIcon = LoadSkinnedProtoIcon(NULL, idBack); GetDlgItemText(hdlg, IDC_POPUPSTAMP, szstamp, SIZEOF(szstamp)); - _tcsncpy(ppd.lptzContactName, ParseString(szstamp, NULL, 0), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzContactName, ParseString(szstamp, NULL, 0), MAX_CONTACTNAME); GetDlgItemText(hdlg, IDC_POPUPSTAMPTEXT, szstamp, SIZEOF(szstamp)); - _tcsncpy(ppd.lptzText, ParseString(szstamp, NULL, 0), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzText, ParseString(szstamp, NULL, 0), MAX_SECONDLINE); PUAddPopupT(&ppd); SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); diff --git a/plugins/SeenPlugin/src/utils.cpp b/plugins/SeenPlugin/src/utils.cpp index c8421bf359..e8fa6ef4a3 100644 --- a/plugins/SeenPlugin/src/utils.cpp +++ b/plugins/SeenPlugin/src/utils.cpp @@ -266,7 +266,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) case 'G': if (!db_get_ts(hcontact, "CList", "Group", &dbv)) { - _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); db_free(&dbv); charPtr = szdbsetting; goto LBL_charPtr; @@ -287,7 +287,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) _ltot(ci.dVal, szdbsetting, 10); break; case CNFT_ASCIIZ: - _tcsncpy(szdbsetting, ci.pszVal, SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, ci.pszVal, SIZEOF(szdbsetting)); break; } } @@ -297,7 +297,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) case 's': if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "StatusTriger" : courProtoName, 0)) { - _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting | 0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)(isetting | 0x8000), GSMDF_TCHAR), SIZEOF(szdbsetting)); if (!(isetting & 0x8000)) { mir_tstrncat(szdbsetting, _T("/"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting)); mir_tstrncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting)); @@ -317,7 +317,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) case 'o': if (isetting = db_get_w(hcontact, S_MOD, hcontact ? "OldStatus" : courProtoName, 0)) { - _tcsncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)isetting, GSMDF_TCHAR), SIZEOF(szdbsetting)); if (includeIdle && hcontact && db_get_b(hcontact, S_MOD, "OldIdle", 0)) { mir_tstrncat(szdbsetting, _T("/"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting)); mir_tstrncat(szdbsetting, TranslateT("Idle"), SIZEOF(szdbsetting) - mir_tstrlen(szdbsetting)); @@ -333,7 +333,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) if (db_get_ts(hcontact, ci.szProto, *p == 'i' ? "Resource" : "System", &dbv)) goto LBL_noData; - _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); db_free(&dbv); charPtr = szdbsetting; } @@ -343,13 +343,13 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) goto LBL_noData; ia.S_un.S_addr = htonl(dwsetting); - _tcsncpy(szdbsetting, _A2T(inet_ntoa(ia)), SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, _A2T(inet_ntoa(ia)), SIZEOF(szdbsetting)); charPtr = szdbsetting; } goto LBL_charPtr; case 'P': - _tcsncpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")), SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, ci.szProto ? _A2T(ci.szProto) : (wantempty ? _T("") : _T("ProtoUnknown")), SIZEOF(szdbsetting)); charPtr = szdbsetting; goto LBL_charPtr; @@ -359,7 +359,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) case 'C': // Get Client Info if (!db_get_ts(hcontact, ci.szProto, "MirVer", &dbv)) { - _tcsncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, dbv.ptszVal, SIZEOF(szdbsetting)); db_free(&dbv); } else goto LBL_noData; @@ -374,7 +374,7 @@ TCHAR *ParseString(TCHAR *szstring, MCONTACT hcontact, BYTE isfile) { PROTOACCOUNT *pa = ProtoGetAccount(ci.szProto); if (!pa) goto LBL_noData; - _tcsncpy(szdbsetting, pa->tszAccountName, SIZEOF(szdbsetting)); + mir_tstrncpy(szdbsetting, pa->tszAccountName, SIZEOF(szdbsetting)); charPtr = szdbsetting; goto LBL_charPtr; } @@ -496,16 +496,16 @@ void ShowPopup(MCONTACT hcontact, const char * lpzProto, int newStatus) ppd.lchIcon = LoadSkinnedProtoIcon(lpzProto, newStatus); if (!db_get_ts(NULL, S_MOD, "PopupStamp", &dbv)) { - _tcsncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact, 0), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzContactName, ParseString(dbv.ptszVal, hcontact, 0), MAX_CONTACTNAME); db_free(&dbv); } - else _tcsncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact, 0), MAX_CONTACTNAME); + else mir_tstrncpy(ppd.lptzContactName, ParseString(DEFAULT_POPUPSTAMP, hcontact, 0), MAX_CONTACTNAME); if (!db_get_ts(NULL, S_MOD, "PopupStampText", &dbv)) { - _tcsncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact, 0), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzText, ParseString(dbv.ptszVal, hcontact, 0), MAX_SECONDLINE); db_free(&dbv); } - else _tcsncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact, 0), MAX_SECONDLINE); + else mir_tstrncpy(ppd.lptzText, ParseString(DEFAULT_POPUPSTAMPTEXT, hcontact, 0), MAX_SECONDLINE); ppd.PluginWindowProc = PopupDlgProc; PUAddPopupT(&ppd); } @@ -750,10 +750,10 @@ TCHAR* any_to_IdleNotidleUnknown(MCONTACT hContact, const char *module_name, con { short int r = isDbZero(hContact, module_name, setting_name); if (r == -1) { - _tcsncpy(buff, TranslateT("Unknown"), bufflen); + mir_tstrncpy(buff, TranslateT("Unknown"), bufflen); } else { - _tcsncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen); + mir_tstrncpy(buff, r ? TranslateT("Not Idle") : TranslateT("Idle"), bufflen); }; buff[bufflen - 1] = 0; return buff; @@ -763,7 +763,7 @@ TCHAR* any_to_Idle(MCONTACT hContact, const char *module_name, const char *setti { if (isDbZero(hContact, module_name, setting_name) == 0) { //DB setting is NOT zero and exists buff[0] = L'/'; - _tcsncpy(&buff[1], TranslateT("Idle"), bufflen - 1); + mir_tstrncpy(&buff[1], TranslateT("Idle"), bufflen - 1); } else buff[0] = 0; buff[bufflen - 1] = 0; diff --git a/plugins/Spamotron/src/options.cpp b/plugins/Spamotron/src/options.cpp index fd8d00c01a..375a5a3b8e 100644 --- a/plugins/Spamotron/src/options.cpp +++ b/plugins/Spamotron/src/options.cpp @@ -7,9 +7,9 @@ TCHAR* _getCOptS(TCHAR *buf, unsigned int buflen, MCONTACT hContact, const char* DBVARIANT dbv = {0}; _tcsnset(buf, 0, buflen); if (db_get_ts(hContact, PLUGIN_NAME, option, &dbv) != 0) - _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); + mir_tstrncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); else if (dbv.type == DBVT_TCHAR) { - _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); + mir_tstrncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); } db_free(&dbv); return buf; @@ -20,12 +20,12 @@ TCHAR* _getMOptS(TCHAR *buf, unsigned int buflen, const char* module, const char DBVARIANT dbv = {0}; _tcsnset(buf, 0, buflen); if (db_get_s(NULL, module, option, &dbv) != 0) - _tcsncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); + mir_tstrncpy(buf, def, min(buflen, mir_tstrlen(def)+1)); else if (dbv.type == DBVT_TCHAR) { - _tcsncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); + mir_tstrncpy(buf, dbv.ptszVal, min(buflen, mir_tstrlen(dbv.ptszVal)+1)); } else { tmp = mir_a2u(dbv.pszVal); - _tcsncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1)); + mir_tstrncpy(buf, tmp, min(buflen, mir_tstrlen(tmp)+1)); mir_free(tmp); } db_free(&dbv); diff --git a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp index 2242d866f9..8ac155c9b7 100644 --- a/plugins/StatusPlugins/KeepStatus/keepstatus.cpp +++ b/plugins/StatusPlugins/KeepStatus/keepstatus.cpp @@ -980,8 +980,8 @@ static INT_PTR ShowPopup(TCHAR *msg, HICON hIcon) { POPUPDATAT ppd = { 0 }; ppd.lchIcon = hIcon; - _tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, msg, MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, msg, MAX_SECONDLINE); if (db_get_b(NULL, MODULENAME, SETTING_POPUP_USEWINCOLORS, 0)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); diff --git a/plugins/StatusPlugins/KeepStatus/options.cpp b/plugins/StatusPlugins/KeepStatus/options.cpp index c533847b03..82024fecae 100644 --- a/plugins/StatusPlugins/KeepStatus/options.cpp +++ b/plugins/StatusPlugins/KeepStatus/options.cpp @@ -480,8 +480,8 @@ INT_PTR CALLBACK PopupOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l ppd.lchContact = NULL; ppd.lchIcon = LoadSkinnedIcon(SKINICON_STATUS_OFFLINE); - _tcsncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); - _tcsncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, TranslateT("KeepStatus"), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, TranslateT("You broke the Internet!"), MAX_SECONDLINE); if (IsDlgButtonChecked(hwndDlg, IDC_WINCOLORS)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); diff --git a/plugins/StatusPlugins/StartupStatus/profiles.cpp b/plugins/StatusPlugins/StartupStatus/profiles.cpp index 3a7421957f..d4cef9446d 100644 --- a/plugins/StatusPlugins/StartupStatus/profiles.cpp +++ b/plugins/StatusPlugins/StartupStatus/profiles.cpp @@ -155,7 +155,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) TCHAR* buf = (TCHAR*)lParam; if (count == 0) { - _tcsncpy(buf, TranslateT("default"), 128-1); + mir_tstrncpy(buf, TranslateT("default"), 128-1); return 0; } @@ -165,7 +165,7 @@ INT_PTR GetProfileName(WPARAM wParam, LPARAM lParam) if ( db_get_ts(NULL, MODULENAME, setting, &dbv)) return -1; - _tcsncpy(buf, dbv.ptszVal, 128-1); buf[127] = 0; + mir_tstrncpy(buf, dbv.ptszVal, 128-1); buf[127] = 0; db_free(&dbv); return 0; } diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 38df7808a1..ee5cfaeb4f 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -502,54 +502,54 @@ void RegisterFontServiceFonts() mir_snprintf(szTemp, SIZEOF(szTemp), "Font%d", i); mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); fid.order = i; - _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); + mir_tstrncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; fid.deffontsettings.size = (char)lf.lfHeight; fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fid.deffontsettings.charset = lf.lfCharSet; fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); - _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); - _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.group)); + mir_tstrncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); + mir_tstrncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.backgroundGroup)); + mir_tstrncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Single Messaging"), SIZEOF(fid.group)); switch (i) { case MSGFONTID_MYMSG: case 1: case MSGFONTID_MYNAME: case MSGFONTID_MYTIME: case 21: - _tcsncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, LPGENT("Outgoing background"), SIZEOF(fid.backgroundName)); break; case 8: case 9: case 12: case 13: - _tcsncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, LPGENT("Outgoing background(old)"), SIZEOF(fid.backgroundName)); break; case 10: case 11: case 14: case 15: - _tcsncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, LPGENT("Incoming background(old)"), SIZEOF(fid.backgroundName)); break; case MSGFONTID_MESSAGEAREA: - _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group)); - _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group)); + mir_tstrncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup)); + mir_tstrncpy(fid.backgroundName, LPGENT("Input area background"), SIZEOF(fid.backgroundName)); fid.flags |= FIDF_DISABLESTYLES; fid.flags &= ~FIDF_ALLOWEFFECTS; break; case 17: - _tcsncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, LPGENT("Status background"), SIZEOF(fid.backgroundName)); break; case 18: - _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundGroup, LPGENT("Message Sessions"), SIZEOF(fid.backgroundGroup)); + mir_tstrncpy(fid.backgroundName, LPGENT("Log background"), SIZEOF(fid.backgroundName)); break; case 19: - _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); break; default: - _tcsncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.backgroundName, LPGENT("Incoming background"), SIZEOF(fid.backgroundName)); break; } FontRegisterT(&fid); @@ -557,35 +557,35 @@ void RegisterFontServiceFonts() fontOptionsList = IP_fontOptionsList; fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS; - _tcsncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group)); - _tcsncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.group, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.group)); + mir_tstrncpy(fid.backgroundGroup, LPGENT("Message Sessions")_T("/")LPGENT("Info Panel"), SIZEOF(fid.backgroundGroup)); + mir_tstrncpy(fid.backgroundName, LPGENT("Fields background"), SIZEOF(fid.backgroundName)); 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); mir_strncpy(fid.prefix, szTemp, SIZEOF(fid.prefix)); fid.order = i + 100; - _tcsncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); + mir_tstrncpy(fid.name, fontOptionsList[i].szDescr, SIZEOF(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].colour; fid.deffontsettings.size = (char)lf.lfHeight; fid.deffontsettings.style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fid.deffontsettings.charset = lf.lfCharSet; fid.flags = fid.flags & ~FIDF_CLASSMASK | (fid.deffontsettings.style&FONTF_BOLD ? FIDF_CLASSHEADER : FIDF_CLASSGENERAL); fid.deffontsettings.charset = lf.lfCharSet; - _tcsncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); + mir_tstrncpy(fid.deffontsettings.szFace, lf.lfFaceName, LF_FACESIZE); if (i == IPFONTCOUNT - 1) { - _tcsncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup)); - _tcsncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); - _tcsncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group)); + mir_tstrncpy(fid.backgroundGroup, _T(""), SIZEOF(fid.backgroundGroup)); + mir_tstrncpy(fid.backgroundName, _T(""), SIZEOF(fid.backgroundName)); + mir_tstrncpy(fid.group, LPGENT("Message Sessions"), SIZEOF(fid.group)); } FontRegisterT(&fid); } - _tcsncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group)); + mir_tstrncpy(cid.group, LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), SIZEOF(cid.group)); 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)); + mir_tstrncpy(cid.name, chatcolorsnames[i], SIZEOF(cid.name)); cid.order = i + 1; mir_strncpy(cid.setting, szTemp, SIZEOF(cid.setting)); switch (i) { @@ -618,8 +618,8 @@ void RegisterFontServiceFonts() 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)); + mir_tstrncpy(cid.group, _clrs[i].tszGroup, SIZEOF(fid.group)); + mir_tstrncpy(cid.name, _clrs[i].tszName, SIZEOF(cid.name)); mir_strncpy(cid.setting, _clrs[i].szSetting, SIZEOF(cid.setting)); if (_clrs[i].def & 0xff000000) cid.defcolour = GetSysColor(_clrs[i].def & 0x000000ff); @@ -633,8 +633,8 @@ void RegisterFontServiceFonts() // 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)); + mir_tstrncpy(cid.group, _tabclrs[i].tszGroup, SIZEOF(fid.group)); + mir_tstrncpy(cid.name, _tabclrs[i].tszName, SIZEOF(cid.name)); mir_strncpy(cid.setting, _tabclrs[i].szSetting, SIZEOF(cid.setting)); if (_tabclrs[i].def & 0xff000000) cid.defcolour = GetSysColor(_tabclrs[i].def & 0x000000ff); diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 46c67ba0a1..f996e50832 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -168,7 +168,7 @@ void ShowRoom(SESSION_INFO *si, WPARAM, BOOL) if (pContainer == NULL) { GetContainerNameForContact(si->hContact, szName, CONTAINER_NAMELEN); if (!g_Settings.bOpenInDefault && !mir_tstrcmp(szName, _T("default"))) - _tcsncpy(szName, _T("Chat Rooms"), CONTAINER_NAMELEN); + mir_tstrncpy(szName, _T("Chat Rooms"), CONTAINER_NAMELEN); szName[CONTAINER_NAMELEN] = 0; pContainer = FindContainerByName(szName); } diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 61e9997c1c..1e3632a40d 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1788,7 +1788,7 @@ TContainerData* TSAPI CreateContainer(const TCHAR *name, int iTemp, MCONTACT hCo TContainerData *pContainer = (TContainerData*)mir_calloc(sizeof(TContainerData)); if (pContainer == NULL) return NULL; - _tcsncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1); + mir_tstrncpy(pContainer->szName, name, CONTAINER_NAMELEN + 1); AppendToContainerList(pContainer); if (M.GetByte("limittabs", 0) && !mir_tstrcmp(name, _T("default"))) diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 94fe049ccc..3282ca59e3 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -979,7 +979,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR _tcsncpy_s(wBuf, TranslateT("Session list.\nClick left for a list of open sessions.\nClick right to access favorites and quickly configure message window behavior"), _TRUNCATE); } else if (sid->tszTooltip) - _tcsncpy(wBuf, sid->tszTooltip, SIZEOF(wBuf)); + mir_tstrncpy(wBuf, sid->tszTooltip, SIZEOF(wBuf)); if (wBuf[0]) { CallService("mToolTip/ShowTipW", (WPARAM)wBuf, (LPARAM)&ti); diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index f7d9d81686..40bbe9448c 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -532,7 +532,7 @@ static int PopupUpdateT(MCONTACT hContact, MEVENT hEvent) TCHAR lpzText[MAX_SECONDLINE]; int i, available = MAX_SECONDLINE - 1; if (pdata->pluginOptions->bShowHeaders) { - _tcsncpy(lpzText, szHeader, MAX_SECONDLINE); + mir_tstrncpy(lpzText, szHeader, MAX_SECONDLINE); available -= (int)mir_tstrlen(szHeader); } else lpzText[0] = 0; @@ -622,12 +622,12 @@ static int PopupShowT(NEN_OPTIONS *pluginOptions, MCONTACT hContact, MEVENT hEve _tcsncpy_s(pud.lptzText, szPreview, _TRUNCATE); mir_free(szPreview); } - else _tcsncpy(pud.lptzText, _T(" "), MAX_SECONDLINE); + else mir_tstrncpy(pud.lptzText, _T(" "), MAX_SECONDLINE); pdata->eventData = (EVENT_DATAT *)mir_alloc(NR_MERGED * sizeof(EVENT_DATAT)); pdata->eventData[0].hEvent = hEvent; pdata->eventData[0].timestamp = dbe.timestamp; - _tcsncpy(pdata->eventData[0].tszText, pud.lptzText, MAX_SECONDLINE); + mir_tstrncpy(pdata->eventData[0].tszText, pud.lptzText, MAX_SECONDLINE); pdata->eventData[0].tszText[MAX_SECONDLINE - 1] = 0; pdata->nrEventsAlloced = NR_MERGED; pdata->nrMerged = 1; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index be469c5842..68640fb48c 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1780,7 +1780,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM, LPARAM lParam) if (dat->idle != dwOldIdle || lParam != 0) { if (item.mask & TCIF_TEXT) { item.pszText = newtitle; - _tcsncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle)); + mir_tstrncpy(dat->newtitle, newtitle, SIZEOF(dat->newtitle)); dat->newtitle[127] = 0; if (dat->pWnd) dat->pWnd->updateTitle(dat->cache->getNick()); diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 9c642a0db2..e3363eb1ae 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -989,11 +989,11 @@ BOOL TSAPI DoRtfToTags(const TWindowData *dat, CMString &pszText, int iNumColors TCHAR tmp[10]; if (p[3] != ' ' && p[3] != '\\') { - _tcsncpy(tmp, p + 2, 3); + mir_tstrncpy(tmp, p + 2, 3); tmp[3] = 0; } else { - _tcsncpy(tmp, p + 2, 2); + mir_tstrncpy(tmp, p + 2, 2); tmp[2] = 0; } diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 67f7fb0733..d32949d03f 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -133,8 +133,8 @@ void TSAPI CacheLogFonts() } mir_snprintf(rtfFontsGlobal[MSGDLGFONTCOUNT], SIZEOF(rtfFontsGlobal[MSGDLGFONTCOUNT]), "\\f%u\\cf%u\\b%d\\i%d\\fs%u", MSGDLGFONTCOUNT, MSGDLGFONTCOUNT, 0, 0, 0); - _tcsncpy(szToday, TranslateT("Today"), 20); - _tcsncpy(szYesterday, TranslateT("Yesterday"), 20); + mir_tstrncpy(szToday, TranslateT("Today"), 20); + mir_tstrncpy(szYesterday, TranslateT("Yesterday"), 20); szToday[19] = szYesterday[19] = 0; // cache/create the info panel fonts diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 5e83a533bc..070771b799 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -787,7 +787,7 @@ static int TSAPI SetupIconLibConfig() int j = 2, version = 0; TCHAR szFilename[MAX_PATH]; - _tcsncpy(szFilename, _T("icons\\tabsrmm_icons.dll"), MAX_PATH); + mir_tstrncpy(szFilename, _T("icons\\tabsrmm_icons.dll"), MAX_PATH); g_hIconDLL = LoadLibrary(szFilename); if (g_hIconDLL == 0) { CWarning::show(CWarning::WARN_ICONPACKMISSING, CWarning::CWF_NOALLOWHIDE | MB_ICONERROR | MB_OK); @@ -824,7 +824,7 @@ static int TSAPI SetupIconLibConfig() sid.iDefaultIndex = -IDI_CLOCK; Skin_AddIcon(&sid); - _tcsncpy(szFilename, _T("plugins\\tabsrmm.dll"), MAX_PATH); + mir_tstrncpy(szFilename, _T("plugins\\tabsrmm.dll"), MAX_PATH); sid.pszName = "tabSRMM_overlay_disabled"; sid.pszDescription = LPGEN("Feature disabled (used as overlay)"); diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 41b7951151..6b34af57fe 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -128,7 +128,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0); for (TContainerData *p = pFirstContainer; p; p = p->pNext) { if (!_tcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_tstrlen(p->szName) == mir_tstrlen(szName)) { - _tcsncpy(p->szName, szNewName, CONTAINER_NAMELEN); + mir_tstrncpy(p->szName, szNewName, CONTAINER_NAMELEN); SendMessage(p->hwnd, DM_CONFIGURECONTAINER, 0, 0); } } diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index f8762db894..a4bb0e2243 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -342,7 +342,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat) DBVARIANT dbv = { 0 }; if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) { - _tcsncpy(szTemp, dbv.ptszVal, 500); + mir_tstrncpy(szTemp, dbv.ptszVal, 500); szTemp[500] = 0; db_free(&dbv); title.insert(tempmark + 2, szTemp); @@ -363,7 +363,7 @@ TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat) DBVARIANT dbv = { 0 }; if (!db_get_ts(dat->hContact, (char *)dat->szProto, "XStatusName", &dbv)) { - _tcsncpy(szTemp, dbv.ptszVal, 500); + mir_tstrncpy(szTemp, dbv.ptszVal, 500); szTemp[500] = 0; db_free(&dbv); title.insert(tempmark + 2, szTemp); diff --git a/plugins/TipperYM/src/options.cpp b/plugins/TipperYM/src/options.cpp index 14d46e1855..07c8ba99ef 100644 --- a/plugins/TipperYM/src/options.cpp +++ b/plugins/TipperYM/src/options.cpp @@ -49,8 +49,8 @@ void CreateDefaultItems() for (int i = 0; defaultItemList[i].szName; i++) { if (defaultItemList[i].szName[0] == '-') { DIListNode *di_node = (DIListNode *)mir_alloc(sizeof(DIListNode)); - _tcsncpy(di_node->di.swzLabel, _T(""), LABEL_LEN); - _tcsncpy(di_node->di.swzValue, _T(""), VALUE_LEN); + mir_tstrncpy(di_node->di.swzLabel, _T(""), LABEL_LEN); + mir_tstrncpy(di_node->di.swzValue, _T(""), VALUE_LEN); di_node->di.bLineAbove = true; di_node->di.bIsVisible = true; di_node->di.bParseTipperVarsFirst = false; @@ -67,7 +67,7 @@ void CreateDefaultItems() if (subst == NULL) continue; DSListNode *ds_node = (DSListNode *)mir_alloc(sizeof(DSListNode)); - _tcsncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN); + mir_tstrncpy(ds_node->ds.swzName, subst->swzName, LABEL_LEN); ds_node->ds.type = subst->type; mir_strncpy(ds_node->ds.szSettingName, subst->szSettingName, SETTING_NAME_LEN); ds_node->ds.iTranslateFuncId = subst->iTranslateFuncId; @@ -77,8 +77,8 @@ void CreateDefaultItems() } DIListNode *di_node = (DIListNode *)mir_alloc(sizeof(DIListNode)); - _tcsncpy(di_node->di.swzLabel, TranslateTS(item->swzLabel), LABEL_LEN); - _tcsncpy(di_node->di.swzValue, item->swzValue, VALUE_LEN); + mir_tstrncpy(di_node->di.swzLabel, TranslateTS(item->swzLabel), LABEL_LEN); + mir_tstrncpy(di_node->di.swzValue, item->swzValue, VALUE_LEN); di_node->di.bLineAbove = false; di_node->di.bValueNewline = defaultItemList[i].bValueNewline; di_node->di.bIsVisible = true; @@ -100,7 +100,7 @@ bool LoadDS(DISPLAYSUBST *ds, int index) if (db_get_ts(0, MODULE_ITEMS, setting, &dbv)) return false; - _tcsncpy(ds->swzName, dbv.ptszVal, SIZEOF(ds->swzName)); + mir_tstrncpy(ds->swzName, dbv.ptszVal, SIZEOF(ds->swzName)); ds->swzName[SIZEOF(ds->swzName) - 1] = 0; db_free(&dbv); @@ -161,14 +161,14 @@ bool LoadDI(DISPLAYITEM *di, int index) if (db_get_ts(0, MODULE_ITEMS, setting, &dbv)) return false; - _tcsncpy(di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel)); + mir_tstrncpy(di->swzLabel, dbv.ptszVal, SIZEOF(di->swzLabel)); di->swzLabel[SIZEOF(di->swzLabel) - 1] = 0; db_free(&dbv); mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index); di->swzValue[0] = 0; if (!db_get_ts(0, MODULE_ITEMS, setting, &dbv)) { - _tcsncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue)); + mir_tstrncpy(di->swzValue, dbv.ptszVal, SIZEOF(di->swzValue)); di->swzValue[SIZEOF(di->swzValue) - 1] = 0; db_free(&dbv); } @@ -411,8 +411,8 @@ void LoadOptions() di_node = opt.diList; } - _tcsncpy(di_node->di.swzLabel, _T("Last message: (%sys:last_msg_reltime% ago)"), LABEL_LEN); - _tcsncpy(di_node->di.swzValue, _T("%sys:last_msg%"), VALUE_LEN); + mir_tstrncpy(di_node->di.swzLabel, _T("Last message: (%sys:last_msg_reltime% ago)"), LABEL_LEN); + mir_tstrncpy(di_node->di.swzValue, _T("%sys:last_msg%"), VALUE_LEN); di_node->di.bLineAbove = di_node->di.bValueNewline = true; di_node->next = 0; opt.iDiCount++; @@ -436,8 +436,8 @@ void LoadOptions() di_node = opt.diList; } - _tcsncpy(di_node->di.swzLabel, _T("Status message:"), LABEL_LEN); - _tcsncpy(di_node->di.swzValue, _T("%sys:status_msg%"), VALUE_LEN); + mir_tstrncpy(di_node->di.swzLabel, _T("Status message:"), LABEL_LEN); + mir_tstrncpy(di_node->di.swzValue, _T("%sys:status_msg%"), VALUE_LEN); di_node->di.bLineAbove = di_node->di.bValueNewline = true; di_node->next = 0; opt.iDiCount++; @@ -516,7 +516,7 @@ void LoadOptions() } else if (opt.skinMode == SM_IMAGE) { if (!db_get_ts(NULL, MODULE, "SkinName", &dbv)) { - _tcsncpy(opt.szSkinName, dbv.ptszVal, SIZEOF(opt.szSkinName) - 1); + mir_tstrncpy(opt.szSkinName, dbv.ptszVal, SIZEOF(opt.szSkinName) - 1); db_free(&dbv); } } @@ -907,7 +907,7 @@ INT_PTR CALLBACK DlgProcOptsContent(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA memset(ds_value, 0, sizeof(DSListNode)); ds_value->next = NULL; ds_value->ds.type = subst->type; - _tcsncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1); + mir_tstrncpy(ds_value->ds.swzName, subst->swzName, LABEL_LEN - 1); if (ds_value->ds.type == DVT_DB && subst->szModuleName) mir_strncpy(ds_value->ds.szModuleName, subst->szModuleName, MODULE_NAME_LEN - 1); diff --git a/plugins/TipperYM/src/popwin.cpp b/plugins/TipperYM/src/popwin.cpp index 11fa12f1e5..24377573bf 100644 --- a/plugins/TipperYM/src/popwin.cpp +++ b/plugins/TipperYM/src/popwin.cpp @@ -314,7 +314,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa db_unset(pwd->hContact, MODULE, "TempStatusMsg"); TCHAR *swzNick = pcli->pfnGetContactDisplayName(pwd->hContact, 0); - _tcsncpy(pwd->swzTitle, swzNick, TITLE_TEXT_LEN); + mir_tstrncpy(pwd->swzTitle, swzNick, TITLE_TEXT_LEN); char *szProto = GetContactProto(pwd->hContact); pwd->spiTitle = Smileys_PreParse(pwd->swzTitle, -1, szProto); @@ -775,7 +775,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa int iLen = (int)mir_tstrlen(pwd->rows[i].swzValue); if (iLen) { if (iLen > MAX_VALUE_LEN) { - _tcsncpy(buff, pwd->rows[i].swzValue, MAX_VALUE_LEN); + mir_tstrncpy(buff, pwd->rows[i].swzValue, MAX_VALUE_LEN); buff[MAX_VALUE_LEN] = 0; mir_tstrcat(buff, _T("...")); } diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 998694c0e6..91740cf8af 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -272,7 +272,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff else if (szProto) { PROTOACCOUNT *pa = ProtoGetAccount(szProto); if (pa && pa->tszAccountName) { - _tcsncpy(buff, pa->tszAccountName, bufflen); + mir_tstrncpy(buff, pa->tszAccountName, bufflen); return true; } else @@ -290,7 +290,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff else if (!mir_tstrcmp(swzRawSpec, _T("status_msg"))) { TCHAR *swzMsg = GetStatusMessageText(hContact); if (swzMsg) { - _tcsncpy(buff, swzMsg, bufflen); + mir_tstrncpy(buff, swzMsg, bufflen); mir_free(swzMsg); return true; } @@ -298,7 +298,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff else if ((recv = !mir_tstrcmp(swzRawSpec, _T("last_msg"))) || !mir_tstrcmp(swzRawSpec, _T("last_msg_out"))) { TCHAR *swzMsg = GetLastMessageText(hContact, recv); if (swzMsg) { - _tcsncpy(buff, swzMsg, bufflen); + mir_tstrncpy(buff, swzMsg, bufflen); mir_free(swzMsg); return true; } @@ -310,7 +310,7 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff return false; TCHAR *swzNick = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hSubContact, GCDNF_TCHAR); - if (swzNick) _tcsncpy(buff, swzNick, bufflen); + if (swzNick) mir_tstrncpy(buff, swzNick, bufflen); return true; } else if (!mir_tstrcmp(swzRawSpec, _T("meta_subuid"))) { @@ -581,7 +581,7 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF if (ds_node) GetSubstText(hContact, ds_node->ds, swzAlt, VALUE_LEN); else { - _tcsncpy(swzAlt, p, VALUE_LEN); + mir_tstrncpy(swzAlt, p, VALUE_LEN); bAltSubst = true; } } @@ -619,12 +619,12 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF if (bSubst) { size_t rep_len = mir_tstrlen(swzRep); - _tcsncpy(&swzDest[di], swzRep, min(rep_len, iDestLen - di)); + mir_tstrncpy(&swzDest[di], swzRep, min(rep_len, iDestLen - di)); di += rep_len - 1; // -1 because we inc at bottom of loop } else if (bAltSubst) { size_t alt_len = mir_tstrlen(swzAlt); - _tcsncpy(&swzDest[di], swzAlt, min(alt_len, iDestLen - di)); + mir_tstrncpy(&swzDest[di], swzAlt, min(alt_len, iDestLen - di)); di += alt_len - 1; // -1 because we inc at bottom of loop } else goto empty; // empty value @@ -643,7 +643,7 @@ bool ApplySubst(MCONTACT hContact, const TCHAR *swzSource, bool parseTipperVarsF if (parseTipperVarsFirst) { swzVarSrc = variables_parsedup(swzDest, 0, hContact); - _tcsncpy(swzDest, swzVarSrc, iDestLen); + mir_tstrncpy(swzDest, swzVarSrc, iDestLen); mir_free(swzVarSrc); } diff --git a/plugins/TipperYM/src/translations.cpp b/plugins/TipperYM/src/translations.cpp index 12ac692831..1d60bb3970 100644 --- a/plugins/TipperYM/src/translations.cpp +++ b/plugins/TipperYM/src/translations.cpp @@ -174,9 +174,9 @@ TCHAR *ByteToYesNo(MCONTACT hContact, const char *szModuleName, const char *szSe if (dbv.type == DBVT_BYTE) { if (dbv.bVal != 0) - _tcsncpy(buff, _T("Yes"), bufflen); + mir_tstrncpy(buff, _T("Yes"), bufflen); else - _tcsncpy(buff, _T("No"), bufflen); + mir_tstrncpy(buff, _T("No"), bufflen); buff[bufflen - 1] = 0; db_free(&dbv); return buff; @@ -190,9 +190,9 @@ TCHAR *ByteToGender(MCONTACT hContact, const char *szModuleName, const char *szS { BYTE val = (BYTE)db_get_b(hContact, szModuleName, szSettingName, 0); if (val == 'F') - _tcsncpy(buff, TranslateT("Female"), bufflen); + mir_tstrncpy(buff, TranslateT("Female"), bufflen); else if (val == 'M') - _tcsncpy(buff, TranslateT("Male"), bufflen); + mir_tstrncpy(buff, TranslateT("Male"), bufflen); else return 0; @@ -588,7 +588,7 @@ TCHAR *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, co { if (!db_get_ts(hContact, szModuleName, szSettingName, &dbv)) { - _tcsncpy(buff, TranslateTS(dbv.ptszVal), bufflen); + mir_tstrncpy(buff, TranslateTS(dbv.ptszVal), bufflen); buff[bufflen - 1] = 0; return buff; } @@ -609,7 +609,7 @@ TCHAR *EmptyXStatusToDefaultName(MCONTACT hContact, const char *szModuleName, co if (CallProtoService(szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&xstatus)) return 0; - _tcsncpy(buff, TranslateTS(szDefaultName), bufflen); + mir_tstrncpy(buff, TranslateTS(szDefaultName), bufflen); buff[bufflen - 1] = 0; return buff; } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index ffd7b749ce..bf6f30667e 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -73,31 +73,31 @@ CTooltipNotify::~CTooltipNotify() void CTooltipNotify::RegisterFonts() { FontIDT fontId = { sizeof(fontId) }; - _tcsncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-1); + mir_tstrncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-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); fontId.deffontsettings.style = DEF_SETTING_FONT_STYLE; fontId.deffontsettings.charset = DEF_SETTING_FONT_CHARSET; - _tcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, SIZEOF(fontId.deffontsettings.szFace)-1); + mir_tstrncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, SIZEOF(fontId.deffontsettings.szFace)-1); fontId.order = 0; - _tcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, SIZEOF(fontId.backgroundGroup)-1); + mir_tstrncpy(fontId.backgroundGroup, FONTSERV_GROUP, SIZEOF(fontId.backgroundGroup)-1); ColourIDT colorId = { sizeof(colorId) }; - _tcsncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-1); + mir_tstrncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-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> 10); @@ -1155,7 +1155,7 @@ void NotifyOnRecv(void) memset(&ppd, 0, sizeof(ppd)); ppd.lchContact = NULL; ppd.lchIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); - _tcsncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"),MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzContactName, TranslateT("Traffic counter notification"),MAX_CONTACTNAME); // mir_sntprintf(ppd.lptzText, SIZEOF(ppd.lptzText), TranslateT("%d kilobytes received"), notify_recv_size = OverallInfo.CurrentRecvTraffic >> 10); diff --git a/plugins/TrafficCounter/src/misc.cpp b/plugins/TrafficCounter/src/misc.cpp index 196ec13abb..51fb9e96b9 100644 --- a/plugins/TrafficCounter/src/misc.cpp +++ b/plugins/TrafficCounter/src/misc.cpp @@ -60,7 +60,7 @@ WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) // Выделяем память под строку. (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * (begin - end)); // Копируем строку. - _tcsncpy((*RowItemsList)[c].String, end + 1, begin - end - 1); + mir_tstrncpy((*RowItemsList)[c].String, end + 1, begin - end - 1); (*RowItemsList)[c].String[begin - end - 1] = 0; } else @@ -68,7 +68,7 @@ WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList) // Выделяем память под строку. (*RowItemsList)[c].String = (TCHAR*)mir_alloc(sizeof(TCHAR) * mir_tstrlen(end)); // Копируем строку. - _tcsncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end)); + mir_tstrncpy((*RowItemsList)[c].String, end + 1, mir_tstrlen(end)); } c++; @@ -264,7 +264,7 @@ size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Siz if (Size && Buffer) { - _tcsncpy(Buffer, Res, Size); + mir_tstrncpy(Buffer, Res, Size); Length = mir_tstrlen(Buffer); } else diff --git a/plugins/UserGuide/src/main.cpp b/plugins/UserGuide/src/main.cpp index 91de3fec58..9c75a55b85 100644 --- a/plugins/UserGuide/src/main.cpp +++ b/plugins/UserGuide/src/main.cpp @@ -44,13 +44,13 @@ static INT_PTR ShowGuideFile(WPARAM, LPARAM) if (pszDivider == NULL) { mir_tstrcpy(pszDirName, _T("")); - _tcsncpy(pszFileName, ptszHelpFile, mir_tstrlen(ptszHelpFile)); + mir_tstrncpy(pszFileName, ptszHelpFile, mir_tstrlen(ptszHelpFile)); } else { - _tcsncpy(pszFileName, pszDivider + 1, mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1); + mir_tstrncpy(pszFileName, pszDivider + 1, mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1); pszFileName[mir_tstrlen(ptszHelpFile) - mir_tstrlen(pszDivider) - 1] = 0; - _tcsncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile); + mir_tstrncpy(pszDirName, ptszHelpFile, pszDivider - ptszHelpFile); pszDirName[pszDivider - ptszHelpFile] = 0; } } diff --git a/plugins/Variables/src/parse_alias.cpp b/plugins/Variables/src/parse_alias.cpp index d08a05a2ec..f0d745f95e 100644 --- a/plugins/Variables/src/parse_alias.cpp +++ b/plugins/Variables/src/parse_alias.cpp @@ -62,7 +62,7 @@ static TCHAR *replaceArguments(TCHAR *res, TCHAR *tArg, TCHAR *rArg) return NULL; } memmove(res + ecur + (mir_tstrlen(rArg) - mir_tstrlen(tArg)), res + ecur, (mir_tstrlen(res + ecur) + 1)*sizeof(TCHAR)); - _tcsncpy(res + cur, rArg, mir_tstrlen(rArg)); + mir_tstrncpy(res + cur, rArg, mir_tstrlen(rArg)); } } cur++; diff --git a/plugins/Variables/src/parse_str.cpp b/plugins/Variables/src/parse_str.cpp index a8903e89f0..4e1b65f725 100644 --- a/plugins/Variables/src/parse_str.cpp +++ b/plugins/Variables/src/parse_str.cpp @@ -118,7 +118,7 @@ static TCHAR *parseFixeol(ARGUMENTSINFO *ai) return res; memset(res, 0, (((cur - ai->targv[1]) + 1) * sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1], cur - ai->targv[1]); + mir_tstrncpy(res, ai->targv[1], cur - ai->targv[1]); mir_tstrcat(res, szReplacement); return res; } @@ -169,7 +169,7 @@ static TCHAR *parseInsert(ARGUMENTSINFO *ai) return NULL; memset(res, 0, ((mir_tstrlen(ai->targv[1]) + mir_tstrlen(ai->targv[2]) + 1) * sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1], pos); + mir_tstrncpy(res, ai->targv[1], pos); mir_tstrcpy(res + pos, ai->targv[2]); mir_tstrcpy(res + pos + mir_tstrlen(ai->targv[2]), ai->targv[1] + pos); return res; @@ -190,7 +190,7 @@ static TCHAR *parseLeft(ARGUMENTSINFO *ai) return NULL; memset(res, 0, ((len + 1) * sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1], len); + mir_tstrncpy(res, ai->targv[1], len); return res; } @@ -334,7 +334,7 @@ static TCHAR *parsePadcut(ARGUMENTSINFO *ai) *cur++ = padchar; if (padding > addcount) - _tcsncpy(res + addcount, ai->targv[1], padding - addcount); + mir_tstrncpy(res + addcount, ai->targv[1], padding - addcount); return res; } @@ -363,7 +363,7 @@ static TCHAR *parsePadcutright(ARGUMENTSINFO *ai) *cur++ = padchar; if (padding > addcount) - _tcsncpy(res, ai->targv[1], padding - addcount); + mir_tstrncpy(res, ai->targv[1], padding - addcount); return res; } @@ -434,7 +434,7 @@ static TCHAR *parseRight(ARGUMENTSINFO *ai) return NULL; memset(res, 0, ((len + 1)*sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len); + mir_tstrncpy(res, ai->targv[1] + mir_tstrlen(ai->targv[1]) - len, len); return res; } @@ -603,7 +603,7 @@ static TCHAR *parseSubstr(ARGUMENTSINFO *ai) TCHAR *res = (TCHAR*)mir_alloc((to - from + 1)*sizeof(TCHAR)); memset(res, 0, ((to - from + 1) * sizeof(TCHAR))); - _tcsncpy(res, ai->targv[1] + from, to - from); + mir_tstrncpy(res, ai->targv[1] + from, to - from); return res; } @@ -652,7 +652,7 @@ static TCHAR *parseTrim(ARGUMENTSINFO *ai) return NULL; memset(res, 0, ((ecur - scur + 2) * sizeof(TCHAR))); - _tcsncpy(res, scur, ecur - scur + 1); + mir_tstrncpy(res, scur, ecur - scur + 1); return res; } @@ -723,7 +723,7 @@ static TCHAR *getNthWord(TCHAR *szString, int w) return NULL; memset(res, 0, ((ecur - scur + 1) * sizeof(TCHAR))); - _tcsncpy(res, scur, ecur - scur); + mir_tstrncpy(res, scur, ecur - scur); return res; } diff --git a/plugins/Variables/src/parse_system.cpp b/plugins/Variables/src/parse_system.cpp index 73c83cf22e..b815f8f104 100644 --- a/plugins/Variables/src/parse_system.cpp +++ b/plugins/Variables/src/parse_system.cpp @@ -182,7 +182,7 @@ static TCHAR *parseDirectory(ARGUMENTSINFO *ai) break; TCHAR *res = (TCHAR*)mir_alloc((ei - bi + 1) * sizeof(TCHAR)); - _tcsncpy(res, ai->targv[1] + bi, ei - bi); + mir_tstrncpy(res, ai->targv[1] + bi, ei - bi); res[ei - bi] = 0; return res; } @@ -218,7 +218,7 @@ static TCHAR *parseDirectory2(ARGUMENTSINFO *ai) if (res == NULL) return NULL; - _tcsncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1); + mir_tstrncpy(res, ai->targv[1], (ecur - ai->targv[1]) + 1); return res; } @@ -371,7 +371,7 @@ static TCHAR *parseListDir(ARGUMENTSINFO *ai) tszRes = NULL; if (ai->argc > 1) - _tcsncpy(tszFirst, ai->targv[1], SIZEOF(tszFirst) - 1); + mir_tstrncpy(tszFirst, ai->targv[1], SIZEOF(tszFirst) - 1); if (ai->argc > 2) tszFilter = ai->targv[2]; diff --git a/plugins/Variables/src/variables.cpp b/plugins/Variables/src/variables.cpp index 3c5652f6f1..4e38a5194f 100644 --- a/plugins/Variables/src/variables.cpp +++ b/plugins/Variables/src/variables.cpp @@ -92,7 +92,7 @@ TCHAR* getArguments(TCHAR *string, TCHAR ***aargv, int *aargc) } memset(argv[argc], '\0', (cur-(scur+1)+1)*sizeof(TCHAR)); - _tcsncpy(argv[argc], scur+1, cur-(scur+1)); + mir_tstrncpy(argv[argc], scur+1, cur-(scur+1)); } else argv[argc] = mir_tstrdup(_T("")); @@ -233,7 +233,7 @@ static TCHAR* replaceDynVars(TCHAR* szTemplate, FORMATINFO* fi) return NULL; } memset(token, '\0', (tcur-scur+1)*sizeof(TCHAR)); - _tcsncpy(token, cur+1, tcur-scur); + mir_tstrncpy(token, cur+1, tcur-scur); // cur points to FIELD_CHAR or FUNC_CHAR tmpVarPos = -1; tr = NULL; diff --git a/plugins/Weather/src/weather_addstn.cpp b/plugins/Weather/src/weather_addstn.cpp index 5f2fd10f6b..ab22d58b7a 100644 --- a/plugins/Weather/src/weather_addstn.cpp +++ b/plugins/Weather/src/weather_addstn.cpp @@ -71,7 +71,7 @@ INT_PTR WeatherAddToList(WPARAM wParam, LPARAM lParam) // set contact info and settings TCHAR svc[256]; - _tcsncpy(svc, psr->email, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0; + mir_tstrncpy(svc, psr->email, SIZEOF(svc)); svc[SIZEOF(svc)-1] = 0; GetSvc(svc); // set settings by obtaining the default for the service if (psr->lastName[0] != 0) { @@ -156,7 +156,7 @@ static void __cdecl BasicSearchTimerProc(LPVOID hWnd) INT_PTR WeatherBasicSearch(WPARAM wParam, LPARAM lParam) { if (searchId != -1) return 0; //only one search at a time - _tcsncpy(sID, ( TCHAR* )lParam, SIZEOF(sID)); + mir_tstrncpy(sID, ( TCHAR* )lParam, SIZEOF(sID)); sID[SIZEOF(sID)-1] = 0; searchId = 1; // create a thread for the ID search @@ -250,7 +250,7 @@ int IDSearchProc(TCHAR *sID, const int searchId, WIIDSEARCH *sData, TCHAR *svc, } // give no station name but only ID if the search is unavailable - else _tcsncpy(str, TranslateT(""), MAX_DATA_LEN - 1); + else mir_tstrncpy(str, TranslateT(""), MAX_DATA_LEN - 1); mir_sntprintf(newID, SIZEOF(newID), _T("%s/%s"), svc, sID); // set the search result and broadcast it @@ -344,7 +344,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if can't get the name, use the search string as name if (Name[0] == 0) - _tcsncpy(Name, name, SIZEOF(Name)); + mir_tstrncpy(Name, name, SIZEOF(Name)); // set the data and broadcast it PROTOSEARCHRESULT psr = { sizeof(psr) }; @@ -383,7 +383,7 @@ int NameSearchProc(TCHAR *name, const int searchId, WINAMESEARCH *sData, TCHAR * // if can't get the name, use the search string as name if (Name[0] == 0) - _tcsncpy(Name, name, SIZEOF(Name)); + mir_tstrncpy(Name, name, SIZEOF(Name)); PROTOSEARCHRESULT psr = { sizeof(psr) }; psr.flags = PSR_TCHAR; diff --git a/plugins/Weather/src/weather_contacts.cpp b/plugins/Weather/src/weather_contacts.cpp index 5eec260dd7..947378c026 100644 --- a/plugins/Weather/src/weather_contacts.cpp +++ b/plugins/Weather/src/weather_contacts.cpp @@ -293,15 +293,15 @@ INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa ofn.lpstrFile = str; ofn.nMaxFile = SIZEOF(str); // set filters - _tcsncpy(filter, TranslateT("Text Files"), SIZEOF(filter) - 1); + mir_tstrncpy(filter, TranslateT("Text Files"), SIZEOF(filter) - 1); mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = filter + mir_tstrlen(filter)+1; - _tcsncpy(pfilter, _T("*.txt"), SIZEOF(filter) - 1); + mir_tstrncpy(pfilter, _T("*.txt"), SIZEOF(filter) - 1); pfilter = pfilter + mir_tstrlen(pfilter)+1; - _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - 1); + mir_tstrncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - 1); mir_tstrncat(pfilter, _T(" (*.*)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = pfilter + mir_tstrlen(pfilter)+1; - _tcsncpy(pfilter, _T("*.*"), SIZEOF(filter) - 1); + mir_tstrncpy(pfilter, _T("*.*"), SIZEOF(filter) - 1); pfilter = pfilter + mir_tstrlen(pfilter)+1; *pfilter = '\0'; ofn.lpstrFilter = filter; @@ -452,7 +452,7 @@ int ContactDeleted(WPARAM wParam, LPARAM lParam) // if the station is not a default station, set it as the new default station // this is the first weather station encountered from the search if ( mir_tstrcmp(opt.Default, dbv.ptszVal)) { - _tcsncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1); + mir_tstrncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1); opt.DefStn = hContact; db_free(&dbv); if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) { diff --git a/plugins/Weather/src/weather_data.cpp b/plugins/Weather/src/weather_data.cpp index f47db595de..9e5d3be614 100644 --- a/plugins/Weather/src/weather_data.cpp +++ b/plugins/Weather/src/weather_data.cpp @@ -50,35 +50,35 @@ WEATHERINFO LoadWeatherInfo(MCONTACT hContact) GetStationID(hContact, winfo.id, SIZEOF(winfo.id)); if (DBGetStaticString(hContact, WEATHERPROTONAME, "Nick", winfo.city, SIZEOF(winfo.city))) - _tcsncpy(winfo.city, NODATA, SIZEOF(winfo.city) - 1); + mir_tstrncpy(winfo.city, NODATA, SIZEOF(winfo.city) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Update", winfo.update, SIZEOF(winfo.update))) - _tcsncpy(winfo.update, NODATA, SIZEOF(winfo.update) - 1); + mir_tstrncpy(winfo.update, NODATA, SIZEOF(winfo.update) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Condition", winfo.cond, SIZEOF(winfo.cond))) - _tcsncpy(winfo.cond, NODATA, SIZEOF(winfo.cond) - 1); + mir_tstrncpy(winfo.cond, NODATA, SIZEOF(winfo.cond) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Temperature", winfo.temp, SIZEOF(winfo.temp))) - _tcsncpy(winfo.temp, NODATA, SIZEOF(winfo.temp) - 1); + mir_tstrncpy(winfo.temp, NODATA, SIZEOF(winfo.temp) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "High", winfo.high, SIZEOF(winfo.high))) - _tcsncpy(winfo.high, NODATA, SIZEOF(winfo.high) - 1); + mir_tstrncpy(winfo.high, NODATA, SIZEOF(winfo.high) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Low", winfo.low, SIZEOF(winfo.low))) - _tcsncpy(winfo.low, NODATA, SIZEOF(winfo.low) - 1); + mir_tstrncpy(winfo.low, NODATA, SIZEOF(winfo.low) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunset", winfo.sunset, SIZEOF(winfo.sunset))) - _tcsncpy(winfo.sunset, NODATA, SIZEOF(winfo.sunset) - 1); + mir_tstrncpy(winfo.sunset, NODATA, SIZEOF(winfo.sunset) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Sunrise", winfo.sunrise, SIZEOF(winfo.sunrise))) - _tcsncpy(winfo.sunrise, NODATA, SIZEOF(winfo.sunrise) - 1); + mir_tstrncpy(winfo.sunrise, NODATA, SIZEOF(winfo.sunrise) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Speed", winfo.wind, SIZEOF(winfo.wind))) - _tcsncpy(winfo.wind, NODATA, SIZEOF(winfo.wind) - 1); + mir_tstrncpy(winfo.wind, NODATA, SIZEOF(winfo.wind) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Wind Direction", winfo.winddir, SIZEOF(winfo.winddir))) - _tcsncpy(winfo.winddir, NODATA, SIZEOF(winfo.winddir) - 1); + mir_tstrncpy(winfo.winddir, NODATA, SIZEOF(winfo.winddir) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Dewpoint", winfo.dewpoint, SIZEOF(winfo.dewpoint))) - _tcsncpy(winfo.dewpoint, NODATA, SIZEOF(winfo.dewpoint) - 1); + mir_tstrncpy(winfo.dewpoint, NODATA, SIZEOF(winfo.dewpoint) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Pressure", winfo.pressure, SIZEOF(winfo.pressure))) - _tcsncpy(winfo.pressure, NODATA, SIZEOF(winfo.pressure) - 1); + mir_tstrncpy(winfo.pressure, NODATA, SIZEOF(winfo.pressure) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Visibility", winfo.vis, SIZEOF(winfo.vis))) - _tcsncpy(winfo.vis, NODATA, SIZEOF(winfo.vis) - 1); + mir_tstrncpy(winfo.vis, NODATA, SIZEOF(winfo.vis) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Humidity", winfo.humid, SIZEOF(winfo.humid))) - _tcsncpy(winfo.humid, NODATA, SIZEOF(winfo.humid) - 1); + mir_tstrncpy(winfo.humid, NODATA, SIZEOF(winfo.humid) - 1); if (DBGetStaticString(hContact, WEATHERCONDITION, "Feel", winfo.feel, SIZEOF(winfo.feel))) - _tcsncpy(winfo.feel, NODATA, SIZEOF(winfo.feel) - 1); + mir_tstrncpy(winfo.feel, NODATA, SIZEOF(winfo.feel) - 1); winfo.status = (WORD)db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE); return winfo; @@ -106,7 +106,7 @@ int DBGetStaticString(MCONTACT hContact, const char *szModule, const char *value if ( db_get_ts( hContact, szModule, valueName, &dbv )) return 1; - _tcsncpy( dest, dbv.ptszVal, dest_len ); + mir_tstrncpy( dest, dbv.ptszVal, dest_len ); dest[ dest_len-1 ] = 0; db_free( &dbv ); return 0; @@ -176,7 +176,7 @@ void EraseAllInfo() // in case where the default station is missing if (opt.DefStn == NULL && ContactCount != 0) { if ( !db_get_ts(LastContact, WEATHERPROTONAME, "ID", &dbv)) { - _tcsncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1); + mir_tstrncpy(opt.Default, dbv.ptszVal, SIZEOF(opt.Default) - 1); db_free(&dbv); } opt.DefStn = LastContact; @@ -340,7 +340,7 @@ void GetDataValue(WIDATAITEM *UpdateData, TCHAR *Data, TCHAR** szData) mir_sntprintf(Data, MAX_DATA_LEN, TranslateT("Error when obtaining data: %s"), UpdateData->Name); WPShowMessage(Data, SM_WARNING); } - _tcsncpy(Data, TranslateT(""), MAX_DATA_LEN); + mir_tstrncpy(Data, TranslateT(""), MAX_DATA_LEN); last = ' '; respos = MAX_DATA_LEN - 1; break; diff --git a/plugins/Weather/src/weather_info.cpp b/plugins/Weather/src/weather_info.cpp index 39e41637c7..4ceeb921ae 100644 --- a/plugins/Weather/src/weather_info.cpp +++ b/plugins/Weather/src/weather_info.cpp @@ -216,7 +216,7 @@ void MoreVarList(void) TCHAR str[10240], tempstr[1024]; // heading - _tcsncpy(str, VARS_LIST, SIZEOF(str) - 1); + mir_tstrncpy(str, VARS_LIST, SIZEOF(str) - 1); mir_tstrncat(str, _T("\n\n"), SIZEOF(str) - mir_tstrlen(str)); // loop through all weather services to find custom variables for (WIDATALIST *Item = WIHead;Item != NULL;Item = Item->next) diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index d28e24549e..fa689562e0 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -184,7 +184,7 @@ bool LoadWIData(bool dial) return false; *chop = '\0'; mir_tstrncat(szSearchPath, _T("\\Plugins\\Weather\\*.ini"), SIZEOF(szSearchPath) - mir_tstrlen(szSearchPath)); - _tcsncpy(FileName, szSearchPath, MAX_PATH - 1); + mir_tstrncpy(FileName, szSearchPath, MAX_PATH - 1); WIN32_FIND_DATA fd; HANDLE hFind = FindFirstFile(szSearchPath, &fd); diff --git a/plugins/Weather/src/weather_opt.cpp b/plugins/Weather/src/weather_opt.cpp index 77cc37b97a..57e6b3fabb 100644 --- a/plugins/Weather/src/weather_opt.cpp +++ b/plugins/Weather/src/weather_opt.cpp @@ -36,43 +36,43 @@ void SetTextDefault(const char* in) TCHAR str[MAX_TEXT_SIZE]; if (strchr(in, 'C') != NULL) { - _tcsncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, C_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.cText, str); } if (strchr(in, 'b') != NULL) { - _tcsncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, b_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.bTitle, str); } if (strchr(in, 'B') != NULL) { - _tcsncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, B_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.bText, str); } if (strchr(in, 'N') != NULL) { - _tcsncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, N_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.nText, str); } if (strchr(in, 'E') != NULL) { - _tcsncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, E_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.eText, str); } if (strchr(in, 'H') != NULL) { - _tcsncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, H_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.hText, str); } if (strchr(in, 'X') != NULL) { - _tcsncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, X_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.xText, str); } if (strchr(in, 'P') != NULL) { - _tcsncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, P_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.pTitle, str); } if (strchr(in, 'p') != NULL) { - _tcsncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, p_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.pText, str); } if (strchr(in, 'S') != NULL) { - _tcsncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1); + mir_tstrncpy(str, s_DEFAULT, MAX_TEXT_SIZE - 1); wSetData(&opt.sText, str); } } @@ -472,7 +472,7 @@ INT_PTR CALLBACK DlgProcText(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) SetWindowPos(hdlg, HWND_TOPMOST, rc.left, rc.top, 0, 0, SWP_NOSIZE); TranslateDialogDefault(hdlg); // generate the display text for variable list - _tcsncpy(str, VAR_LIST_OPT, SIZEOF(str) - 1); + mir_tstrncpy(str, VAR_LIST_OPT, SIZEOF(str) - 1); SetDlgItemText(hdlg, IDC_VARLIST, str); // make the more variable and other buttons flat diff --git a/plugins/Weather/src/weather_popup.cpp b/plugins/Weather/src/weather_popup.cpp index 17ab3696c8..9abcac9dda 100644 --- a/plugins/Weather/src/weather_popup.cpp +++ b/plugins/Weather/src/weather_popup.cpp @@ -79,8 +79,8 @@ int WeatherError(WPARAM wParam, LPARAM lParam) TCHAR str1[512], str2[512]; // get the 2 strings - _tcsncpy(str1, tszMsg, SIZEOF(str1) - 1); - _tcsncpy(str2, tszMsg, SIZEOF(str2) - 1); + mir_tstrncpy(str1, tszMsg, SIZEOF(str1) - 1); + mir_tstrncpy(str2, tszMsg, SIZEOF(str2) - 1); TCHAR *chop = _tcschr(str1, 255); if (chop != NULL) *chop = '\0'; @@ -88,7 +88,7 @@ int WeatherError(WPARAM wParam, LPARAM lParam) str1[0] = 0; chop = _tcschr(str2, 255); if (chop != NULL) - _tcsncpy(str2, chop+1, SIZEOF(str2) - 1); + mir_tstrncpy(str2, chop+1, SIZEOF(str2) - 1); else str2[0] = 0; @@ -396,7 +396,7 @@ INT_PTR CALLBACK DlgPopupOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_VAR3: // display variable list - _tcsncpy(str, _T(" \n"),SIZEOF(str) - 1); // to make the message box wider + mir_tstrncpy(str, _T(" \n"),SIZEOF(str) - 1); // to make the message box wider mir_tstrncat(str, VAR_LIST_POPUP, SIZEOF(str) - mir_tstrlen(str)); mir_tstrncat(str, _T("\n"), SIZEOF(str) - mir_tstrlen(str)); mir_tstrncat(str, CUSTOM_VARS, SIZEOF(str) - mir_tstrlen(str)); diff --git a/plugins/Weather/src/weather_update.cpp b/plugins/Weather/src/weather_update.cpp index ed9275e2c4..6a8890b62d 100644 --- a/plugins/Weather/src/weather_update.cpp +++ b/plugins/Weather/src/weather_update.cpp @@ -460,7 +460,7 @@ int GetWeatherData(MCONTACT hContact) // to get a data value. GetDataValue(&Item->Item, DataValue, &szInfo); if ( mir_tstrcmp(Item->Item.Name, _T("Condition")) && mir_tstrcmpi(Item->Item.Unit, _T("Cond"))) - _tcsncpy(DataValue, TranslateTS(DataValue), MAX_DATA_LEN - 1); + mir_tstrncpy(DataValue, TranslateTS(DataValue), MAX_DATA_LEN - 1); break; case WID_SET: @@ -482,7 +482,7 @@ int GetWeatherData(MCONTACT hContact) chop = _tcschr(str, '\0'); stl = min(sizeof(str2)-1, (unsigned)(chop-str-2)); - _tcsncpy(str2, str+1, stl); + mir_tstrncpy(str2, str+1, stl); str2[stl] = 0; switch(str[0]) { @@ -513,7 +513,7 @@ int GetWeatherData(MCONTACT hContact) // for the "Break Data=" operation DBVARIANT dbv; if ( !DBGetData(hContact, _T2A(Item->Item.Start), &dbv)) { - _tcsncpy(DataValue, dbv.ptszVal, SIZEOF(DataValue)); + mir_tstrncpy(DataValue, dbv.ptszVal, SIZEOF(DataValue)); DataValue[SIZEOF(DataValue)-1] = 0; db_free(&dbv); } diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp index befe325ad0..444ee9f135 100644 --- a/plugins/Weather/src/weather_userinfo.cpp +++ b/plugins/Weather/src/weather_userinfo.cpp @@ -336,7 +336,7 @@ void LoadBriefInfoText(HWND hwndDlg, MCONTACT hContact) winfo = LoadWeatherInfo(hContact); // check if data exist. If not, display error message box if ( !(BOOL)db_get_b(hContact, WEATHERPROTONAME, "IsUpdated", FALSE)) - _tcsncpy(str, WEATHER_NO_INFO, SIZEOF(str) - 1); + mir_tstrncpy(str, WEATHER_NO_INFO, SIZEOF(str) - 1); else // set the display text and show the message box GetDisplay(&winfo, opt.bText, str); diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 77438d6ccc..36c4ceb4d2 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -172,7 +172,7 @@ INT_PTR PingWebsiteMenuCommand(WPARAM wParam, LPARAM lParam) return 0; TCHAR Cnick[200], *Oldnick; - _tcsncpy(Cnick, url, SIZEOF(Cnick)); + mir_tstrncpy(Cnick, url, SIZEOF(Cnick)); if ((Oldnick = _tcsstr(Cnick, _T("://"))) != 0) Oldnick += 3; else @@ -380,7 +380,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) //Convert url into a name for contact TCHAR Cnick[255]; if (psr->nick != NULL) - _tcsncpy(Cnick, psr->nick, SIZEOF(Cnick)); + mir_tstrncpy(Cnick, psr->nick, SIZEOF(Cnick)); else Cnick[0] = 0; diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp index 79c518246d..68f2e6fb15 100644 --- a/plugins/WhenWasIt/src/notifiers.cpp +++ b/plugins/WhenWasIt/src/notifiers.cpp @@ -35,8 +35,8 @@ void PopupNotifyNoBirthdays() FillPopupData(pd, -1); pd.lchIcon = GetDTBIcon(-1); - _tcsncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME - 1); - _tcsncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE - 1); + mir_tstrncpy(pd.lptzContactName, TranslateT("WhenWasIt"), MAX_CONTACTNAME - 1); + mir_tstrncpy(pd.lptzText, TranslateT("No upcoming birthdays."), MAX_SECONDLINE - 1); PUAddPopupT(&pd); } diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp index 79c699d7de..4eebe0aaa1 100644 --- a/plugins/WhenWasIt/src/services.cpp +++ b/plugins/WhenWasIt/src/services.cpp @@ -180,8 +180,8 @@ void ShowPopupMessage(TCHAR *title, TCHAR *message, HANDLE icon) { POPUPDATAT pd = { 0 }; pd.lchIcon = Skin_GetIconByHandle(icon); - _tcsncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1); - _tcsncpy(pd.lptzText, message, MAX_SECONDLINE - 1); + mir_tstrncpy(pd.lptzContactName, title, MAX_CONTACTNAME - 1); + mir_tstrncpy(pd.lptzText, message, MAX_SECONDLINE - 1); pd.colorText = commonData.foreground; pd.colorBack = commonData.background; PUAddPopupT(&pd); diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 294372504a..d408aeda61 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -28,7 +28,7 @@ void LoadOptions() memset(&WumfOptions, 0, sizeof(WumfOptions)); if (db_get_ts(NULL, MODULENAME, OPT_FILE, &dbv) == 0) { - _tcsncpy(WumfOptions.LogFile, dbv.ptszVal, 255); + mir_tstrncpy(WumfOptions.LogFile, dbv.ptszVal, 255); db_free(&dbv); } else diff --git a/plugins/XSoundNotify/src/Common.h b/plugins/XSoundNotify/src/Common.h index 4cbed8f0fb..c776482380 100644 --- a/plugins/XSoundNotify/src/Common.h +++ b/plugins/XSoundNotify/src/Common.h @@ -31,7 +31,7 @@ struct XSN_Data __forceinline XSN_Data(MCONTACT _aContact, TCHAR *_path, BYTE _ignore) : hContact(_aContact) { - _tcsncpy(path, _path, SIZEOF(path)); + mir_tstrncpy(path, _path, SIZEOF(path)); ignore = _ignore; } }; diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 00a777b36b..2abe6cf9d9 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -122,7 +122,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP if (p == NULL) XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0)); else { - _tcsncpy(p->path, FileName, SIZEOF(p->path)); + mir_tstrncpy(p->path, FileName, SIZEOF(p->path)); p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0; } EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_TEST_PLAY), TRUE); diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index d85991de2e..0c1c963951 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -144,7 +144,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0)); else { - _tcsncpy(p->path, FileName, SIZEOF(p->path)); + mir_tstrncpy(p->path, FileName, SIZEOF(p->path)); p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0; } EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index a837cda3b7..8d09e8240f 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -78,7 +78,7 @@ static void GetProfileDirectory(TCHAR *szPath, int cbPath) _T("") }; SHFileOperation(&file_op); - _tcsncpy(szPath, ptszNewPath, cbPath); + mir_tstrncpy(szPath, ptszNewPath, cbPath); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/YAPP/src/services.cpp b/plugins/YAPP/src/services.cpp index f968d505a2..5e54392edd 100644 --- a/plugins/YAPP/src/services.cpp +++ b/plugins/YAPP/src/services.cpp @@ -292,7 +292,7 @@ static INT_PTR ShowMessage(WPARAM wParam, LPARAM lParam) POPUPDATAT pd = {0}; mir_tstrcpy(pd.lptzContactName, lParam == SM_WARNING ? _T("Warning") : _T("Notification")); pd.lchIcon = LoadIcon(0, lParam == SM_WARNING ? IDI_WARNING : IDI_INFORMATION); - _tcsncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0; + mir_tstrncpy(pd.lptzText, _A2T((char *)wParam), MAX_SECONDLINE); pd.lptzText[MAX_SECONDLINE-1] = 0; CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&pd, 0); } return 0; diff --git a/plugins/YAPP/src/yapp_history_dlg.cpp b/plugins/YAPP/src/yapp_history_dlg.cpp index f98482dcdd..68f39dea74 100644 --- a/plugins/YAPP/src/yapp_history_dlg.cpp +++ b/plugins/YAPP/src/yapp_history_dlg.cpp @@ -143,7 +143,7 @@ int MatchesFilterCS(const TCHAR *filter, const PopupHistoryData *popupItem) //ca __inline void ConvertCase(TCHAR *dest, const TCHAR *source, size_t size) { - _tcsncpy(dest, source, size); + mir_tstrncpy(dest, source, size); _tcslwr(dest); } @@ -493,7 +493,7 @@ void CopyPopupDataToClipboard(HWND hList, int selection) HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, (len + 2) * sizeof(TCHAR)); clipboard = (TCHAR *) GlobalLock(hData); - _tcsncpy(clipboard, buffer, len); + mir_tstrncpy(clipboard, buffer, len); clipboard[len] = _T('\0'); GlobalUnlock(hData); if (!SetClipboardData(textType, hData)) diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 62849bc75b..48de35a8f6 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -241,10 +241,10 @@ extern "C" int __declspec(dllexport) Load() TCHAR *szForwardTemplate = db_get_tsa(NULL, "yaRelay", "ForwardTemplate"); if (szForwardTemplate){ - _tcsncpy(tszForwardTemplate, szForwardTemplate, SIZEOF(tszForwardTemplate)); + mir_tstrncpy(tszForwardTemplate, szForwardTemplate, SIZEOF(tszForwardTemplate)); mir_free(szForwardTemplate); } - else _tcsncpy(tszForwardTemplate, _T("%u: %m"), MAXTEMPLATESIZE-1); + else mir_tstrncpy(tszForwardTemplate, _T("%u: %m"), MAXTEMPLATESIZE-1); iSplit = db_get_dw(NULL, "yaRelay", "Split", 0); iSplitMaxSize = db_get_dw(NULL, "yaRelay", "SplitMaxSize", 100); diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp index a8e3742819..e802f31473 100644 --- a/plugins/YahooGroups/src/utils.cpp +++ b/plugins/YahooGroups/src/utils.cpp @@ -327,7 +327,7 @@ MCONTACT GetContactFromID(TCHAR *szID, char *szProto) szHandle = GetContactID(hContact, cProtocol); tmp = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR); - _tcsncpy(dispName, tmp, SIZEOF(dispName)); + mir_tstrncpy(dispName, tmp, SIZEOF(dispName)); if ((szHandle) && ((mir_tstrcmpi(szHandle, szID) == 0) || (mir_tstrcmpi(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) found = 1; diff --git a/plugins/helpers/gen_helpers.cpp b/plugins/helpers/gen_helpers.cpp index edfaff270d..cda62e18de 100644 --- a/plugins/helpers/gen_helpers.cpp +++ b/plugins/helpers/gen_helpers.cpp @@ -108,7 +108,7 @@ int AddDebugLogMessage(const TCHAR* fmt, ...) #ifdef MODULENAME mir_sntprintf(tszFinal, SIZEOF(tszFinal), _T("%s: %s"), MODULENAME, tszText); #else - _tcsncpy(tszFinal, tszText, SIZEOF(tszFinal)); + mir_tstrncpy(tszFinal, tszText, SIZEOF(tszFinal)); #endif diff --git a/plugins/wbOSD/src/events.cpp b/plugins/wbOSD/src/events.cpp index af04e7156e..6d7209f0a3 100644 --- a/plugins/wbOSD/src/events.cpp +++ b/plugins/wbOSD/src/events.cpp @@ -152,7 +152,7 @@ int HookedNewEvent(WPARAM wParam, LPARAM hDBEvent) logmsg("HookedNewEvent2"); TCHAR buf[512]; - _tcsncpy(buf, DEFAULT_MESSAGEFORMAT,SIZEOF(buf)); + mir_tstrncpy(buf, DEFAULT_MESSAGEFORMAT,SIZEOF(buf)); DBVARIANT dbv; if(!db_get_ts(NULL,THIS_MODULE,"message_format",&dbv)) { diff --git a/protocols/AimOscar/src/services.cpp b/protocols/AimOscar/src/services.cpp index 01944ef024..25a6eb9012 100644 --- a/protocols/AimOscar/src/services.cpp +++ b/protocols/AimOscar/src/services.cpp @@ -413,7 +413,7 @@ INT_PTR CAimProto::GetAvatar(WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai) }; if (GetAvatarInfo(0, (LPARAM)&ai) == GAIR_SUCCESS) { - _tcsncpy(buf, ai.filename, size); + mir_tstrncpy(buf, ai.filename, size); buf[size-1] = 0; return 0; } diff --git a/protocols/FacebookRM/src/avatars.cpp b/protocols/FacebookRM/src/avatars.cpp index 3f9dfa0994..3a87ed85af 100644 --- a/protocols/FacebookRM/src/avatars.cpp +++ b/protocols/FacebookRM/src/avatars.cpp @@ -223,7 +223,7 @@ INT_PTR FacebookProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai) }; switch (GetAvatarInfo(0, (LPARAM)&ai)) { case GAIR_SUCCESS: - _tcsncpy(buf, ai.filename, size); + mir_tstrncpy(buf, ai.filename, size); buf[size - 1] = 0; return 0; diff --git a/protocols/GTalkExt/src/handlers.cpp b/protocols/GTalkExt/src/handlers.cpp index 16af0a823e..8f4c54600b 100644 --- a/protocols/GTalkExt/src/handlers.cpp +++ b/protocols/GTalkExt/src/handlers.cpp @@ -67,7 +67,7 @@ LPTSTR ExtractJid(LPCTSTR jidWithRes) size_t l = size_t(p - jidWithRes); LPTSTR result = (LPTSTR)mir_alloc((l + 1) * sizeof(TCHAR)); - _tcsncpy(result, jidWithRes, l); + mir_tstrncpy(result, jidWithRes, l); result[l] = 0; return result; } diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 7fccf30251..56528ba82b 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -226,10 +226,10 @@ TCHAR *gg_img_getfilter(TCHAR *szFilter, int nSize) szFilterMask = _T("*.bmp;*.gif;*.jpeg;*.jpg;*.png"); // Make up filter - _tcsncpy(pFilter, szFilterName, nSize); + mir_tstrncpy(pFilter, szFilterName, nSize); pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; - _tcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter)); + mir_tstrncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter)); pFilter += mir_tstrlen(pFilter) + 1; if (pFilter >= szFilter + nSize) return NULL; *pFilter = 0; @@ -251,7 +251,7 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) gg_img_getfilter(szFilter, SIZEOF(szFilter)); TCHAR szFileName[MAX_PATH]; - _tcsncpy(szFileName, dat->lpszFileName, SIZEOF(szFileName)); + mir_tstrncpy(szFileName, dat->lpszFileName, SIZEOF(szFileName)); OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 2b903179bb..42ee730f8e 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -336,24 +336,24 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0}; ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter)); + mir_tstrncpy(filter, TranslateT("Text files"), SIZEOF(filter)); mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; @@ -403,25 +403,25 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) OPENFILENAME ofn = {0}; TCHAR filter[512], *pfilter; - _tcsncpy(str, TranslateT("contacts"), SIZEOF(str)); + mir_tstrncpy(str, TranslateT("contacts"), SIZEOF(str)); mir_tstrncat(str, _T(".txt"), SIZEOF(str) - mir_tstrlen(str)); ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; - _tcsncpy(filter, TranslateT("Text files"), SIZEOF(filter)); + mir_tstrncpy(filter, TranslateT("Text files"), SIZEOF(filter)); mir_tstrncat(filter, _T(" (*.txt)"), SIZEOF(filter) - mir_tstrlen(filter)); pfilter = filter + mir_tstrlen(filter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, _T("*.TXT"), SIZEOF(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, TranslateT("All Files"), SIZEOF(filter) - (pfilter - filter)); mir_tstrncat(pfilter, _T(" (*)"), SIZEOF(filter) - (pfilter - filter) - mir_tstrlen(pfilter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; - _tcsncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); + mir_tstrncpy(pfilter, _T("*"), SIZEOF(filter) - (pfilter - filter)); pfilter = pfilter + mir_tstrlen(pfilter) + 1; if (pfilter >= filter + SIZEOF(filter)) return 0; diff --git a/protocols/IRCG/src/options.cpp b/protocols/IRCG/src/options.cpp index 24f51da361..29212e110d 100644 --- a/protocols/IRCG/src/options.cpp +++ b/protocols/IRCG/src/options.cpp @@ -1218,7 +1218,7 @@ CAddIgnoreDlg::CAddIgnoreDlg(CIrcProto* _pro, const TCHAR* mask, CIgnorePrefsDlg if (mask == NULL) szOldMask[0] = 0; else - _tcsncpy(szOldMask, mask, SIZEOF(szOldMask)); + mir_tstrncpy(szOldMask, mask, SIZEOF(szOldMask)); m_Ok.OnClick = Callback(this, &CAddIgnoreDlg::OnOk); } diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index ff7c0d5f1f..89df241c17 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -391,7 +391,7 @@ INT_PTR CIcqProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) TCHAR *tszFile = GetOwnAvatarFileName(); if (tszFile && !_taccess(tszFile, 0)) { - _tcsncpy((TCHAR*)wParam, tszFile, (int)lParam); + mir_tstrncpy((TCHAR*)wParam, tszFile, (int)lParam); SAFE_FREE(&tszFile); return 0; } diff --git a/protocols/MSN/src/msn_chat.cpp b/protocols/MSN/src/msn_chat.cpp index da9fd4f2b4..8f3e6e0ba6 100644 --- a/protocols/MSN/src/msn_chat.cpp +++ b/protocols/MSN/src/msn_chat.cpp @@ -47,14 +47,14 @@ int CMsnProto::MSN_ChatInit(GCThreadData *info, const char *pszID, const char *p { char *szNet, *szEmail; - _tcsncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID)); + mir_tstrncpy(info->mChatID, _A2T(pszID), SIZEOF(info->mChatID)); parseWLID(NEWSTR_ALLOCA(pszID), &szNet, &szEmail, NULL); info->netId = atoi(szNet); mir_strncpy(info->szEmail, szEmail, sizeof(info->szEmail)); TCHAR szName[512]; InterlockedIncrement(&m_chatID); - if (*pszTopic) _tcsncpy(szName, _A2T(pszTopic), SIZEOF(szName)); + if (*pszTopic) mir_tstrncpy(szName, _A2T(pszTopic), SIZEOF(szName)); else mir_sntprintf(szName, SIZEOF(szName), _T("%s %s%d"), m_tszUserName, TranslateT("Chat #"), m_chatID); diff --git a/protocols/Sametime/src/userlist.cpp b/protocols/Sametime/src/userlist.cpp index 0fd6d87e72..aeb7b69156 100644 --- a/protocols/Sametime/src/userlist.cpp +++ b/protocols/Sametime/src/userlist.cpp @@ -673,10 +673,10 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code if (advanced == TRUE) { // send column names mcsr.psr.cbSize = 0; - _tcsncpy(mcsr.pszFields[0], TranslateT("ID"), 512); - _tcsncpy(mcsr.pszFields[1], TranslateT("Name"), 512); - _tcsncpy(mcsr.pszFields[2], TranslateT("Description"), 512); - _tcsncpy(mcsr.pszFields[3], TranslateT("Group?"), 512); + mir_tstrncpy(mcsr.pszFields[0], TranslateT("ID"), 512); + mir_tstrncpy(mcsr.pszFields[1], TranslateT("Name"), 512); + mir_tstrncpy(mcsr.pszFields[2], TranslateT("Description"), 512); + mir_tstrncpy(mcsr.pszFields[3], TranslateT("Group?"), 512); proto->ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, (HANDLE)id, (LPARAM)&mcsr); } @@ -702,7 +702,7 @@ void mwResolve_handler_callback(mwServiceResolve* srvc, guint32 id, guint32 code mcsr.psr.group = (((mwResolveMatch *)mri->data)->type == mwResolveMatch_GROUP); //MultiByteToWideChar(CP_UTF8, 0, mcsr.psr.name, -1, mcsr.pszFields[1], 512); - _tcsncpy(mcsr.pszFields[3], mcsr.psr.group ? TranslateT("True") : TranslateT("False"), 512); + mir_tstrncpy(mcsr.pszFields[3], mcsr.psr.group ? TranslateT("True") : TranslateT("False"), 512); if (advanced == TRUE) proto->ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SEARCHRESULT, (HANDLE)id, (LPARAM)&mcsr); diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 9effeb2554..91f992f6a9 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -99,7 +99,7 @@ INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) TCHAR tszFileName[MAX_PATH]; GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName)); - _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); + mir_tstrncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); if (::_taccess(AI->filename, 0) == 0 && !getBool(AI->hContact, "NeedNewAvatar", 0)) return GAIR_SUCCESS; @@ -118,7 +118,7 @@ INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) { TCHAR path[MAX_PATH]; GetAvatarFileName(NULL, path, SIZEOF(path)); - _tcsncpy((TCHAR*)wParam, path, (int)lParam); + mir_tstrncpy((TCHAR*)wParam, path, (int)lParam); return 0; } diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index ec2694b878..a8f4a811f9 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -148,7 +148,7 @@ INT_PTR CSteamProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) PROTO_AVATAR_INFORMATIONT ai = { sizeof(ai) }; switch (GetAvatarInfo(0, (LPARAM)&ai)) { case GAIR_SUCCESS: - _tcsncpy(buf, ai.filename, size); + mir_tstrncpy(buf, ai.filename, size); buf[size - 1] = 0; return 0; diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 6442ecf019..a710bc6cd2 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -602,8 +602,8 @@ static void MailPopupPreview(DWORD colorBack, DWORD colorText, TCHAR *title, TCH HICON hIcon = GetIcolibIcon(IDI_MAIL); ppd.lchIcon = CopyIcon(hIcon); ReleaseIcolibIcon(hIcon); - _tcsncpy(ppd.lptzContactName, title, MAX_CONTACTNAME-1); - _tcsncpy(ppd.lptzText, emailInfo,MAX_SECONDLINE-1); + mir_tstrncpy(ppd.lptzContactName, title, MAX_CONTACTNAME-1); + mir_tstrncpy(ppd.lptzText, emailInfo,MAX_SECONDLINE-1); ppd.colorBack = colorBack; ppd.colorText = colorText; ppd.iSeconds = delay; diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index c8aef49d25..d3eb3ddab4 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -1063,8 +1063,8 @@ static void TlenMailPopup(TlenProtocol *proto, char *title, char *emailInfo) POPUPDATAT ppd = { 0 }; ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_MAIL)); - _tcsncpy(ppd.lptzContactName, _A2T(title), MAX_CONTACTNAME -1); - _tcsncpy(ppd.lptzText, _A2T(emailInfo), MAX_SECONDLINE - 1); + mir_tstrncpy(ppd.lptzContactName, _A2T(title), MAX_CONTACTNAME -1); + mir_tstrncpy(ppd.lptzText, _A2T(emailInfo), MAX_SECONDLINE - 1); ppd.colorBack = db_get_dw(NULL, proto->m_szModuleName, "MailPopupBack", 0); ppd.colorText = db_get_dw(NULL, proto->m_szModuleName, "MailPopupText", 0); BYTE delayMode = db_get_b(NULL, proto->m_szModuleName, "MailPopupDelayMode", 0); diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index e1460b3d53..0b3d04b732 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -201,7 +201,7 @@ HANDLE CToxProto::OnSendFile(MCONTACT hContact, const PROTOCHAR*, PROTOCHAR **pp TCHAR *fileName = _tcsrchr(ppszFiles[0], '\\') + 1; size_t fileDirLength = fileName - ppszFiles[0]; TCHAR *fileDir = (TCHAR*)mir_alloc(sizeof(TCHAR)*(fileDirLength + 1)); - _tcsncpy(fileDir, ppszFiles[0], fileDirLength); + mir_tstrncpy(fileDir, ppszFiles[0], fileDirLength); fileDir[fileDirLength] = '\0'; _fseeki64(hFile, 0, SEEK_END); diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index f793b09e0a..79d0e354ff 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -412,7 +412,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this. } - _tcsncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now) + mir_tstrncpy(ai.filename, filename.c_str(), MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now) debugLogA("***** Updating avatar: %s", data->url.c_str()); mir_cslock lck(avatar_lock_); @@ -536,7 +536,7 @@ void TwitterProto::ShowContactPopup(MCONTACT hContact, const std::string &text, DBVARIANT dbv; if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !db_get_ts(hContact, m_szModuleName, TWITTER_KEY_UN, &dbv)) { - _tcsncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME); + mir_tstrncpy(popup.lptzContactName, dbv.ptszVal, MAX_CONTACTNAME); db_free(&dbv); } diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp index a0232d5da2..2dc2e9e6be 100644 --- a/protocols/Twitter/src/ui.cpp +++ b/protocols/Twitter/src/ui.cpp @@ -331,8 +331,8 @@ namespace popup_options // Pick a random quote int q = rand() % SIZEOF(quotes); - _tcsncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME); - _tcsncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE); + mir_tstrncpy(popup.lptzContactName, quotes[q].name, MAX_CONTACTNAME); + mir_tstrncpy(popup.lptzText, quotes[q].text, MAX_SECONDLINE); popup.lchContact = hContact; popup.iSeconds = get_timeout(hwndDlg); diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp index 85740be99c..09d64881be 100644 --- a/protocols/VKontakte/src/vk_avatars.cpp +++ b/protocols/VKontakte/src/vk_avatars.cpp @@ -81,7 +81,7 @@ INT_PTR CVkProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam) TCHAR tszFileName[MAX_PATH]; GetAvatarFileName(AI->hContact, tszFileName, SIZEOF(tszFileName)); - _tcsncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); + mir_tstrncpy(AI->filename, tszFileName, SIZEOF(AI->filename)); AI->format = ProtoGetAvatarFormat(AI->filename); @@ -117,7 +117,7 @@ INT_PTR CVkProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam) TCHAR* buf = (TCHAR*)wParam; int size = (int)lParam; - _tcsncpy(buf, AI.filename, size); + mir_tstrncpy(buf, AI.filename, size); buf[size - 1] = 0; return 0; diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 5b35f6b3d9..a269030c33 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -246,7 +246,7 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) AI.cbSize = sizeof AI; AI.format = PA_FORMAT_PNG; AI.hContact = hContact; - _tcsncpy(AI.filename, buf, SIZEOF(AI.filename)-1); + mir_tstrncpy(AI.filename, buf, SIZEOF(AI.filename)-1); if (error) setDword(hContact, "PictCK", 0); diff --git a/src/core/stdchat/src/main.cpp b/src/core/stdchat/src/main.cpp index 28390d4b66..62ad5f08a7 100644 --- a/src/core/stdchat/src/main.cpp +++ b/src/core/stdchat/src/main.cpp @@ -287,30 +287,30 @@ static void RegisterFonts() { ColourIDT colourid = { sizeof(colourid) }; mir_strncpy(colourid.dbSettingsGroup, CHAT_MODULE, sizeof(colourid.dbSettingsGroup)); - _tcsncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group)); + mir_tstrncpy(colourid.group, LPGENT("Chat module"), SIZEOF(colourid.group)); mir_strncpy(colourid.setting, "ColorLogBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Group chat log background"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Group chat log background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "ColorMessageBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Message background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "ColorNicklistBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list background"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Nick list background"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_WINDOW); ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "ColorNicklistLines", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list lines"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Nick list lines"), SIZEOF(colourid.name)); colourid.defcolour = GetSysColor(COLOR_INACTIVEBORDER); ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "ColorNicklistSelectedBG", SIZEOF(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Nick list background (selected)"), SIZEOF(colourid.name)); + mir_tstrncpy(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 07e823d998..35f1f78962 100644 --- a/src/core/stdclist/src/clcfonts.cpp +++ b/src/core/stdclist/src/clcfonts.cpp @@ -54,7 +54,7 @@ void RegisterCListFonts() FontIDT fontid = { sizeof(fontid) }; fontid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWREREGISTER | FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS; mir_strncpy(fontid.dbSettingsGroup, "CLC", sizeof(fontid.dbSettingsGroup)); - _tcsncpy(fontid.group, LPGENT("Contact list"), SIZEOF(fontid.group)); + mir_tstrncpy(fontid.group, LPGENT("Contact list"), SIZEOF(fontid.group)); HDC hdc = GetDC(NULL); for (int i = 0; i < SIZEOF(clistFontDescr); i++) { @@ -70,7 +70,7 @@ void RegisterCListFonts() fontid.flags &= ~FIDF_CLASSMASK; fontid.flags |= clistFontDescr[i].iMask; - _tcsncpy(fontid.name, clistFontDescr[i].tszName, SIZEOF(fontid.name)); + mir_tstrncpy(fontid.name, clistFontDescr[i].tszName, SIZEOF(fontid.name)); char idstr[10]; mir_snprintf(idstr, SIZEOF(idstr), "Font%d", i); @@ -87,25 +87,25 @@ void RegisterCListFonts() mir_strncpy(colourid.dbSettingsGroup, "CLC", sizeof(colourid.dbSettingsGroup)); 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)); + mir_tstrncpy(colourid.name, LPGENT("Background"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.group, LPGENT("Contact list"), SIZEOF(colourid.group)); colourid.defcolour = CLCDEFAULT_BKCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "SelTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Selected text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_SELTEXTCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "HotTextColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Hottrack text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_HOTTEXTCOLOUR; ColourRegisterT(&colourid); mir_strncpy(colourid.setting, "QuickSearchColour", sizeof(colourid.setting)); - _tcsncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); + mir_tstrncpy(colourid.name, LPGENT("Quicksearch text"), SIZEOF(colourid.name)); colourid.order = 1; colourid.defcolour = CLCDEFAULT_QUICKSEARCHCOLOUR; ColourRegisterT(&colourid); diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index 81b1a220ba..124ca9e37d 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -287,7 +287,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; - _tcsncpy(filter, TranslateT("All files"),SIZEOF(filter)-1); + mir_tstrncpy(filter, TranslateT("All files"),SIZEOF(filter)-1); mir_tstrcat(filter, _T(" (*)")); pfilter = filter + mir_tstrlen(filter) + 1; mir_tstrcpy(pfilter, _T("*")); diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp index ccfaa427e2..5e50b02df8 100644 --- a/src/core/stdfile/src/filerecvdlg.cpp +++ b/src/core/stdfile/src/filerecvdlg.cpp @@ -117,7 +117,7 @@ static void patchDir(TCHAR *str, size_t strSize) TCHAR *result = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)str, (LPARAM)&dat); if (result) { - _tcsncpy(str, result, strSize); + mir_tstrncpy(str, result, strSize); mir_free(result); } @@ -158,7 +158,7 @@ void GetContactReceivedFilesDir(MCONTACT hContact, TCHAR *szDir, int cchDir, BOO dat.hContact = hContact; TCHAR *result = (TCHAR*)CallService(MS_UTILS_REPLACEVARS, (WPARAM)tszTemp, (LPARAM)&dat); if (result) { - _tcsncpy(tszTemp, result, SIZEOF(tszTemp)); + mir_tstrncpy(tszTemp, result, SIZEOF(tszTemp)); mir_free(result); for (int i = 0; i < (SIZEOF(rvaVarsToReplace) - 1); i++) mir_free(rvaVarsToReplace[i].lptzValue); diff --git a/src/core/stdmsg/src/msgoptions.cpp b/src/core/stdmsg/src/msgoptions.cpp index f7e1ddeb2a..fa203b42b5 100644 --- a/src/core/stdmsg/src/msgoptions.cpp +++ b/src/core/stdmsg/src/msgoptions.cpp @@ -82,7 +82,7 @@ bool LoadMsgDlgFont(int i, LOGFONT* lf, COLORREF * colour) DBVARIANT dbv; if (db_get_ts(NULL, SRMMMOD, str, &dbv)) - _tcsncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, SIZEOF(lf->lfFaceName)-1); + mir_tstrncpy(lf->lfFaceName, fontOptionsList[i].szDefFace, SIZEOF(lf->lfFaceName)-1); else { mir_tstrncpy(lf->lfFaceName, dbv.ptszVal, SIZEOF(lf->lfFaceName)); db_free(&dbv); diff --git a/src/core/stduihist/src/history.cpp b/src/core/stduihist/src/history.cpp index 176a761ac4..fab500fa2d 100644 --- a/src/core/stduihist/src/history.cpp +++ b/src/core/stduihist/src/history.cpp @@ -40,7 +40,7 @@ static HGENMENU hContactMenu = 0; static void GetMessageDescription(DBEVENTINFO *dbei, TCHAR* buf, int cbBuf) { TCHAR *msg = DbGetEventTextT(dbei, CP_ACP); - _tcsncpy(buf, msg ? msg : TranslateT("Invalid message"), cbBuf); + mir_tstrncpy(buf, msg ? msg : TranslateT("Invalid message"), cbBuf); buf[ cbBuf-1 ] = 0; mir_free(msg); } @@ -125,7 +125,7 @@ static void GetObjectSummary(DBEVENTINFO *dbei, TCHAR* str, int cbStr) return; } - _tcsncpy(str, (const TCHAR*)pszSrc, cbStr); + mir_tstrncpy(str, (const TCHAR*)pszSrc, cbStr); str[cbStr-1] = 0; mir_free(pszTmp); } diff --git a/src/modules/netlib/netlibsecurity.cpp b/src/modules/netlib/netlibsecurity.cpp index 31873e94a7..a00f667076 100644 --- a/src/modules/netlib/netlibsecurity.cpp +++ b/src/modules/netlib/netlibsecurity.cpp @@ -292,7 +292,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, size_t newLoginLen = mir_tstrlen(login) + domainLen + 1; TCHAR *newLogin = (TCHAR*)alloca(newLoginLen * sizeof(TCHAR)); - _tcsncpy(newLogin, domainName, domainLen); + mir_tstrncpy(newLogin, domainName, domainLen); newLogin[domainLen] = '\\'; mir_tstrcpy(newLogin + domainLen + 1, login); diff --git a/src/modules/utils/path.cpp b/src/modules/utils/path.cpp index 91b8dba050..b5dad26176 100644 --- a/src/modules/utils/path.cpp +++ b/src/modules/utils/path.cpp @@ -196,7 +196,7 @@ static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return mir_ static __forceinline int _xcsncmp(const TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncmp(s1, s2, n); } static __forceinline size_t _xcslen(const TCHAR *s1) { return mir_tstrlen(s1); } static __forceinline TCHAR *_xcscpy(TCHAR *s1, const TCHAR *s2) { return mir_tstrcpy(s1, s2); } -static __forceinline TCHAR *_xcsncpy(TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncpy(s1, s2, n); } +static __forceinline TCHAR *_xcsncpy(TCHAR *s1, const TCHAR *s2, size_t n) { return mir_tstrncpy(s1, s2, n); } static __forceinline TCHAR *_xstrselect(TCHAR *, char *s1, TCHAR *s2) { return s2; } static __forceinline TCHAR *_itox(TCHAR *, int a) { return _itot(a, (TCHAR *)mir_alloc(sizeof(TCHAR)*20), 10); } static __forceinline TCHAR *mir_a2x(TCHAR *, char *s) { return mir_a2t(s); } -- cgit v1.2.3