From faa5fc757a25eeeaf57ff35ae908702d22d68163 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 11 Mar 2018 17:26:39 +0300 Subject: Alarms: use strncpy_s and wcsncpy_s instead of mir_wstrcpy and mir_strcpy --- plugins/Alarms/src/alarm_win.cpp | 32 ++++++++++++++++---------------- plugins/Alarms/src/frame.cpp | 16 ++++++++-------- 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'plugins') diff --git a/plugins/Alarms/src/alarm_win.cpp b/plugins/Alarms/src/alarm_win.cpp index f47f1f566d..1eb844c870 100644 --- a/plugins/Alarms/src/alarm_win.cpp +++ b/plugins/Alarms/src/alarm_win.cpp @@ -349,32 +349,32 @@ int ReloadFonts(WPARAM, LPARAM) int AlarmWinModulesLoaded(WPARAM, LPARAM) { title_font_id.cbSize = sizeof(FontIDW); - mir_wstrcpy(title_font_id.group, LPGENW("Alarms")); - mir_wstrcpy(title_font_id.name, LPGENW("Title")); - mir_strcpy(title_font_id.dbSettingsGroup, MODULE); - mir_strcpy(title_font_id.prefix, "FontTitle"); - mir_wstrcpy(title_font_id.backgroundGroup, LPGENW("Alarms")); - mir_wstrcpy(title_font_id.backgroundName, LPGENW("Background")); + wcsncpy_s(title_font_id.group, LPGENW("Alarms"), _TRUNCATE); + wcsncpy_s(title_font_id.name, LPGENW("Title"), _TRUNCATE); + strncpy_s(title_font_id.dbSettingsGroup, MODULE, _TRUNCATE); + strncpy_s(title_font_id.prefix, "FontTitle", _TRUNCATE); + wcsncpy_s(title_font_id.backgroundGroup, LPGENW("Alarms"), _TRUNCATE); + wcsncpy_s(title_font_id.backgroundName, LPGENW("Background"), _TRUNCATE); title_font_id.flags = 0; title_font_id.order = 0; Font_RegisterW(&title_font_id); window_font_id.cbSize = sizeof(FontIDW); - mir_wstrcpy(window_font_id.group, LPGENW("Alarms")); - mir_wstrcpy(window_font_id.name, LPGENW("Window")); - mir_strcpy(window_font_id.dbSettingsGroup, MODULE); - mir_strcpy(window_font_id.prefix, "FontWindow"); - mir_wstrcpy(window_font_id.backgroundGroup, LPGENW("Alarms")); - mir_wstrcpy(window_font_id.backgroundName, LPGENW("Background")); + wcsncpy_s(window_font_id.group, LPGENW("Alarms"), _TRUNCATE); + wcsncpy_s(window_font_id.name, LPGENW("Window"), _TRUNCATE); + strncpy_s(window_font_id.dbSettingsGroup, MODULE, _TRUNCATE); + strncpy_s(window_font_id.prefix, "FontWindow", _TRUNCATE); + wcsncpy_s(window_font_id.backgroundGroup, LPGENW("Alarms"), _TRUNCATE); + wcsncpy_s(window_font_id.backgroundName, LPGENW("Background"), _TRUNCATE); window_font_id.flags = 0; window_font_id.order = 1; Font_RegisterW(&window_font_id); bk_colour_id.cbSize = sizeof(ColourIDW); - mir_strcpy(bk_colour_id.dbSettingsGroup, MODULE); - mir_wstrcpy(bk_colour_id.group, LPGENW("Alarms")); - mir_wstrcpy(bk_colour_id.name, LPGENW("Background")); - mir_strcpy(bk_colour_id.setting, "BkColour"); + strncpy_s(bk_colour_id.dbSettingsGroup, MODULE, _TRUNCATE); + wcsncpy_s(bk_colour_id.group, LPGENW("Alarms"), _TRUNCATE); + wcsncpy_s(bk_colour_id.name, LPGENW("Background"), _TRUNCATE); + strncpy_s(bk_colour_id.setting, "BkColour", _TRUNCATE); bk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); bk_colour_id.flags = 0; bk_colour_id.order = 0; diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index fcbc4d75e0..b6ad0770c4 100755 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -557,18 +557,18 @@ int CreateFrame() SendMessage(hwnd_plugin, WMU_INITIALIZE, 0, 0); font_id.cbSize = sizeof(font_id); - strncpy(font_id.group, LPGEN("Frames"), sizeof(font_id.group)); - strncpy(font_id.name, LPGEN("Alarm reminders"), sizeof(font_id.name)); - strncpy(font_id.dbSettingsGroup, MODULE, sizeof(font_id.dbSettingsGroup)); - strncpy(font_id.prefix, "Font", sizeof(font_id.prefix)); + strncpy_s(font_id.group, LPGEN("Frames"), _TRUNCATE); + strncpy_s(font_id.name, LPGEN("Alarm reminders"), _TRUNCATE); + strncpy_s(font_id.dbSettingsGroup, MODULE, _TRUNCATE); + strncpy_s(font_id.prefix, "Font", _TRUNCATE); font_id.order = 0; Font_Register(&font_id); framebk_colour_id.cbSize = sizeof(ColourID); - mir_strcpy(framebk_colour_id.dbSettingsGroup, MODULE); - mir_strcpy(framebk_colour_id.group, LPGEN("Frames")); - mir_strcpy(framebk_colour_id.name, LPGEN("Alarm reminders")); - mir_strcpy(framebk_colour_id.setting, "clFrameBack"); + strncpy_s(framebk_colour_id.dbSettingsGroup, MODULE, _TRUNCATE); + strncpy_s(framebk_colour_id.group, LPGEN("Frames"), _TRUNCATE); + strncpy_s(framebk_colour_id.name, LPGEN("Alarm reminders"), _TRUNCATE); + strncpy_s(framebk_colour_id.setting, "clFrameBack", _TRUNCATE); framebk_colour_id.defcolour = GetSysColor(COLOR_3DFACE); framebk_colour_id.flags = 0; framebk_colour_id.order = 0; -- cgit v1.2.3