From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Utils/mir_buffer.h | 4 ++-- plugins/Utils/mir_fonts.cpp | 26 +++++++++++++------------- plugins/Utils/mir_options.cpp | 14 +++++++------- plugins/Utils/mir_smileys.cpp | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) (limited to 'plugins/Utils') diff --git a/plugins/Utils/mir_buffer.h b/plugins/Utils/mir_buffer.h index 45c8af0e20..6dc35c0a88 100644 --- a/plugins/Utils/mir_buffer.h +++ b/plugins/Utils/mir_buffer.h @@ -41,7 +41,7 @@ static inline size_t __blen(const char *str) template<> static inline size_t __blen(const wchar_t *str) { - return lstrlenW(str); + return mir_wstrlen(str); } template @@ -479,7 +479,7 @@ static void ReplaceVars(Buffer *buffer, MCONTACT hContact, TCHAR **variab { for(int k = 0; k < numVariables; k += 2) { - size_t len = lstrlen(variables[k]); + size_t len = mir_tstrlen(variables[k]); if (foundLen == len + 2 && _tcsncmp(&buffer->str[j]+1, variables[k], len) == 0) { buffer->replace(j, i + 1, variables[k + 1]); diff --git a/plugins/Utils/mir_fonts.cpp b/plugins/Utils/mir_fonts.cpp index 214e922d91..d43b8ddab4 100644 --- a/plugins/Utils/mir_fonts.cpp +++ b/plugins/Utils/mir_fonts.cpp @@ -11,10 +11,10 @@ int FontService_RegisterFont(const char *pszDbModule,const char *pszDbName,const FontIDT fid; ZeroMemory(&fid,sizeof(fid)); fid.cbSize=sizeof(fid); - lstrcpynA(fid.dbSettingsGroup,pszDbModule,sizeof(fid.dbSettingsGroup)); /* buffer safe */ - lstrcpynA(fid.prefix,pszDbName,sizeof(fid.prefix)); /* buffer safe */ - lstrcpyn(fid.group,pszSection,SIZEOF(fid.group)); /* buffer safe */ - lstrcpyn(fid.name,pszDescription,SIZEOF(fid.name)); /* buffer safe */ + 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 */ fid.flags=FIDF_ALLOWREREGISTER; if(bAllowEffects) fid.flags|=FIDF_ALLOWEFFECTS; fid.order=position; @@ -27,7 +27,7 @@ int FontService_RegisterFont(const char *pszDbModule,const char *pszDbName,const if(plfDefault->lfUnderline) fid.deffontsettings.style|=DBFONTF_UNDERLINE; if(plfDefault->lfStrikeOut) fid.deffontsettings.style|=DBFONTF_STRIKEOUT; fid.deffontsettings.charset=plfDefault->lfCharSet; - lstrcpyn(fid.deffontsettings.szFace,plfDefault->lfFaceName,SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */ + mir_tstrncpy(fid.deffontsettings.szFace,plfDefault->lfFaceName,SIZEOF(fid.deffontsettings.szFace)); /* buffer safe */ } FontRegisterT(&fid); return 0; @@ -37,8 +37,8 @@ int FontService_GetFont(const TCHAR *pszSection,const TCHAR *pszDescription,COLO { FontIDT fid; fid.cbSize=sizeof(fid); - lstrcpyn(fid.group,pszSection,SIZEOF(fid.group)); /* buffer sfae */ - lstrcpyn(fid.name,pszDescription,SIZEOF(fid.name)); /* buffer safe */ + 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; } @@ -49,10 +49,10 @@ int FontService_RegisterColor(const char *pszDbModule,const char *pszDbName,cons ZeroMemory(&cid,sizeof(cid)); cid.cbSize=sizeof(cid); cid.defcolour=clrDefault; - lstrcpynA(cid.dbSettingsGroup,pszDbModule,sizeof(cid.dbSettingsGroup)); /* buffer safe */ - lstrcpynA(cid.setting,pszDbName,sizeof(cid.setting)); /* buffer safe */ - lstrcpyn(cid.group,pszSection,SIZEOF(cid.group)); /* buffer safe */ - lstrcpyn(cid.name,pszDescription,SIZEOF(cid.name)); /* buffer safe */ + 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; } @@ -62,8 +62,8 @@ int FontService_GetColor(const TCHAR *pszSection,const TCHAR *pszDescription,COL ColourIDT cid; ZeroMemory(&cid,sizeof(cid)); cid.cbSize=sizeof(cid); - lstrcpyn(cid.group,pszSection,sizeof(cid.group)); /* buffer safe */ - lstrcpyn(cid.name,pszDescription,sizeof(cid.name)); /* buffer safe */ + mir_tstrncpy(cid.group,pszSection,sizeof(cid.group)); /* buffer safe */ + mir_tstrncpy(cid.name,pszDescription,sizeof(cid.name)); /* buffer safe */ *pclr=(COLORREF)CallService(MS_COLOUR_GETT,(WPARAM)&cid,0); return (int)*pclr==-1; } diff --git a/plugins/Utils/mir_options.cpp b/plugins/Utils/mir_options.cpp index 9f0aabd22a..59b9ff6748 100644 --- a/plugins/Utils/mir_options.cpp +++ b/plugins/Utils/mir_options.cpp @@ -40,12 +40,12 @@ static TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char out[0] = _T('\0'); if (!db_get_ts(hContact, module, setting, &dbv)) { - lstrcpyn(out, dbv.ptszVal, (int)len); + mir_tstrncpy(out, dbv.ptszVal, (int)len); db_free(&dbv); } else { if (def != NULL) - lstrcpyn(out, def, (int)len); + mir_tstrncpy(out, def, (int)len); } return out; @@ -57,7 +57,7 @@ static TCHAR dbPath[MAX_PATH] = { 0 }; // database profile path (read at startu static int PathIsAbsolute(const TCHAR *path) { - if (!path || !(lstrlen(path) > 2)) + if (!path || !(mir_tstrlen(path) > 2)) return 0; if ((path[1] == _T(':') && path[2] == _T('\\')) || (path[0] == _T('\\') && path[1] == _T('\\'))) return 1; @@ -67,7 +67,7 @@ static int PathIsAbsolute(const TCHAR *path) static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc) { if (!PathIsAbsolute(pSrc)) - lstrcpyn(pOut, pSrc, (int)outSize); + mir_tstrncpy(pOut, pSrc, (int)outSize); else { if (dbPath[0] == _T('\0')) { char tmp[1024]; @@ -75,18 +75,18 @@ static void PathToRelative(TCHAR *pOut, size_t outSize, const TCHAR *pSrc) mir_sntprintf(dbPath, SIZEOF(dbPath), _T("%S\\"), tmp); } - size_t len = lstrlen(dbPath); + size_t len = mir_tstrlen(dbPath); if (_tcsnicmp(pSrc, dbPath, len)) mir_sntprintf(pOut, outSize, _T("%s"), pSrc + len); else - lstrcpyn(pOut, pSrc, (int)outSize); + mir_tstrncpy(pOut, pSrc, (int)outSize); } } static void PathToAbsolute(TCHAR *pOut, size_t outSize, const TCHAR *pSrc) { if (PathIsAbsolute(pSrc) || !isalnum(pSrc[0])) - lstrcpyn(pOut, pSrc, (int)outSize); + mir_tstrncpy(pOut, pSrc, (int)outSize); else { if (dbPath[0] == _T('\0')) { char tmp[1024]; diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index 9eedd165fb..051f30f2fc 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -223,7 +223,7 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText RECT text_rc = {0, 0, 0x7FFFFFFF, 0x7FFFFFFF}; // Always need cy... - DrawText(hdcMem,szText,lstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat); + DrawText(hdcMem,szText,mir_tstrlen(szText), &text_rc, DT_CALCRECT | uTextFormat); text_size.cy = text_rc.bottom - text_rc.top; if (plText == NULL) -- cgit v1.2.3