diff options
author | George Hazan <ghazan@miranda.im> | 2018-03-06 17:26:27 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-03-06 17:26:27 +0300 |
commit | 24dc075a6d3c8d86f0d343b6c7dd62bbf4c7e9a5 (patch) | |
tree | 7ea006ddf42c3d3ac8a1029c2b0eb90a174a3af1 /src/mir_app | |
parent | 51c5c1b3946ff5c244614141e76e92f1ef1dbac3 (diff) |
static buffers are evil
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/srmm_base.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 898f98c7a8..3991b8e324 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -420,24 +420,24 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO *pa ti.uId = 1; ti.rect = clientRect; - wchar_t tszBuf[1024]; tszBuf[0] = 0; + CMStringW wszBuf; USERINFO *ui1 = chatApi.SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered); if (ui1) { if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) { wchar_t *p = (wchar_t*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui1->pszUID); if (p != nullptr) { - wcsncpy_s(tszBuf, p, _TRUNCATE); + wszBuf = p; mir_free(p); } } - if (tszBuf[0] == 0) - mir_snwprintf(tszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", + if (wszBuf.IsEmpty()) + wszBuf.Format(L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui1->pszNick, TranslateT("Unique ID"), ui1->pszUID, TranslateT("Status"), chatApi.TM_WordToString(parentdat->pStatuses, ui1->Status)); - ti.lpszText = tszBuf; + ti.lpszText = wszBuf.GetBuffer(); } SendMessage(hwndToolTip, bNewTip ? TTM_ADDTOOL : TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); |