summaryrefslogtreecommitdiff
path: root/plugins/Utils
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-02-20 21:09:35 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-02-20 21:09:35 +0000
commitb166399eeadfb34652a0171c966161d2fe9cd38c (patch)
tree84fbbc7484ee75316c33171dc781231a7f78e95f /plugins/Utils
parentb64a4938d07384ddde24ddb7cccc316f7f12554a (diff)
fix for FontService_RegisterFont usage
git-svn-id: http://svn.miranda-ng.org/main/trunk@12224 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Utils')
-rw-r--r--plugins/Utils/mir_fonts.cpp75
1 files changed, 35 insertions, 40 deletions
diff --git a/plugins/Utils/mir_fonts.cpp b/plugins/Utils/mir_fonts.cpp
index c7af5c3088..d18dfd020c 100644
--- a/plugins/Utils/mir_fonts.cpp
+++ b/plugins/Utils/mir_fonts.cpp
@@ -6,64 +6,59 @@
#include "mir_fonts.h"
-int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, const TCHAR *pszSection, const TCHAR *pszDescription, const TCHAR* pszBackgroundGroup, const TCHAR* pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault)
+int FontService_RegisterFont(const char *pszDbModule, const char *pszDbName, const TCHAR *pszSection, const TCHAR *pszDescription, const TCHAR *pszBackgroundGroup, const TCHAR *pszBackgroundName, int position, BOOL bAllowEffects, LOGFONT *plfDefault, COLORREF clrDefault)
{
- FontIDT fid;
- memset(&fid, 0, sizeof(fid));
- fid.cbSize=sizeof(fid);
- mir_strncpy(fid.dbSettingsGroup,pszDbModule,sizeof(fid.dbSettingsGroup)); /* buffer safe */
- mir_strncpy(fid.prefix,pszDbName,sizeof(fid.prefix)); /* buffer safe */
- mir_tstrncpy(fid.group,pszSection,SIZEOF(fid.group)); /* buffer safe */
- mir_tstrncpy(fid.name,pszDescription,SIZEOF(fid.name)); /* buffer safe */
+ FontIDT fid = { 0 };
+ fid.cbSize = sizeof(fid);
+ mir_strncpy(fid.dbSettingsGroup, pszDbModule, sizeof(fid.dbSettingsGroup)); /* buffer safe */
+ mir_strncpy(fid.prefix, pszDbName, sizeof(fid.prefix)); /* buffer safe */
+ mir_tstrncpy(fid.group, pszSection, SIZEOF(fid.group)); /* buffer safe */
+ mir_tstrncpy(fid.name, pszDescription, SIZEOF(fid.name)); /* buffer safe */
mir_tstrncpy(fid.backgroundGroup, pszBackgroundGroup, SIZEOF(fid.backgroundGroup)); /* buffer safe */
mir_tstrncpy(fid.backgroundName, pszBackgroundName, SIZEOF(fid.backgroundName)); /* buffer safe */
fid.flags = FIDF_ALLOWREREGISTER;
- if(bAllowEffects) fid.flags|=FIDF_ALLOWEFFECTS;
- fid.order=position;
- if(plfDefault!=NULL) {
- fid.flags|=FIDF_DEFAULTVALID;
- fid.deffontsettings.colour=clrDefault;
- fid.deffontsettings.size=(char)plfDefault->lfHeight;
- if(plfDefault->lfItalic) fid.deffontsettings.style|=DBFONTF_ITALIC;
- if(plfDefault->lfWeight!=FW_NORMAL) fid.deffontsettings.style|=DBFONTF_BOLD;
- if(plfDefault->lfUnderline) fid.deffontsettings.style|=DBFONTF_UNDERLINE;
- if(plfDefault->lfStrikeOut) fid.deffontsettings.style|=DBFONTF_STRIKEOUT;
- fid.deffontsettings.charset=plfDefault->lfCharSet;
- mir_tstrncpy(fid.deffontsettings.szFace,plfDefault->lfFaceName,SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */
+ if (bAllowEffects) fid.flags |= FIDF_ALLOWEFFECTS;
+ fid.order = position;
+ if (plfDefault != NULL) {
+ fid.flags |= FIDF_DEFAULTVALID;
+ fid.deffontsettings.colour = clrDefault;
+ fid.deffontsettings.size = (char)plfDefault->lfHeight;
+ if (plfDefault->lfItalic) fid.deffontsettings.style |= DBFONTF_ITALIC;
+ if (plfDefault->lfWeight != FW_NORMAL) fid.deffontsettings.style |= DBFONTF_BOLD;
+ if (plfDefault->lfUnderline) fid.deffontsettings.style |= DBFONTF_UNDERLINE;
+ if (plfDefault->lfStrikeOut) fid.deffontsettings.style |= DBFONTF_STRIKEOUT;
+ fid.deffontsettings.charset = plfDefault->lfCharSet;
+ mir_tstrncpy(fid.deffontsettings.szFace, plfDefault->lfFaceName, SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */
}
FontRegisterT(&fid);
return 0;
}
-int FontService_GetFont(const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF *pclr,LOGFONT *plf)
+int FontService_GetFont(const TCHAR *pszSection, const TCHAR *pszDescription, COLORREF *pclr, LOGFONT *plf)
{
- FontIDT fid;
- fid.cbSize=sizeof(fid);
- mir_tstrncpy(fid.group,pszSection,SIZEOF(fid.group)); /* buffer sfae */
- mir_tstrncpy(fid.name,pszDescription,SIZEOF(fid.name)); /* buffer safe */
- *pclr=(COLORREF)CallService(MS_FONT_GETT,(WPARAM)&fid,(LPARAM)plf); /* uses fallback font on error */
- return (int)*pclr==-1;
+ FontIDT fid = { 0 };
+ mir_tstrncpy(fid.group, pszSection, SIZEOF(fid.group)); /* buffer sfae */
+ mir_tstrncpy(fid.name, pszDescription, SIZEOF(fid.name)); /* buffer safe */
+ *pclr = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)plf); /* uses fallback font on error */
+ return (int)*pclr == -1;
}
-int FontService_RegisterColor(const char *pszDbModule,const char *pszDbName,const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF clrDefault)
+int FontService_RegisterColor(const char *pszDbModule, const char *pszDbName, const TCHAR *pszSection, const TCHAR *pszDescription, COLORREF clrDefault)
{
- ColourIDT cid;
- memset(&cid, 0, sizeof(cid));
- cid.cbSize=sizeof(cid);
- cid.defcolour=clrDefault;
- mir_strncpy(cid.dbSettingsGroup,pszDbModule,sizeof(cid.dbSettingsGroup)); /* buffer safe */
- mir_strncpy(cid.setting,pszDbName,sizeof(cid.setting)); /* buffer safe */
- mir_tstrncpy(cid.group,pszSection,SIZEOF(cid.group)); /* buffer safe */
- mir_tstrncpy(cid.name,pszDescription,SIZEOF(cid.name)); /* buffer safe */
+ ColourIDT cid = { 0 };
+ cid.cbSize = sizeof(cid);
+ cid.defcolour = clrDefault;
+ mir_strncpy(cid.dbSettingsGroup, pszDbModule, sizeof(cid.dbSettingsGroup)); /* buffer safe */
+ mir_strncpy(cid.setting, pszDbName, sizeof(cid.setting)); /* buffer safe */
+ mir_tstrncpy(cid.group, pszSection, SIZEOF(cid.group)); /* buffer safe */
+ mir_tstrncpy(cid.name, pszDescription, SIZEOF(cid.name)); /* buffer safe */
ColourRegisterT(&cid);
return 0;
}
-int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COLORREF *pclr)
+int FontService_GetColor(const TCHAR *pszSection, const TCHAR *pszDescription, COLORREF *pclr)
{
- ColourIDT cid;
-
- memset(&cid, 0, sizeof(cid));
+ ColourIDT cid = { 0 };
cid.cbSize = sizeof(cid);
_tcsncpy_s(cid.group, pszSection, _TRUNCATE);
_tcsncpy_s(cid.name, pszDescription, _TRUNCATE);