From 8ffc77be71507825a8f7585bcabff8ccc370206a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 8 Dec 2018 20:12:16 +0300 Subject: db_get_sa / db_get_wsa to receive the default value, massive code simplification --- plugins/MyDetails/src/data.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins/MyDetails/src/data.cpp') diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index 7b8852c657..adb014400f 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -477,18 +477,14 @@ void ProtocolArray::GetDefaultNick() { ptrW tszNick(g_plugin.getWStringA(SETTING_DEFAULT_NICK)); if (tszNick) - mir_wstrncpy(default_nick, tszNick, _countof(default_nick)); + wcsncpy_s(default_nick, tszNick, _TRUNCATE); else default_nick[0] = '\0'; } void ProtocolArray::GetDefaultAvatar() { - ptrW tszFile(db_get_wsa(0, "ContactPhoto", "File")); - if (tszFile) - mir_wstrncpy(default_avatar_file, tszFile, _countof(default_avatar_file)); - else - default_avatar_file[0] = '\0'; + wcsncpy_s(default_avatar_file, ptrW(db_get_wsa(0, "ContactPhoto", "File", L"")), _TRUNCATE); } wchar_t *ProtocolArray::GetDefaultStatusMsg() -- cgit v1.2.3