From d2b26b1f86326362f56540b5185fa09ab5f2779c Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 14 Mar 2015 16:46:51 +0000 Subject: TooltipNotify: - Minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@12401 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TooltipNotify/src/TooltipNotify.cpp | 34 ++++++++++++++--------------- plugins/TooltipNotify/src/Utils.cpp | 4 +--- 2 files changed, 18 insertions(+), 20 deletions(-) (limited to 'plugins/TooltipNotify') diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 230aea9377..4b6db0329e 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -73,32 +73,32 @@ CTooltipNotify::~CTooltipNotify() void CTooltipNotify::RegisterFonts() { FontIDT fontId = { sizeof(fontId) }; - _tcscpy(fontId.group, FONTSERV_GROUP); - strcpy(fontId.dbSettingsGroup, MODULENAME); + _tcsncpy(fontId.group, FONTSERV_GROUP, SIZEOF(fontId.group)-1); + 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; - _tcscpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE); + _tcsncpy(fontId.deffontsettings.szFace, DEF_SETTING_FONT_FACE, SIZEOF(fontId.deffontsettings.szFace)-1); fontId.order = 0; - _tcscpy(fontId.backgroundGroup, FONTSERV_GROUP); + _tcsncpy(fontId.backgroundGroup, FONTSERV_GROUP, SIZEOF(fontId.backgroundGroup)-1); ColourIDT colorId = { sizeof(colorId) }; - _tcscpy(colorId.group, FONTSERV_GROUP); - strcpy(colorId.dbSettingsGroup, MODULENAME); + _tcsncpy(colorId.group, FONTSERV_GROUP, SIZEOF(colorId.group)-1); + strncpy(colorId.dbSettingsGroup, MODULENAME, SIZEOF(colorId.dbSettingsGroup)-1); colorId.flags = 0; colorId.defcolour = DEF_SETTING_BGCOLOR; colorId.order = 0; for (int i=0; itype != ACKTYPE_STATUS) return 0; + if((ack == NULL) || (ack->type != ACKTYPE_STATUS)) return 0; WORD wNewStatus = (WORD)ack->lParam; WORD wOldStatus = (WORD)ack->hProcess; @@ -725,7 +725,7 @@ BOOL CTooltipNotify::ProtosDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP ListView_GetItemText(GetDlgItem(hDlg,IDC_PROTOS), i, 0, szProto, SIZEOF(szProto)); char szMultiByteProto[128]; - long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, mir_tstrlen(szProto), + long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, (int)mir_tstrlen(szProto), szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL); szMultiByteProto[lLen] = '\0'; diff --git a/plugins/TooltipNotify/src/Utils.cpp b/plugins/TooltipNotify/src/Utils.cpp index 7b777b73db..63b981bb78 100644 --- a/plugins/TooltipNotify/src/Utils.cpp +++ b/plugins/TooltipNotify/src/Utils.cpp @@ -10,13 +10,11 @@ BOOL IsNt50() BYTE bMajorVer = LOBYTE(wOsVersion); BYTE bMinorVer = HIBYTE(wOsVersion); - return (bMajorVer>=5 && bMinorVer>=0); + return (bMajorVer>=5); } void TruncateWithDots(TCHAR* szString, size_t iNewLen) { - assert(iNewLen >= 0); - size_t iOrigLen = _tcslen(szString); if (iNewLen < iOrigLen) { TCHAR* p = szString+iNewLen; -- cgit v1.2.3