diff options
author | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-11-30 18:51:36 +0000 |
commit | 688f55ba998c19304a29727c910504903f4cc49a (patch) | |
tree | 69121ebb6d02bcf9e670428b11813087fc7f1640 /plugins | |
parent | 4f0e30cdf56fbafdf955bbe8b93930bab9e39bd0 (diff) |
lstr* replacements
git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
237 files changed, 1356 insertions, 1358 deletions
diff --git a/plugins/AVS/src/acc.cpp b/plugins/AVS/src/acc.cpp index 72d9c3b3b6..5930bd8dfb 100644 --- a/plugins/AVS/src/acc.cpp +++ b/plugins/AVS/src/acc.cpp @@ -425,7 +425,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP if (lParam == NULL)
data->proto[0] = '\0';
else
- lstrcpynA(data->proto, GetContactProto(data->hContact), sizeof(data->proto));
+ mir_strncpy(data->proto, GetContactProto(data->hContact), sizeof(data->proto));
StartAnimation(hwnd, data);
@@ -473,7 +473,7 @@ static LRESULT CALLBACK ACCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return TRUE;
case AVATAR_SETNOAVATARTEXT:
- lstrcpyn(data->noAvatarText, TranslateTS((TCHAR*)lParam), SIZEOF(data->noAvatarText));
+ mir_tstrncpy(data->noAvatarText, TranslateTS((TCHAR*)lParam), SIZEOF(data->noAvatarText));
Invalidate(hwnd);
return TRUE;
diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index d6b94ba9a7..0c2b87803c 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -68,8 +68,8 @@ static void RemoveProtoPic(const char *szProto) if (strstr(szProto, "Global avatar for")) { char szProtoname[MAX_PATH] = { 0 }; - lstrcpynA(szProtoname, szProto, lstrlenA(szProto) - lstrlenA("accounts")); - lstrcpyA(szProtoname, strrchr(szProtoname, ' ') + 1); + mir_strncpy(szProtoname, szProto, mir_strlen(szProto) - mir_strlen("accounts")); + mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1); for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry& p = g_ProtoPictures[i]; @@ -129,7 +129,7 @@ static void SetProtoPic(char *szProto) if (!lstrcmpA(AVS_DEFAULT, szProto)) { for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry& p = g_ProtoPictures[i]; - if (lstrlenA(p.szProtoname) == 0) + if (mir_strlen(p.szProtoname) == 0) continue; if (p.hbmPic == 0 || !lstrcmpA(p.szProtoname, AVS_DEFAULT)) { @@ -140,8 +140,8 @@ static void SetProtoPic(char *szProto) } else if (strstr(szProto, "Global avatar for")) { char szProtoname[MAX_PATH] = { 0 }; - lstrcpynA(szProtoname, szProto, lstrlenA(szProto) - lstrlenA("accounts")); - lstrcpyA(szProtoname, strrchr(szProtoname, ' ') + 1); + mir_strncpy(szProtoname, szProto, mir_strlen(szProto) - mir_strlen("accounts")); + mir_strcpy(szProtoname, strrchr(szProtoname, ' ') + 1); for (int i = 0; i < g_ProtoPictures.getCount(); i++) { PROTOACCOUNT* pdescr = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)g_ProtoPictures[i].szProtoname); if (pdescr == NULL && lstrcmpA(g_ProtoPictures[i].szProtoname, szProto)) @@ -149,7 +149,7 @@ static void SetProtoPic(char *szProto) if (!lstrcmpA(g_ProtoPictures[i].szProtoname, szProto) || !lstrcmpA(pdescr->szProtoName, szProtoname)) { protoPicCacheEntry& p = g_ProtoPictures[i]; - if (lstrlenA(p.szProtoname) != 0) { + if (mir_strlen(p.szProtoname) != 0) { if (p.hbmPic == 0) { CreateAvatarInCache(0, &p, szProto); NotifyEventHooks(hEventChanged, 0, (LPARAM)&p); @@ -161,10 +161,10 @@ static void SetProtoPic(char *szProto) else { for (int i = 0; i < g_ProtoPictures.getCount(); i++) { protoPicCacheEntry& p = g_ProtoPictures[i]; - if (lstrlenA(p.szProtoname) == 0) + if (mir_strlen(p.szProtoname) == 0) break; - if (!strcmp(p.szProtoname, szProto) && lstrlenA(p.szProtoname) == lstrlenA(szProto)) { + if (!strcmp(p.szProtoname, szProto) && mir_strlen(p.szProtoname) == mir_strlen(szProto)) { if (p.hbmPic != 0) DeleteObject(p.hbmPic); ZeroMemory(&p, sizeof(avatarCacheEntry)); diff --git a/plugins/AVS/src/services.cpp b/plugins/AVS/src/services.cpp index 3206546bee..7334939f40 100644 --- a/plugins/AVS/src/services.cpp +++ b/plugins/AVS/src/services.cpp @@ -750,7 +750,7 @@ INT_PTR DrawAvatarPicture(WPARAM wParam, LPARAM lParam) for (int i = 0; i < g_ProtoPictures.getCount(); i++) {
protoPicCacheEntry& p = g_ProtoPictures[i];
- if (!lstrcmpA(p.szProtoname, r->szProto) && lstrlenA(r->szProto) == lstrlenA(p.szProtoname) && p.hbmPic != 0) {
+ if (!lstrcmpA(p.szProtoname, r->szProto) && mir_strlen(r->szProto) == mir_strlen(p.szProtoname) && p.hbmPic != 0) {
ace = (AVATARCACHEENTRY *)&g_ProtoPictures[i];
break;
}
@@ -844,7 +844,7 @@ INT_PTR ReportMyAvatarChanged(WPARAM wParam, LPARAM lParam) continue;
if (!lstrcmpA(g_MyAvatars[i].szProtoname, proto)) {
- LPVOID lpParam = (void *)malloc(lstrlenA(g_MyAvatars[i].szProtoname) + 2);
+ LPVOID lpParam = (void *)malloc(mir_strlen(g_MyAvatars[i].szProtoname) + 2);
strcpy((char *)lpParam, g_MyAvatars[i].szProtoname);
mir_forkthread(ReloadMyAvatar, lpParam);
return 0;
diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index d9a4c07229..fdc16d4338 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -140,7 +140,7 @@ int CreateAvatarInCache(MCONTACT hContact, avatarCacheEntry *ace, char *szProto) }
}
- if (lstrlen(tszFilename) < 4)
+ if (mir_tstrlen(tszFilename) < 4)
return -1;
_tcsncpy_s(tszFilename, VARST(tszFilename), _TRUNCATE);
diff --git a/plugins/AddContactPlus/src/addcontact.cpp b/plugins/AddContactPlus/src/addcontact.cpp index bc33ab425e..caa45fcaca 100644 --- a/plugins/AddContactPlus/src/addcontact.cpp +++ b/plugins/AddContactPlus/src/addcontact.cpp @@ -126,7 +126,7 @@ bool AddContactDlgAccounts(HWND hdlg, AddDialogParam *acs) continue;
cbei.pszText = pAccounts[i]->tszAccountName;
- GetTextExtentPoint32(hdc, cbei.pszText, lstrlen(cbei.pszText), &textSize);
+ GetTextExtentPoint32(hdc, cbei.pszText, mir_tstrlen(cbei.pszText), &textSize);
if (textSize.cx > cbWidth) cbWidth = textSize.cx;
HICON hIcon = (HICON)CallProtoService(pAccounts[i]->szModuleName, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0);
cbei.iImage = cbei.iSelectedImage = ImageList_AddIcon(hIml, hIcon);
diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index eea69fee51..563ad000f0 100644 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -331,7 +331,7 @@ void SaveAlarms() { if (_tcslen(i->szCommand)) {
mir_snprintf(buff, SIZEOF(buff), "ActionCommand%d", index);
db_set_ts(0, MODULE, buff, i->szCommand);
- if (lstrlen(i->szCommandParams)) {
+ if (mir_tstrlen(i->szCommandParams)) {
mir_snprintf(buff, SIZEOF(buff), "ActionParams%d", index);
db_set_ts(0, MODULE, buff, i->szCommandParams);
}
@@ -508,8 +508,8 @@ void ShowPopup(ALARM *alarm) POPUPDATAT ppd = { 0 };
ppd.lchIcon = hIconMenuSet;
- lstrcpyn(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, data->szTitle, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, data->szDesc, MAX_SECONDLINE);
ppd.PluginWindowProc = PopupAlarmDlgProc;
ppd.PluginData = data;
ppd.iSeconds = -1;
diff --git a/plugins/Alarms/src/alarms.cpp b/plugins/Alarms/src/alarms.cpp index 5c38706ce8..c3d3a8e1f7 100644 --- a/plugins/Alarms/src/alarms.cpp +++ b/plugins/Alarms/src/alarms.cpp @@ -72,8 +72,8 @@ void ShowPopup(MCONTACT hContact, const TCHAR *msg) POPUPDATAT ppd = { 0 };
ppd.lchContact = hContact; //Be sure to use a GOOD handle, since this will not be checked.
ppd.lchIcon = hIconList1;
- lstrcpyn(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, msg, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, lpzContactName,MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, msg, MAX_SECONDLINE);
ppd.colorBack = GetSysColor(COLOR_BTNFACE);
ppd.colorText = RGB(0,0,0);
ppd.PluginWindowProc = PopupDlgProc;
diff --git a/plugins/Alarms/src/frame.cpp b/plugins/Alarms/src/frame.cpp index 2c40ab5270..9a8d48b224 100644 --- a/plugins/Alarms/src/frame.cpp +++ b/plugins/Alarms/src/frame.cpp @@ -137,7 +137,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HICON hIcon = (min <= 5 ? hIconList2 : hIconList1);
DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - 16)>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
- GetTextExtentPoint32(dis->hDC,alarm.szTitle,lstrlen(alarm.szTitle),&textSize);
+ GetTextExtentPoint32(dis->hDC,alarm.szTitle,mir_tstrlen(alarm.szTitle),&textSize);
TCHAR buff[100];
if (min >= 60)
@@ -145,26 +145,26 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar else
mir_sntprintf(buff, 100, TranslateT("%dm"), min);
- GetTextExtentPoint32(dis->hDC,buff,lstrlen(buff),&timeSize);
+ GetTextExtentPoint32(dis->hDC,buff,mir_tstrlen(buff),&timeSize);
if (textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
// need elipsis
TCHAR titlebuff[512];
- int len = lstrlen(alarm.szTitle);
+ int len = mir_tstrlen(alarm.szTitle);
if (len > 511) len = 511;
while(len > 0 && textSize.cx > (dis->rcItem.right - dis->rcItem.left) - (GetSystemMetrics(SM_CXSMICON) + 4) - timeSize.cx - 2 - 4) {
len--;
_tcsncpy(titlebuff, alarm.szTitle, len);
titlebuff[len] = 0;
_tcscat(titlebuff, _T("..."));
- GetTextExtentPoint32(dis->hDC,titlebuff,lstrlen(titlebuff),&textSize);
+ GetTextExtentPoint32(dis->hDC,titlebuff,mir_tstrlen(titlebuff),&textSize);
}
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,lstrlen(titlebuff));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,titlebuff,mir_tstrlen(titlebuff));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,mir_tstrlen(buff));
}
else {
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,lstrlen(alarm.szTitle));
- TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,lstrlen(buff));
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,alarm.szTitle,mir_tstrlen(alarm.szTitle));
+ TextOut(dis->hDC,dis->rcItem.right - timeSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom - timeSize.cy)>>1, buff,mir_tstrlen(buff));
}
SetBkMode(dis->hDC, OPAQUE);
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index a1dce06bdf..7d12f4686f 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -527,7 +527,7 @@ static INT_PTR ServiceAddNewUrlType(WPARAM, LPARAM lParam) return 1;
if(utd->pszService == NULL)
return 2;
- if(utd->pszProtoPrefix == NULL || utd->pszProtoPrefix[lstrlenA(utd->pszProtoPrefix)-1]!= ':')
+ if(utd->pszProtoPrefix == NULL || utd->pszProtoPrefix[mir_strlen(utd->pszProtoPrefix)-1]!= ':')
return 2;
char *pszClassName = MakeUrlClassName(utd->pszProtoPrefix);
diff --git a/plugins/AssocMgr/src/dde.cpp b/plugins/AssocMgr/src/dde.cpp index 71e719e760..641e193359 100644 --- a/plugins/AssocMgr/src/dde.cpp +++ b/plugins/AssocMgr/src/dde.cpp @@ -80,7 +80,7 @@ static TCHAR* GetExecuteParam(TCHAR **ppszString) if(p!=NULL) {
*(p++)=0;
if(fQuoted && *p==_T(',')) p++;
- } else p=&pszParam[lstrlen(pszParam)];
+ } else p=&pszParam[mir_tstrlen(pszParam)];
*ppszString=p;
return pszParam;
}
@@ -173,7 +173,7 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath) p=_tcsrchr(szPath,_T('\\'));
if(p!=NULL) { *p=0; p=_tcsrchr(szPath,_T('\\')); }
if(p==NULL) return NULL;
- lstrcpy(++p,_T("miranda32.exe"));
+ mir_tstrcpy(++p,_T("miranda32.exe"));
/* inherit startup data from RunDll32 process */
STARTUPINFO si;
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp index a40c0ecd34..fcf1d3543e 100644 --- a/plugins/AssocMgr/src/main.cpp +++ b/plugins/AssocMgr/src/main.cpp @@ -48,27 +48,27 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
{
TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
- if ( !GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
+ if ( !GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-mir_tstrlen(pszFileName)))
return;
TCHAR *p = _tcsrchr(szFileFrom,_T('\\'));
if (p != NULL)
*(++p) = 0;
- lstrcat(szFileFrom,pszFileName); /* buffer safe */
+ mir_tstrcat(szFileFrom,pszFileName); /* buffer safe */
HANDLE hFile = CreateFile(szFileFrom,0,FILE_SHARE_READ,0,OPEN_EXISTING,0,0);
if (hFile == INVALID_HANDLE_VALUE)
return;
CloseHandle(hFile);
- if ( !GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
+ if ( !GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-mir_tstrlen(pszDestSubDir)-mir_tstrlen(pszFileName)))
return;
p = _tcsrchr(szFileTo,_T('\\'));
if (p)
*(++p)=0;
- lstrcat(szFileTo,pszDestSubDir); /* buffer safe */
+ mir_tstrcat(szFileTo,pszDestSubDir); /* buffer safe */
CreateDirectory(szFileTo,NULL);
- lstrcat(szFileTo,pszFileName); /* buffer safe */
+ mir_tstrcat(szFileTo,pszFileName); /* buffer safe */
if ( !MoveFile(szFileFrom,szFileTo) && GetLastError() == ERROR_ALREADY_EXISTS) {
DeleteFile(szFileTo);
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 9fa97d0e61..ded3aca55b 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -98,7 +98,7 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, // mir_free() the return value
char *MakeFileClassName(const char *pszFileExt)
{
- int cbLen = lstrlenA(pszFileExt)+12;
+ int cbLen = mir_strlen(pszFileExt)+12;
char *pszClass = (char*)mir_alloc(cbLen);
if (pszClass != NULL)
/* using correctly formated PROGID */
@@ -112,7 +112,7 @@ char *MakeUrlClassName(const char *pszUrl) char *pszClass = mir_strdup(pszUrl);
if (pszClass != NULL)
/* remove trailing : */
- pszClass[lstrlenA(pszClass)-1]=0;
+ pszClass[mir_strlen(pszClass)-1]=0;
return pszClass;
}
@@ -133,7 +133,7 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) if (p)
*p = 0;
}
- else lstrcpy(szDbFile, _T("%1")); /* buffer safe */
+ else mir_tstrcpy(szDbFile, _T("%1")); /* buffer safe */
if ( !GetModuleFileName(fMirExe ? NULL : hInst, szExe, SIZEOF(szExe)))
return NULL;
@@ -147,7 +147,7 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) /* ensure the command line is not too long */
GetShortPathName(szExe, szExe, SIZEOF(szExe));
/* surround by quotes if failed */
- DWORD len = lstrlen(szExe);
+ DWORD len = mir_tstrlen(szExe);
if ( _tcschr(szExe,_T(' ')) != NULL && (len+2) < SIZEOF(szExe)) {
MoveMemory(szExe, szExe+1, (len+1)*sizeof(TCHAR));
szExe[len+2] = szExe[0] = _T('\"');
@@ -164,7 +164,7 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd) {
TCHAR *buf,*pexe,*pargs;
TCHAR szFullExe[MAX_PATH],*pszFilePart;
- buf=lstrcpy((TCHAR*)_alloca((lstrlen(pszRunCmd)+1)*sizeof(TCHAR)),pszRunCmd);
+ buf=mir_tstrcpy((TCHAR*)_alloca((mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR)),pszRunCmd);
/* split into executable path and arguments */
if (buf[0]==_T('\"')) {
pargs=_tcschr(&buf[1],_T('\"'));
@@ -253,7 +253,7 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const T HKEY hSubKey;
LONG res=RegCreateKeyEx(hMainKey,pszSubKey,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE,NULL,&hSubKey,NULL);
if (!res) {
- res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(lstrlen(pszVal)+1)*sizeof(TCHAR));
+ res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(mir_tstrlen(pszVal)+1)*sizeof(TCHAR));
RegCloseKey(hSubKey);
}
return res;
@@ -262,10 +262,10 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const T // hKey must have been opened with KEY_SET_VALUE access right
static void SetRegStrPrefixValue(HKEY hKey,const TCHAR *pszValPrefix,const TCHAR *pszVal)
{
- DWORD dwSize=(lstrlen(pszVal)+lstrlen(pszValPrefix)+1)*sizeof(TCHAR);
+ DWORD dwSize=(mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(TCHAR);
TCHAR *pszStr=(TCHAR*)mir_alloc(dwSize);
if (pszStr==NULL) return;
- lstrcat(lstrcpy(pszStr,pszValPrefix),pszVal); /* buffer safe */
+ mir_tstrcat(mir_tstrcpy(pszStr,pszValPrefix),pszVal); /* buffer safe */
RegSetValueEx(hKey,NULL,0,REG_SZ,(BYTE*)pszStr,dwSize);
mir_free(pszStr);
}
@@ -381,7 +381,7 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe if ((res=RegQueryInfoKey(hKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,&nMaxValNameLen,&nMaxValSize,NULL,NULL))==ERROR_SUCCESS) {
if (nMaxSubKeyLen>nMaxValNameLen) nMaxValNameLen=nMaxSubKeyLen;
/* prepare buffer */
- nDbPrefixLen=(DWORD)lstrlenA(*param->ppszDbPrefix)+lstrlenA(pszSubKey)+1;
+ nDbPrefixLen=(DWORD)mir_strlen(*param->ppszDbPrefix)+mir_strlen(pszSubKey)+1;
cchName=nDbPrefixLen+nMaxValNameLen+3;
if (cchName>*param->pdwDbPrefixSize) {
pszName=(char*)mir_realloc(*param->ppszDbPrefix,cchName);
@@ -389,7 +389,7 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe *param->ppszDbPrefix=pszName;
*param->pdwDbPrefixSize=cchName;
}
- lstrcatA(lstrcatA(*param->ppszDbPrefix,pszSubKey),"\\"); /* buffer safe */
+ mir_strcat(mir_strcat(*param->ppszDbPrefix,pszSubKey),"\\"); /* buffer safe */
/* enum values */
pszName=(char*)mir_alloc(nMaxValNameLen+1);
if (nMaxValSize==0) nMaxValSize=1;
@@ -401,7 +401,7 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe cbData=nMaxValSize;
if ((res=RegEnumValueA(hKey,index++,pszName,&cchName,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
(*param->ppszDbPrefix)[nDbPrefixLen]=0;
- lstrcatA(*param->ppszDbPrefix,pszName); /* buffer safe */
+ mir_strcat(*param->ppszDbPrefix,pszName); /* buffer safe */
ptszName=a2t(pszName);
if (ptszName!=NULL) {
if (!RegQueryValueEx(hKey,ptszName,NULL,&dwType,pData,&cbData)) {
@@ -444,7 +444,7 @@ static void BackupRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPrefi param.ppszDbPrefix=(char**)&pszDbPrefix;
pszDbPrefix=mir_strdup(pszDbPrefix);
if (pszDbPrefix!=NULL) {
- dwDbPrefixSize=lstrlenA(pszDbPrefix)+1;
+ dwDbPrefixSize=mir_strlen(pszDbPrefix)+1;
BackupRegTree_Worker(hKey,pszSubKey,¶m);
mir_free((char*)pszDbPrefix);
}
@@ -461,18 +461,18 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref DWORD dwType,cbData;
BYTE *pData;
- int nDbPrefixLen=lstrlenA(pszDbPrefix);
- int nPrefixWithSubKeyLen=nDbPrefixLen+lstrlenA(pszSubKey)+1;
+ int nDbPrefixLen=mir_strlen(pszDbPrefix);
+ int nPrefixWithSubKeyLen=nDbPrefixLen+mir_strlen(pszSubKey)+1;
char *pszPrefixWithSubKey=(char*)mir_alloc(nPrefixWithSubKeyLen+1);
if (pszPrefixWithSubKey==NULL) return ERROR_OUTOFMEMORY;
- lstrcatA(lstrcatA(lstrcpyA(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
+ mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
LONG res=ERROR_NO_MORE_ITEMS;
if (pszPrefixWithSubKey!=NULL) {
if (EnumDbPrefixSettings("AssocMgr",pszPrefixWithSubKey,&ppszSettings,&nSettingsCount)) {
for(i=0;i<nSettingsCount;++i) {
pszSuffix=&ppszSettings[i][nDbPrefixLen];
/* key hierachy */
- pkeys=lstrcpyA((char*)_alloca(lstrlenA(pszSuffix)+1),pszSuffix);
+ pkeys=mir_strcpy((char*)_alloca(mir_strlen(pszSuffix)+1),pszSuffix);
pnext=pkeys;
while((pnext=strchr(pnext+1,_T('\\')))!=NULL) pslash=pnext;
if (pslash!=NULL) {
@@ -512,9 +512,9 @@ static void DeleteRegTreeBackup(const char *pszSubKey,const char *pszDbPrefix) char **ppszSettings;
int nSettingsCount,i;
- char *pszPrefixWithSubKey=(char*)mir_alloc(lstrlenA(pszDbPrefix)+lstrlenA(pszSubKey)+2);
+ char *pszPrefixWithSubKey=(char*)mir_alloc(mir_strlen(pszDbPrefix)+mir_strlen(pszSubKey)+2);
if (pszPrefixWithSubKey==NULL) return;
- lstrcatA(lstrcatA(lstrcpyA(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
+ mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
if (pszPrefixWithSubKey!=NULL) {
if (EnumDbPrefixSettings("AssocMgr",pszPrefixWithSubKey,&ppszSettings,&nSettingsCount)) {
for(i=0;i<nSettingsCount;++i) {
@@ -594,7 +594,7 @@ static BOOL Opera6_GetIniFilePath(TCHAR *szIniFile) /* path */
mir_free(p);
p=GetRegStrValue(hExeKey,_T("Path"));
- len=lstrlen(p);
+ len=mir_tstrlen(p);
if (p[len-1]==_T('\\')) p[len-1]=0;
fSuccess=(p!=NULL && ExpandEnvironmentStrings(p,szPath,MAX_PATH));
}
@@ -604,15 +604,15 @@ static BOOL Opera6_GetIniFilePath(TCHAR *szIniFile) if (fSuccess) {
TCHAR szFileBuf[MAX_PATH+34];
/* operadef6.ini */
- lstrcat(lstrcpy(szFileBuf,szPath),_T("\\operadef6.ini")); /* buffer safe */
+ mir_tstrcat(mir_tstrcpy(szFileBuf,szPath),_T("\\operadef6.ini")); /* buffer safe */
/* If enabled Opera will use Windows profiles to store individual user settings */
if (GetPrivateProfileInt(_T("System"),_T("Multi User"),0,szFileBuf)==1) {
p=_tcsrchr(szPath,'\\');
- lstrcpy(szFileBuf,_T("%APPDATA%\\Opera")); /* buffer safe */
- if (p!=NULL) lstrcat(szFileBuf,p); /* buffer safe */
- } else lstrcpy(szFileBuf,szPath);
+ mir_tstrcpy(szFileBuf,_T("%APPDATA%\\Opera")); /* buffer safe */
+ if (p!=NULL) mir_tstrcat(szFileBuf,p); /* buffer safe */
+ } else mir_tstrcpy(szFileBuf,szPath);
/* opera6.ini */
- lstrcat(szFileBuf,_T("\\profile\\opera6.ini")); /* buffer safe */
+ mir_tstrcat(szFileBuf,_T("\\profile\\opera6.ini")); /* buffer safe */
fSuccess=ExpandEnvironmentStrings(szFileBuf,szIniFile,MAX_PATH)!=0;
}
/* check file existstance */
@@ -690,7 +690,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const if (fUrlProto) BackupRegTree(hRootKey,pszClassName,"bak_");
/* type description */
if (fUrlProto) SetRegStrPrefixValue(hClassKey,_T("URL:"),pszTypeDescription);
- else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(lstrlen(pszTypeDescription)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(mir_tstrlen(pszTypeDescription)+1)*sizeof(TCHAR));
/* default icon */
if (pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hClassKey,_T("DefaultIcon"),pszIconLoc);
/* url protocol */
@@ -718,16 +718,16 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const if ((res=RegCreateKeyEx(hShellKey,_T("open"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hVerbKey,NULL))==ERROR_SUCCESS) {
/* verb description */
if (pszVerbDesc==NULL) RegDeleteValue(hVerbKey,NULL);
- else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(lstrlen(pszVerbDesc)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(mir_tstrlen(pszVerbDesc)+1)*sizeof(TCHAR));
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(lstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,_T("command"),pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL) {
if (!RegCreateKeyEx(hVerbKey,_T("ddeexec"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(lstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,_T("application"),pszDdeApp);
/* topic */
@@ -922,9 +922,9 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p }
mir_free(pszPrevClass); /* does NULL check */
/* class name */
- fSuccess=!RegSetValueExA(hExtKey,NULL,0,REG_SZ,(BYTE*)pszClassName,lstrlenA(pszClassName)+1);
+ fSuccess=!RegSetValueExA(hExtKey,NULL,0,REG_SZ,(BYTE*)pszClassName,mir_strlen(pszClassName)+1);
/* mime type e.g. "application/x-icq" */
- if (pszMimeType!=NULL) RegSetValueExA(hExtKey,"Content Type",0,REG_SZ,(BYTE*)pszMimeType,lstrlenA(pszMimeType)+1);
+ if (pszMimeType!=NULL) RegSetValueExA(hExtKey,"Content Type",0,REG_SZ,(BYTE*)pszMimeType,mir_strlen(pszMimeType)+1);
/* perceived type e.g. text (WinXP+) */
if (fIsText) RegSetValueEx(hExtKey,_T("PerceivedType"),0,REG_SZ,(BYTE*)_T("text"),5*sizeof(TCHAR));
RegCloseKey(hExtKey);
@@ -1028,7 +1028,7 @@ BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt,const TCHAR * if (!RegCreateKeyExA(hDbKey,pszMimeType,0,NULL,0,KEY_QUERY_VALUE|KEY_SET_VALUE,NULL,&hTypeKey,NULL)) {
/* file ext */
if (RegQueryValueExA(hTypeKey,"Extension",NULL,NULL,NULL,NULL)) /* only set if not present */
- fSuccess=!RegSetValueExA(hTypeKey,"Extension",0,REG_SZ,(BYTE*)pszFileExt,lstrlenA(pszFileExt)+1);
+ fSuccess=!RegSetValueExA(hTypeKey,"Extension",0,REG_SZ,(BYTE*)pszFileExt,mir_strlen(pszFileExt)+1);
RegCloseKey(hTypeKey);
/* Opera support */
Opera6_AddKnownMimeType(pszMimeType,pszFileExt,pszDescription);
@@ -1086,7 +1086,7 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR /* filename */
if (!RegCreateKeyEx(hAppsKey,pszAppFileName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExeKey,NULL)) {
/* appname */
- RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(lstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
/* no open-with flag */
if (fAllowOpenWith) RegDeleteValue(hExeKey,_T("NoOpenWith"));
else RegSetValueEx(hExeKey,_T("NoOpenWith"),0,REG_SZ,NULL,0);
@@ -1099,14 +1099,14 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR /* verb */
if (!RegCreateKeyEx(hShellKey,_T("open"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hVerbKey,NULL)) {
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(lstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
/* command */
SetRegSubKeyStrDefValue(hVerbKey,_T("command"),pszRunCmd);
/* ddeexec */
if (pszDdeCmd!=NULL)
if (!RegCreateKeyEx(hVerbKey,_T("ddeexec"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hDdeKey,NULL)) {
/* command */
- RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(lstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,_T("application"),pszDdeApp);
/* topic */
@@ -1194,7 +1194,7 @@ void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,c TCHAR *ptszFileExt;
ptszFileExt=a2t(pszFileExt);
if (ptszFileExt!=NULL)
- RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(lstrlen(pszFileDesc)+1)*sizeof(TCHAR));
+ RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(mir_tstrlen(pszFileDesc)+1)*sizeof(TCHAR));
mir_free(ptszFileExt); /* does NULL check */
RegCloseKey(hTypesKey);
}
@@ -1247,7 +1247,7 @@ BOOL AddRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd) /* run */
if (!RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,NULL,0,KEY_SET_VALUE,NULL,&hRunKey,NULL)) {
/* appname */
- fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(lstrlen(pszRunCmd)+1)*sizeof(TCHAR));
+ fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR));
RegCloseKey(hRunKey);
}
return fSuccess;
diff --git a/plugins/AssocMgr/src/test.cpp b/plugins/AssocMgr/src/test.cpp index 6d6ba9add4..41cb0548de 100644 --- a/plugins/AssocMgr/src/test.cpp +++ b/plugins/AssocMgr/src/test.cpp @@ -225,7 +225,7 @@ static HANDLE hServiceOpenFile; static void TrimString(char *str)
{
int len,start;
- len=lstrlenA(str);
+ len=mir_strlen(str);
while(str[0]!='\0' && (unsigned char)str[len-1]<=' ') str[--len]=0;
for(start=0;str[start] && (unsigned char)str[start]<=' ';++start);
MoveMemory(str,str+start,len-start+1);
@@ -348,11 +348,11 @@ static int IcqOpenFile(WPARAM wParam,LPARAM lParam) sep=strchr(line,'=');
if(sep==NULL) { info.type=0; break; } /* format error */
*(sep++)='\0';
- if (!lstrcmpA("UIN",line)) lstrcpynA(info.uin,sep,sizeof(info.uin)); /* buffer safe */
- else if (!lstrcmpA("Email",line)) lstrcpynA(info.email,sep,sizeof(info.email)); /* buffer safe */
- else if (!lstrcmpA("NickName",line)) lstrcpynA(info.nick,sep,sizeof(info.nick)); /* buffer safe */
- else if (!lstrcmpA("FirstName",line)) lstrcpynA(info.firstName,sep,sizeof(info.firstName)); /* buffer safe */
- else if (!lstrcmpA("LastName",line)) lstrcpynA(info.lastName,sep,sizeof(info.lastName)); /* buffer safe */
+ if (!lstrcmpA("UIN",line)) mir_strncpy(info.uin,sep,sizeof(info.uin)); /* buffer safe */
+ else if (!lstrcmpA("Email",line)) mir_strncpy(info.email,sep,sizeof(info.email)); /* buffer safe */
+ else if (!lstrcmpA("NickName",line)) mir_strncpy(info.nick,sep,sizeof(info.nick)); /* buffer safe */
+ else if (!lstrcmpA("FirstName",line)) mir_strncpy(info.firstName,sep,sizeof(info.firstName)); /* buffer safe */
+ else if (!lstrcmpA("LastName",line)) mir_strncpy(info.lastName,sep,sizeof(info.lastName)); /* buffer safe */
}
fclose(fp);
switch(info.type) {
@@ -707,7 +707,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) */
/* user id */
arg=strchr(jid=arg,'?');
- if(arg==NULL) arg+=lstrlenA(arg); /* points to terminating nul */
+ if(arg==NULL) arg+=mir_strlen(arg); /* points to terminating nul */
else *(arg++)=0;
if (*jid==0) return 1; /* parse failed */
/* send a message to a contact */
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp index 031ec3b6e9..d1d5dad270 100644 --- a/plugins/AssocMgr/src/utils.cpp +++ b/plugins/AssocMgr/src/utils.cpp @@ -118,7 +118,7 @@ BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,cha param.settings=NULL;
param.nSettingsCount=0;
param.pszPrefix=pszSettingPrefix;
- param.nPrefixLen=lstrlenA(pszSettingPrefix);
+ param.nPrefixLen=mir_strlen(pszSettingPrefix);
CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
*pnSettingsCount=param.nSettingsCount;
*pSettings=param.settings;
diff --git a/plugins/AutoRun/src/main.cpp b/plugins/AutoRun/src/main.cpp index 1db8bfd406..eeddd928e3 100644 --- a/plugins/AutoRun/src/main.cpp +++ b/plugins/AutoRun/src/main.cpp @@ -45,7 +45,7 @@ static void SetAutorun(BOOL autorun) if ( RegCreateKeyEx(ROOT_KEY, SUB_KEY, 0, NULL, 0, KEY_CREATE_SUB_KEY|KEY_SET_VALUE,NULL,&hKey,&dw) == ERROR_SUCCESS) {
TCHAR result[MAX_PATH];
GetProfilePath(result, SIZEOF(result));
- RegSetValueEx(hKey, _T("MirandaNG"), 0, REG_SZ, (BYTE*)result, sizeof(TCHAR)*lstrlen(result));
+ RegSetValueEx(hKey, _T("MirandaNG"), 0, REG_SZ, (BYTE*)result, sizeof(TCHAR)*mir_tstrlen(result));
RegCloseKey(hKey);
}
break;
diff --git a/plugins/AutoShutdown/src/frame.cpp b/plugins/AutoShutdown/src/frame.cpp index e406e4a494..b77aba262b 100644 --- a/plugins/AutoShutdown/src/frame.cpp +++ b/plugins/AutoShutdown/src/frame.cpp @@ -455,7 +455,7 @@ static LRESULT CALLBACK FrameWndProc(HWND hwndFrame,UINT msg,WPARAM wParam,LPARA if (hdc != NULL) {
if (dat->hFont != NULL)
hFontPrev = (HFONT)SelectObject(hdc,dat->hFont);
- if (GetTextExtentPoint32(hdc,szOutput,lstrlen(szOutput),&size))
+ if (GetTextExtentPoint32(hdc,szOutput,mir_tstrlen(szOutput),&size))
if (size.cx>=(rc.right-rc.left))
dat->flags&=FWPDF_TIMEISCLIPPED;
if (dat->hFont != NULL)
diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 1ede40e86d..7f1ab8b818 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -483,7 +483,7 @@ INT_PTR ServiceGetTypeDescription(WPARAM wParam,LPARAM lParam) static char szConvBuf[128];
char *buf=u2a(pszDesc);
if (buf==NULL) return 0;
- lstrcpynA(szConvBuf,buf,sizeof(szConvBuf));
+ mir_strncpy(szConvBuf,buf,sizeof(szConvBuf));
mir_free(buf);
return (INT_PTR)szConvBuf;
}
diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index 75c65dc345..5c537fa06c 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -51,14 +51,14 @@ void TrimString(TCHAR *pszStr) TCHAR *psz,szChars[]=_T(" \r\n\t");
for(i=0;i<SIZEOF(szChars);++i) {
/* trim end */
- psz=&pszStr[lstrlen(pszStr)-1];
+ psz=&pszStr[mir_tstrlen(pszStr)-1];
while(pszStr[0] && *psz==szChars[i]) {
*psz=0;
psz=CharPrev(pszStr,psz);
}
/* trim beginning */
for(psz=pszStr;(*psz && *psz==szChars[i]);psz=CharNext(psz));
- MoveMemory(pszStr,psz,(lstrlen(psz)+1)*sizeof(TCHAR));
+ MoveMemory(pszStr,psz,(mir_tstrlen(psz)+1)*sizeof(TCHAR));
}
}
@@ -209,12 +209,12 @@ 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 */
- lstrcpyn(fid.backgroundGroup,pszBackgroundGroup,SIZEOF(fid.backgroundGroup)); /* buffer safe */
- lstrcpyn(fid.backgroundName,pszBackgroundName,SIZEOF(fid.backgroundName)); /* 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 */
+ 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;
@@ -227,7 +227,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;
@@ -237,8 +237,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;
}
@@ -249,10 +249,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;
}
@@ -262,8 +262,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/AutoShutdown/src/watcher.cpp b/plugins/AutoShutdown/src/watcher.cpp index 61686744f4..e95b97f145 100644 --- a/plugins/AutoShutdown/src/watcher.cpp +++ b/plugins/AutoShutdown/src/watcher.cpp @@ -66,7 +66,7 @@ static void __inline ShutdownAndStopWatcher(void) static TCHAR* GetMessageText(BYTE **ppBlob,DWORD *pcbBlob)
{
(*ppBlob)[*pcbBlob]=0;
- DWORD cb = lstrlenA((char*)*ppBlob);
+ DWORD cb = mir_strlen((char*)*ppBlob);
/* use Unicode data if present */
if (*pcbBlob>(cb+3)) {
(*ppBlob)[*pcbBlob-1]=0;
diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 2c4f63afd4..997df7b244 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -553,7 +553,7 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact) ofn.lpstrFilter = filter;
ofn.nFilterIndex = 1;
- lstrcpyn(file, _tcsrchr(fn, '\\')+1, sizeof(file));
+ mir_tstrncpy(file, _tcsrchr(fn, '\\')+1, sizeof(file));
ofn.lpstrFile = file;
TCHAR *displayName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR);
diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 77a60eead3..cd3489212b 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -75,7 +75,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) static INT_PTR GetCachedAvatar(WPARAM wParam, LPARAM lParam)
{
TCHAR hash[128];
- lstrcpyn(hash, (TCHAR *) lParam, sizeof(hash));
+ mir_tstrncpy(hash, (TCHAR *) lParam, sizeof(hash));
ConvertToFilename(hash, sizeof(hash));
return (INT_PTR) GetCachedAvatar((char *) wParam, hash);
}
@@ -169,13 +169,13 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) else {
// See if we already have the avatar
TCHAR hash[128];
- lstrcpyn(hash, avatar->hash, sizeof(hash));
+ mir_tstrncpy(hash, avatar->hash, sizeof(hash));
ConvertToFilename(hash, sizeof(hash));
TCHAR *file = GetCachedAvatar(proto, hash);
if (file != NULL) {
- lstrcpyn(history_filename, file, SIZEOF(history_filename));
+ mir_tstrncpy(history_filename, file, SIZEOF(history_filename));
mir_free(file);
}
else {
diff --git a/plugins/AvatarHistory/src/popup.cpp b/plugins/AvatarHistory/src/popup.cpp index 42e2a4c87f..55f3a3ffd2 100644 --- a/plugins/AvatarHistory/src/popup.cpp +++ b/plugins/AvatarHistory/src/popup.cpp @@ -105,13 +105,13 @@ void ShowPopupEx(MCONTACT hContact, const TCHAR *title, const TCHAR *description ((PopupDataType*)ppd.PluginData)->hIcon = ppd.lchIcon;
if (title != NULL)
- lstrcpyn(ppd.lptzContactName, title, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, title, SIZEOF(ppd.lptzContactName));
else if (hContact != NULL)
- lstrcpyn(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
+ mir_tstrncpy(ppd.lptzContactName, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR),
SIZEOF(ppd.lptzContactName));
if (description != NULL)
- lstrcpyn(ppd.lptzText, description, SIZEOF(ppd.lptzText));
+ mir_tstrncpy(ppd.lptzText, description, SIZEOF(ppd.lptzText));
if (type == POPUP_TYPE_NORMAL || type == POPUP_TYPE_TEST)
{
diff --git a/plugins/AvatarHistory/src/utils.cpp b/plugins/AvatarHistory/src/utils.cpp index 57e30f163a..2c18e2edea 100644 --- a/plugins/AvatarHistory/src/utils.cpp +++ b/plugins/AvatarHistory/src/utils.cpp @@ -86,7 +86,7 @@ int GetUIDFromHContact(MCONTACT contact, TCHAR* uinout, int uinout_len) cinfo.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&cinfo) == 0) {
if (cinfo.type == CNFT_ASCIIZ) {
- lstrcpyn(uinout, cinfo.pszVal, uinout_len);
+ mir_tstrncpy(uinout, cinfo.pszVal, uinout_len);
// It is up to us to free the string
// The catch? We need to use Miranda's free(), not our CRT's :)
mir_free(cinfo.pszVal);
@@ -101,7 +101,7 @@ int GetUIDFromHContact(MCONTACT contact, TCHAR* uinout, int uinout_len) else found = false;
if (!found)
- lstrcpyn(uinout, TranslateT("Unknown UIN"), uinout_len);
+ mir_tstrncpy(uinout, TranslateT("Unknown UIN"), uinout_len);
return 0;
}
@@ -217,7 +217,7 @@ TCHAR * GetCachedAvatar(char *proto, TCHAR *hash) do
{
- size_t len = lstrlen(finddata.cFileName);
+ size_t len = mir_tstrlen(finddata.cFileName);
if (len > 4
&& (!lstrcmpi(&finddata.cFileName[len-4], _T(".png"))
|| !lstrcmpi(&finddata.cFileName[len-4], _T(".bmp"))
diff --git a/plugins/BASS_interface/src/Main.cpp b/plugins/BASS_interface/src/Main.cpp index 2c172d6a79..6d94afb260 100644 --- a/plugins/BASS_interface/src/Main.cpp +++ b/plugins/BASS_interface/src/Main.cpp @@ -549,11 +549,11 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) else {
DBVARIANT dbv;
if ( db_get_ts(NULL, ModuleName, OPT_BASSPATH, &dbv)) {
- lstrcpyn(CurrBassPath, VARST( _T("Plugins\\Bass\\bass.dll")), SIZEOF(CurrBassPath));
+ mir_tstrncpy(CurrBassPath, VARST( _T("Plugins\\Bass\\bass.dll")), SIZEOF(CurrBassPath));
db_set_ts(NULL, ModuleName, OPT_BASSPATH, CurrBassPath);
}
else {
- lstrcpy(CurrBassPath, dbv.ptszVal);
+ mir_tstrcpy(CurrBassPath, dbv.ptszVal);
db_free(&dbv);
}
}
diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 4b18ae58c3..6fce6f0fb4 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1248,7 +1248,7 @@ void CreatePath(const TCHAR *szDir) DWORD dwAttributes;
TCHAR *pszLastBackslash, szTestDir[ MAX_PATH ];
- lstrcpyn( szTestDir, szDir, SIZEOF( szTestDir ));
+ mir_tstrncpy( szTestDir, szDir, SIZEOF( szTestDir ));
if (( dwAttributes = GetFileAttributes( szTestDir )) != INVALID_FILE_ATTRIBUTES && ( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ))
return;
diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 11863ee70b..c2ca03957e 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -270,7 +270,7 @@ static void CreateTrayIcon(bool create) db_free(&dbVar);
}
else
- lstrcpy(nim.szTip, _T("Miranda NG"));
+ mir_tstrcpy(nim.szTip, _T("Miranda NG"));
nim.cbSize = sizeof(nim);
nim.hWnd = g_hListenWindow;
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 091c912a6b..ee86de1094 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -628,17 +628,17 @@ int ModulesLoaded(WPARAM, LPARAM) missyouactions[0].cbSize = sizeof(POPUPACTION);
missyouactions[0].lchIcon = Skin_GetIcon("disabled_icon");
- lstrcpyA(missyouactions[0].lpzTitle, LPGEN("Disable Miss You"));
+ mir_strcpy(missyouactions[0].lpzTitle, LPGEN("Disable Miss You"));
missyouactions[0].wParam = missyouactions[0].lParam = 1;
hideactions[0].cbSize = sizeof(POPUPACTION);
hideactions[0].lchIcon = Skin_GetIcon("hide_icon");
- lstrcpyA(hideactions[0].lpzTitle, LPGEN("Hide contact"));
+ mir_strcpy(hideactions[0].lpzTitle, LPGEN("Hide contact"));
hideactions[0].wParam = hideactions[0].lParam = 2;
hideactions[1].cbSize = sizeof(POPUPACTION);
hideactions[1].lchIcon = Skin_GetIcon("neverhide_icon");
- lstrcpyA(hideactions[1].lpzTitle, LPGEN("Never hide this contact"));
+ mir_strcpy(hideactions[1].lpzTitle, LPGEN("Never hide this contact"));
hideactions[1].wParam = hideactions[1].lParam = 3;
return 0;
diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index ff3dc4468e..0b1bc5872f 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -76,7 +76,7 @@ int MsgAck(WPARAM wParam, LPARAM lParam) dbei.flags = DBEF_UTF | DBEF_SENT;
dbei.szModule = (char*)ack->szModule;
dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(pszUtf) + 1;
+ dbei.cbBlob = mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)(char*)pszUtf;
db_event_add(ack->hContact, &dbei);
}
@@ -219,7 +219,7 @@ INT_PTR AddToPounce(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!db_get_ts(hContact, modname, "PounceMsg",&dbv))
{
- TCHAR* newPounce = (TCHAR*)mir_alloc(lstrlen(dbv.ptszVal) + lstrlen(message) + 1);
+ TCHAR* newPounce = (TCHAR*)mir_alloc(mir_tstrlen(dbv.ptszVal) + mir_tstrlen(message) + 1);
if (!newPounce) return 1;
_tcscpy(newPounce, dbv.ptszVal);
_tcscat(newPounce, message);
diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 32bc9c85d3..7926bf6af7 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -263,14 +263,14 @@ void importCustomStatuses(CSWindow* csw, int result) mir_snprintf(bufTitle, 32, "XStatus%dName", i); if ( !db_get_ts( NULL, protoName, bufTitle, &dbv )) { - lstrcpy(si->m_tszTitle, dbv.ptszVal); + mir_tstrcpy(si->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else si->m_tszTitle[0] = 0; mir_snprintf(bufMessage, 32, "XStatus%dMsg", i); if ( !db_get_ts( NULL, protoName, bufMessage, &dbv )) { - lstrcpy(si->m_tszMessage, dbv.ptszVal); + mir_tstrcpy(si->m_tszMessage, dbv.ptszVal); db_free(&dbv); } else si->m_tszMessage[0] = 0; @@ -392,10 +392,10 @@ BOOL CSWindow::itemPassedFilter( ListItem< StatusItem >* li ) TCHAR filter[MAX_PATH]; GetDlgItemText( m_handle, IDC_FILTER_FIELD, filter, SIZEOF(filter) ); - if ( lstrlen( filter )) + if ( mir_tstrlen( filter )) { TCHAR title[EXTRASTATUS_TITLE_LIMIT], message[EXTRASTATUS_MESSAGE_LIMIT]; - lstrcpy( title, li->m_item->m_tszTitle ); lstrcpy( message, li->m_item->m_tszMessage ); + mir_tstrcpy( title, li->m_item->m_tszTitle ); mir_tstrcpy( message, li->m_item->m_tszMessage ); if ( strpos( _tcslwr( title ), _tcslwr( filter )) == -1 ) if ( strpos( _tcslwr( message ), _tcslwr( filter )) == -1 ) return FALSE; @@ -580,10 +580,10 @@ void CSAMWindow::checkItemValidity() cs.ptszName = tszTitle; cs.wParam = &i; if ( CallProtoService(pdescr->szModuleName, PS_GETCUSTOMSTATUSEX, 0, (LPARAM)&cs) == 0) - lstrcpyn(m_item->m_tszTitle, TranslateTS(tszTitle), SIZEOF(m_item->m_tszTitle)); + mir_tstrncpy(m_item->m_tszTitle, TranslateTS(tszTitle), SIZEOF(m_item->m_tszTitle)); if ( lstrcmp(m_item->m_tszMessage, tszInputMessage)) - lstrcpy( m_item->m_tszMessage, tszInputMessage), m_bChanged = true; + mir_tstrcpy( m_item->m_tszMessage, tszInputMessage), m_bChanged = true; } CSListView::CSListView(HWND hwnd, CSWindow* parent) @@ -754,14 +754,14 @@ void CSItemsList::loadItems(char *protoName) mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dTitle", protoName, i); if ( !getTString(dbSetting, &dbv)) { - lstrcpy(item->m_tszTitle, dbv.ptszVal); + mir_tstrcpy(item->m_tszTitle, dbv.ptszVal); db_free(&dbv); } else item->m_tszTitle[0] = 0; mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_Item%dMessage", protoName, i); if ( !getTString(dbSetting, &dbv)) { - lstrcpy(item->m_tszMessage, dbv.ptszVal); + mir_tstrcpy(item->m_tszMessage, dbv.ptszVal); db_free(&dbv); } else item->m_tszMessage[0] = 0; diff --git a/plugins/CSList/src/cslist.h b/plugins/CSList/src/cslist.h index b359367fcf..e7ea295437 100644 --- a/plugins/CSList/src/cslist.h +++ b/plugins/CSList/src/cslist.h @@ -116,16 +116,16 @@ struct StatusItem // list item structure StatusItem()
{
m_iIcon = 0;
- lstrcpy(m_tszTitle, _T(""));
- lstrcpy(m_tszMessage, _T(""));
+ mir_tstrcpy(m_tszTitle, _T(""));
+ mir_tstrcpy(m_tszMessage, _T(""));
m_bFavourite = FALSE;
}
StatusItem( const StatusItem& p )
{
m_iIcon = p.m_iIcon;
- lstrcpy( m_tszTitle, p.m_tszTitle );
- lstrcpy( m_tszMessage, p.m_tszMessage );
+ mir_tstrcpy( m_tszTitle, p.m_tszTitle );
+ mir_tstrcpy( m_tszMessage, p.m_tszMessage );
m_bFavourite = p.m_bFavourite;
}
diff --git a/plugins/ClientChangeNotify/src/CommonLibs/CString.h b/plugins/ClientChangeNotify/src/CommonLibs/CString.h index 0d81a4f7c3..161977cf28 100644 --- a/plugins/ClientChangeNotify/src/CommonLibs/CString.h +++ b/plugins/ClientChangeNotify/src/CommonLibs/CString.h @@ -29,14 +29,14 @@ #include "m_system.h"
#include "m_database.h"
-__inline int My_lstrlen(LPCSTR lpString) {return lstrlenA(lpString);}
-__inline int My_lstrlen(LPCWSTR lpString) {return lstrlenW(lpString);}
+__inline int My_lstrlen(LPCSTR lpString) {return mir_strlen(lpString);}
+__inline int My_lstrlen(LPCWSTR lpString) {return mir_wstrlen(lpString);}
__inline int My_lstrcmp(LPCSTR lpString1, LPCSTR lpString2) {return lstrcmpA(lpString1, lpString2);}
__inline int My_lstrcmp(LPCWSTR lpString1, LPCWSTR lpString2) {return lstrcmpW(lpString1, lpString2);}
__inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpString1, lpString2);}
__inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);}
-__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return lstrcpyA(lpString1, lpString2);}
-__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return lstrcpyW(lpString1, lpString2);}
+__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);}
+__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);}
__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);}
__inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);}
__inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);}
diff --git a/plugins/ClientChangeNotify/src/Misc.h b/plugins/ClientChangeNotify/src/Misc.h index 8f3d299073..c6b85e9cf6 100644 --- a/plugins/ClientChangeNotify/src/Misc.h +++ b/plugins/ClientChangeNotify/src/Misc.h @@ -26,8 +26,8 @@ __inline void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine = _T(""), bool IsError {
POPUPDATAT ppd = {0};
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
- lstrcpy(ppd.lptzContactName, FirstLine);
- lstrcpy(ppd.lptzText, SecondLine);
+ mir_tstrcpy(ppd.lptzContactName, FirstLine);
+ mir_tstrcpy(ppd.lptzText, SecondLine);
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
diff --git a/plugins/Clist_blind/src/clcpaint.cpp b/plugins/Clist_blind/src/clcpaint.cpp index 2e041b0765..e4a6a1408d 100644 --- a/plugins/Clist_blind/src/clcpaint.cpp +++ b/plugins/Clist_blind/src/clcpaint.cpp @@ -307,14 +307,14 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) ChangeToFont(hdcMem, dat, FONTID_OFFLINE, &fontHeight);
else
ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
- GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, lstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, group->cl.items[group->scanIndex]->szText, mir_tstrlen(group->cl.items[group->scanIndex]->szText), &textSize);
width = textSize.cx;
if (group->cl.items[group->scanIndex]->type == CLCIT_GROUP) {
szCounts = pcli->pfnGetGroupCountsText(dat, group->cl.items[group->scanIndex]);
if (szCounts[0]) {
GetTextExtentPoint32A(hdcMem, " ", 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32A(hdcMem, szCounts, lstrlenA(szCounts), &countsSize);
+ GetTextExtentPoint32A(hdcMem, szCounts, mir_strlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -388,7 +388,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.right = rc.left + ((clRect.right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
TextOut(hdcMem, rc.right + 3, y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText));
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect.right;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -404,7 +404,7 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) if (rc.right < rc.left + 4)
rc.right = clRect.right + 1;
else
- TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, lstrlenA(szCounts));
+ TextOutA(hdcMem, rc.right, rc.top + groupCountsFontTopShift, szCounts, mir_strlen(szCounts));
ChangeToFont(hdcMem, dat, FONTID_GROUPS, &fontHeight);
if (selected)
SetTextColor(hdcMem, dat->selTextColour);
@@ -412,12 +412,12 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) SetHotTrackColour(hdcMem, dat);
rc.right--;
ExtTextOut(hdcMem, rc.left, rc.top, ETO_CLIPPED, &rc, group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText), NULL);
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText), NULL);
}
else
TextOut(hdcMem, dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace,
y + ((dat->rowHeight - fontHeight) >> 1), group->cl.items[group->scanIndex]->szText,
- lstrlen(group->cl.items[group->scanIndex]->szText));
+ mir_tstrlen(group->cl.items[group->scanIndex]->szText));
if (dat->exStyle & CLS_EX_LINEWITHGROUPS) {
rc.top = y + (dat->rowHeight >> 1);
rc.bottom = rc.top + 2;
@@ -434,13 +434,13 @@ void PaintClc(HWND hwnd, struct ClcData *dat, HDC hdc, RECT * rcPaint) rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
rc.right = (clRect.right - clRect.left);
rc.bottom = rc.top;
- DrawText(hdcMem, szText, lstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
+ DrawText(hdcMem, szText, mir_tstrlen(szText), &rc, DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_WORD_ELLIPSIS | DT_SINGLELINE);
}
if (selected) {
if (group->cl.items[group->scanIndex]->type != CLCIT_DIVIDER) {
TCHAR *szText = group->cl.items[group->scanIndex]->szText;
RECT rc;
- int qlen = lstrlen(dat->szQuickSearch);
+ int qlen = mir_tstrlen(dat->szQuickSearch);
SetTextColor(hdcMem, dat->quickSearchColour);
rc.left = dat->leftMargin + indent * dat->groupIndent + checkboxWidth + dat->iconXSpace;
rc.top = y + ((dat->rowHeight - fontHeight) >> 1);
diff --git a/plugins/Clist_blind/src/init.cpp b/plugins/Clist_blind/src/init.cpp index d2302364e7..c2e6c53512 100644 --- a/plugins/Clist_blind/src/init.cpp +++ b/plugins/Clist_blind/src/init.cpp @@ -185,15 +185,15 @@ TCHAR* MyDBGetContactSettingTString(MCONTACT hContact, char* module, char* setti else if (dbv.type == DBVT_UTF8)
MultiByteToWideChar(CP_UTF8, 0, dbv.pszVal, -1, out, (int)len);
else if (dbv.type == DBVT_WCHAR)
- lstrcpyn(out, dbv.pwszVal, (int)len);
+ mir_tstrncpy(out, dbv.pwszVal, (int)len);
else if (def != NULL)
- lstrcpyn(out, def, (int)len);
+ mir_tstrncpy(out, def, (int)len);
db_free(&dbv);
}
else {
if (def != NULL)
- lstrcpyn(out, def, (int)len);
+ mir_tstrncpy(out, def, (int)len);
}
return out;
@@ -262,7 +262,7 @@ TCHAR * ParseText(const TCHAR *text, const TCHAR **variables, size_t variablesSize,
const TCHAR **data, size_t dataSize)
{
- size_t length = lstrlen(text);
+ size_t length = mir_tstrlen(text);
size_t nextPos = 0;
StringHelper ret = {0};
size_t i;
@@ -294,11 +294,11 @@ TCHAR * ParseText(const TCHAR *text, // See if can find it
for(j = 0 ; j < size ; j++)
{
- size_t vlen = lstrlen(variables[j]);
+ size_t vlen = mir_tstrlen(variables[j]);
if (_tcsnicmp(&text[i], variables[j], vlen) == 0)
{
- if (CopyData(&ret, data[j], lstrlen(data[j])))
+ if (CopyData(&ret, data[j], mir_tstrlen(data[j])))
return NULL;
i += vlen - 1;
@@ -448,7 +448,7 @@ TCHAR *GetStatusName(struct ClcContact *item) // Get status name
status = db_get_w(item->hContact, item->proto, "Status", ID_STATUS_OFFLINE);
- lstrcpyn(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), MAX_REGS(status_name));
+ mir_tstrncpy(status_name, pcli->pfnGetStatusModeDescription(status, GSMDF_TCHAR), MAX_REGS(status_name));
return status_name;
}
@@ -484,7 +484,7 @@ TCHAR *GetProtoName(struct ClcContact *item) proto_name[0] = '\0';
if (item->hContact == NULL || item->proto == NULL)
{
- lstrcpyn(proto_name, TranslateT("Unknown Protocol"), MAX_REGS(proto_name));
+ mir_tstrncpy(proto_name, TranslateT("Unknown Protocol"), MAX_REGS(proto_name));
return proto_name;
}
@@ -501,7 +501,7 @@ TCHAR *GetProtoName(struct ClcContact *item) return proto_name;
}
- lstrcpyn(proto_name, acc->tszAccountName, MAX_REGS(proto_name));
+ mir_tstrncpy(proto_name, acc->tszAccountName, MAX_REGS(proto_name));
return proto_name;
}
@@ -590,7 +590,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) txt = ParseText(template_group, t, MAX_REGS(t), v, MAX_REGS(v));
if (txt != NULL)
- lstrcpyn(text, txt, (int)size);
+ mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
break;
}
@@ -612,7 +612,7 @@ void RebuildEntireListInternal(HWND hwnd, ClcData *tmp_dat, BOOL call_orig) TCHAR *txt = ParseText(template_contact, t, MAX_REGS(t), v, MAX_REGS(v));
if (txt != NULL)
- lstrcpyn(text, txt, (int)size);
+ mir_tstrncpy(text, txt, (int)size);
mir_free(txt);
break;
}
diff --git a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp index 42741e8028..3821131aa1 100644 --- a/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/cluiframes.cpp @@ -1810,7 +1810,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM lParam) };
g_pfwFrames[g_nFramesCount].dwFlags = clfrm->Flags;
- if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) {
+ if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) {
g_pfwFrames[g_nFramesCount].name = (LPTSTR)mir_alloc(255 * sizeof(TCHAR));
GetClassName(g_pfwFrames[g_nFramesCount].hWnd,g_pfwFrames[g_nFramesCount].name,255);
}
@@ -1820,7 +1820,7 @@ static int _us_DoAddFrame(WPARAM wParam, LPARAM lParam) }
g_pfwFrames[g_nFramesCount].szName = mir_t2a(g_pfwFrames[g_nFramesCount].name);
if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL
- || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0)
+ || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0)
g_pfwFrames[g_nFramesCount].TitleBar.tbname = mir_tstrdup(g_pfwFrames[g_nFramesCount].name);
else
g_pfwFrames[g_nFramesCount].TitleBar.tbname = (clfrm->Flags&F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname);
@@ -2873,7 +2873,7 @@ int DrawTitleBar(HDC hdcMem2,RECT *rect,int Frameid) textrc.left += GetSystemMetrics(SM_CXSMICON)+2;
textrc.top += 2;
}
- ske_TextOut(hdcMem,textrc.left,textrc.top,g_pfwFrames[pos].TitleBar.tbname,lstrlen(g_pfwFrames[pos].TitleBar.tbname));
+ ske_TextOut(hdcMem,textrc.left,textrc.top,g_pfwFrames[pos].TitleBar.tbname,mir_tstrlen(g_pfwFrames[pos].TitleBar.tbname));
}
if (!AlignCOLLIconToLeft)
diff --git a/plugins/Clist_modern/src/modern_cachefuncs.cpp b/plugins/Clist_modern/src/modern_cachefuncs.cpp index 87fae9df20..7eeb92ba6f 100644 --- a/plugins/Clist_modern/src/modern_cachefuncs.cpp +++ b/plugins/Clist_modern/src/modern_cachefuncs.cpp @@ -298,7 +298,7 @@ int GetStatusName(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xstatus if (!noAwayMsg && !noXstatus && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusName", &dbv)) { - //lstrcpyn(text, dbv.pszVal, text_size); + //mir_tstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); @@ -366,7 +366,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta if (!noAwayMsg && xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto) { // Try to get XStatusMsg if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { - //lstrcpyn(text, dbv.pszVal, text_size); + //mir_tstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); @@ -378,7 +378,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta // Get StatusMsg if (pdnce->hContact && text[0] == '\0') { if (!db_get_ts(pdnce->hContact, "CList", "StatusMsg", &dbv)) { - //lstrcpyn(text, dbv.pszVal, text_size); + //mir_tstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); @@ -391,7 +391,7 @@ int GetStatusMessage(TCHAR *text, int text_size, ClcCacheEntry *pdnce, BOOL xsta if (!noAwayMsg && !xstatus_has_priority && pdnce->hContact && pdnce->m_cache_cszProto && text[0] == '\0') { // Try to get XStatusMsg if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "XStatusMsg", &dbv)) { - //lstrcpyn(text, dbv.pszVal, text_size); + //mir_tstrncpy(text, dbv.pszVal, text_size); CopySkipUnprintableChars(text, dbv.ptszVal, text_size - 1); db_free(&dbv); @@ -439,7 +439,7 @@ int Cache_GetLineText( if (pdnce->hContact && pdnce->m_cache_cszProto) { DBVARIANT dbv = {0}; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { - lstrcpyn(text, dbv.ptszVal, text_size); + mir_tstrncpy(text, dbv.ptszVal, text_size); db_free(&dbv); CopySkipUnprintableChars(text, text, text_size-1); } @@ -493,7 +493,7 @@ int Cache_GetLineText( case TEXT_TEXT: { TCHAR *tmp = variables_parsedup(variable_text, pdnce->tszName, pdnce->hContact); - lstrcpyn(text, tmp, text_size); + mir_tstrncpy(text, tmp, text_size); mir_free(tmp); CopySkipUnprintableChars(text, text, text_size-1); } @@ -526,19 +526,19 @@ void Cache_GetFirstLineText(ClcData *dat, ClcContact *contact) DBVARIANT dbv = { 0 }; if (!db_get_ts(pdnce->hContact, pdnce->m_cache_cszProto, "Nick", &dbv)) { TCHAR nick[SIZEOF(contact->szText)]; - lstrcpyn(nick, dbv.ptszVal, SIZEOF(contact->szText)); + mir_tstrncpy(nick, dbv.ptszVal, SIZEOF(contact->szText)); db_free(&dbv); // They are the same -> use the name to keep the case if (_tcsicmp(name, nick) == 0) - lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText)); else // Append then mir_sntprintf(contact->szText, SIZEOF(contact->szText), _T("%s - %s"), name, nick); } - else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); + else mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText)); } - else lstrcpyn(contact->szText, name, SIZEOF(contact->szText)); + else mir_tstrncpy(contact->szText, name, SIZEOF(contact->szText)); if (!dat->force_in_dialog) { struct SHORTDATA data = { 0 }; diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 3dfe676130..696dfde5d3 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -298,7 +298,7 @@ static int clcProceedDragToScroll(HWND hwnd, int Y) static int clcSearchNextContact(HWND hwnd, ClcData *dat, int index, const TCHAR *text, int prefixOk, BOOL fSearchUp) { ClcGroup *group = &dat->list; - int testlen = lstrlen(text); + int testlen = mir_tstrlen(text); BOOL fReturnAsFound = FALSE; int nLastFound = -1; if (index == -1) fReturnAsFound = TRUE; @@ -1595,7 +1595,7 @@ static LRESULT clcOnIntmNameChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wP return ret; if (contact) { - lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); + mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText)); Cache_GetText(dat, contact, 1); cliRecalcScrollBar(hwnd, dat); } diff --git a/plugins/Clist_modern/src/modern_clcitems.cpp b/plugins/Clist_modern/src/modern_clcitems.cpp index 9c5ecc6c1e..7b8d3ad64d 100644 --- a/plugins/Clist_modern/src/modern_clcitems.cpp +++ b/plugins/Clist_modern/src/modern_clcitems.cpp @@ -362,7 +362,7 @@ void cliRebuildEntireList(HWND hwnd, ClcData *dat) int nHiddenStatus = CLVM_GetContactHiddenStatus(hContact, NULL, dat); if ((style & CLS_SHOWHIDDEN && nHiddenStatus != -1) || !nHiddenStatus) { - if (lstrlen(cacheEntry->tszGroup) == 0) + if (mir_tstrlen(cacheEntry->tszGroup) == 0) group = &dat->list; else group = cli_AddGroup(hwnd, dat, cacheEntry->tszGroup, (DWORD)-1, 0, 0); diff --git a/plugins/Clist_modern/src/modern_clcopts.cpp b/plugins/Clist_modern/src/modern_clcopts.cpp index 0c18063a46..032e57fb22 100644 --- a/plugins/Clist_modern/src/modern_clcopts.cpp +++ b/plugins/Clist_modern/src/modern_clcopts.cpp @@ -1383,7 +1383,7 @@ static INT_PTR CALLBACK DlgProcClcBkgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, if (!db_get_s(NULL, module, "BkBitmap", &dbv)) {
int retval = PathToAbsolute(dbv.pszVal, dat->item[indx].filename);
if (!retval || retval == CALLSERVICE_NOTFOUND)
- lstrcpynA(dat->item[indx].filename, dbv.pszVal, MAX_PATH);
+ mir_strncpy(dat->item[indx].filename, dbv.pszVal, MAX_PATH);
mir_free(dbv.pszVal);
}
else *dat->item[indx].filename = 0;
diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 689dcca7bc..42d4cfe939 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -209,7 +209,7 @@ void CLCPaint::GetTextSize( SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHA free_height = text_rc.bottom - text_rc.top;
// Always need cy...
- text_size->cy = ske_DrawText(hdcMem, szText, lstrlen( szText ), &text_rc, DT_CALCRECT | uTextFormat );
+ text_size->cy = ske_DrawText(hdcMem, szText, mir_tstrlen( szText ), &text_rc, DT_CALCRECT | uTextFormat );
text_size->cy = min( text_size->cy, free_height );
if ( plText == NULL )
text_size->cx = min( text_rc.right - text_rc.left + 2, free_width );
@@ -643,7 +643,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask( ClcGroup *group, ClcConta {
TCHAR * b2 = mir_tstrdup( Drawing->szText );
int i, m;
- m = lstrlen( b2 );
+ m = mir_tstrlen( b2 );
for ( i=0; i < m; i++ )
if ( b2[i] == _T( ',' )) b2[i] = _T( '.' );
{
@@ -658,7 +658,7 @@ MODERNMASK* CLCPaint::_GetCLCContactRowBackModernMask( ClcGroup *group, ClcConta {
TCHAR * b2 = mir_tstrdup( group->parent->cl.items[0]->szText );
int i, m;
- m = lstrlen( b2 );
+ m = mir_tstrlen( b2 );
for ( i=0; i < m; i++ )
if ( b2[i] == _T( ',' )) b2[i] = _T( '.' );
{
@@ -854,7 +854,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact space_width = count_size.cx;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT );
+ ske_DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &count_rc, DT_CALCRECT );
count_size.cx += count_rc.right-count_rc.left;
count_size.cy = count_rc.bottom-count_rc.top;
}
@@ -909,11 +909,11 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
if ( dat->text_rtl != 0 ) _RTLRect( &nameRect, free_row_rc.right, dx );
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
if (selected && !dat->filterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour );
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
}
if ( szCounts && strlen( szCounts )>0 )
{
@@ -923,7 +923,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
if ( dat->text_rtl != 0 ) _RTLRect( &countRect, free_row_rc.right, dx );
- ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat );
+ ske_DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &countRect, uTextFormat );
}
{
RECT rc = fr_rc;
@@ -953,7 +953,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact space_size.cy = min( space_rc.bottom - space_rc.top, fr_rc.bottom-fr_rc.top );
ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL );
- DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT );
+ DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &counts_rc, DT_CALCRECT );
counts_size.cx = counts_rc.right - counts_rc.left;
counts_size.cy = min( counts_rc.bottom - counts_rc.top, fr_rc.bottom-fr_rc.top );
@@ -985,7 +985,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
if ( dat->text_rtl != 0 ) _RTLRect( &text_rect, free_row_rc.right, dx );
- _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
if ( ((dat->filterSearch && Drawing->type != CLCIT_GROUP) || selected) && dat->szQuickSearch[0] != '\0' )
{
int idx = 0;
@@ -998,13 +998,13 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour );
- _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &text_rect, &text_size, Drawing->szText, idx, mir_tstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
}
if ( Drawing->type == CLCIT_GROUP && szCounts && szCounts[0] && counts_rc.right-counts_rc.left>0 )
{
ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL );
if ( dat->text_rtl != 0 ) _RTLRect( &counts_rc, free_row_rc.right, dx );
- ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, uTextFormat );
+ ske_DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &counts_rc, uTextFormat );
if ( dat->text_rtl == 0 )
text_rect.right = counts_rc.right;
else
@@ -1075,7 +1075,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact SetTextColor(hdcMem, dat->selTextColour );
else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
if ( (dat->filterSearch || selected) && dat->szQuickSearch[0] != '\0' )
{
int idx = 0;
@@ -1088,7 +1088,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour );
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, Drawing->szText, idx, mir_tstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
}
Drawing->pos_rename_rect = p_rect;
{
@@ -1119,7 +1119,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact space_width = count_size.cx;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &count_rc, DT_CALCRECT );
+ ske_DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &count_rc, DT_CALCRECT );
count_size.cx += count_rc.right-count_rc.left;
count_size.cy = count_rc.bottom-count_rc.top;
}
@@ -1173,10 +1173,10 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact SetTextColor(hdcMem, dat->selTextColour );
else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
if (selected && !dat->filterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour );
- _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, lstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &nameRect, &text_size, Drawing->szText, 0, mir_tstrlen( Drawing->szText ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
}
if ( szCounts && strlen( szCounts )>0 )
{
@@ -1185,7 +1185,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact SetTextColor(hdcMem, dat->selTextColour );
else if ( hottrack )
_SetHotTrackColour(hdcMem, dat );
- ske_DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &countRect, uTextFormat );
+ ske_DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &countRect, uTextFormat );
}
Drawing->pos_rename_rect = p_rect;
Drawing->pos_label = nameRect;
@@ -1219,7 +1219,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact ChangeToFont(hdcMem, dat, FONTID_SECONDLINE, NULL );
uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE;
if ( Drawing->type == CLCIT_CONTACT )
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, lstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szSecondLineText, 0, mir_tstrlen( pdnce->szSecondLineText ), pdnce->ssSecondLine.plText, uTextFormat, dat->text_resize_smileys );
break;
}
case TC_TEXT3:
@@ -1248,7 +1248,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact ChangeToFont(hdcMem, dat, FONTID_THIRDLINE, NULL );
uTextFormat = uTextFormat | ( gl_TrimText?DT_END_ELLIPSIS:0 )|DT_SINGLELINE;
if ( Drawing->type == CLCIT_CONTACT )
- _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, lstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, &p_rect, &text_size, pdnce->szThirdLineText, 0, mir_tstrlen( pdnce->szThirdLineText ), pdnce->ssThirdLine.plText, uTextFormat, dat->text_resize_smileys );
break;
}
case TC_STATUS:
@@ -1572,7 +1572,7 @@ void CLCPaint::_PaintRowItemsEx( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL );
- ske_DrawText(hdcMem, szResult, lstrlen( szResult ), &p_rect, DT_NOPREFIX | DT_SINGLELINE|( dat->text_rtl ? DT_RTLREADING : 0 ));
+ ske_DrawText(hdcMem, szResult, mir_tstrlen( szResult ), &p_rect, DT_NOPREFIX | DT_SINGLELINE|( dat->text_rtl ? DT_RTLREADING : 0 ));
}
break;
}
@@ -2400,7 +2400,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL );
// Get text size
- text_size.cy = ske_DrawText(hdcMem, szResult, lstrlen( szResult ), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE );
+ text_size.cy = ske_DrawText(hdcMem, szResult, mir_tstrlen( szResult ), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE );
text_size.cy = min( text_size.cy, free_row_rc.bottom - free_row_rc.top );
text_size.cx = rc.right - rc.left;
@@ -2525,7 +2525,7 @@ void CLCPaint::_CalcItemsPos( HWND hwnd, HDC hdcMem, ClcData *dat, ClcContact *D space_size.cy = min( space_rc.bottom - space_rc.top, free_height );
ChangeToFont(hdcMem, dat, Drawing->group->expanded?FONTID_OPENGROUPCOUNTS:FONTID_CLOSEDGROUPCOUNTS, NULL );
- DrawTextA(hdcMem, szCounts, lstrlenA( szCounts ), &counts_rc, DT_CALCRECT );
+ DrawTextA(hdcMem, szCounts, mir_strlen( szCounts ), &counts_rc, DT_CALCRECT );
//Store position
//StoreItemPos( Drawing, CIT_SUBTEXT1, &counts_rc ); // Or not to comment?
@@ -3029,7 +3029,7 @@ void CLCPaint::_DrawContactText( HDC hdcMem, ClcData *dat, ClcContact *Drawing, ske_DrawText(hdcMem, Drawing->szText, -1, prcItem, uTextFormat );
if (selected && !dat->filterSearch) {
SetTextColor(hdcMem, dat->quickSearchColour );
- ske_DrawText(hdcMem, Drawing->szText, lstrlen( dat->szQuickSearch ), prcItem, uTextFormat );
+ ske_DrawText(hdcMem, Drawing->szText, mir_tstrlen( dat->szQuickSearch ), prcItem, uTextFormat );
}
}
else if ( Drawing->type == CLCIT_CONTACT )
@@ -3052,7 +3052,7 @@ void CLCPaint::_DrawContactText( HDC hdcMem, ClcData *dat, ClcContact *Drawing, idx = int(p1 - lowered);
}
SetTextColor(hdcMem, dat->quickSearchColour );
- _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, idx, lstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
+ _DrawTextSmiley(hdcMem, prcItem, &text_size, Drawing->szText, idx, mir_tstrlen( dat->szQuickSearch ), Drawing->ssText.plText, uTextFormat, dat->text_resize_smileys );
}
}
else
@@ -3112,7 +3112,7 @@ void CLCPaint::_DrawContactTime( HDC hdcMem, ClcData *dat, ClcContact *Drawing, if (!tmi.printDateTime(pdnce->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0)) {
// Select font
ChangeToFont(hdcMem, dat, FONTID_CONTACT_TIME, NULL );
- ske_DrawText(hdcMem, szResult, lstrlen( szResult ), prcItem, DT_NOPREFIX | DT_SINGLELINE );
+ ske_DrawText(hdcMem, szResult, mir_tstrlen( szResult ), prcItem, DT_NOPREFIX | DT_SINGLELINE );
}
}
diff --git a/plugins/Clist_modern/src/modern_clcutils.cpp b/plugins/Clist_modern/src/modern_clcutils.cpp index 8293adaefc..f23dc89266 100644 --- a/plugins/Clist_modern/src/modern_clcutils.cpp +++ b/plugins/Clist_modern/src/modern_clcutils.cpp @@ -724,7 +724,7 @@ int ExpandMetaContact(HWND hwnd, ClcContact *contact, ClcData *dat, BOOL bExpand int cliFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
{
ClcGroup *group = &dat->list;
- int testlen = lstrlen(text);
+ int testlen = mir_tstrlen(text);
ClcContact *contact = NULL;
int SubCount = 0;
diff --git a/plugins/Clist_modern/src/modern_clistevents.cpp b/plugins/Clist_modern/src/modern_clistevents.cpp index ade09879b1..560a76244b 100644 --- a/plugins/Clist_modern/src/modern_clistevents.cpp +++ b/plugins/Clist_modern/src/modern_clistevents.cpp @@ -355,7 +355,7 @@ static int EventArea_DrawWorker(HWND hWnd, HDC hDC) else {
HICON hIcon = (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0);
TCHAR *ptszEvents = TranslateT("No Events");
- ske_DrawText(hDC, ptszEvents, lstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
+ ske_DrawText(hDC, ptszEvents, mir_tstrlen(ptszEvents), &rc, DT_VCENTER | DT_SINGLELINE);
ske_DrawIconEx(hDC, 4, (rc.bottom + rc.top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
diff --git a/plugins/Clist_modern/src/modern_clistmenus.cpp b/plugins/Clist_modern/src/modern_clistmenus.cpp index fcad83ee28..2fe2157340 100644 --- a/plugins/Clist_modern/src/modern_clistmenus.cpp +++ b/plugins/Clist_modern/src/modern_clistmenus.cpp @@ -108,7 +108,7 @@ static int FAV_OnContactMenuBuild(WPARAM hContact, LPARAM) mi.ptszName = FAVMENUROOTNAME;
else {
TCHAR *str1 = TranslateTS(FAVMENUROOTNAME), *str2 = TranslateTS(rates[bContactRate]);
- int bufsize = (lstrlen(str1) + lstrlen(str2) + 15) * sizeof(TCHAR);
+ int bufsize = (mir_tstrlen(str1) + mir_tstrlen(str2) + 15) * sizeof(TCHAR);
TCHAR *name = (TCHAR *)_alloca(bufsize);
mir_sntprintf(name, bufsize / sizeof(TCHAR), _T("%s (%s)"), str1, str2);
mi.ptszName = name;
diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index fd01a532de..7ddb44fa42 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -33,21 +33,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "hdr/modern_clcpaint.h"
#include "hdr/modern_sync.h"
-struct PROTOTICKS -{ - ~PROTOTICKS() - { - ImageList_Destroy(himlIconList); - } - - ptrA szProto; - int nIconsCount; - int nCycleStartTick; - int nIndex; - BOOL bTimerCreated; - BOOL bGlobal; - HIMAGELIST himlIconList; -}; +struct PROTOTICKS
+{
+ ~PROTOTICKS()
+ {
+ ImageList_Destroy(himlIconList);
+ }
+
+ ptrA szProto;
+ int nIconsCount;
+ int nCycleStartTick;
+ int nIndex;
+ BOOL bTimerCreated;
+ BOOL bGlobal;
+ HIMAGELIST himlIconList;
+};
static int CompareTicks(const PROTOTICKS *p1, const PROTOTICKS *p2)
{
@@ -701,9 +701,9 @@ void CLUI_ChangeWindowMode() TCHAR titleText[255] = { 0 };
DBVARIANT dbv;
if (db_get_ts(NULL, "CList", "TitleText", &dbv))
- lstrcpyn(titleText, _T(MIRANDANAME), SIZEOF(titleText));
+ mir_tstrncpy(titleText, _T(MIRANDANAME), SIZEOF(titleText));
else {
- lstrcpyn(titleText, dbv.ptszVal, SIZEOF(titleText));
+ mir_tstrncpy(titleText, dbv.ptszVal, SIZEOF(titleText));
db_free(&dbv);
}
SetWindowText(pcli->hwndContactList, titleText);
@@ -994,7 +994,7 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx) }
// third try global
- lstrcpyn(szFullPath, _T("proto_conn.dll"), SIZEOF(szFullPath));
+ mir_tstrncpy(szFullPath, _T("proto_conn.dll"), SIZEOF(szFullPath));
if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx))
return hIcon;
@@ -2511,7 +2511,7 @@ LRESULT CLUI::OnMeasureItem(UINT msg, WPARAM wParam, LPARAM lParam) HDC hdc = GetDC(m_hWnd);
TCHAR *ptszStr = TranslateT("Status");
SIZE textSize;
- GetTextExtentPoint32(hdc, ptszStr, lstrlen(ptszStr), &textSize);
+ GetTextExtentPoint32(hdc, ptszStr, mir_tstrlen(ptszStr), &textSize);
pmis->itemWidth = textSize.cx;
pmis->itemHeight = 0;
ReleaseDC(m_hWnd, hdc);
@@ -2572,7 +2572,7 @@ LRESULT CLUI::OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam) mir_snprintf(buf, SIZEOF(buf), "Main,ID=StatusMenu,Selected=%s,Hot=%s", (dis->itemState&ODS_SELECTED) ? "True" : "False", (dis->itemState&ODS_HOTLIGHT) ? "True" : "False");
SkinDrawGlyph(dis->hDC, &dis->rcItem, &dis->rcItem, buf);
SetTextColor(dis->hDC, (dis->itemState&ODS_SELECTED/*|dis->itemState&ODS_HOTLIGHT*/) ? dat->MenuTextHiColor : dat->MenuTextColor);
- DrawText(dis->hDC, TranslateT("Status"), lstrlen(TranslateT("Status")), &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+ DrawText(dis->hDC, TranslateT("Status"), mir_tstrlen(TranslateT("Status")), &rc, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
nStatusMenuState = dis->itemState;
}
else {
diff --git a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp index e4166f89e9..9593ac6d99 100644 --- a/plugins/Clist_modern/src/modern_rowheight_funcs.cpp +++ b/plugins/Clist_modern/src/modern_rowheight_funcs.cpp @@ -148,7 +148,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i size.cx += count_rc.right-count_rc.left;
count_rc.right = 0;
count_rc.left = 0;
- ske_DrawTextA(hdc,szCounts,lstrlenA(szCounts),&count_rc,DT_CALCRECT);
+ ske_DrawTextA(hdc,szCounts,mir_strlen(szCounts),&count_rc,DT_CALCRECT);
size.cx += count_rc.right-count_rc.left;
tmp = max(tmp,count_rc.bottom-count_rc.top);
}
@@ -306,7 +306,7 @@ int mod_CalcRowHeight_worker(ClcData *dat, HWND hwnd, ClcContact *contact, int i g_clcPainter.ChangeToFont(hdc,dat,FONTID_CONTACT_TIME,NULL);
// Get text size
- text_size.cy = ske_DrawText(hdc, szResult, lstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
+ text_size.cy = ske_DrawText(hdc, szResult, mir_tstrlen(szResult), &rc, DT_CALCRECT | DT_NOPREFIX | DT_SINGLELINE);
SelectObject(hdc,GetStockObject(DEFAULT_GUI_FONT));
ske_ResetTextEffect(hdc);
DeleteDC(hdc);
diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index ba02bcb6df..837610d0bc 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -1868,8 +1868,8 @@ static HBITMAP ske_LoadGlyphImageByDecoders(const TCHAR *tszFileName) BITMAP bmpInfo; { - int l = lstrlen(tszFileName); - lstrcpyn(ext, tszFileName+(l-4),5); + int l = mir_tstrlen(tszFileName); + mir_tstrncpy(ext, tszFileName+(l-4),5); } if (!_tcschr(tszFileName,'%') && !PathFileExists(tszFileName)) return NULL; @@ -2552,7 +2552,7 @@ static int ske_AlphaTextOut (HDC hDC, LPCTSTR lpString, int nCount, RECT *lpRect // Calc len of input string if (nCount == -1) - nCount = lstrlen(lpString); + nCount = mir_tstrlen(lpString); // retrieve destination bitmap bits HBITMAP hDestBitmap = (HBITMAP)GetCurrentObject(hDC, OBJ_BITMAP); @@ -3669,8 +3669,8 @@ static DWORD ske_HexToARGB(char * Hex) static TCHAR *ske_ReAppend(TCHAR *lfirst, TCHAR * lsecond, int len) { - int l1 = lfirst?lstrlen(lfirst):0; - int l2 = (len?len:(lstrlen(lsecond)+1)); + int l1 = lfirst?mir_tstrlen(lfirst):0; + int l2 = (len?len:(mir_tstrlen(lsecond)+1)); TCHAR *buf = (TCHAR *)mir_alloc((l1+l2+1)*sizeof(TCHAR)); if (lfirst) memmove(buf,lfirst,l1*sizeof(TCHAR)); memmove(buf+l1,lsecond,l2*sizeof(TCHAR)); @@ -3700,7 +3700,7 @@ TCHAR* ske_ReplaceVar(TCHAR *var) TCHAR *ske_ParseText(TCHAR *stzText) { - int len = lstrlen(stzText); + int len = mir_tstrlen(stzText); TCHAR *result = NULL; int stpos = 0; int curpos = 0; diff --git a/plugins/Clist_modern/src/modern_skinselector.cpp b/plugins/Clist_modern/src/modern_skinselector.cpp index 804f7bab41..7748eff498 100644 --- a/plugins/Clist_modern/src/modern_skinselector.cpp +++ b/plugins/Clist_modern/src/modern_skinselector.cpp @@ -506,7 +506,7 @@ WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim DWORD end = 0;
DWORD CurentCount = 0;
DWORD len;
- while (i < lstrlen(string))
+ while (i < mir_tstrlen(string))
{
if (string[i] == Delim)
{
@@ -520,7 +520,7 @@ WCHAR* GetParamN(WCHAR *string, WCHAR *buf, int buflen, BYTE paramN, WCHAR Delim {
if (SkipSpaces)
{ //remove spaces
- while (string[start] == ' ' && (int)start < lstrlen(string))
+ while (string[start] == ' ' && (int)start < mir_tstrlen(string))
start++;
while (i>1 && string[i-1] == ' ' && i>(int)start)
i--;
diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 8922bf04a3..e381ec59e7 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -374,22 +374,22 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) SIZE textSize;
if (p.bShowProtoName) {
- GetTextExtentPoint32(hDC, p.tszProtoHumanName, lstrlen(p.tszProtoHumanName), &textSize);
+ GetTextExtentPoint32(hDC, p.tszProtoHumanName, mir_tstrlen(p.tszProtoHumanName), &textSize);
w += textSize.cx + 3 + spaceWidth;
}
if (p.bShowProtoEmails && p.szProtoEMailCount) {
- GetTextExtentPoint32A(hDC, p.szProtoEMailCount, lstrlenA(p.szProtoEMailCount), &textSize);
+ GetTextExtentPoint32A(hDC, p.szProtoEMailCount, mir_strlen(p.szProtoEMailCount), &textSize);
w += textSize.cx + 3 + spaceWidth;
}
if (p.bShowStatusName) {
- GetTextExtentPoint32(hDC, p.tszProtoStatusText, lstrlen(p.tszProtoStatusText), &textSize);
+ GetTextExtentPoint32(hDC, p.tszProtoStatusText, mir_tstrlen(p.tszProtoStatusText), &textSize);
w += textSize.cx + 3 + spaceWidth;
}
if ((p.xStatusMode & 8) && p.tszProtoXStatus) {
- GetTextExtentPoint32(hDC, p.tszProtoXStatus, lstrlen(p.tszProtoXStatus), &textSize);
+ GetTextExtentPoint32(hDC, p.tszProtoXStatus, mir_tstrlen(p.tszProtoXStatus), &textSize);
w += textSize.cx + 3 + spaceWidth;
}
@@ -530,10 +530,10 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
- ske_DrawText(hDC, p.tszProtoHumanName, lstrlen(p.tszProtoHumanName), &rt, 0);
+ ske_DrawText(hDC, p.tszProtoHumanName, mir_tstrlen(p.tszProtoHumanName), &rt, 0);
if ((p.bShowProtoEmails && p.szProtoEMailCount != NULL) || p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) {
- GetTextExtentPoint32(hDC, p.tszProtoHumanName, lstrlen(p.tszProtoHumanName), &textSize);
+ GetTextExtentPoint32(hDC, p.tszProtoHumanName, mir_tstrlen(p.tszProtoHumanName), &textSize);
x += textSize.cx + 3;
}
}
@@ -543,9 +543,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
- ske_DrawTextA(hDC, p.szProtoEMailCount, lstrlenA(p.szProtoEMailCount), &rt, 0);
+ ske_DrawTextA(hDC, p.szProtoEMailCount, mir_strlen(p.szProtoEMailCount), &rt, 0);
if (p.bShowStatusName || ((p.xStatusMode & 8) && p.tszProtoXStatus)) {
- GetTextExtentPoint32A(hDC, p.szProtoEMailCount, lstrlenA(p.szProtoEMailCount), &textSize);
+ GetTextExtentPoint32A(hDC, p.szProtoEMailCount, mir_strlen(p.szProtoEMailCount), &textSize);
x += textSize.cx + 3;
}
}
@@ -555,9 +555,9 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
- ske_DrawText(hDC, p.tszProtoStatusText, lstrlen(p.tszProtoStatusText), &rt, 0);
+ ske_DrawText(hDC, p.tszProtoStatusText, mir_tstrlen(p.tszProtoStatusText), &rt, 0);
if (((p.xStatusMode & 8) && p.tszProtoXStatus)) {
- GetTextExtentPoint32(hDC, p.tszProtoStatusText, lstrlen(p.tszProtoStatusText), &textSize);
+ GetTextExtentPoint32(hDC, p.tszProtoStatusText, mir_tstrlen(p.tszProtoStatusText), &textSize);
x += textSize.cx + 3;
}
}
@@ -566,7 +566,7 @@ int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC) RECT rt = r;
rt.left = x + (spaceWidth >> 1);
rt.top = textY;
- ske_DrawText(hDC, p.tszProtoXStatus, lstrlen(p.tszProtoXStatus), &rt, 0);
+ ske_DrawText(hDC, p.tszProtoXStatus, mir_tstrlen(p.tszProtoXStatus), &rt, 0);
}
p.protoRect = r;
diff --git a/plugins/Clist_modern/src/modern_viewmodebar.cpp b/plugins/Clist_modern/src/modern_viewmodebar.cpp index 34fffc42ce..4324fb1a81 100644 --- a/plugins/Clist_modern/src/modern_viewmodebar.cpp +++ b/plugins/Clist_modern/src/modern_viewmodebar.cpp @@ -650,7 +650,7 @@ void DeleteViewMode( char * szName ) db_unset(NULL, CLVM_MODULE, szSetting);
db_unset(NULL, CLVM_MODULE, szName);
- if (!strcmp(g_CluiData.current_viewmode, szName) && lstrlenA(szName) == lstrlenA(g_CluiData.current_viewmode)) {
+ if (!strcmp(g_CluiData.current_viewmode, szName) && mir_strlen(szName) == mir_strlen(g_CluiData.current_viewmode)) {
g_CluiData.bFilterEffective = 0;
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SetWindowText(hwndSelector, TranslateT("All contacts"));
@@ -1306,7 +1306,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) if (!onlySelector) {
mir_snprintf(szSetting, 256, "%c%s_PF", 246, Name);
if (!db_get_s(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlenA(dbv.pszVal) >= 2) {
+ if (mir_strlen(dbv.pszVal) >= 2) {
strncpy(g_CluiData.protoFilter, dbv.pszVal, SIZEOF(g_CluiData.protoFilter));
g_CluiData.protoFilter[SIZEOF(g_CluiData.protoFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_PROTOS;
@@ -1315,7 +1315,7 @@ void ApplyViewMode(const char *Name, bool onlySelector ) }
mir_snprintf(szSetting, 256, "%c%s_GF", 246, Name);
if (!db_get_ts(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlen(dbv.ptszVal) >= 2) {
+ if (mir_tstrlen(dbv.ptszVal) >= 2) {
_tcsncpy(g_CluiData.groupFilter, dbv.ptszVal, SIZEOF(g_CluiData.groupFilter));
g_CluiData.groupFilter[SIZEOF(g_CluiData.groupFilter) - 1] = 0;
g_CluiData.bFilterEffective |= CLVM_FILTER_GROUPS;
diff --git a/plugins/Clist_nicer/skineditor/src/main.cpp b/plugins/Clist_nicer/skineditor/src/main.cpp index 62fcef06f2..9eca756415 100644 --- a/plugins/Clist_nicer/skineditor/src/main.cpp +++ b/plugins/Clist_nicer/skineditor/src/main.cpp @@ -731,7 +731,7 @@ static INT_PTR CALLBACK SkinEdit_ExtBkDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa else if (item) { char *szName = item->szName[0] == '{' ? &item->szName[3] : item->szName; - TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, lstrlenA(szName)); + TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, szName, mir_strlen(szName)); } return TRUE; } diff --git a/plugins/Clist_nicer/src/CLCButton.cpp b/plugins/Clist_nicer/src/CLCButton.cpp index 7efef43e8d..79cf53b26a 100644 --- a/plugins/Clist_nicer/src/CLCButton.cpp +++ b/plugins/Clist_nicer/src/CLCButton.cpp @@ -328,7 +328,7 @@ static void PaintWorker(MButtonExtension *ctl, HDC hdcPaint) ctl->sLabel.cx = ctl->sLabel.cy = 0;
}
else {
- GetTextExtentPoint32(hdcMem, ctl->szText, lstrlen(ctl->szText), &ctl->sLabel);
+ GetTextExtentPoint32(hdcMem, ctl->szText, mir_tstrlen(ctl->szText), &ctl->sLabel);
if (g_cxsmIcon + ctl->sLabel.cx + 8 > rcClient.right - rcClient.left)
ctl->sLabel.cx = (rcClient.right - rcClient.left) - g_cxsmIcon - 8;
diff --git a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp index b75315df51..af499ceab3 100644 --- a/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp +++ b/plugins/Clist_nicer/src/CLUIFrames/cluiframes.cpp @@ -1772,7 +1772,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) Frames[nFramescount].dwFlags = clfrm->Flags; - if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->wname) : lstrlenA(clfrm->name)) == 0) { + if (clfrm->name == NULL || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->wname) : mir_strlen(clfrm->name)) == 0) { TCHAR ptszClassName[256]; GetClassName(Frames[nFramescount].hWnd, ptszClassName, SIZEOF(ptszClassName)); Frames[nFramescount].name = mir_tstrdup(ptszClassName); @@ -1780,7 +1780,7 @@ INT_PTR CLUIFramesAddFrame(WPARAM wParam, LPARAM lParam) else Frames[nFramescount].name = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->wname) : mir_a2t(clfrm->name); if (IsBadCodePtr((FARPROC)clfrm->TBname) || clfrm->TBname == NULL - || ((clfrm->Flags&F_UNICODE) ? lstrlenW(clfrm->TBwname) : lstrlenA(clfrm->TBname)) == 0) + || ((clfrm->Flags&F_UNICODE) ? mir_wstrlen(clfrm->TBwname) : mir_strlen(clfrm->TBname)) == 0) Frames[nFramescount].TitleBar.tbname = mir_tstrdup(Frames[nFramescount].name); else Frames[nFramescount].TitleBar.tbname = (clfrm->Flags & F_UNICODE) ? mir_u2t(clfrm->TBwname) : mir_a2t(clfrm->TBname); @@ -2418,11 +2418,11 @@ static int DrawTitleBar(HDC dc, RECT rect, int Frameid) if (!AlignCOLLIconToLeft) { if (Frames[pos].TitleBar.hicon != NULL) { DrawIconEx(hdcMem, 6 + cfg::dat.bClipBorder, ((TitleBarH >> 1) - 8), Frames[pos].TitleBar.hicon, 16, 16, 0, NULL, DI_NORMAL); - TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + TextOut(hdcMem, 24 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, mir_tstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 6 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, mir_tstrlen(Frames[pos].TitleBar.tbname)); } - else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, lstrlen(Frames[pos].TitleBar.tbname)); + else TextOut(hdcMem, 18 + cfg::dat.bClipBorder, fontTop, Frames[pos].TitleBar.tbname, mir_tstrlen(Frames[pos].TitleBar.tbname)); if (!AlignCOLLIconToLeft) DrawIconEx(hdcMem, Frames[pos].TitleBar.wndSize.right - 22, ((TitleBarH >> 1) - 8), Frames[pos].collapsed ? LoadSkinnedIcon(SKINICON_OTHER_GROUPOPEN) : LoadSkinnedIcon(SKINICON_OTHER_GROUPSHUT), 16, 16, 0, NULL, DI_NORMAL); diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 1449b0446f..0f58d631b8 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -161,7 +161,7 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) ReloadExtraInfo(hContact);
if (!(cfg::dat.dwFlags & CLUI_USEMETAICONS) && !__strcmp(szProto, META_PROTO))
- if ((lstrlenA(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting))
+ if ((mir_strlen(cws->szSetting) > 6 && !strncmp(cws->szSetting, "Status", 6)) || strstr("Default,ForceSend,Nick", cws->szSetting))
pcli->pfnClcBroadcast(INTM_NAMEORDERCHANGED, hContact, lParam);
}
if (cfg::dat.bMetaEnabled && !__strcmp(cws->szModule, META_PROTO) && !__strcmp(cws->szSetting, "IsSubcontact"))
@@ -420,7 +420,7 @@ LBL_Def: ClcContact *contact;
if (!FindItem(hwnd, dat, (HANDLE)wParam, &contact, NULL, NULL))
break;
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
RTL_DetectAndSet(contact, 0);
@@ -504,7 +504,7 @@ LBL_Def: contact->proto = GetContactProto(wParam);
CallService(MS_CLIST_INVALIDATEDISPLAYNAME, wParam, 0);
- lstrcpyn(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
+ mir_tstrncpy(contact->szText, pcli->pfnGetContactDisplayName(wParam, 0), SIZEOF(contact->szText));
RTL_DetectAndSet(contact, 0);
diff --git a/plugins/Clist_nicer/src/clcitems.cpp b/plugins/Clist_nicer/src/clcitems.cpp index 8442edb661..94de708bef 100644 --- a/plugins/Clist_nicer/src/clcitems.cpp +++ b/plugins/Clist_nicer/src/clcitems.cpp @@ -225,7 +225,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) DBVARIANT dbv = {0};
INT_PTR result = cfg::getTString(hContact, "CList", "StatusMsg", &dbv);
- if ( !result && lstrlen(dbv.ptszVal) > 0)
+ if ( !result && mir_tstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_CLIST;
else {
if ( !szProto)
@@ -233,11 +233,11 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (szProto) {
if ( !result )
db_free( &dbv );
- if ( !( result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && lstrlen(dbv.ptszVal) > 0)
+ if ( !( result = cfg::getTString(hContact, szProto, "YMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_YIM;
- else if ( !(result = cfg::getTString(hContact, szProto, "StatusDescr", &dbv)) && lstrlen(dbv.ptszVal) > 0)
+ else if ( !(result = cfg::getTString(hContact, szProto, "StatusDescr", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_GG;
- else if ( !(result = cfg::getTString(hContact, szProto, "XStatusMsg", &dbv)) && lstrlen(dbv.ptszVal) > 0)
+ else if ( !(result = cfg::getTString(hContact, szProto, "XStatusMsg", &dbv)) && mir_tstrlen(dbv.ptszVal) > 0)
p->bStatusMsgValid = STATUSMSG_XSTATUS;
}
}
@@ -246,8 +246,8 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if ( !result )
db_free( &dbv );
result = cfg::getTString(hContact, szProto, "XStatusName", &dbv);
- if ( !result && lstrlen(dbv.ptszVal) > 1) {
- int iLen = lstrlen(dbv.ptszVal);
+ if ( !result && mir_tstrlen(dbv.ptszVal) > 1) {
+ int iLen = mir_tstrlen(dbv.ptszVal);
p->bStatusMsgValid = STATUSMSG_XSTATUSNAME;
p->statusMsg = (TCHAR *)realloc(p->statusMsg, (iLen + 2) * sizeof(TCHAR));
_tcsncpy(p->statusMsg, dbv.ptszVal, iLen + 1);
@@ -266,8 +266,8 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) cst.ptszName = xStatusName;
if ( !CallProtoService(szProto, PS_GETCUSTOMSTATUSEX, hContact, (LPARAM)&cst)) {
TCHAR *szwXstatusName = TranslateTS(xStatusName);
- p->statusMsg = (TCHAR *)realloc(p->statusMsg, (lstrlen(szwXstatusName) + 2) * sizeof(TCHAR));
- _tcsncpy(p->statusMsg, szwXstatusName, lstrlen(szwXstatusName) + 1);
+ p->statusMsg = (TCHAR *)realloc(p->statusMsg, (mir_tstrlen(szwXstatusName) + 2) * sizeof(TCHAR));
+ _tcsncpy(p->statusMsg, szwXstatusName, mir_tstrlen(szwXstatusName) + 1);
p->bStatusMsgValid = STATUSMSG_XSTATUSNAME;
}
}
@@ -276,7 +276,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (p->bStatusMsgValid > STATUSMSG_XSTATUSNAME) {
int j = 0;
- p->statusMsg = (TCHAR *)realloc(p->statusMsg, (lstrlen(dbv.ptszVal) + 2) * sizeof(TCHAR));
+ p->statusMsg = (TCHAR *)realloc(p->statusMsg, (mir_tstrlen(dbv.ptszVal) + 2) * sizeof(TCHAR));
for (int i = 0; dbv.ptszVal[i]; i++) {
if (dbv.ptszVal[i] == (TCHAR)0x0d)
continue;
@@ -291,7 +291,7 @@ BYTE GetCachedStatusMsg(TExtraCache *p, char *szProto) if (p->bStatusMsgValid != STATUSMSG_NOTFOUND) {
WORD infoTypeC2[12];
ZeroMemory(infoTypeC2, sizeof(WORD) * 12);
- int iLen = min(lstrlenW(p->statusMsg), 10);
+ int iLen = min(mir_wstrlen(p->statusMsg), 10);
GetStringTypeW(CT_CTYPE2, p->statusMsg, iLen, infoTypeC2);
p->dwCFlags &= ~ECF_RTLSTATUSMSG;
for (int i = 0; i < 10; i++) {
@@ -361,7 +361,7 @@ void RTL_DetectAndSet(ClcContact *contact, MCONTACT hContact) p = contact->pExtra;
}
if (p) {
- iLen = min(lstrlenW(szText), 10);
+ iLen = min(mir_wstrlen(szText), 10);
GetStringTypeW(CT_CTYPE2, szText, iLen, infoTypeC2);
p->dwCFlags &= ~ECF_RTLNICK;
for (i = 0; i < 10; i++) {
@@ -382,7 +382,7 @@ void RTL_DetectGroupName(ClcContact *group) group->isRtl = 0;
if (group->szText) {
- iLen = min(lstrlenW(group->szText), 10);
+ iLen = min(mir_wstrlen(group->szText), 10);
GetStringTypeW(CT_CTYPE2, group->szText, iLen, infoTypeC2);
for (i = 0; i < 10; i++) {
if (infoTypeC2[i] == C2_RIGHTTOLEFT) {
diff --git a/plugins/Clist_nicer/src/clcpaint.cpp b/plugins/Clist_nicer/src/clcpaint.cpp index 40434ce98e..ab0134290a 100644 --- a/plugins/Clist_nicer/src/clcpaint.cpp +++ b/plugins/Clist_nicer/src/clcpaint.cpp @@ -231,7 +231,7 @@ void PaintNotifyArea(HDC hDC, RECT *rc) else {
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 16, 16, 0));
TCHAR *ptszNoEvents = TranslateT("No events...");
- DrawText(hDC, ptszNoEvents, lstrlen(ptszNoEvents), rc, DT_VCENTER | DT_SINGLELINE);
+ DrawText(hDC, ptszNoEvents, mir_tstrlen(ptszNoEvents), rc, DT_VCENTER | DT_SINGLELINE);
DrawIconEx(hDC, 4, (rc->bottom + rc->top - 16) / 2, hIcon, 16, 16, 0, 0, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
}
@@ -495,7 +495,7 @@ set_bg_l: }
else if (type == CLCIT_DIVIDER) {
ChangeToFont(hdcMem, dat, FONTID_DIVIDERS, &fontHeight);
- GetTextExtentPoint32(hdcMem, contact->szText, lstrlen(contact->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, contact->szText, mir_tstrlen(contact->szText), &textSize);
}
else if (type == CLCIT_CONTACT && flags & CONTACTF_NOTONLIST)
ChangeToFont(hdcMem, dat, FONTID_NOTONLIST, &fontHeight);
@@ -510,13 +510,13 @@ set_bg_l: ChangeToFont(hdcMem, dat, FONTID_CONTACTS, &fontHeight);
if (type == CLCIT_GROUP) {
- GetTextExtentPoint32(hdcMem, contact->szText, lstrlen(contact->szText), &textSize);
+ GetTextExtentPoint32(hdcMem, contact->szText, mir_tstrlen(contact->szText), &textSize);
width = textSize.cx;
szCounts = pcli->pfnGetGroupCountsText(dat, contact);
if (szCounts[0]) {
GetTextExtentPoint32(hdcMem, _T(" "), 1, &spaceSize);
ChangeToFont(hdcMem, dat, FONTID_GROUPCOUNTS, &fontHeight);
- GetTextExtentPoint32A(hdcMem, szCounts, lstrlenA(szCounts), &countsSize);
+ GetTextExtentPoint32A(hdcMem, szCounts, mir_strlen(szCounts), &countsSize);
width += spaceSize.cx + countsSize.cx;
}
}
@@ -978,7 +978,7 @@ bgskipped: rc.left = rcContent.left;
rc.right = rc.left - dat->rightMargin + ((clRect->right - rc.left - textSize.cx) >> 1) - 3;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
- TextOut(hdcMem, rc.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, lstrlen(contact->szText));
+ TextOut(hdcMem, rc.right + 3, y + ((rowHeight - fontHeight) >> 1), contact->szText, mir_tstrlen(contact->szText));
rc.left = rc.right + 6 + textSize.cx;
rc.right = clRect->right - dat->rightMargin;
DrawEdge(hdcMem, &rc, BDR_SUNKENOUTER, BF_RECT);
@@ -1013,7 +1013,7 @@ bgskipped: if (g_center)
offset = ((rc.right - rc.left) - labelWidth) / 2;
- TextOutA(hdcMem, rc.left + offset + textSize.cx + spaceSize.cx, rc.top + groupCountsFontTopShift, szCounts, lstrlenA(szCounts));
+ TextOutA(hdcMem, rc.left + offset + textSize.cx + spaceSize.cx, rc.top + groupCountsFontTopShift, szCounts, mir_strlen(szCounts));
rightLineStart = rc.left + offset + textSize.cx + spaceSize.cx + countsSize.cx + 2;
if (selected && !g_ignoreselforgroups)
@@ -1122,7 +1122,7 @@ bgskipped: COLORREF oldColor = GetTextColor(hdcMem);
int idOldFont = dat->currentFontID;
ChangeToFont(hdcMem, dat, FONTID_TIMESTAMP, &fHeight);
- GetTextExtentPoint32(hdcMem, szResult, lstrlen(szResult), &szTime);
+ GetTextExtentPoint32(hdcMem, szResult, mir_tstrlen(szResult), &szTime);
verticalfit = (rowHeight - fHeight >= g_cysmIcon+1);
if (av_right) {
@@ -1204,7 +1204,7 @@ nodisplay: LONG rightIconsTop = rcContent.bottom - g_cysmIcon;
LONG old_right = rcContent.right;
ULONG textCounter = 0;
- ULONG ulLen = lstrlen(szText);
+ ULONG ulLen = mir_tstrlen(szText);
LONG old_bottom = rcContent.bottom;
DWORD i_dtFlags = DT_WORDBREAK | DT_NOPREFIX | dt_2ndrowflags;
dtp.cbSize = sizeof(dtp);
@@ -1230,7 +1230,7 @@ nodisplay: if (type != CLCIT_DIVIDER) {
TCHAR *szText = contact->szText;
RECT rc;
- int qlen = lstrlen(dat->szQuickSearch);
+ int qlen = mir_tstrlen(dat->szQuickSearch);
if (hPreviousFont)
SelectObject(hdcMem, hPreviousFont);
SetTextColor(hdcMem, dat->quickSearchColour);
diff --git a/plugins/Clist_nicer/src/clcutils.cpp b/plugins/Clist_nicer/src/clcutils.cpp index 5b21bcaa72..cbbc46ce79 100644 --- a/plugins/Clist_nicer/src/clcutils.cpp +++ b/plugins/Clist_nicer/src/clcutils.cpp @@ -37,7 +37,7 @@ extern void ( *saveRecalcScrollBar )(HWND hwnd, struct ClcData *dat); static int MY_pathIsAbsolute(const TCHAR *path)
{
- if ( !path || !(lstrlen(path) > 2))
+ if ( !path || !(mir_tstrlen(path) > 2))
return 0;
if ((path[1] == ':' && path[2] == '\\') || (path[0] == '\\' && path[1] == '\\'))
@@ -48,30 +48,30 @@ static int MY_pathIsAbsolute(const TCHAR *path) size_t MY_pathToRelative(const TCHAR *pSrc, TCHAR *pOut)
{
- if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
+ if ( !pSrc || !mir_tstrlen(pSrc) || mir_tstrlen(pSrc) > MAX_PATH)
return 0;
if ( !MY_pathIsAbsolute(pSrc)) {
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return lstrlen(pOut);
+ return mir_tstrlen(pOut);
}
TCHAR szTmp[MAX_PATH];
mir_sntprintf(szTmp, SIZEOF(szTmp), _T("%s"), pSrc);
_tcslwr(szTmp);
if ( _tcsstr(szTmp, cfg::dat.tszProfilePath)) {
- mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + lstrlen(cfg::dat.tszProfilePath) - 1);
+ mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc + mir_tstrlen(cfg::dat.tszProfilePath) - 1);
pOut[0]='.';
- return lstrlen(pOut);
+ return mir_tstrlen(pOut);
}
mir_sntprintf(pOut, MAX_PATH, _T("%s"), pSrc);
- return lstrlen(pOut);
+ return mir_tstrlen(pOut);
}
size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut)
{
- if ( !pSrc || !lstrlen(pSrc) || lstrlen(pSrc) > MAX_PATH)
+ if ( !pSrc || !mir_tstrlen(pSrc) || mir_tstrlen(pSrc) > MAX_PATH)
return 0;
if (MY_pathIsAbsolute(pSrc)&&pSrc[0]!='.')
@@ -79,7 +79,7 @@ size_t MY_pathToAbsolute(const TCHAR *pSrc, TCHAR *pOut) else if (pSrc[0]=='.')
mir_sntprintf(pOut, MAX_PATH, _T("%s\\%s"), cfg::dat.tszProfilePath, pSrc);
- return lstrlen(pOut);
+ return mir_tstrlen(pOut);
}
/*
@@ -149,7 +149,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
else
hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, mir_tstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
char *szCounts;
@@ -158,7 +158,7 @@ int RTL_HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact GetTextExtentPoint32A(hdc, " ", 1, &textSize);
width += textSize.cx;
SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ GetTextExtentPoint32A(hdc, szCounts, mir_strlen(szCounts), &textSize);
width += textSize.cx;
}
}
@@ -290,7 +290,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_GROUPS].hFont));
else
hFont = reinterpret_cast<HFONT>(SelectObject(hdc, dat->fontInfo[FONTID_CONTACTS].hFont));
- GetTextExtentPoint32(hdc, hitcontact->szText, lstrlen(hitcontact->szText), &textSize);
+ GetTextExtentPoint32(hdc, hitcontact->szText, mir_tstrlen(hitcontact->szText), &textSize);
width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
char *szCounts;
@@ -299,7 +299,7 @@ int HitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **c GetTextExtentPoint32A(hdc, " ", 1, &textSize);
width += textSize.cx;
SelectObject(hdc, dat->fontInfo[FONTID_GROUPCOUNTS].hFont);
- GetTextExtentPoint32A(hdc, szCounts, lstrlenA(szCounts), &textSize);
+ GetTextExtentPoint32A(hdc, szCounts, mir_strlen(szCounts), &textSize);
width += textSize.cx;
}
}
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 1f2530a0b6..6b3f548bf7 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -885,7 +885,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l if (cfg::getByte("CList", "AutoApplyLastViewMode", 0)) { DBVARIANT dbv = {0}; if (!db_get(NULL, "CList", "LastViewMode", &dbv)) { - if (lstrlenA(dbv.pszVal) > 2) { + if (mir_strlen(dbv.pszVal) > 2) { if (cfg::getDword(NULL, CLVM_MODULE, dbv.pszVal, -1) != 0xffffffff) ApplyViewMode((char *)dbv.pszVal); } @@ -1765,22 +1765,22 @@ buttons_done: TCHAR szName[64]; PROTOACCOUNT *pa = ProtoGetAccount(szProto); if (pa) { - lstrcpyn(szName, pa->tszAccountName, SIZEOF(szName)); + mir_tstrncpy(szName, pa->tszAccountName, SIZEOF(szName)); szName[SIZEOF(szName) - 1] = 0; } else szName[0] = 0; - if (lstrlen(szName) < sizeof(szName) - 1) - lstrcat(szName, _T(" ")); - GetTextExtentPoint32(dis->hDC, szName, lstrlen(szName), &textSize); - TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szName, lstrlen(szName)); + if (mir_tstrlen(szName) < sizeof(szName) - 1) + mir_tstrcat(szName, _T(" ")); + GetTextExtentPoint32(dis->hDC, szName, mir_tstrlen(szName), &textSize); + TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szName, mir_tstrlen(szName)); x += textSize.cx; } if (showOpts & 4) { TCHAR *szStatus = pcli->pfnGetStatusModeDescription(status, 0); - GetTextExtentPoint32(dis->hDC, szStatus, lstrlen(szStatus), &textSize); - TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, lstrlen(szStatus)); + GetTextExtentPoint32(dis->hDC, szStatus, mir_tstrlen(szStatus), &textSize); + TextOut(dis->hDC, x, (dis->rcItem.top + dis->rcItem.bottom - textSize.cy) >> 1, szStatus, mir_tstrlen(szStatus)); } } else if (dis->CtlType == ODT_MENU) { diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index e9140ed75b..d7ed5ed41c 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -140,16 +140,16 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) if (showOpts & 1)
x += 16;
if (showOpts & 2) {
- lstrcpyn( szName, pa->tszAccountName, SIZEOF(szName));
+ mir_tstrncpy( szName, pa->tszAccountName, SIZEOF(szName));
szName[ SIZEOF(szName)-1 ] = 0;
- if (( showOpts & 4 ) && lstrlen(szName) < sizeof(szName)-1 )
- lstrcat( szName, _T(" "));
- GetTextExtentPoint32( hdc, szName, lstrlen(szName), &textSize );
+ if (( showOpts & 4 ) && mir_tstrlen(szName) < sizeof(szName)-1 )
+ mir_tstrcat( szName, _T(" "));
+ GetTextExtentPoint32( hdc, szName, mir_tstrlen(szName), &textSize );
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
TCHAR* modeDescr = pcli->pfnGetStatusModeDescription( CallProtoService(accs[i]->szModuleName,PS_GETSTATUS,0,0 ), 0 );
- GetTextExtentPoint32(hdc, modeDescr, lstrlen(modeDescr), &textSize );
+ GetTextExtentPoint32(hdc, modeDescr, mir_tstrlen(modeDescr), &textSize );
x += textSize.cx + GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
partWidths[partCount]=(partCount?partWidths[partCount-1]:cfg::dat.bCLeft)+ x + 2;
@@ -204,7 +204,7 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) // update the clui button
if ( !db_get(NULL, "CList", "PrimaryStatus", &dbv)) {
- if (dbv.type == DBVT_ASCIIZ && lstrlenA(dbv.pszVal) > 1) {
+ if (dbv.type == DBVT_ASCIIZ && mir_strlen(dbv.pszVal) > 1) {
wStatus = (WORD) CallProtoService(dbv.pszVal, PS_GETSTATUS, 0, 0);
iIcon = IconFromStatusMode(dbv.pszVal, (int) wStatus, 0, &hIcon);
}
diff --git a/plugins/Clist_nicer/src/config.cpp b/plugins/Clist_nicer/src/config.cpp index 2034a7d7e5..47f27e5623 100644 --- a/plugins/Clist_nicer/src/config.cpp +++ b/plugins/Clist_nicer/src/config.cpp @@ -353,7 +353,7 @@ HMODULE Utils::loadSystemLibrary(const TCHAR* szFilename, bool useGetHandle) if (_tcslen(sysPathName) + _tcslen(szFilename) >= MAX_PATH)
throw(CRTException("Error while loading system library", szFilename));
- lstrcat(sysPathName, szFilename);
+ mir_tstrcat(sysPathName, szFilename);
if (useGetHandle)
_h = ::GetModuleHandle(sysPathName);
else
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp index 0c4832ba3e..7344e6e6c6 100644 --- a/plugins/Clist_nicer/src/extBackg.cpp +++ b/plugins/Clist_nicer/src/extBackg.cpp @@ -289,10 +289,10 @@ void LoadExtBkSettingsFromDB() mir_snprintf(p->szDBname, 30, "EXBK_%s", accs[i]->szModuleName);
if (i == 0) {
- lstrcpynA(p->szName, "{-}", 30);
+ mir_strncpy(p->szName, "{-}", 30);
strncat(p->szName, accs[i]->szModuleName, 30);
}
- else lstrcpynA(p->szName, accs[i]->szModuleName, 30);
+ else mir_strncpy(p->szName, accs[i]->szModuleName, 30);
p->statusID = ID_EXTBK_LAST;
arStatusItems.insert(p);
}
@@ -1202,17 +1202,17 @@ void IMG_LoadItems() szSections[3001] = szSections[3000] = 0;
char *p = szSections;
- while (lstrlenA(p) > 1) {
+ while (mir_strlen(p) > 1) {
if (p[0] == '$' || p[0] == '@')
IMG_ReadItem(p, szFileName);
- p += (lstrlenA(p) + 1);
+ p += (mir_strlen(p) + 1);
}
nextButtonID = IDC_TBFIRSTUID;
p = szSections;
- while (lstrlenA(p) > 1) {
+ while (mir_strlen(p) > 1) {
if (p[0] == '!')
BTN_ReadItem(p, szFileName);
- p += (lstrlenA(p) + 1);
+ p += (mir_strlen(p) + 1);
}
if (pcli && pcli->hwndContactList)
SetButtonStates(pcli->hwndContactList);
@@ -1251,9 +1251,9 @@ void LoadPerContactSkins(TCHAR *tszFileName) GetPrivateProfileSectionNamesA(szSections, 3000, file);
szSections[3001] = szSections[3000] = 0;
p = szSections;
- while (lstrlenA(p) > 1) {
+ while (mir_strlen(p) > 1) {
if (p[0] == '%') {
- p += (lstrlenA(p) + 1);
+ p += (mir_strlen(p) + 1);
continue;
}
items = reinterpret_cast<StatusItems_t *>(realloc(items, i * sizeof(StatusItems_t)));
@@ -1268,7 +1268,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) szItem[99] = 0;
//_DebugPopup(0, "Section: %s -> %s", p, szItem);
ReadItem(this_item, szItem, file);
- p += (lstrlenA(p) + 1);
+ p += (mir_strlen(p) + 1);
i++;
}
@@ -1300,7 +1300,7 @@ void LoadPerContactSkins(TCHAR *tszFileName) int j;
for (j = 0; j < i - 1; j++) {
if (!strcmp(szProto, items[j].szName) && !strcmp(UIN, items[j].szDBname) &&
- lstrlenA(szProto) == lstrlenA(items[j].szName) && lstrlenA(UIN) == lstrlenA(items[j].szDBname)) {
+ mir_strlen(szProto) == mir_strlen(items[j].szName) && mir_strlen(UIN) == mir_strlen(items[j].szDBname)) {
cfg::writeDword(hContact, "EXTBK", "TEXT", items[j].TEXTCOLOR);
cfg::writeDword(hContact, "EXTBK", "COLOR1", items[j].COLOR);
cfg::writeDword(hContact, "EXTBK", "COLOR2", items[j].COLOR2);
diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 18fda921a4..eebaf61c4f 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -91,7 +91,7 @@ void _DebugTraceW(const wchar_t *fmt, ...) va_list va;
va_start(va, fmt);
- lstrcpyW(debug, L"CLN: ");
+ mir_wstrcpy(debug, L"CLN: ");
mir_vsnwprintf(&debug[5], ibsize - 10, fmt, va);
OutputDebugStringW(debug);
@@ -106,7 +106,7 @@ void _DebugTraceA(const char *fmt, ...) va_list va;
va_start(va, fmt);
- lstrcpyA(debug, "CLN: ");
+ mir_strcpy(debug, "CLN: ");
mir_vsnprintf(&debug[5], ibsize - 10, fmt, va);
#ifdef _DEBUG
OutputDebugStringA(debug);
diff --git a/plugins/Clist_nicer/src/viewmodes.cpp b/plugins/Clist_nicer/src/viewmodes.cpp index c4909b02b6..b4a200fc46 100644 --- a/plugins/Clist_nicer/src/viewmodes.cpp +++ b/plugins/Clist_nicer/src/viewmodes.cpp @@ -663,7 +663,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP mir_snprintf(szSetting, 256, "%c%s_SSM", 246, szBuf);
db_unset(NULL, CLVM_MODULE, szSetting);
db_unset(NULL, CLVM_MODULE, szBuf);
- if (!strcmp(cfg::dat.current_viewmode, szBuf) && lstrlenA(szBuf) == lstrlenA(cfg::dat.current_viewmode)) {
+ if (!strcmp(cfg::dat.current_viewmode, szBuf) && mir_strlen(szBuf) == mir_strlen(cfg::dat.current_viewmode)) {
cfg::dat.bFilterEffective = 0;
pcli->pfnClcBroadcast(CLM_AUTOREBUILD, 0, 0);
SetWindowTextA(hwndSelector, Translate("No view mode"));
@@ -693,7 +693,7 @@ INT_PTR CALLBACK DlgProcViewModesSetup(HWND hwndDlg, UINT msg, WPARAM wParam, LP GetDlgItemTextA(hwndDlg, IDC_NEWVIEMODE, szBuf, SIZEOF(szBuf));
szBuf[255] = 0;
- if (lstrlenA(szBuf) > 2) {
+ if (mir_strlen(szBuf) > 2) {
if (cfg::getDword(CLVM_MODULE, szBuf, -1) != -1)
MessageBox(0, TranslateT("A view mode with this name does already exist"), TranslateT("Duplicate name"), MB_OK);
else {
@@ -1050,7 +1050,7 @@ void ApplyViewMode(const char *name) mir_snprintf(szSetting, 256, "%c%s_PF", 246, name);
if (!cfg::getString(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlenA(dbv.pszVal) >= 2) {
+ if (mir_strlen(dbv.pszVal) >= 2) {
strncpy(cfg::dat.protoFilter, dbv.pszVal, sizeof(cfg::dat.protoFilter));
cfg::dat.protoFilter[sizeof(cfg::dat.protoFilter) - 1] = 0;
cfg::dat.bFilterEffective |= CLVM_FILTER_PROTOS;
@@ -1059,7 +1059,7 @@ void ApplyViewMode(const char *name) }
mir_snprintf(szSetting, 256, "%c%s_GF", 246, name);
if (!cfg::getTString(NULL, CLVM_MODULE, szSetting, &dbv)) {
- if (lstrlen(dbv.ptszVal) >= 2) {
+ if (mir_tstrlen(dbv.ptszVal) >= 2) {
_tcsncpy(cfg::dat.groupFilter, dbv.ptszVal, SIZEOF(cfg::dat.groupFilter));
cfg::dat.groupFilter[SIZEOF(cfg::dat.groupFilter) - 1] = 0;
cfg::dat.bFilterEffective |= CLVM_FILTER_GROUPS;
diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 70f6006372..01f15f3ebd 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -624,7 +624,7 @@ INT_PTR GetCaps(WPARAM wParam,LPARAM lParam) //gives name to protocol module
INT_PTR GetName(WPARAM wParam,LPARAM lParam)
{
- lstrcpynA((char*)lParam,PLUGINNAME,wParam);
+ mir_strncpy((char*)lParam,PLUGINNAME,wParam);
return 0;
}
@@ -794,7 +794,7 @@ void showMsg(TCHAR *pName, DWORD pid,TCHAR *intIp,TCHAR *extIp,int intPort,int e //99% of the times you'll just copy this line.
//1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
//char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
struct CONNECTION *mpd = (struct CONNECTION*)mir_alloc(sizeof(struct CONNECTION));
//MessageBox(NULL,"aaa","aaa",1);
diff --git a/plugins/ContactsPlus/src/utils.cpp b/plugins/ContactsPlus/src/utils.cpp index 546468bd20..a414d0a6b8 100644 --- a/plugins/ContactsPlus/src/utils.cpp +++ b/plugins/ContactsPlus/src/utils.cpp @@ -115,7 +115,7 @@ void DrawProtocolIcon(HWND hwndDlg, LPARAM lParam, MCONTACT hContact) void UpdateDialogTitle(HWND hwndDlg, MCONTACT hContact, TCHAR *pszTitleStart)
{
TCHAR newtitle[512];
- lstrcpyn(newtitle, TranslateTS(pszTitleStart), SIZEOF(newtitle));
+ mir_tstrncpy(newtitle, TranslateTS(pszTitleStart), SIZEOF(newtitle));
if (hContact) {
char *szProto = GetContactProto(hContact);
diff --git a/plugins/CountryFlags/src/ip2country.cpp b/plugins/CountryFlags/src/ip2country.cpp index 803e8baa72..b47ab8ded7 100644 --- a/plugins/CountryFlags/src/ip2country.cpp +++ b/plugins/CountryFlags/src/ip2country.cpp @@ -210,19 +210,19 @@ static int EnumIpDataLines(const char *pszFileCSV,const char *pszFileOut) if (!lstrcmpi(pszCountry,"ANTARCTICA")) continue;
if (!lstrcmpi(pszCountry,"TIMOR-LESTE")) continue;
if (!lstrcmpi(pszCountry,"PALESTINIAN TERRITORY, OCCUPIED"))
- lstrcpy(pszCountry,"ISRAEL");
+ mir_tstrcpy(pszCountry,"ISRAEL");
else if (!lstrcmpi(pszCountry,"UNITED STATES MINOR OUTLYING ISLANDS"))
- lstrcpy(pszCountry,"UNITED STATES");
+ mir_tstrcpy(pszCountry,"UNITED STATES");
else if (!lstrcmpi(pszCountry,"SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS"))
- lstrcpy(pszCountry,"UNITED KINGDOM");
+ mir_tstrcpy(pszCountry,"UNITED KINGDOM");
else if (!lstrcmpi(pszTwo,"JE")) /* map error */
- lstrcpy(pszCountry,"UNITED KINGDOM");
+ mir_tstrcpy(pszCountry,"UNITED KINGDOM");
else if (!lstrcmpi(pszTwo,"AX")) /* Еland Island belongs to Finland */
- lstrcpy(pszCountry,"FINLAND");
+ mir_tstrcpy(pszCountry,"FINLAND");
else if (!lstrcmpi(pszTwo,"ME"))
- lstrcpy(pszCountry,"MONTENEGRO");
+ mir_tstrcpy(pszCountry,"MONTENEGRO");
else if (!lstrcmpi(pszTwo,"RS") || !lstrcmpi(pszTwo,"CS"))
- lstrcpy(pszCountry,"SERBIA");
+ mir_tstrcpy(pszCountry,"SERBIA");
/* convert */
for(i=0;i<nCountriesCount;i++) {
/* map different writings */
diff --git a/plugins/CryptoPP/src/PGPw/sdk8.cpp b/plugins/CryptoPP/src/PGPw/sdk8.cpp index 2dec9b07f4..e91f714d6b 100644 --- a/plugins/CryptoPP/src/PGPw/sdk8.cpp +++ b/plugins/CryptoPP/src/PGPw/sdk8.cpp @@ -163,7 +163,7 @@ LPSTR __cdecl _pgp_encrypt_keydb(LPCSTR szPlainMsg, PVOID pgpKeyID) PGPFindKeyByKeyID(pgpKeyDB, RemoteKeyID, &PublicKey);
PGPError err = PGPEncode(pgpContext,
- PGPOInputBuffer(pgpContext, szPlainMsg, lstrlen(szPlainMsg)),
+ PGPOInputBuffer(pgpContext, szPlainMsg, mir_tstrlen(szPlainMsg)),
PGPOArmorOutput(pgpContext, TRUE),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, &dwEncMsgLen),
PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
@@ -206,7 +206,7 @@ LPSTR __cdecl _pgp_decrypt_keydb(LPCSTR szEncMsg) }
PGPError err = PGPDecode(pgpContext,
- PGPOInputBuffer(pgpContext, szEncMsg, lstrlen(szEncMsg)),
+ PGPOInputBuffer(pgpContext, szEncMsg, mir_tstrlen(szEncMsg)),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, &dwPlainMsgLen),
PGPOKeyDBRef(pgpContext, pgpKeyDB),
PGPOPassphrase(pgpContext, pszPassphrase),
@@ -244,7 +244,7 @@ PGPError _pgp_import_key(PGPKeyDBRef *keyDB, LPCSTR pgpKey) keyDB,
PGPOInputBuffer( pgpContext,
pgpKey,
- lstrlen(pgpKey) ),
+ mir_tstrlen(pgpKey) ),
PGPOLastOption(pgpContext ));
#endif
}
@@ -278,7 +278,7 @@ LPSTR __cdecl _pgp_encrypt_key(LPCSTR szPlainMsg, LPCSTR pgpKey) }
PGPError err = PGPEncode(pgpContext,
- PGPOInputBuffer(pgpContext, szPlainMsg, lstrlen(szPlainMsg)),
+ PGPOInputBuffer(pgpContext, szPlainMsg, mir_tstrlen(szPlainMsg)),
PGPOArmorOutput(pgpContext, TRUE),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szEncMsg, 16384, &dwEncMsgLen),
PGPOEncryptToKeyDBObj(pgpContext, PublicKey),
@@ -332,7 +332,7 @@ LPSTR __cdecl _pgp_decrypt_key(LPCSTR szEncMsg, LPCSTR pgpKey) }
PGPError err = PGPDecode(pgpContext,
- PGPOInputBuffer(pgpContext, szEncMsg, lstrlen(szEncMsg)),
+ PGPOInputBuffer(pgpContext, szEncMsg, mir_tstrlen(szEncMsg)),
PGPOAllocatedOutputBuffer(pgpContext, (LPVOID *)&szPlainMsg, 16384, &dwPlainMsgLen),
PGPOKeyDBRef(pgpContext, PrivateKeyDB),
PGPOPassphrase(pgpContext, pszPassphrase),
diff --git a/plugins/DbChecker/src/selectdb.cpp b/plugins/DbChecker/src/selectdb.cpp index c5455ef4fd..09268d48e4 100644 --- a/plugins/DbChecker/src/selectdb.cpp +++ b/plugins/DbChecker/src/selectdb.cpp @@ -77,15 +77,15 @@ void GetProfileDirectory(TCHAR* szMirandaDir, TCHAR* szPath, int cbPath) {
TCHAR szProfileDir[MAX_PATH], szExpandedProfileDir[MAX_PATH], szMirandaBootIni[MAX_PATH];
- lstrcpy(szMirandaBootIni, szMirandaDir);
- lstrcat(szMirandaBootIni, _T("\\mirandaboot.ini"));
+ mir_tstrcpy(szMirandaBootIni, szMirandaDir);
+ mir_tstrcat(szMirandaBootIni, _T("\\mirandaboot.ini"));
GetPrivateProfileString(_T("Database"), _T("ProfileDir"), _T("./Profiles"), szProfileDir, SIZEOF(szProfileDir), szMirandaBootIni);
ExpandEnvironmentStrings(szProfileDir, szExpandedProfileDir, SIZEOF(szExpandedProfileDir));
_tchdir(szMirandaDir);
if (!_tfullpath(szPath, szExpandedProfileDir, cbPath))
- lstrcpyn(szPath, szMirandaDir, cbPath);
- if (szPath[lstrlen(szPath) - 1] == '\\')
- szPath[lstrlen(szPath) - 1] = 0;
+ mir_tstrncpy(szPath, szMirandaDir, cbPath);
+ if (szPath[mir_tstrlen(szPath) - 1] == '\\')
+ szPath[mir_tstrlen(szPath) - 1] = 0;
}
static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir)
@@ -140,8 +140,8 @@ void FindAdd(HWND hdlg, TCHAR *szProfileDir, TCHAR *szPrefix) WIN32_FIND_DATA fd;
TCHAR szSearchPath[MAX_PATH], szFilename[MAX_PATH];
- lstrcpy(szSearchPath, szProfileDir);
- lstrcat(szSearchPath, _T("\\*.*"));
+ mir_tstrcpy(szSearchPath, szProfileDir);
+ mir_tstrcat(szSearchPath, _T("\\*.*"));
hFind = FindFirstFile(szSearchPath, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
diff --git a/plugins/DbChecker/src/welcome.cpp b/plugins/DbChecker/src/welcome.cpp index 5958b09444..a929f5f97c 100644 --- a/plugins/DbChecker/src/welcome.cpp +++ b/plugins/DbChecker/src/welcome.cpp @@ -42,7 +42,7 @@ INT_PTR CALLBACK WelcomeDlgProc(HWND hdlg, UINT message, WPARAM wParam, LPARAM l SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
LOGFONT TitleLogFont = ncm.lfMessageFont;
TitleLogFont.lfWeight = FW_BOLD;
- lstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
+ mir_tstrcpy(TitleLogFont.lfFaceName, TEXT("Verdana Bold"));
HDC hdc = GetDC(NULL);
INT FontSize = 12;
diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 4e2aa2b3e0..3141423c99 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -43,7 +43,7 @@ int Openfile(char *outputFile, const char *module) if (!GetSaveFileName(&ofn))
return 0;
- lstrcpy(outputFile,filename);
+ mir_tstrcpy(outputFile,filename);
return 1;
}
@@ -493,7 +493,7 @@ void importSettings(MCONTACT hContact, char *importstring ) case 'r': *pstr='\r'; break;
default: *pstr=pstr[1]; break;
}
- MoveMemory(pstr+1,pstr+2,lstrlenA(pstr+2)+1);
+ MoveMemory(pstr+1,pstr+2,mir_strlen(pstr+2)+1);
}
}
}
@@ -654,14 +654,14 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, char* FilePath) else
{
if(Exists(FilePath))
- lstrcpy(szFileNames, FilePath);
+ mir_tstrcpy(szFileNames, FilePath);
else
- lstrcpy(szFileNames, "");
+ mir_tstrcpy(szFileNames, "");
}
if (!lstrcmp(szFileNames, "") == 0)
{
- if ((DWORD)lstrlenA(szFileNames) < offset)
+ if ((DWORD)mir_strlen(szFileNames) < offset)
{
index += offset;
strncpy(szPath, szFileNames, offset);
diff --git a/plugins/DbEditorPP/src/watchedvars.cpp b/plugins/DbEditorPP/src/watchedvars.cpp index df5468c285..96d15d638b 100644 --- a/plugins/DbEditorPP/src/watchedvars.cpp +++ b/plugins/DbEditorPP/src/watchedvars.cpp @@ -331,8 +331,8 @@ void popupWatchedVar(MCONTACT hContact,const char* module,const char* setting) POPUPDATA ppd = { 0 };
ppd.lchContact = (MCONTACT)hContact;
ppd.lchIcon = hIcon;
- lstrcpyn(ppd.lpzContactName, lpzContactName,MAX_CONTACTNAME);
- lstrcpyn(ppd.lpzText, lpzText,MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lpzContactName, lpzContactName,MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lpzText, lpzText,MAX_SECONDLINE);
ppd.colorBack = colorBack;
ppd.colorText = colorText;
ppd.iSeconds = timeout ? timeout : -1;
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp index 7627dae3ed..a79d1fb311 100644 --- a/plugins/Db_autobackups/src/backup.cpp +++ b/plugins/Db_autobackups/src/backup.cpp @@ -232,7 +232,7 @@ int Backup(TCHAR* backup_filename) }
else
{
- lstrcpyn(dest_file, backup_filename, MAX_PATH);
+ mir_tstrncpy(dest_file, backup_filename, MAX_PATH);
if (!_tcscmp(_tcsrchr(backup_filename, _T('.')), _T(".zip")))
bZip = true;
}
@@ -268,7 +268,7 @@ int Backup(TCHAR* backup_filename) db_set_dw(0, "AutoBackups", "LastBackupTimestamp", (DWORD)time(0));
if (!options.disable_popups)
{
- size_t dest_file_len = lstrlen(dest_file);
+ size_t dest_file_len = mir_tstrlen(dest_file);
TCHAR *puText;
if (dest_file_len > 50)
{
@@ -276,9 +276,9 @@ int Backup(TCHAR* backup_filename) puText = (TCHAR*)mir_alloc(sizeof(TCHAR) * (dest_file_len + 2));
for (i = (int)dest_file_len - 1; dest_file[i] != _T('\\'); i--);
- lstrcpyn(puText, dest_file, i + 2);
- lstrcat(puText, _T("\n"));
- lstrcat(puText, dest_file + i + 1);
+ mir_tstrncpy(puText, dest_file, i + 2);
+ mir_tstrcat(puText, _T("\n"));
+ mir_tstrcat(puText, dest_file + i + 1);
}
else
puText = mir_tstrdup(dest_file);
diff --git a/plugins/Db_autobackups/src/main.cpp b/plugins/Db_autobackups/src/main.cpp index 79ea056065..2b684a610a 100644 --- a/plugins/Db_autobackups/src/main.cpp +++ b/plugins/Db_autobackups/src/main.cpp @@ -149,8 +149,8 @@ void ShowPopup(TCHAR* ptszText, TCHAR* ptszHeader, TCHAR* ptszPath) {
POPUPDATAT ppd = {0};
- lstrcpy(ppd.lptzText, ptszText);
- lstrcpy(ppd.lptzContactName, ptszHeader);
+ mir_tstrcpy(ppd.lptzText, ptszText);
+ mir_tstrcpy(ppd.lptzContactName, ptszHeader);
if (ptszPath != NULL)
ppd.PluginData = (void*)mir_tstrdup(ptszPath);
ppd.PluginWindowProc = DlgProcPopup;
diff --git a/plugins/Dropbox/src/dropbox_services.cpp b/plugins/Dropbox/src/dropbox_services.cpp index 9197a82eed..1a5bc9c64c 100644 --- a/plugins/Dropbox/src/dropbox_services.cpp +++ b/plugins/Dropbox/src/dropbox_services.cpp @@ -76,7 +76,7 @@ INT_PTR CDropbox::ProtoSendFile(void *obj, WPARAM, LPARAM lParam) wchar_t *path = paths[j];
int length = wcsrchr(path, '\\') - path;
ftp->pfts.wszWorkingDir = (wchar_t*)mir_alloc(sizeof(wchar_t) * (length + 1));
- lstrcpyn(ftp->pfts.wszWorkingDir, paths[j], length + 1);
+ mir_tstrncpy(ftp->pfts.wszWorkingDir, paths[j], length + 1);
ftp->pfts.wszWorkingDir[length] = '\0';
}
@@ -212,7 +212,7 @@ INT_PTR CDropbox::SendFileToDropbox(void *obj, WPARAM hContact, LPARAM lParam) int length = wcsrchr(filePath, '\\') - filePath;
ftp->pfts.wszWorkingDir = (wchar_t*)mir_alloc(sizeof(wchar_t) * (length + 1));
- lstrcpyn(ftp->pfts.wszWorkingDir, filePath, length + 1);
+ mir_tstrncpy(ftp->pfts.wszWorkingDir, filePath, length + 1);
ftp->pfts.wszWorkingDir[length] = '\0';
ftp->pfts.pwszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*) * (ftp->pfts.totalFiles + 1));
diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index bda23904e2..48cfe368a0 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -131,8 +131,8 @@ static bool AppendInfo(TCHAR *buf, int size, MCONTACT hContact, int info) bool ret = false;
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci) && (ci.type == CNFT_ASCIIZ) && ci.pszVal) {
- if (*ci.pszVal && (lstrlen(ci.pszVal) < size - 2)) {
- lstrcpy(buf, ci.pszVal);
+ if (*ci.pszVal && (mir_tstrlen(ci.pszVal) < size - 2)) {
+ mir_tstrcpy(buf, ci.pszVal);
ret = true;
}
mir_free(ci.pszVal);
@@ -156,7 +156,7 @@ void CContactCache::TContactInfo::LoadInfo() for (int i = 0; i < SIZEOF(items); ++i)
if (AppendInfo(p, SIZEOF(info) - (p - info), hContact, items[i]))
- p += lstrlen(p) + 1;
+ p += mir_tstrlen(p) + 1;
*p = 0;
@@ -171,8 +171,8 @@ TCHAR *nb_stristr(TCHAR *str, TCHAR *substr) TCHAR *str_up = NEWTSTR_ALLOCA(str);
TCHAR *substr_up = NEWTSTR_ALLOCA(substr);
- CharUpperBuff(str_up, lstrlen(str_up));
- CharUpperBuff(substr_up, lstrlen(substr_up));
+ CharUpperBuff(str_up, mir_tstrlen(str_up));
+ CharUpperBuff(substr_up, mir_tstrlen(substr_up));
TCHAR *p = _tcsstr(str_up, substr_up);
return p ? (str + (p - str_up)) : NULL;
@@ -193,7 +193,7 @@ bool CContactCache::filter(int rate, TCHAR *str) for (int iLayout = 0; iLayout < nKbdLayouts; ++iLayout) {
if (kbdLayoutActive == kbdLayouts[iLayout])
- lstrcpy(buf, str);
+ mir_tstrcpy(buf, str);
else {
int i;
for (i = 0; str[i]; ++i) {
@@ -204,7 +204,7 @@ bool CContactCache::filter(int rate, TCHAR *str) buf[i] = 0;
}
- for (TCHAR *p = m_cache[rate]->info; p && *p; p = p + lstrlen(p) + 1)
+ for (TCHAR *p = m_cache[rate]->info; p && *p; p = p + mir_tstrlen(p) + 1)
if (nb_stristr(p, buf))
return true;
}
diff --git a/plugins/FavContacts/src/menu.cpp b/plugins/FavContacts/src/menu.cpp index 3138ff9ba8..6136b41c3f 100644 --- a/plugins/FavContacts/src/menu.cpp +++ b/plugins/FavContacts/src/menu.cpp @@ -47,7 +47,7 @@ static BOOL sttMeasureItem_Group(LPMEASUREITEMSTRUCT lpmis, Options *options) SelectObject(hdc, g_Options.hfntName);
SIZE sz;
- GetTextExtentPoint32(hdc, name, lstrlen(name), &sz);
+ GetTextExtentPoint32(hdc, name, mir_tstrlen(name), &sz);
lpmis->itemHeight = sz.cy + 8;
lpmis->itemWidth = sz.cx + 10;
SelectObject(hdc, hfntSave);
@@ -81,7 +81,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) if (!options->bSysColors)
SelectObject(hdc, g_Options.hfntSecond);
- GetTextExtentPoint32(hdc, title, lstrlen(title), &sz);
+ GetTextExtentPoint32(hdc, title, mir_tstrlen(title), &sz);
textWidth = sz.cx;
lpmis->itemHeight += sz.cy + 3;
@@ -92,7 +92,7 @@ static BOOL sttMeasureItem_Contact(LPMEASUREITEMSTRUCT lpmis, Options *options) TCHAR *name = (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
if (!options->bSysColors) SelectObject(hdc, g_Options.hfntName);
- GetTextExtentPoint32(hdc, name, lstrlen(name), &sz);
+ GetTextExtentPoint32(hdc, name, mir_tstrlen(name), &sz);
textWidth = max(textWidth, sz.cx);
SelectObject(hdc, hfntSave);
@@ -158,7 +158,7 @@ static BOOL sttDrawItem_Group(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) TCHAR *name = sttGetGroupName(-INT_PTR(lpdis->itemData));
if (!options->bSysColors)
SelectObject(lpdis->hDC, g_Options.hfntName);
- DrawText(lpdis->hDC, name, lstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_CENTER);
+ DrawText(lpdis->hDC, name, mir_tstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_CENTER);
SelectObject(lpdis->hDC, hfntSave);
@@ -306,10 +306,10 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (!options->bSysColors)
SelectObject(hdcTemp, g_Options.hfntName);
SetTextColor(hdcTemp, clLine1);
- DrawText(hdcTemp, name, lstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
+ DrawText(hdcTemp, name, mir_tstrlen(name), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
SIZE sz;
- GetTextExtentPoint32(hdcTemp, name, lstrlen(name), &sz);
+ GetTextExtentPoint32(hdcTemp, name, mir_tstrlen(name), &sz);
lpdis->rcItem.top += sz.cy + 3;
}
@@ -324,7 +324,7 @@ static BOOL sttDrawItem_Contact(LPDRAWITEMSTRUCT lpdis, Options *options = NULL) if (!options->bSysColors) SelectObject(hdcTemp, g_Options.hfntSecond);
SetTextColor(hdcTemp, clLine2);
- DrawText(hdcTemp, title, lstrlen(title), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
+ DrawText(hdcTemp, title, mir_tstrlen(title), &lpdis->rcItem, DT_NOPREFIX | DT_SINGLELINE | DT_TOP | DT_LEFT);
if (bFree) mir_free(title);
}
@@ -390,13 +390,13 @@ static LRESULT CALLBACK MenuHostWndProc(HWND hwnd, UINT message, WPARAM wParam, RemoveMenu((HMENU)lParam, 1, MF_BYPOSITION);
if (LOWORD(wParam) == VK_BACK) {
- if (int l = lstrlen(g_filter))
+ if (int l = mir_tstrlen(g_filter))
g_filter[l - 1] = 0;
}
else if (_istalnum(LOWORD(wParam))) {
- if (lstrlen(g_filter) < SIZEOF(g_filter) - 1) {
+ if (mir_tstrlen(g_filter) < SIZEOF(g_filter) - 1) {
TCHAR s[] = { LOWORD(wParam), 0 };
- lstrcat(g_filter, s);
+ mir_tstrcat(g_filter, s);
}
}
{
diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index b853dac162..fce6dffea0 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -128,27 +128,27 @@ int ProcessReloadFonts(WPARAM wParam, LPARAM lParam) LOGFONT lf = { 0 };
FontIDT fontid = { sizeof(fontid) };
- lstrcpy(fontid.group, LPGENT("Favorite Contacts"));
- lstrcpy(fontid.name, LPGENT("Contact name"));
+ mir_tstrcpy(fontid.group, LPGENT("Favorite Contacts"));
+ mir_tstrcpy(fontid.name, LPGENT("Contact name"));
g_Options.clLine1 = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
g_Options.hfntName = CreateFontIndirect(&lf);
- lstrcpy(fontid.name, LPGENT("Second line"));
+ mir_tstrcpy(fontid.name, LPGENT("Second line"));
g_Options.clLine2 = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
g_Options.hfntSecond = CreateFontIndirect(&lf);
- lstrcpy(fontid.name, LPGENT("Selected contact name (color)"));
+ mir_tstrcpy(fontid.name, LPGENT("Selected contact name (color)"));
g_Options.clLine1Sel = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
- lstrcpy(fontid.name, LPGENT("Selected second line (color)"));
+ mir_tstrcpy(fontid.name, LPGENT("Selected second line (color)"));
g_Options.clLine2Sel = CallService(MS_FONT_GETT, (WPARAM)&fontid, (LPARAM)&lf);
ColourIDT colourid = { sizeof(colourid) };
- lstrcpy(colourid.group, LPGENT("Favorite Contacts"));
- lstrcpy(colourid.name, LPGENT("Background"));
+ mir_tstrcpy(colourid.group, LPGENT("Favorite Contacts"));
+ mir_tstrcpy(colourid.name, LPGENT("Background"));
g_Options.clBack = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, (LPARAM)&lf);
- lstrcpy(colourid.name, LPGENT("Selected background"));
+ mir_tstrcpy(colourid.name, LPGENT("Selected background"));
g_Options.clBackSel = CallService(MS_COLOUR_GETT, (WPARAM)&colourid, (LPARAM)&lf);
return 0;
@@ -171,39 +171,39 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////
FontIDT fontid = { sizeof(fontid) };
- lstrcpy(fontid.group, LPGENT("Favorite Contacts"));
- lstrcpyA(fontid.dbSettingsGroup, "FavContacts");
- lstrcpy(fontid.backgroundGroup, LPGENT("Favorite Contacts"));
+ mir_tstrcpy(fontid.group, LPGENT("Favorite Contacts"));
+ mir_strcpy(fontid.dbSettingsGroup, "FavContacts");
+ mir_tstrcpy(fontid.backgroundGroup, LPGENT("Favorite Contacts"));
fontid.flags = FIDF_DEFAULTVALID;
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.size = -11;
- lstrcpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"));
+ mir_tstrcpy(fontid.deffontsettings.szFace, _T("MS Shell Dlg"));
fontid.deffontsettings.style = 0;
- lstrcpy(fontid.backgroundName, LPGENT("Background"));
+ mir_tstrcpy(fontid.backgroundName, LPGENT("Background"));
- lstrcpy(fontid.name, LPGENT("Contact name"));
- lstrcpyA(fontid.prefix, "fntName");
+ mir_tstrcpy(fontid.name, LPGENT("Contact name"));
+ mir_strcpy(fontid.prefix, "fntName");
fontid.deffontsettings.colour = GetSysColor(COLOR_MENUTEXT);
fontid.deffontsettings.style = DBFONTF_BOLD;
FontRegisterT(&fontid);
- lstrcpy(fontid.name, LPGENT("Second line"));
- lstrcpyA(fontid.prefix, "fntSecond");
+ mir_tstrcpy(fontid.name, LPGENT("Second line"));
+ mir_strcpy(fontid.prefix, "fntSecond");
fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_MENUTEXT), GetSysColor(COLOR_MENU));
fontid.deffontsettings.style = 0;
FontRegisterT(&fontid);
- lstrcpy(fontid.backgroundName, LPGENT("Selected background"));
+ mir_tstrcpy(fontid.backgroundName, LPGENT("Selected background"));
- lstrcpy(fontid.name, LPGENT("Selected contact name (color)"));
- lstrcpyA(fontid.prefix, "fntNameSel");
+ mir_tstrcpy(fontid.name, LPGENT("Selected contact name (color)"));
+ mir_strcpy(fontid.prefix, "fntNameSel");
fontid.deffontsettings.colour = GetSysColor(COLOR_HIGHLIGHTTEXT);
fontid.deffontsettings.style = DBFONTF_BOLD;
FontRegisterT(&fontid);
- lstrcpy(fontid.name, LPGENT("Selected second line (color)"));
- lstrcpyA(fontid.prefix, "fntSecondSel");
+ mir_tstrcpy(fontid.name, LPGENT("Selected second line (color)"));
+ mir_strcpy(fontid.prefix, "fntSecondSel");
fontid.deffontsettings.colour = sttShadeColor(GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_HIGHLIGHT));
fontid.deffontsettings.style = 0;
FontRegisterT(&fontid);
@@ -211,16 +211,16 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) /////////////////////////////////////////////////////////////////////////////////////
ColourIDT colourid = { sizeof(colourid) };
- lstrcpy(colourid.group, LPGENT("Favorite Contacts"));
- lstrcpyA(colourid.dbSettingsGroup, "FavContacts");
+ mir_tstrcpy(colourid.group, LPGENT("Favorite Contacts"));
+ mir_strcpy(colourid.dbSettingsGroup, "FavContacts");
- lstrcpy(colourid.name, LPGENT("Background"));
- lstrcpyA(colourid.setting, "BackColour");
+ mir_tstrcpy(colourid.name, LPGENT("Background"));
+ mir_strcpy(colourid.setting, "BackColour");
colourid.defcolour = GetSysColor(COLOR_MENU);
ColourRegisterT(&colourid);
- lstrcpy(colourid.name, LPGENT("Selected background"));
- lstrcpyA(colourid.setting, "SelectedColour");
+ mir_tstrcpy(colourid.name, LPGENT("Selected background"));
+ mir_strcpy(colourid.setting, "SelectedColour");
colourid.defcolour = GetSysColor(COLOR_HIGHLIGHT);
ColourRegisterT(&colourid);
diff --git a/plugins/FileAsMessage/src/dialog.cpp b/plugins/FileAsMessage/src/dialog.cpp index 9ca66fa2a7..5af8b3603d 100644 --- a/plugins/FileAsMessage/src/dialog.cpp +++ b/plugins/FileAsMessage/src/dialog.cpp @@ -118,13 +118,13 @@ void MakePopupMsg(HWND hDlg, MCONTACT hContact, char *msg) if(hDlg == hFocused || hDlg == GetParent(hFocused)) return;
//
- //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
//
POPUPDATA ppd = { 0 };
ppd.lchContact = hContact;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMALLICON));
- lstrcpy(ppd.lpzContactName, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
- lstrcpy(ppd.lpzText, msg);
+ mir_tstrcpy(ppd.lpzContactName, (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, 0));
+ mir_tstrcpy(ppd.lpzText, msg);
ppd.colorBack = GetSysColor(COLOR_INFOBK);
ppd.colorText = GetSysColor(COLOR_INFOTEXT);
ppd.PluginWindowProc = (WNDPROC)PopupDlgProc;
@@ -637,7 +637,7 @@ void FILEECHO::onSendTimer() char prefix[128];
mir_snprintf(prefix, sizeof(prefix), "%X,%X,%X>", chunkIndx+1, chunkPos[chunkIndx], chksum);
#ifdef DEBUG
- overhead += lstrlen((char*)buffer);
+ overhead += mir_tstrlen((char*)buffer);
#endif
sendCmd(0, CMD_DATA, (char*)buffer, (char*)prefix);
chunkAck[chunkIndx] = CHUNK_SENT;
@@ -886,7 +886,7 @@ void CreateDirectoryTree(char *szDir) DWORD dwAttributes;
char *pszLastBackslash,szTestDir[MAX_PATH];
- lstrcpyn(szTestDir,szDir,sizeof(szTestDir));
+ mir_tstrncpy(szTestDir,szDir,sizeof(szTestDir));
if((dwAttributes=GetFileAttributes(szTestDir))!=0xffffffff
&& dwAttributes&FILE_ATTRIBUTE_DIRECTORY) return;
pszLastBackslash=strrchr(szTestDir,'\\');
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index ed23f8a94c..650ca060c2 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -148,7 +148,7 @@ static void SetSrmmIcon(MCONTACT hContact, LPTSTR ptszMirver) sid.flags = MBF_TCHAR; sid.tszTooltip = ptszMirver; - if ( lstrlen(ptszMirver)) + if ( mir_tstrlen(ptszMirver)) sid.hIcon = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); else sid.flags |= MBF_HIDDEN; diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index b6dc796822..05d74ff974 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -789,7 +789,7 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) //slightly modified and integrated to MyBitmap class
void MyBitmap::DrawText(TCHAR *str, int x, int y, int blur, int strength)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, lstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, mir_tstrlen(str), &sz);
sz.cx += (blur+2)*2; sz.cy += (blur+2)*2;
x -= blur+2; y -= blur+2;
@@ -819,7 +819,7 @@ void MyBitmap::DrawText(TCHAR *str, int x, int y, int blur, int strength) SetTextColor(tmp.getDC(), RGB(255,255,255));
SetBkColor(tmp.getDC(), RGB(0,0,0));
ExtTextOutA(tmp.getDC(), 0, 0, ETO_OPAQUE, &rc, "", 0, NULL);
- ::DrawText(tmp.getDC(), str, lstrlen(str), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+ ::DrawText(tmp.getDC(), str, mir_tstrlen(str), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
SelectObject(tmp.getDC(), hfnTmp);
GdiFlush();
@@ -997,7 +997,7 @@ bool MyBitmap::loadFromFile_pixel(const char *fn, const char *fnAlpha) {
allocate(1,1);
int r, g, b, a = 255;
- const char *p = fn + lstrlenA("pixel:");
+ const char *p = fn + mir_strlen("pixel:");
r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
@@ -1007,7 +1007,7 @@ bool MyBitmap::loadFromFile_pixel(const char *fn, const char *fnAlpha) bool MyBitmap::loadFromFile_gradient(const char *fn, const char *fnAlpha)
{
- const char *p = fn + lstrlenA("gradient:");
+ const char *p = fn + mir_strlen("gradient:");
if (*p == 'h') allocate(256,1);
else allocate(1,256);
@@ -1153,11 +1153,11 @@ bool MyBitmap::loadFromFile(const char *fn, const char *fnAlpha) {
if (bits) free();
- if (!strncmp(fn, "pixel:", lstrlenA("pixel:")))
+ if (!strncmp(fn, "pixel:", mir_strlen("pixel:")))
{
return loadFromFile_pixel(fn, fnAlpha);
} else
- if (!strncmp(fn, "gradient:", lstrlenA("gradient:")))
+ if (!strncmp(fn, "gradient:", mir_strlen("gradient:")))
{
return loadFromFile_gradient(fn, fnAlpha);
} else
diff --git a/plugins/GmailNotifier/src/check.cpp b/plugins/GmailNotifier/src/check.cpp index b3821cb7cf..6e407a1afd 100644 --- a/plugins/GmailNotifier/src/check.cpp +++ b/plugins/GmailNotifier/src/check.cpp @@ -23,23 +23,23 @@ void CheckMailInbox(Account *curAcc) curAcc->IsChecking = TRUE;
if (!db_get_s(curAcc->hContact, "CList", "MyHandle", &dbv)) {
- lstrcpyA(curAcc->results.content, dbv.pszVal);
+ mir_strcpy(curAcc->results.content, dbv.pszVal);
db_free(&dbv);
}
- else lstrcpyA(curAcc->results.content, curAcc->name);
+ else mir_strcpy(curAcc->results.content, curAcc->name);
tail = strstr(curAcc->results.content, " [");
if (tail) *tail = '\0';
- lstrcatA(curAcc->results.content, " [");
+ mir_strcat(curAcc->results.content, " [");
- lstrcpyA(str, curAcc->results.content);
- lstrcatA(str, Translate("Checking..."));
- lstrcatA(str, "]");
+ mir_strcpy(str, curAcc->results.content);
+ mir_strcat(str, Translate("Checking..."));
+ mir_strcat(str, "]");
db_set_s(curAcc->hContact, "CList", "MyHandle", str);
hHTTPOpen = InternetOpenA("", INTERNET_OPEN_TYPE_PRECONFIG, "", "", 0);
if (!hHTTPOpen) {
- lstrcatA(curAcc->results.content, Translate("Can't open Internet!"));
+ mir_strcat(curAcc->results.content, Translate("Can't open Internet!"));
goto error_handle;
}
@@ -54,22 +54,22 @@ void CheckMailInbox(Account *curAcc) 0);
if (!hHTTPConnection) {
- lstrcatA(curAcc->results.content, Translate("Can't reach server!"));
+ mir_strcat(curAcc->results.content, Translate("Can't reach server!"));
goto error_handle;
}
- lstrcpyA(str, "/a/");
- lstrcatA(str, curAcc->hosted);
- lstrcatA(str, "/LoginAction");
+ mir_strcpy(str, "/a/");
+ mir_strcat(str, curAcc->hosted);
+ mir_strcat(str, "/LoginAction");
hHTTPRequest = HttpOpenRequestA(hHTTPConnection, "POST", str, HTTP_VERSIONA, NULL, NULL, INTERNET_FLAG_SECURE, 0);
- lstrcatA(requestBuffer, curAcc->hosted);
- lstrcatA(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName=");
- lstrcatA(requestBuffer, curAcc->name);
+ mir_strcat(requestBuffer, curAcc->hosted);
+ mir_strcat(requestBuffer, "%2Ffeed%2Fatom&service=mail&userName=");
+ mir_strcat(requestBuffer, curAcc->name);
tail = strchr(requestBuffer, '@');
*tail = '\0';
- lstrcatA(requestBuffer, "&password=");
- lstrcatA(requestBuffer, curAcc->pass);
+ mir_strcat(requestBuffer, "&password=");
+ mir_strcat(requestBuffer, curAcc->pass);
if (!HttpSendRequestA(hHTTPRequest, contentType, (int)strlen(contentType) + 1, requestBuffer, (int)strlen(requestBuffer) + 1)) {
- lstrcpyA(curAcc->results.content, Translate("Can't send account data!"));
+ mir_strcpy(curAcc->results.content, Translate("Can't send account data!"));
goto error_handle;
}
@@ -79,40 +79,40 @@ void CheckMailInbox(Account *curAcc) hHTTPConnection = InternetConnectA(hHTTPOpen, "mail.google.com", INTERNET_DEFAULT_HTTPS_PORT, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0);
if (!hHTTPConnection) {
- lstrcatA(curAcc->results.content, Translate("Can't reach server!"));
+ mir_strcat(curAcc->results.content, Translate("Can't reach server!"));
goto error_handle;
}
if (curAcc->hosted[0]) {
- lstrcpyA(str, "/a/");
- lstrcatA(str, curAcc->hosted);
- lstrcatA(str, "/feed/atom");
+ mir_strcpy(str, "/a/");
+ mir_strcat(str, curAcc->hosted);
+ mir_strcat(str, "/feed/atom");
}
- else lstrcpyA(str, "/mail/feed/atom");
+ else mir_strcpy(str, "/mail/feed/atom");
hHTTPRequest = HttpOpenRequest(hHTTPConnection, _T("GET"), _A2T(str), NULL, NULL, NULL, INTERNET_FLAG_SECURE | INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_RELOAD, 0);
InternetSetOption(hHTTPRequest, INTERNET_OPTION_USERNAME, _A2T(curAcc->name), (int)strlen(curAcc->name) + 1);
InternetSetOption(hHTTPRequest, INTERNET_OPTION_PASSWORD, _A2T(curAcc->pass), (int)strlen(curAcc->pass) + 1);
if (!HttpSendRequest(hHTTPRequest, NULL, 0, NULL, 0)) {
- lstrcatA(curAcc->results.content, Translate("Can't get RSS feed!"));
+ mir_strcat(curAcc->results.content, Translate("Can't get RSS feed!"));
goto error_handle;
}
while (InternetReadFile(hHTTPRequest, temp, _MAX_DOWN_BUFFER, &bufferLength) && bufferLength > 0) {
temp[bufferLength] = '\0';
- lstrcatA(fileBuffer, temp);
+ mir_strcat(fileBuffer, temp);
}
fileBuffer[_MAX_DOWN_BUFFER - 1] = '\0';
curAcc->results_num = ParsePage(fileBuffer, &curAcc->results);
if (curAcc->results_num == -1) {
- lstrcatA(curAcc->results.content, Translate("Wrong name or password!"));
+ mir_strcat(curAcc->results.content, Translate("Wrong name or password!"));
goto error_handle;
}
InternetCloseHandle(hHTTPOpen);
InternetCloseHandle(hHTTPConnection);
InternetCloseHandle(hHTTPRequest);
- lstrcatA(curAcc->results.content, _itoa(curAcc->results_num, str, 10));
- lstrcatA(curAcc->results.content, "]");
+ mir_strcat(curAcc->results.content, _itoa(curAcc->results_num, str, 10));
+ mir_strcat(curAcc->results.content, "]");
curAcc->IsChecking = FALSE;
return;
@@ -123,7 +123,7 @@ error_handle: InternetCloseHandle(hHTTPConnection);
InternetCloseHandle(hHTTPRequest);
- lstrcatA(curAcc->results.content, "]");
+ mir_strcat(curAcc->results.content, "]");
curAcc->IsChecking = FALSE;
}
@@ -162,20 +162,20 @@ int ParsePage(char *page, resultLink *prst) str_head += 7;
str_tail = strstr(str_head, "</title>");
*str_tail = '\0';
- lstrcpynA(title, str_head, 41);
- if (lstrlenA(title) == 40)
- lstrcatA(title, "...");
+ mir_strncpy(title, str_head, 41);
+ if (mir_strlen(title) == 40)
+ mir_strcat(title, "...");
*str_tail = ' ';
str_head = strstr(str_head, "<name>") + 6;
str_tail = strstr(str_head, "</name>");
*str_tail = '\0';
- lstrcpynA(name, str_head, 11);
- lstrcatA(name, ": ");
+ mir_strncpy(name, str_head, 11);
+ mir_strcat(name, ": ");
*str_tail = ' ';
- lstrcpyA(prst->content, name);
- lstrcatA(prst->content, title);
+ mir_strcpy(prst->content, name);
+ mir_strcat(prst->content, title);
MultiByteToWideChar(CP_UTF8, 0, prst->content, -1, str, 64);
WideCharToMultiByte(CP_ACP, 0, str, -1, prst->content, 64, NULL, NULL);
num++;
diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index 0458dad8b8..992b2cc633 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -51,7 +51,7 @@ INT_PTR GetStatus(WPARAM wParam, LPARAM lParam) INT_PTR GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpynA((char*)lParam, pluginName, wParam);
+ mir_strncpy((char*)lParam, pluginName, wParam);
return 0;
}
diff --git a/plugins/GmailNotifier/src/notify.cpp b/plugins/GmailNotifier/src/notify.cpp index a684e5ff0c..cf6cb8b06e 100644 --- a/plugins/GmailNotifier/src/notify.cpp +++ b/plugins/GmailNotifier/src/notify.cpp @@ -80,7 +80,7 @@ void NotifyUser(Account *curAcc) resultLink *prst = curAcc->results.next;
for (int i = 0; i < newMails; i++) {
- dbei.cbBlob = lstrlenA(prst->content) + 1;
+ dbei.cbBlob = mir_strlen(prst->content) + 1;
dbei.pBlob = (PBYTE)prst->content;
db_event_add(curAcc->hContact, &dbei);
prst = prst->next;
@@ -103,7 +103,7 @@ void NotifyUser(Account *curAcc) ppd.lchContact = curAcc->hContact;
ppd.lchIcon = LoadSkinnedProtoIcon(pluginName, ID_STATUS_OCCUPIED);
- lstrcpyA(ppd.lpzContactName, curAcc->results.content);
+ mir_strcpy(ppd.lpzContactName, curAcc->results.content);
resultLink *prst = curAcc->results.next;
for (int i = 0; i < 5 && i < newMails; i++) {
strcat(ppd.lpzText, prst->content);
@@ -151,12 +151,12 @@ void __cdecl Login_ThreadFunc(void *lpParam) if (GetBrowser(lpPathBuffer)) {
if (opt.AutoLogin == 0) {
if (curAcc->hosted[0]) {
- lstrcatA(lpPathBuffer, "https://mail.google.com/a/");
- lstrcatA(lpPathBuffer, curAcc->hosted);
- lstrcatA(lpPathBuffer, "/?logout");
+ mir_strcat(lpPathBuffer, "https://mail.google.com/a/");
+ mir_strcat(lpPathBuffer, curAcc->hosted);
+ mir_strcat(lpPathBuffer, "/?logout");
}
else {
- lstrcatA(lpPathBuffer, "https://mail.google.com/mail/?logout");
+ mir_strcat(lpPathBuffer, "https://mail.google.com/mail/?logout");
}
}
else {
@@ -165,29 +165,29 @@ void __cdecl Login_ThreadFunc(void *lpParam) GetTempFileNameA(buffer, "gmail", 0, szTempName);
hTempFile = CreateFileA(szTempName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- lstrcpyA(buffer, FORMDATA1);
- lstrcatA(buffer, curAcc->hosted);
- lstrcatA(buffer, FORMDATA2);
- lstrcatA(buffer, curAcc->hosted);
- lstrcatA(buffer, FORMDATA3);
- lstrcatA(buffer, "<input type=hidden name=userName value=");
- lstrcatA(buffer, curAcc->name);
+ mir_strcpy(buffer, FORMDATA1);
+ mir_strcat(buffer, curAcc->hosted);
+ mir_strcat(buffer, FORMDATA2);
+ mir_strcat(buffer, curAcc->hosted);
+ mir_strcat(buffer, FORMDATA3);
+ mir_strcat(buffer, "<input type=hidden name=userName value=");
+ mir_strcat(buffer, curAcc->name);
if ((str_temp = strstr(buffer, "@")) != NULL)
*str_temp = '\0';
- lstrcatA(buffer, "><input type=hidden name=password value=");
- lstrcatA(buffer, curAcc->pass);
- lstrcatA(buffer, "></form></body>");
- WriteFile(hTempFile, buffer, lstrlenA(buffer), &dwBytesWritten, NULL);
+ mir_strcat(buffer, "><input type=hidden name=password value=");
+ mir_strcat(buffer, curAcc->pass);
+ mir_strcat(buffer, "></form></body>");
+ WriteFile(hTempFile, buffer, mir_strlen(buffer), &dwBytesWritten, NULL);
CloseHandle(hTempFile);
- lstrcatA(lpPathBuffer, szTempName);
+ mir_strcat(lpPathBuffer, szTempName);
}
else {
- lstrcatA(lpPathBuffer, LINK);
- lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->name));
- lstrcatA(lpPathBuffer, "&Passwd=");
- lstrcatA(lpPathBuffer, mir_urlEncode(curAcc->pass));
+ mir_strcat(lpPathBuffer, LINK);
+ mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->name));
+ mir_strcat(lpPathBuffer, "&Passwd=");
+ mir_strcat(lpPathBuffer, mir_urlEncode(curAcc->pass));
if (opt.AutoLogin == 1)
- lstrcatA(lpPathBuffer, "&PersistentCookie=yes");
+ mir_strcat(lpPathBuffer, "&PersistentCookie=yes");
}
}
}
diff --git a/plugins/GmailNotifier/src/options.cpp b/plugins/GmailNotifier/src/options.cpp index 8ac8e51e64..b03a442c96 100644 --- a/plugins/GmailNotifier/src/options.cpp +++ b/plugins/GmailNotifier/src/options.cpp @@ -87,7 +87,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
DBVARIANT dbv;
if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) {
- lstrcpyA(str, dbv.pszVal);
+ mir_strcpy(str, dbv.pszVal);
db_free(&dbv);
}
}
@@ -166,7 +166,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (GetDlgItemTextA(hwndDlg, IDC_NAME, acc[curIndex].name, SIZEOF(acc[curIndex].name))) {
tail = strstr(acc[curIndex].name, "@");
if (tail && lstrcmpA(tail + 1, "gmail.com") != 0)
- lstrcpyA(acc[curIndex].hosted, tail + 1);
+ mir_strcpy(acc[curIndex].hosted, tail + 1);
SendMessageA(hwndCombo, CB_DELETESTRING, curIndex, 0);
SendMessageA(hwndCombo, CB_INSERTSTRING, curIndex, (LONG_PTR)acc[curIndex].name);
SendMessageA(hwndCombo, CB_SETCURSEL, curIndex, 0);
diff --git a/plugins/GmailNotifier/src/utility.cpp b/plugins/GmailNotifier/src/utility.cpp index 9363f27f60..19156366fd 100644 --- a/plugins/GmailNotifier/src/utility.cpp +++ b/plugins/GmailNotifier/src/utility.cpp @@ -11,12 +11,12 @@ void BuildList(void) acc = (Account *)realloc(acc, acc_num * sizeof(Account));
memset(&acc[acc_num-1], 0, sizeof(Account));
acc[acc_num-1].hContact = hContact;
- lstrcpyA(acc[acc_num-1].name, dbv.pszVal);
+ mir_strcpy(acc[acc_num-1].name, dbv.pszVal);
CallService(MS_IGNORE_IGNORE, hContact, IGNOREEVENT_USERONLINE);
db_free(&dbv);
if (!db_get_s(hContact, pluginName, "Password", &dbv)) {
- lstrcpyA(acc[acc_num-1].pass, dbv.pszVal);
+ mir_strcpy(acc[acc_num-1].pass, dbv.pszVal);
db_free(&dbv);
}
}
@@ -25,7 +25,7 @@ void BuildList(void) for (int i = 0; i < acc_num; i++) {
char *tail = strchr(acc[i].name, '@');
if (tail && lstrcmpA(tail + 1, "gmail.com") != 0)
- lstrcpyA(acc[i].hosted, tail + 1);
+ mir_strcpy(acc[i].hosted, tail + 1);
acc[i].IsChecking = FALSE;
}
}
@@ -43,7 +43,7 @@ BOOL GetBrowser(char *str) else if (opt.OpenUsePrg == 0)
strKey = strDefault;
else if (!db_get_s(NULL, pluginName, "OpenUsePrgPath", &dbv)) {
- lstrcpyA(str, dbv.pszVal);
+ mir_strcpy(str, dbv.pszVal);
db_free(&dbv);
return FALSE;
}
diff --git a/plugins/IEView/src/ChatHTMLBuilder.cpp b/plugins/IEView/src/ChatHTMLBuilder.cpp index 6b262f8a92..c5b65d489c 100644 --- a/plugins/IEView/src/ChatHTMLBuilder.cpp +++ b/plugins/IEView/src/ChatHTMLBuilder.cpp @@ -74,9 +74,9 @@ void ChatHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%d", i);
if (db_get(NULL, CHATFONTMOD, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
+ mir_strcpy(lf->lfFaceName, "Verdana");
else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ mir_strncpy(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
db_free(&dbv);
}
}
@@ -89,7 +89,7 @@ char *ChatHTMLBuilder::timestampToString(time_t time) char *pszStamp = "[%H:%M]";
//InitSetting( &g_Settings.pszTimeStamp, "HeaderTime", _T("[%H:%M]"));
strftime(str, 79, pszStamp, localtime(&time));
- lstrcpynA(szResult, ptrA(mir_utf8encode(str)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encode(str)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index b0bebbb8f7..d7ecb26fe3 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -374,7 +374,7 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) else if (dbei.eventType == EVENTTYPE_FILE) {
//blob is: sequenceid(DWORD),filename(ASCIIZ),description(ASCIIZ)
char* filename = ((char *)dbei.pBlob) + sizeof(DWORD);
- char* descr = filename + lstrlenA(filename) + 1;
+ char* descr = filename + mir_strlen(filename) + 1;
eventData->ptszText = DbGetEventStringT(&dbei, filename);
if (*descr != '\0')
eventData->ptszText2 = DbGetEventStringT(&dbei, descr);
diff --git a/plugins/IEView/src/HistoryHTMLBuilder.cpp b/plugins/IEView/src/HistoryHTMLBuilder.cpp index 493531e2bc..812b3b5b3d 100644 --- a/plugins/IEView/src/HistoryHTMLBuilder.cpp +++ b/plugins/IEView/src/HistoryHTMLBuilder.cpp @@ -90,7 +90,7 @@ char *HistoryHTMLBuilder::timestampToString(DWORD dwFlags, time_t check) dbtts.szFormat = (char *)"d t";
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, ptrA(mir_utf8encode(szResult)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
@@ -129,9 +129,9 @@ void HistoryHTMLBuilder::loadMsgDlgFont(const char *dbSetting, LOGFONTA * lf, CO lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font.%s.Name", dbSetting);
if (db_get(NULL, HPPMOD, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
+ mir_strcpy(lf->lfFaceName, "Verdana");
else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ mir_strncpy(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
db_free(&dbv);
}
}
diff --git a/plugins/IEView/src/MUCCHTMLBuilder.cpp b/plugins/IEView/src/MUCCHTMLBuilder.cpp index d3e910663e..0728738aac 100644 --- a/plugins/IEView/src/MUCCHTMLBuilder.cpp +++ b/plugins/IEView/src/MUCCHTMLBuilder.cpp @@ -70,9 +70,9 @@ void MUCCHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%dFace", i);
if (db_get(NULL, MUCCMOD, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
+ mir_strcpy(lf->lfFaceName, "Verdana");
else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ mir_strncpy(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
db_free(&dbv);
}
}
@@ -111,7 +111,7 @@ char *MUCCHTMLBuilder::timestampToString(DWORD dwData, time_t check) }
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM) & dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, ptrA(mir_utf8encode(szResult)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/ScriverHTMLBuilder.cpp b/plugins/IEView/src/ScriverHTMLBuilder.cpp index f1057dca36..bc42feb127 100644 --- a/plugins/IEView/src/ScriverHTMLBuilder.cpp +++ b/plugins/IEView/src/ScriverHTMLBuilder.cpp @@ -112,9 +112,9 @@ void ScriverHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "SRMFont%d", i);
if (db_get(NULL, SRMMMOD, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
+ mir_strcpy(lf->lfFaceName, "Verdana");
else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ mir_strncpy(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
db_free(&dbv);
}
}
@@ -172,7 +172,7 @@ char *ScriverHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mod //_tcsncat(szResult, str, 500);
strncat(szResult, str, 500);
}
- lstrcpynA(szResult, ptrA(mir_utf8encode(szResult)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp index da11d66568..2a87dc18f2 100644 --- a/plugins/IEView/src/TabSRMMHTMLBuilder.cpp +++ b/plugins/IEView/src/TabSRMMHTMLBuilder.cpp @@ -143,9 +143,9 @@ void TabSRMMHTMLBuilder::loadMsgDlgFont(int i, LOGFONTA * lf, COLORREF * colour) lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
mir_snprintf(str, SIZEOF(str), "Font%d", i);
if (db_get(NULL, TABSRMM_FONTMODULE, str, &dbv))
- lstrcpyA(lf->lfFaceName, "Verdana");
+ mir_strcpy(lf->lfFaceName, "Verdana");
else {
- lstrcpynA(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
+ mir_strncpy(lf->lfFaceName, dbv.pszVal, sizeof(lf->lfFaceName));
db_free(&dbv);
}
}
@@ -195,7 +195,7 @@ char* TabSRMMHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int isG }
CallService(MS_DB_TIME_TIMESTAMPTOSTRING, check, (LPARAM)& dbtts);
strncat(szResult, str, 500);
- lstrcpynA(szResult, ptrA(mir_utf8encode(szResult)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encode(szResult)), 500);
return szResult;
}
diff --git a/plugins/IEView/src/TemplateHTMLBuilder.cpp b/plugins/IEView/src/TemplateHTMLBuilder.cpp index e31a7ed915..0e2e5ce0be 100644 --- a/plugins/IEView/src/TemplateHTMLBuilder.cpp +++ b/plugins/IEView/src/TemplateHTMLBuilder.cpp @@ -146,7 +146,7 @@ char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mo }
}
- lstrcpynA(szResult, ptrA(mir_utf8encodeT(str)), 500);
+ mir_strncpy(szResult, ptrA(mir_utf8encodeT(str)), 500);
return szResult;
}
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index 5258ca89af..9061969c68 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -220,7 +220,7 @@ void RegisterProtocol(char *proto, TCHAR *account) strncpy(proto_items[id].proto, proto, SIZEOF(proto_items[id].proto));
proto_items[id].proto[SIZEOF(proto_items[id].proto)-1] = 0;
- lstrcpyn(proto_items[id].account, account, SIZEOF(proto_items[id].account));
+ mir_tstrncpy(proto_items[id].account, account, SIZEOF(proto_items[id].account));
proto_items[id].hMenu = NULL;
proto_items[id].old_xstatus = 0;
@@ -240,7 +240,7 @@ int AccListChanged(WPARAM wParam, LPARAM lParam) {
if (wParam == PRAC_UPGRADED || wParam == PRAC_CHANGED)
{
- lstrcpyn(info->account, proto->tszAccountName, SIZEOF(info->account));
+ mir_tstrncpy(info->account, proto->tszAccountName, SIZEOF(info->account));
TCHAR text[512];
mir_sntprintf(text, SIZEOF(text), TranslateT("Send to %s"), info->account);
diff --git a/plugins/ListeningTo/src/players/generic.cpp b/plugins/ListeningTo/src/players/generic.cpp index ff2abd3239..ca44c71f9c 100644 --- a/plugins/ListeningTo/src/players/generic.cpp +++ b/plugins/ListeningTo/src/players/generic.cpp @@ -34,7 +34,7 @@ int m_log(const TCHAR *function, const TCHAR *fmt, ...) mir_sntprintf(text, MAX_REGS(text) - 10, _T("[%08u - %08u] [%s] "),
GetCurrentThreadId(), GetTickCount(), function);
- len = lstrlen(text);
+ len = mir_tstrlen(text);
va_start(va, fmt);
mir_vsntprintf(&text[len], MAX_REGS(text) - len, fmt, va);
diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 2ceafbffc6..3549ddc84a 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -465,7 +465,7 @@ void showMsg(TCHAR* sender,TCHAR* text, DWORD id, char *strUID) //99% of the times you'll just copy this line.
//1% of the times you may wish to change the contact's name. I don't know why you should, but you can.
//char * lpzText;
- //The text for the second line. You could even make something like: char lpzText[128]; lstrcpy(lpzText, "Hello world!"); It's your choice.
+ //The text for the second line. You could even make something like: char lpzText[128]; mir_tstrcpy(lpzText, "Hello world!"); It's your choice.
POPUPATT * mpd = (POPUPATT*)malloc(sizeof(POPUPATT));
ZeroMemory(&ppd, sizeof(ppd)); //This is always a good thing to do.
diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index e686eef680..a6708aabca 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -245,9 +245,9 @@ void CopyToClipboard(HWND hwnd,LPSTR pszMsg, LPTSTR ptszMsg) if (buf == 0)
return;
- hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (lstrlen(buf)+1)*sizeof(TCHAR));
+ hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(buf)+1)*sizeof(TCHAR));
lptstrCopy = (LPTSTR)GlobalLock(hglbCopy);
- lstrcpy(lptstrCopy, buf);
+ mir_tstrcpy(lptstrCopy, buf);
mir_free(buf);
GlobalUnlock(hglbCopy);
@@ -336,7 +336,7 @@ BOOL MirVerExists(MCONTACT hContact) return 0;
ptrT msg(db_get_tsa(hContact, szProto, "MirVer"));
- return lstrlen(msg) != 0;
+ return mir_tstrlen(msg) != 0;
}
void getIP(MCONTACT hContact,LPSTR szProto,LPSTR szIP)
diff --git a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp index 9c05208b43..5648e90235 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_proto.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_proto.cpp @@ -67,7 +67,7 @@ INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){ ShowError(TranslateT(LANG_ENCRYPTION_ERROR));
/* should not be needed
char t[3] = {0, 0, 0};
- if(ccs->wParam & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
+ if(ccs->wParam & PREF_UNICODE) { //TODO!! mir_tstrlen(pre->szMessage)+1 ??
if (strlen(oldmessage)) memcpy(oldmessage, t,3 );
} else {
if (strlen(oldmessage)) memcpy(oldmessage, t, 1);
@@ -300,7 +300,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ /* should not be required ;)
char t[3] = {0, 0, 0};
char t[3] = {0, 0, 0};
- if(pre->flags & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
+ if(pre->flags & PREF_UNICODE) { //TODO!! mir_tstrlen(pre->szMessage)+1 ??
if (pre->szMessage && strlen(pre->szMessage)) memcpy(pre->szMessage, t,3 );
} else {
if (pre->szMessage && strlen(pre->szMessage)) memcpy(pre->szMessage, t, 1);
@@ -313,7 +313,7 @@ INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){ DWORD flags = pre->flags;
/* if(pre->flags & PREF_UTF) {
oldmessage_utf = newmessage;
- } else if(pre->flags & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
+ } else if(pre->flags & PREF_UNICODE) { //TODO!! mir_tstrlen(pre->szMessage)+1 ??
oldmessage_utf = (char*)mir_utf8decodeW(newmessage);
free = true;
} else {
diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 4248ae3fff..1e50d9fbc4 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -801,7 +801,7 @@ void CAppletManager::SendTypingNotification(MCONTACT hContact,bool bEnable) HANDLE CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage) { tstring strAscii = _A2T(toNarrowString(strMessage).c_str()); - int bufSize = lstrlen(strAscii.c_str())+1; + int bufSize = mir_tstrlen(strAscii.c_str())+1; SMessageJob *pJob = new SMessageJob(); pJob->dwTimestamp = GetTickCount(); pJob->hContact = hContact; @@ -849,7 +849,7 @@ HANDLE CAppletManager::SendMessageToContact(MCONTACT hContact,tstring strMessage memcpy(pJob->pcBuffer,szMsgUtf,pJob->iBufferSize); mir_free(szMsgUtf); } else { - bIsUnicode = !IsUnicodeAscii(strMessage.c_str(),lstrlen(strMessage.c_str())); + bIsUnicode = !IsUnicodeAscii(strMessage.c_str(),mir_tstrlen(strMessage.c_str())); if(bIsUnicode) { pref = PREF_UNICODE; pJob->iBufferSize = bufSize * (sizeof(TCHAR) + 1); diff --git a/plugins/MirandaG15/src/CConfig.cpp b/plugins/MirandaG15/src/CConfig.cpp index a35feaa0a3..e5809be5bf 100644 --- a/plugins/MirandaG15/src/CConfig.cpp +++ b/plugins/MirandaG15/src/CConfig.cpp @@ -346,9 +346,9 @@ void CConfig::LoadFontSettings(int iFont) mir_snprintf(szSetting,SIZEOF(szSetting),"Font%dName",iFont);
DBVARIANT dbv;
if (db_get_ts(NULL, "MirandaG15", szSetting, &dbv))
- lstrcpy(m_logfont[iFont].lfFaceName,_T("Small Fonts"));
+ mir_tstrcpy(m_logfont[iFont].lfFaceName,_T("Small Fonts"));
else {
- lstrcpy(m_logfont[iFont].lfFaceName, dbv.ptszVal);
+ mir_tstrcpy(m_logfont[iFont].lfFaceName, dbv.ptszVal);
db_free(&dbv);
}
diff --git a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp index 7240263a79..d1ed4dc48d 100644 --- a/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp +++ b/plugins/MirandaG15/src/LCDFramework/CLCDGfx.cpp @@ -302,7 +302,7 @@ void CLCDGfx::DrawText(int nX, int nY, LPCTSTR sText) dtp.cbSize = sizeof(DRAWTEXTPARAMS);
RECT rBounds = {nX,nY,GetClipWidth(),GetClipHeight()};
- DrawTextEx(m_hDC,(LPTSTR)sText,lstrlen(sText),&rBounds,(DT_LEFT | DT_NOPREFIX),&dtp);
+ DrawTextEx(m_hDC,(LPTSTR)sText,mir_tstrlen(sText),&rBounds,(DT_LEFT | DT_NOPREFIX),&dtp);
// restores
SetMapMode(m_hDC, nOldMapMode);
diff --git a/plugins/ModernOpt/src/mopt_selector.cpp b/plugins/ModernOpt/src/mopt_selector.cpp index 7ac405b294..0c923acfcb 100644 --- a/plugins/ModernOpt/src/mopt_selector.cpp +++ b/plugins/ModernOpt/src/mopt_selector.cpp @@ -47,9 +47,9 @@ static void sttPreviewSkin(MODERNOPTOBJECT *obj, TCHAR *fn, LPDRAWITEMSTRUCT lps }
char *afn = mir_t2a(fn);
- char *fnpreview = (char *)mir_alloc(lstrlenA(afn) + 10);
- lstrcpyA(fnpreview, afn);
- lstrcatA(fnpreview, ".png");
+ char *fnpreview = (char *)mir_alloc(mir_strlen(afn) + 10);
+ mir_strcpy(fnpreview, afn);
+ mir_strcat(fnpreview, ".png");
HBITMAP hbmPreview = (HBITMAP)CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)fnpreview);
mir_free(afn);
mir_free(fnpreview);
@@ -96,7 +96,7 @@ struct TSkinListItem path = (TCHAR *)mir_alloc(MAX_PATH * sizeof(TCHAR));
PathToRelativeT(curPath, path);
- int length = lstrlen(curPath)+lstrlen(fn)+2;
+ int length = mir_tstrlen(curPath)+mir_tstrlen(fn)+2;
filename = (TCHAR *)mir_alloc(length * sizeof(TCHAR));
mir_sntprintf(filename, length, _T("%s\\%s"), curPath, fn);
}
@@ -128,7 +128,7 @@ struct TSelectorData static bool CheckExt(TCHAR *fn, TCHAR *ext, int n)
{
- int l = lstrlen(fn);
+ int l = mir_tstrlen(fn);
return (l > n) && !lstrcmp(fn + l - n, ext);
}
@@ -140,7 +140,7 @@ static void BuildSkinList(HWND hwndList, TCHAR *szExt, int nExtLength = -1, bool if (TCHAR *p = _tcsrchr(mirPath, _T('\\'))) *p = 0;
SetCurrentDirectory(mirPath);
SendMessage(hwndList, LB_RESETCONTENT, 0, 0);
- nExtLength = lstrlen(szExt);
+ nExtLength = mir_tstrlen(szExt);
SendMessage(hwndList, WM_SETREDRAW, FALSE, 0);
}
diff --git a/plugins/MsgPopup/src/main.cpp b/plugins/MsgPopup/src/main.cpp index b7e5872860..035db49c93 100644 --- a/plugins/MsgPopup/src/main.cpp +++ b/plugins/MsgPopup/src/main.cpp @@ -87,8 +87,8 @@ void popupMessage(LPCTSTR lpText, LPCTSTR lpCaption, UINT uType) ppd.iSeconds = options.Timeout[indx];
ppd.lchIcon = (HICON)LoadImage(NULL, MAKEINTRESOURCE(iIcon), IMAGE_ICON, SM_CXSMICON, SM_CYSMICON, LR_SHARED);
- lstrcpy(ppd.lptzContactName, lpCaption);
- lstrcpy(ppd.lptzText, lpText);
+ mir_tstrcpy(ppd.lptzContactName, lpCaption);
+ mir_tstrcpy(ppd.lptzText, lpText);
PUAddPopupT(&ppd);
if(options.Sound)
MessageBeep(uType);
diff --git a/plugins/MyDetails/src/data.cpp b/plugins/MyDetails/src/data.cpp index 55b8a564d9..85eba40907 100644 --- a/plugins/MyDetails/src/data.cpp +++ b/plugins/MyDetails/src/data.cpp @@ -54,8 +54,8 @@ void DeInitProtocolData() Protocol::Protocol(const char *aName, const TCHAR *descr)
{
- lstrcpynA(name, aName, SIZEOF(name));
- lstrcpyn(description, descr, SIZEOF(description));
+ mir_strncpy(name, aName, SIZEOF(name));
+ mir_tstrncpy(description, descr, SIZEOF(description));
data_changed = true;
@@ -88,7 +88,7 @@ void Protocol::lcopystr(TCHAR *dest, TCHAR *src, size_t maxlen) {
if (lstrcmp(dest, src) != 0) {
data_changed = true;
- lstrcpyn(dest, src, (DWORD)maxlen);
+ mir_tstrncpy(dest, src, (DWORD)maxlen);
}
}
@@ -485,7 +485,7 @@ void ProtocolArray::SetNicks(const TCHAR *nick) if (nick == NULL || nick[0] == '\0')
return;
- lstrcpyn(default_nick, nick, SIZEOF(default_nick));
+ mir_tstrncpy(default_nick, nick, SIZEOF(default_nick));
db_set_ts(0, MODULE_NAME, SETTING_DEFAULT_NICK, nick);
@@ -550,7 +550,7 @@ TCHAR *ProtocolArray::GetDefaultStatusMsg(int status) TCHAR *tmp = (TCHAR *)CallService(MS_AWAYMSG_GETSTATUSMSGT, (WPARAM)status, 0);
if (tmp != NULL) {
- lstrcpyn(default_status_message, tmp, SIZEOF(default_status_message));
+ mir_tstrncpy(default_status_message, tmp, SIZEOF(default_status_message));
mir_free(tmp);
}
@@ -590,7 +590,7 @@ static char *StatusModeToDbSetting(int status, const char *suffix) case ID_STATUS_IDLE: prefix = "Idl"; break;
default: return NULL;
}
- lstrcpyA(str, prefix);
- lstrcatA(str, suffix);
+ mir_strcpy(str, prefix);
+ mir_strcat(str, suffix);
return str;
}
diff --git a/plugins/MyDetails/src/services.cpp b/plugins/MyDetails/src/services.cpp index 364946146a..c613b35763 100644 --- a/plugins/MyDetails/src/services.cpp +++ b/plugins/MyDetails/src/services.cpp @@ -60,7 +60,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam if (foundDefNick)
if (_tcsicmp(protocols->default_nick, nick) != 0)
- lstrcpy(protocols->default_nick, nick);
+ mir_tstrcpy(protocols->default_nick, nick);
}
SetDlgItemText(hwndDlg, IDC_NICKNAME, protocols->default_nick);
@@ -189,7 +189,7 @@ INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam) char *proto = (char *)wParam;
if (proto == NULL) {
if (protocols->default_nick != NULL)
- lstrcpyn(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
+ mir_tstrncpy(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
else
ret[0] = '\0';
@@ -198,7 +198,7 @@ INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam) else {
Protocol *protocol = protocols->Get(proto);
if (protocol != NULL) {
- lstrcpyn(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
+ mir_tstrncpy(ret, protocol->nickname, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
return 0;
}
@@ -268,7 +268,7 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) if (proto == NULL) {
if (protocols->default_avatar_file != NULL)
- lstrcpyn(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ mir_tstrncpy(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
else
ret[0] = '\0';
@@ -283,7 +283,7 @@ INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam) protocols->Get(i)->GetAvatar();
if (protocols->Get(i)->avatar_file != NULL)
- lstrcpyn(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
+ mir_tstrncpy(ret, protocols->Get(i)->avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
else
ret[0] = '\0';
diff --git a/plugins/NewAwaySysMod/src/CString.h b/plugins/NewAwaySysMod/src/CString.h index 0d81a4f7c3..161977cf28 100644 --- a/plugins/NewAwaySysMod/src/CString.h +++ b/plugins/NewAwaySysMod/src/CString.h @@ -29,14 +29,14 @@ #include "m_system.h"
#include "m_database.h"
-__inline int My_lstrlen(LPCSTR lpString) {return lstrlenA(lpString);}
-__inline int My_lstrlen(LPCWSTR lpString) {return lstrlenW(lpString);}
+__inline int My_lstrlen(LPCSTR lpString) {return mir_strlen(lpString);}
+__inline int My_lstrlen(LPCWSTR lpString) {return mir_wstrlen(lpString);}
__inline int My_lstrcmp(LPCSTR lpString1, LPCSTR lpString2) {return lstrcmpA(lpString1, lpString2);}
__inline int My_lstrcmp(LPCWSTR lpString1, LPCWSTR lpString2) {return lstrcmpW(lpString1, lpString2);}
__inline LPCSTR My_strstr(LPCSTR lpString1, LPCSTR lpString2) {return strstr(lpString1, lpString2);}
__inline LPWSTR My_strstr(LPCWSTR lpString1, LPCWSTR lpString2) {return (LPWSTR)wcsstr(lpString1, lpString2);}
-__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return lstrcpyA(lpString1, lpString2);}
-__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return lstrcpyW(lpString1, lpString2);}
+__inline LPSTR My_lstrcpy(LPSTR lpString1, LPCSTR lpString2) {return mir_strcpy(lpString1, lpString2);}
+__inline LPWSTR My_lstrcpy(LPWSTR lpString1, LPCWSTR lpString2) {return mir_wstrcpy(lpString1, lpString2);}
__inline LPSTR My_strncpy(LPSTR lpString1, LPCSTR lpString2, int Len) {return strncpy(lpString1, lpString2, Len);}
__inline LPWSTR My_strncpy(LPWSTR lpString1, LPCWSTR lpString2, int Len) {return wcsncpy(lpString1, lpString2, Len);}
__inline LPSTR My_strlwr(LPSTR lpString) {return _strlwr(lpString);}
diff --git a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp index aca2c68830..040b566c94 100644 --- a/plugins/NewAwaySysMod/src/GroupCheckbox.cpp +++ b/plugins/NewAwaySysMod/src/GroupCheckbox.cpp @@ -97,7 +97,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l SIZE size;
TCHAR *szText = (TCHAR*)malloc(Len * sizeof(TCHAR));
GetWindowText(hWnd, szText, Len);
- GetTextExtentPoint32(hdc, szText, lstrlen(szText), &size);
+ GetTextExtentPoint32(hdc, szText, mir_tstrlen(szText), &size);
free(szText);
rcText.right = size.cx;
rcText.bottom = size.cy;
@@ -292,7 +292,7 @@ static int CALLBACK CheckboxWndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM l GetThemeTextExtent(hTheme, hdcMem, BP_GROUPBOX, IsWindowEnabled(hWnd) ? GBS_NORMAL : GBS_DISABLED, szTextT, -1, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE, 0, &rcText);
else {
SIZE size;
- GetTextExtentPoint32(hdcMem, szTextT, lstrlen(szTextT), &size);
+ GetTextExtentPoint32(hdcMem, szTextT, mir_tstrlen(szTextT), &size);
rcText.right = size.cx;
rcText.bottom = size.cy;
}
diff --git a/plugins/NewAwaySysMod/src/Notification.cpp b/plugins/NewAwaySysMod/src/Notification.cpp index 258cdcfccc..6ef034d2f9 100644 --- a/plugins/NewAwaySysMod/src/Notification.cpp +++ b/plugins/NewAwaySysMod/src/Notification.cpp @@ -26,8 +26,8 @@ void ShowMsg(TCHAR *FirstLine, TCHAR *SecondLine, bool IsErrorMsg, int Timeout) if (ServiceExists(MS_POPUP_ADDPOPUPT)) {
POPUPDATAT ppd = { 0 };
ppd.lchIcon = LoadIcon(NULL, IsErrorMsg ? IDI_EXCLAMATION : IDI_INFORMATION);
- lstrcpyn(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, SecondLine, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, FirstLine, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, SecondLine, MAX_SECONDLINE);
ppd.colorBack = IsErrorMsg ? 0x0202E3 : 0xE8F1FD;
ppd.colorText = IsErrorMsg ? 0xE8F1FD : 0x000000;
ppd.iSeconds = Timeout;
diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 12cd708ddc..8c6e7c8e43 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -369,7 +369,7 @@ void ApplySelContactsMessage(SetAwayMsgData* dat, CCList *CList, PTREEITEMARRAY HWND hwndDlg = g_SetAwayMsgPage.GetWnd();
GetDlgItemText(hwndDlg, IDC_SAWAYMSG_MSGDATA, Message.GetBuffer(AWAY_MSGDATA_MAX), AWAY_MSGDATA_MAX);
Message.ReleaseBuffer();
- if (!lstrlen(Message))
+ if (!mir_tstrlen(Message))
Message = NULL; // delete personal message if it's empty
if (CList) {
diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index 835a05102a..90d12c5816 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -387,11 +387,11 @@ static TCHAR* GetEventPreview(DBEVENTINFO *dbei) else commentFix = POPUP_COMMENT_OTHER;
}
- if ( lstrlen(comment1) > 0) {
+ if ( mir_tstrlen(comment1) > 0) {
mir_free(comment2);
return comment1;
}
- if ( lstrlen(comment2) > 0) {
+ if ( mir_tstrlen(comment2) > 0) {
mir_free(comment1);
return comment2;
}
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index ad821778ba..9a3d42a52f 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -189,7 +189,7 @@ TCHAR *GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) TCHAR *str = (TCHAR *)mir_alloc(2048 * sizeof(TCHAR));
str[0] = _T('\0');
- int len = lstrlen(tmplt);
+ int len = mir_tstrlen(tmplt);
for (int i = 0; i < len; i++) {
tmp[0] = _T('\0');
@@ -199,37 +199,37 @@ TCHAR *GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) switch (tmplt[i]) {
case 'n':
if (n->compare == COMPARE_DEL || _tcscmp(n->newstatusmsg, TranslateT("<no status message>")) == 0)
- lstrcpyn(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
else {
TCHAR *_tmp = AddCR(n->newstatusmsg);
- lstrcpyn(tmp, _tmp, SIZEOF(tmp));
+ mir_tstrncpy(tmp, _tmp, SIZEOF(tmp));
mir_free(_tmp);
}
break;
case 'o':
if (n->oldstatusmsg == NULL || n->oldstatusmsg[0] == _T('\0') || _tcscmp(n->oldstatusmsg, TranslateT("<no status message>")) == 0)
- lstrcpyn(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
else {
TCHAR *_tmp = AddCR(n->oldstatusmsg);
- lstrcpyn(tmp, _tmp, SIZEOF(tmp));
+ mir_tstrncpy(tmp, _tmp, SIZEOF(tmp));
mir_free(_tmp);
}
break;
case 'c':
if (n->hContact == NULL)
- lstrcpyn(tmp, TranslateT("Contact"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("Contact"), SIZEOF(tmp));
else
- lstrcpyn(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)n->hContact, GCDNF_TCHAR), SIZEOF(tmp));
+ mir_tstrncpy(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)n->hContact, GCDNF_TCHAR), SIZEOF(tmp));
break;
case 's':
if (n->hContact == NULL)
- lstrcpyn(tmp, TranslateT("<unknown>"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("<unknown>"), SIZEOF(tmp));
else
- lstrcpyn(tmp, StatusList[Index(db_get_w(n->hContact, n->proto, "Status", ID_STATUS_ONLINE))].lpzStandardText, SIZEOF(tmp));
+ mir_tstrncpy(tmp, StatusList[Index(db_get_w(n->hContact, n->proto, "Status", ID_STATUS_ONLINE))].lpzStandardText, SIZEOF(tmp));
break;
default:
@@ -256,10 +256,10 @@ TCHAR *GetStr(STATUSMSGINFO *n, const TCHAR *tmplt) else tmp[0] = tmplt[i], tmp[1] = _T('\0');
if (tmp[0] != _T('\0')) {
- if (lstrlen(tmp) + lstrlen(str) < 2044)
- lstrcat(str, tmp);
+ if (mir_tstrlen(tmp) + mir_tstrlen(str) < 2044)
+ mir_tstrcat(str, tmp);
else {
- lstrcat(str, _T("..."));
+ mir_tstrcat(str, _T("..."));
break;
}
}
@@ -872,121 +872,121 @@ void InitStatusList() int index = 0;
//Online
index = Index(ID_STATUS_ONLINE);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Online"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("global.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is back online!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is back online!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is back online!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Online"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnline", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Online"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("global.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40072bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40072tx", COLOR_TX_DEFAULT);
//Offline
index = Index(ID_STATUS_OFFLINE);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Offline"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("offline.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went offline! :("), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went offline! :("), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went offline! :("), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Offline"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOffline", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Offline"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("offline.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40071bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40071tx", COLOR_TX_DEFAULT);
//Invisible
index = Index(ID_STATUS_INVISIBLE);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Invisible"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("invisible.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) hides in shadows..."), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) hides in shadows..."), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) hides in shadows..."), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Invisible"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserInvisible", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Invisible"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("invisible.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40078bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40078tx", COLOR_TX_DEFAULT);
//Free for chat
index = Index(ID_STATUS_FREECHAT);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Free for chat"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("free4chat.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) feels talkative!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) feels talkative!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) feels talkative!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Free for chat"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserFreeForChat", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Free for chat"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("free4chat.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40077bg", COLOR_BG_AVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40077tx", COLOR_TX_DEFAULT);
//Away
index = Index(ID_STATUS_AWAY);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Away"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("away.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) went away"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) went away"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) went away"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Away"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserAway", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Away"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("away.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40073bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40073tx", COLOR_TX_DEFAULT);
//NA
index = Index(ID_STATUS_NA);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("NA"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Not available"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("na.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) isn't there anymore!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("NA"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserNA", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Not available"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("na.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40075bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40075tx", COLOR_TX_DEFAULT);
//Occupied
index = Index(ID_STATUS_OCCUPIED);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Occupied"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("occupied.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) has something else to do"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) has something else to do"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) has something else to do"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Occupied"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOccupied", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Occupied"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("occupied.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40076bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40076tx", COLOR_TX_DEFAULT);
//DND
index = Index(ID_STATUS_DND);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("DND"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Do not disturb"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("dnd.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) doesn't want to be disturbed!"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("DND"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserDND", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Do not disturb"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("dnd.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40074bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40074tx", COLOR_TX_DEFAULT);
//Out to lunch
index = Index(ID_STATUS_OUTTOLUNCH);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Out to lunch"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("lunch.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) is eating something"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) is eating something"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) is eating something"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("Out to lunch"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOutToLunch", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: Out to lunch"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("lunch.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40080bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40080tx", COLOR_TX_DEFAULT);
//On the phone
index = Index(ID_STATUS_ONTHEPHONE);
- lstrcpyn(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT);
- lstrcpyn(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT);
- lstrcpynA(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusList[index].lpzSkinSoundDesc, LPGENT("User: On the phone"), MAX_SKINSOUNDDESC);
- lstrcpyn(StatusList[index].lpzSkinSoundFile, _T("phone.wav"), MAX_PATH);
+ mir_tstrncpy(StatusList[index].lpzMStatusText, TranslateT("(M) had to answer the phone"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzFStatusText, TranslateT("(F) had to answer the phone"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzUStatusText, TranslateT("(U) had to answer the phone"), MAX_STATUSTEXT);
+ mir_tstrncpy(StatusList[index].lpzStandardText, TranslateT("On the phone"), MAX_STANDARDTEXT);
+ mir_strncpy(StatusList[index].lpzSkinSoundName, "UserOnThePhone", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundDesc, LPGENT("User: On the phone"), MAX_SKINSOUNDDESC);
+ mir_tstrncpy(StatusList[index].lpzSkinSoundFile, _T("phone.wav"), MAX_PATH);
StatusList[index].colorBack = db_get_dw(NULL, MODULE, "40079bg", COLOR_BG_NAVAILDEFAULT);
StatusList[index].colorText = db_get_dw(NULL, MODULE, "40079tx", COLOR_TX_DEFAULT);
@@ -1002,38 +1002,38 @@ void InitStatusList() //From offline
index = ID_STATUS_FROMOFFLINE;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("User: from offline (has priority!)"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, "UserFromOffline", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("User: from offline (has priority!)"), MAX_SKINSOUNDDESC);
//Status message removed
index = ID_STATUS_SMSGREMOVED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message removed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgRemoved", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message removed"), MAX_SKINSOUNDDESC);
//Status message changed
index = ID_STATUS_SMSGCHANGED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message changed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, "StatusMsgChanged", MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Status message changed"), MAX_SKINSOUNDDESC);
//Extra status removed
index = ID_STATUS_XREMOVED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status removed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_REMOVED, MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status removed"), MAX_SKINSOUNDDESC);
//Extra status message changed
index = ID_STATUS_XMSGCHANGED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message changed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGCHANGED, MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message changed"), MAX_SKINSOUNDDESC);
//Extra status changed
index = ID_STATUS_XCHANGED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status changed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_CHANGED, MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status changed"), MAX_SKINSOUNDDESC);
//Extra status message removed
index = ID_STATUS_XMSGREMOVED;
- lstrcpynA(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME);
- lstrcpyn(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message removed"), MAX_SKINSOUNDDESC);
+ mir_strncpy(StatusListEx[index].lpzSkinSoundName, XSTATUS_SOUND_MSGREMOVED, MAX_SKINSOUNDNAME);
+ mir_tstrncpy(StatusListEx[index].lpzSkinSoundDesc, LPGENT("Extra status message removed"), MAX_SKINSOUNDDESC);
}
void CALLBACK ConnectionTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
diff --git a/plugins/NewXstatusNotify/src/utils.cpp b/plugins/NewXstatusNotify/src/utils.cpp index 0ab6804695..b3fd4781ea 100644 --- a/plugins/NewXstatusNotify/src/utils.cpp +++ b/plugins/NewXstatusNotify/src/utils.cpp @@ -111,24 +111,24 @@ WCHAR *mir_dupToUnicodeEx(char *ptr, UINT CodePage) TCHAR *AddCR(const TCHAR *stzText)
{
const TCHAR *found;
- int i = 0, len = lstrlen(stzText), j;
+ int i = 0, len = mir_tstrlen(stzText), j;
TCHAR *tmp = (TCHAR *)mir_alloc(1024 * sizeof(TCHAR));
*tmp = _T('\0');
while ((found = _tcsstr((stzText + i), _T("\n"))) != NULL && _tcslen(tmp) + 1 < 1024) {
j = (int)(found - stzText);
- if (lstrlen(tmp) + j - i + 2 < 1024)
+ if (mir_tstrlen(tmp) + j - i + 2 < 1024)
tmp = _tcsncat(tmp, stzText + i, j - i);
else
break;
if (j == 0 || *(stzText + j - 1) != _T('\r'))
- tmp = lstrcat(tmp, _T("\r"));
+ tmp = mir_tstrcat(tmp, _T("\r"));
- tmp = lstrcat(tmp, _T("\n"));
+ tmp = mir_tstrcat(tmp, _T("\n"));
i = j + 1;
}
- if (lstrlen(tmp) + len - i + 1 < 1024)
- tmp = lstrcat(tmp, stzText + i);
+ if (mir_tstrlen(tmp) + len - i + 1 < 1024)
+ tmp = mir_tstrcat(tmp, stzText + i);
return tmp;
}
diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 113d20a642..06cbeffe0e 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -101,7 +101,7 @@ TCHAR *ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt) TCHAR *str = (TCHAR *)mir_alloc(2048 * sizeof(TCHAR));
str[0] = _T('\0');
- int len = lstrlen(tmplt);
+ int len = mir_tstrlen(tmplt);
for (int i = 0; i < len; i++) {
tmp[0] = _T('\0');
@@ -112,32 +112,32 @@ TCHAR *ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt) case 'n':
{
TCHAR stzType[32];
- lstrcpyn(tmp, GetStatusTypeAsString(xsc->type, stzType), SIZEOF(tmp));
+ mir_tstrncpy(tmp, GetStatusTypeAsString(xsc->type, stzType), SIZEOF(tmp));
}
break;
case 't':
if (xsc->stzTitle == NULL || xsc->stzTitle[0] == _T('\0'))
- lstrcpyn(tmp, TranslateT("<no title>"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("<no title>"), SIZEOF(tmp));
else
- lstrcpyn(tmp, xsc->stzTitle, SIZEOF(tmp));
+ mir_tstrncpy(tmp, xsc->stzTitle, SIZEOF(tmp));
break;
case 'm':
if (xsc->stzText == NULL || xsc->stzText[0] == _T('\0'))
- lstrcpyn(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("<no status message>"), SIZEOF(tmp));
else {
TCHAR *_tmp = AddCR(xsc->stzText);
- lstrcpyn(tmp, _tmp, SIZEOF(tmp));
+ mir_tstrncpy(tmp, _tmp, SIZEOF(tmp));
mir_free(_tmp);
}
break;
case 'c':
if (xsc->hContact == NULL)
- lstrcpyn(tmp, TranslateT("Contact"), SIZEOF(tmp));
+ mir_tstrncpy(tmp, TranslateT("Contact"), SIZEOF(tmp));
else
- lstrcpyn(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GCDNF_TCHAR), SIZEOF(tmp));
+ mir_tstrncpy(tmp, (TCHAR *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)xsc->hContact, GCDNF_TCHAR), SIZEOF(tmp));
break;
default:
@@ -165,10 +165,10 @@ TCHAR *ReplaceVars(XSTATUSCHANGE *xsc, const TCHAR *tmplt) tmp[0] = tmplt[i], tmp[1] = _T('\0');
if (tmp[0] != _T('\0')) {
- if (lstrlen(tmp) + lstrlen(str) < 2044)
- lstrcat(str, tmp);
+ if (mir_tstrlen(tmp) + mir_tstrlen(str) < 2044)
+ mir_tstrcat(str, tmp);
else {
- lstrcat(str, _T("..."));
+ mir_tstrcat(str, _T("..."));
break;
}
}
diff --git a/plugins/NewsAggregator/Src/Services.cpp b/plugins/NewsAggregator/Src/Services.cpp index efe0c49de4..53fa224917 100644 --- a/plugins/NewsAggregator/Src/Services.cpp +++ b/plugins/NewsAggregator/Src/Services.cpp @@ -40,7 +40,7 @@ int NewsAggrInit(WPARAM, LPARAM) if (hNewsAggregatorFolder = FoldersRegisterCustomPathT(LPGEN("Avatars"), LPGEN("News Aggregator"), MIRANDA_USERDATAT _T("\\Avatars\\")_T(DEFAULT_AVATARS_FOLDER)))
FoldersGetCustomPathT(hNewsAggregatorFolder, tszRoot, MAX_PATH, _T(""));
else
- lstrcpyn(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot));
+ mir_tstrncpy(tszRoot, VARST( _T("%miranda_userdata%\\Avatars\\"_T(DEFAULT_AVATARS_FOLDER))), SIZEOF(tszRoot));
for (MCONTACT hContact = db_find_first(MODULE); hContact; hContact = db_find_next(hContact, MODULE)) {
if (!db_get_b(NULL, MODULE, "StartupRetrieve", 1))
@@ -77,7 +77,7 @@ int NewsAggrPreShutdown(WPARAM, LPARAM) INT_PTR NewsAggrGetName(WPARAM wParam, LPARAM lParam)
{
if(lParam) {
- lstrcpynA((char *)lParam, MODULE, wParam);
+ mir_strncpy((char *)lParam, MODULE, wParam);
return 0;
}
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp index 0e162b3674..8638bc5e48 100644 --- a/plugins/Non-IM Contact/src/contactinfo.cpp +++ b/plugins/Non-IM Contact/src/contactinfo.cpp @@ -96,7 +96,7 @@ int BrowseForFolder(HWND hwnd,char *szPath) ITEMIDLIST *pidlResult = SHBrowseForFolder(&bi);
if (pidlResult) {
SHGetPathFromIDListA(pidlResult, szPath);
- lstrcatA(szPath,"\\");
+ mir_strcat(szPath,"\\");
result = 1;
}
pMalloc->Free(pidlResult);
diff --git a/plugins/Non-IM Contact/src/files.cpp b/plugins/Non-IM Contact/src/files.cpp index 226935c79e..4adadbfc6b 100644 --- a/plugins/Non-IM Contact/src/files.cpp +++ b/plugins/Non-IM Contact/src/files.cpp @@ -65,7 +65,7 @@ int Openfile(char *outputFile, int saveOpen) //0=save, 1=open r = GetSaveFileNameA(&ofn);
if (!r)
return 0;
- lstrcpyA(outputFile,filename);
+ mir_strcpy(outputFile,filename);
return 1;
}
diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp index 5c300de80e..8c7ecb594d 100644 --- a/plugins/Non-IM Contact/src/http.cpp +++ b/plugins/Non-IM Contact/src/http.cpp @@ -57,8 +57,8 @@ int InternetDownloadFile (char *szUrl) else if (nlhrReply->resultCode == 200)
{
// allocate memory and save the retrieved data
- szData = (char *)malloc(lstrlenA(nlhrReply->pData)+2);
- lstrcpynA(szData, nlhrReply->pData, lstrlenA(nlhrReply->pData));
+ szData = (char *)malloc(mir_strlen(nlhrReply->pData)+2);
+ mir_strncpy(szData, nlhrReply->pData, mir_strlen(nlhrReply->pData));
}
// if the recieved code is 302 Moved, Found, etc
else if (nlhrReply->resultCode == 302)
diff --git a/plugins/Non-IM Contact/src/services.cpp b/plugins/Non-IM Contact/src/services.cpp index 8b2348f9c9..79f4020e3f 100644 --- a/plugins/Non-IM Contact/src/services.cpp +++ b/plugins/Non-IM Contact/src/services.cpp @@ -41,7 +41,7 @@ INT_PTR GetLCCaps(WPARAM wParam,LPARAM lParam) //=======================================================
INT_PTR GetLCName(WPARAM wParam,LPARAM lParam)
{
- lstrcpynA((char*)lParam, MODNAME, wParam);
+ mir_strncpy((char*)lParam, MODNAME, wParam);
return 0;
}
diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 03f5628709..db503b162a 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -452,10 +452,10 @@ void Nudge_ShowPopup(CNudgeElement n, MCONTACT hContact, TCHAR * Message) NudgePopup.PluginWindowProc = NudgePopupProc;
NudgePopup.PluginData = (void *)1;
- //lstrcpy(NudgePopup.lpzText, Translate(Message));
- lstrcpy(NudgePopup.lptzText, Message);
+ //mir_tstrcpy(NudgePopup.lpzText, Translate(Message));
+ mir_tstrcpy(NudgePopup.lptzText, Message);
- lstrcpy(NudgePopup.lptzContactName, lpzContactName);
+ mir_tstrcpy(NudgePopup.lptzContactName, lpzContactName);
CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&NudgePopup, 0);
}
diff --git a/plugins/PackUpdater/Src/Notifications.cpp b/plugins/PackUpdater/Src/Notifications.cpp index 4944abfeb8..081cae06b8 100644 --- a/plugins/PackUpdater/Src/Notifications.cpp +++ b/plugins/PackUpdater/Src/Notifications.cpp @@ -115,8 +115,8 @@ VOID show_popup(HWND hDlg, LPCTSTR Title, LPCTSTR Text, int Number, int ActType) pd.cbSize = sizeof(pd);
pd.lchContact = NULL; //(HANDLE)wParam;
pd.lchIcon = LoadSkinnedIcon(PopupsList[Number].Icon);
- lstrcpyn(pd.lptzText, Text, SIZEOF(pd.lptzText));
- lstrcpyn(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
+ mir_tstrncpy(pd.lptzText, Text, SIZEOF(pd.lptzText));
+ mir_tstrncpy(pd.lptzContactName, Title, SIZEOF(pd.lptzContactName));
switch (MyOptions.DefColors) {
case byCOLOR_WINDOWS:
pd.colorBack = GetSysColor(COLOR_BTNFACE);
@@ -179,7 +179,7 @@ static void __stdcall CreateDownloadDialog(void*) if ( ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, "Popup", "ModuleIsEnabled", 1) && db_get_b(NULL,MODNAME, "Popups3", DEFAULT_POPUP_ENABLED))
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_POPUPDUMMI), NULL, DlgDownloadPop);
else if (db_get_b(NULL,MODNAME, "Popups3M", DEFAULT_MESSAGE_ENABLED)) {
- lstrcpyn(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
+ mir_tstrncpy(tszDialogMsg, Text, SIZEOF(tszDialogMsg));
hDlgDld = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DOWNLOAD), NULL, DlgDownload);
}
}
@@ -369,16 +369,16 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam CreateDirectory(tszFileDest, NULL);
break;
default:
- lstrcpyn(tszFileDest, tszRoot, SIZEOF(tszFileDest));
+ mir_tstrncpy(tszFileDest, tszRoot, SIZEOF(tszFileDest));
break;
}
mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\Backups"), tszRoot);
CreateDirectory(tszBuff, NULL);
- lstrcpyn(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
+ mir_tstrncpy(tszFileName, todo[i].File.tszDiskPath, SIZEOF(tszFileName));
mir_sntprintf(todo[i].File.tszDiskPath, SIZEOF(todo[i].File.tszDiskPath), _T("%s\\%s"), tszFileDest, tszFileName);
UpdatesCount++;
- tszExt = &todo[i].File.tszDownloadURL[lstrlen(todo[i].File.tszDownloadURL)-5];
+ tszExt = &todo[i].File.tszDownloadURL[mir_tstrlen(todo[i].File.tszDownloadURL)-5];
if (lstrcmp(tszExt, _T(".html")) == 0) {
char* szUrl = mir_t2a(todo[i].File.tszDownloadURL);
CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl);
@@ -399,7 +399,7 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam continue;
}
}
- lstrcpyn(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
+ mir_tstrncpy(todo[i].tszCurVer, todo[i].tszNewVer, SIZEOF(todo[i].tszCurVer));
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_CurrentVersion", todo[i].FileNum);
db_set_ts(NULL, MODNAME, szKey, todo[i].tszCurVer);
arFileType.push_back(todo[i].FileType);
@@ -413,9 +413,9 @@ INT_PTR CALLBACK DlgUpdate(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam }
if (UpdatesCount > 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- lstrcpyn(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Downloads complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
else if (UpdatesCount == 1 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0)
- lstrcpyn(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
+ mir_tstrncpy(tszBuff, TranslateT("Download complete. Start updating? All your data will be saved and Miranda NG will be closed."), SIZEOF(tszBuff));
if (UpdatesCount > 0 && lstrcmp(arExt[0].c_str(), _T(".html")) != 0) {
INT rc = -1;
Title = TranslateT("Pack Updater");
diff --git a/plugins/PackUpdater/Src/PackUpdater.cpp b/plugins/PackUpdater/Src/PackUpdater.cpp index ed5213062e..ab5e8d63ca 100644 --- a/plugins/PackUpdater/Src/PackUpdater.cpp +++ b/plugins/PackUpdater/Src/PackUpdater.cpp @@ -55,7 +55,7 @@ extern "C" __declspec(dllexport) int Load(void) mir_getLP(&pluginInfoEx);
TCHAR* tszFolder = Utils_ReplaceVarsT(_T("%miranda_userdata%\\"DEFAULT_UPDATES_FOLDER));
- lstrcpyn(tszRoot, tszFolder, SIZEOF(tszRoot));
+ mir_tstrncpy(tszRoot, tszFolder, SIZEOF(tszRoot));
hPackUpdaterFolder = FoldersRegisterCustomPathT(MODULEA, LPGEN("Pack Updater"), MIRANDA_USERDATAT _T("\\")DEFAULT_UPDATES_FOLDER);
if (hPackUpdaterFolder)
diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 49d13a9f6d..7a92f49655 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -211,10 +211,10 @@ static void CheckUpdates(void *) }
// Download version info
pFileUrl = (FILEURL *)mir_alloc(sizeof(*pFileUrl));
- lstrcpyn(pFileUrl->tszDownloadURL, dbVar.ptszVal, SIZEOF(pFileUrl->tszDownloadURL));
+ mir_tstrncpy(pFileUrl->tszDownloadURL, dbVar.ptszVal, SIZEOF(pFileUrl->tszDownloadURL));
mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%s\\tmp.ini"), tszRoot);
- lstrcpyn(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath));
- lstrcpyn(tszTmpIni, tszBuff, SIZEOF(tszTmpIni));
+ mir_tstrncpy(pFileUrl->tszDiskPath, tszBuff, SIZEOF(pFileUrl->tszDiskPath));
+ mir_tstrncpy(tszTmpIni, tszBuff, SIZEOF(tszTmpIni));
Title = TranslateT("Pack Updater");
Text = TranslateT("Downloading version info...");
DlgDownloadProc();
@@ -232,18 +232,18 @@ static void CheckUpdates(void *) db_get_ts(NULL, MODNAME, szKey, &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
db_free(&dbVar);
- lstrcpyn(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer));
+ mir_tstrncpy(FileInfo.tszCurVer, _T(""), SIZEOF(FileInfo.tszCurVer));
}
- else lstrcpyn(FileInfo.tszCurVer, dbVar.ptszVal, SIZEOF(FileInfo.tszCurVer));
+ else mir_tstrncpy(FileInfo.tszCurVer, dbVar.ptszVal, SIZEOF(FileInfo.tszCurVer));
dbVar.ptszVal = NULL;
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
db_get_ts(NULL, MODNAME, szKey, &dbVar);
if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
db_free(&dbVar);
- lstrcpyn(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer));
+ mir_tstrncpy(FileInfo.tszLastVer, _T(""), SIZEOF(FileInfo.tszLastVer));
}
- else lstrcpyn(FileInfo.tszLastVer, dbVar.ptszVal, SIZEOF(FileInfo.tszLastVer));
+ else mir_tstrncpy(FileInfo.tszLastVer, dbVar.ptszVal, SIZEOF(FileInfo.tszLastVer));
Files.push_back(FileInfo);
@@ -267,7 +267,7 @@ static void CheckUpdates(void *) MessageBox(NULL, Text, Title, MB_ICONINFORMATION);
continue;
} // end check update name
- lstrcpyn(Files[CurrentFile].File.tszDiskPath, tszBuff, SIZEOF(Files[CurrentFile].File.tszDiskPath));
+ mir_tstrncpy(Files[CurrentFile].File.tszDiskPath, tszBuff, SIZEOF(Files[CurrentFile].File.tszDiskPath));
GetPrivateProfileString(tszFileInfo, _T("InfoURL"), _T(""), Files[CurrentFile].tszInfoURL, SIZEOF(Files[CurrentFile].tszInfoURL), tszTmpIni);
Files[CurrentFile].FileType = GetPrivateProfileInt(tszFileInfo, _T("FileType"), 0, tszTmpIni);
Files[CurrentFile].Force = GetPrivateProfileInt(tszFileInfo, _T("Force"), 0, tszTmpIni);
@@ -335,7 +335,7 @@ static void CheckUpdates(void *) if (Files[CurrentFile].Force || Exists(tszFilePathDest))
UpdateFiles.push_back(Files[CurrentFile]);
// Save last version
- lstrcpyn(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer));
+ mir_tstrncpy(Files[CurrentFile].tszLastVer, Files[CurrentFile].tszNewVer, SIZEOF(Files[CurrentFile].tszLastVer));
mir_snprintf(szKey, SIZEOF(szKey), "File_%d_LastVersion", CurrentFile + 1);
db_set_ts(NULL, MODNAME, szKey, Files[CurrentFile].tszLastVer);
diff --git a/plugins/Ping/src/pingthread.cpp b/plugins/Ping/src/pingthread.cpp index 62f4bdd16a..4f4a9fee28 100644 --- a/plugins/Ping/src/pingthread.cpp +++ b/plugins/Ping/src/pingthread.cpp @@ -411,19 +411,19 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar //DrawIconEx(dis->hDC,dis->rcItem.left,(dis->rcItem.top + dis->rcItem.bottom - GetSystemMetrics(SM_CYSMICON))>>1,hIcon,0, 0, 0, NULL, DI_NORMAL);
DrawIconEx(dis->hDC,dis->rcItem.left,dis->rcItem.top + ((options.row_height - 16)>>1),hIcon,0, 0, 0, NULL, DI_NORMAL);
- GetTextExtentPoint32(dis->hDC,itemData.pszLabel,lstrlen(itemData.pszLabel),&textSize);
- TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,itemData.pszLabel,lstrlen(itemData.pszLabel));
+ GetTextExtentPoint32(dis->hDC,itemData.pszLabel,mir_tstrlen(itemData.pszLabel),&textSize);
+ TextOut(dis->hDC,dis->rcItem.left + 16 + 4,(dis->rcItem.top + dis->rcItem.bottom - textSize.cy)>>1,itemData.pszLabel,mir_tstrlen(itemData.pszLabel));
if(itemData.status != PS_DISABLED) {
TCHAR buf[256];
if(itemData.responding) {
mir_sntprintf(buf, 256, TranslateT("%d ms"), itemData.round_trip_time);
- GetTextExtentPoint32(dis->hDC,buf,lstrlen(buf),&textSize);
- TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,lstrlen(buf));
+ GetTextExtentPoint32(dis->hDC,buf,mir_tstrlen(buf),&textSize);
+ TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,mir_tstrlen(buf));
} else if(itemData.miss_count > 0) {
mir_sntprintf(buf, 256, _T("[%d]"), itemData.miss_count);
- GetTextExtentPoint32(dis->hDC,buf,lstrlen(buf),&textSize);
- TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,lstrlen(buf));
+ GetTextExtentPoint32(dis->hDC,buf,mir_tstrlen(buf),&textSize);
+ TextOut(dis->hDC,dis->rcItem.right - textSize.cx - 2,(dis->rcItem.top + dis->rcItem.bottom -textSize.cy)>>1,buf,mir_tstrlen(buf));
}
}
SetBkMode(dis->hDC, OPAQUE);
diff --git a/plugins/Popup/src/actions.cpp b/plugins/Popup/src/actions.cpp index 22c8d854a9..db3e581b59 100644 --- a/plugins/Popup/src/actions.cpp +++ b/plugins/Popup/src/actions.cpp @@ -96,7 +96,7 @@ bool IsActionEnabled(char *name) {
POPUPACTION action = {0};
action.flags = PAF_ENABLED;
- lstrcpyA(action.lpzTitle, name);
+ mir_strcpy(action.lpzTitle, name);
return IsActionEnabled(&action);
}
@@ -235,7 +235,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM char *szName = strchr(gActions[i]->lpzTitle, '/');
if (!szName) szName = gActions[i]->lpzTitle;
else ++szName;
- lstrcpynA(szGroup, gActions[i]->lpzTitle, szName - gActions[i]->lpzTitle);
+ mir_strncpy(szGroup, gActions[i]->lpzTitle, szName - gActions[i]->lpzTitle);
int grpId = 0;
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcPopupActions(HWND hwnd, UINT msg, WPARAM wParam, LPARAM group.mask = LVGF_HEADER | LVGF_GROUPID;
LPTSTR wszGroup = mir_a2t(szGroup);
group.pszHeader = TranslateTS(wszGroup);
- group.cchHeader = lstrlen(wszGroup);
+ group.cchHeader = mir_tstrlen(wszGroup);
grpId = group.iGroupId = groups.getCount();
int grpId = ListView_InsertGroup(hwndList, -1, &group);
mir_free(wszGroup);
diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index 91cb7093d2..821aa10017 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -596,10 +596,10 @@ void MyBitmap::DrawIcon(HICON hic, int x, int y, int w, int h) void MyBitmap::Draw_Text(TCHAR *str, int x, int y)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, lstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, mir_tstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x + 10000, y + 10000);
this->saveAlpha(x, y, sz.cx, sz.cy);
- DrawText(this->getDC(), str, lstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(this->getDC(), str, mir_tstrlen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
this->restoreAlpha(x, y, sz.cx, sz.cy);
}
@@ -680,7 +680,7 @@ bool MyBitmap::loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha) {
allocate(1, 1);
int r, g, b, a = 255;
- const TCHAR *p = fn + lstrlen(_T("pixel:"));
+ const TCHAR *p = fn + mir_tstrlen(_T("pixel:"));
r = (hex2dec(p[0]) << 4) + hex2dec(p[1]);
g = (hex2dec(p[2]) << 4) + hex2dec(p[3]);
b = (hex2dec(p[4]) << 4) + hex2dec(p[5]);
@@ -690,7 +690,7 @@ bool MyBitmap::loadFromFile_pixel(const TCHAR *fn, const TCHAR *fnAlpha) bool MyBitmap::loadFromFile_gradient(const TCHAR *fn, const TCHAR *fnAlpha)
{
- const TCHAR *p = fn + lstrlen(_T("gradient:"));
+ const TCHAR *p = fn + mir_tstrlen(_T("gradient:"));
if (*p == 'h') allocate(256, 1);
else allocate(1, 256);
@@ -825,10 +825,10 @@ bool MyBitmap::loadFromFile(const TCHAR *fn, const TCHAR *fnAlpha) {
if (bits) freemem();
- if (!_tcsncmp(fn, _T("pixel:"), lstrlen(_T("pixel:"))))
+ if (!_tcsncmp(fn, _T("pixel:"), mir_tstrlen(_T("pixel:"))))
return loadFromFile_pixel(fn, fnAlpha);
- if (!_tcsncmp(fn, _T("gradient:"), lstrlen(_T("gradient:"))))
+ if (!_tcsncmp(fn, _T("gradient:"), mir_tstrlen(_T("gradient:"))))
return loadFromFile_gradient(fn, fnAlpha);
TCHAR ext[5];
diff --git a/plugins/Popup/src/font.cpp b/plugins/Popup/src/font.cpp index 034a8f002c..d481fc63c9 100644 --- a/plugins/Popup/src/font.cpp +++ b/plugins/Popup/src/font.cpp @@ -29,41 +29,41 @@ void InitFonts() { // Fonts
FontIDT fid = {0};
fid.cbSize = sizeof(FontIDT);
- lstrcpyn(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group));
+ mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.group));
strncpy(fid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(fid.dbSettingsGroup));
fid.flags = FIDF_DEFAULTVALID;
fid.deffontsettings.charset = DEFAULT_CHARSET;
fid.deffontsettings.size = -11;
- lstrcpyn(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup));
- lstrcpyn(fid.backgroundName, PU_COL_BACK_NAME, SIZEOF(fid.backgroundName));
- lstrcpyn(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace));
+ mir_tstrncpy(fid.backgroundGroup, _T(PU_FNT_AND_COLOR), SIZEOF(fid.backgroundGroup));
+ mir_tstrncpy(fid.backgroundName, PU_COL_BACK_NAME, SIZEOF(fid.backgroundName));
+ mir_tstrncpy(fid.deffontsettings.szFace, _T("Tahoma"), SIZEOF(fid.deffontsettings.szFace));
- lstrcpyn(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TITLE);
fid.deffontsettings.style = DBFONTF_BOLD;
fid.deffontsettings.colour = RGB(0, 0, 0);
FontRegisterT(&fid);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_CLOCK);
//fid.deffontsettings.style = DBFONTF_BOLD;
//fid.deffontsettings.colour = RGB(0, 0, 0);
FontRegisterT(&fid);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_TEXT);
fid.deffontsettings.style = 0;
//fid.deffontsettings.colour = RGB(0, 0, 0);
FontRegisterT(&fid);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_ACTION);
fid.flags = FIDF_DEFAULTVALID | FIDF_ALLOWEFFECTS;
//fid.deffontsettings.style = 0;
fid.deffontsettings.colour = RGB(0, 0, 255);
FontRegisterT(&fid);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_HOVERED_ACTION);
fid.deffontsettings.style = DBFONTF_UNDERLINE;
//fid.deffontsettings.colour = RGB(0, 0, 255);
@@ -71,15 +71,15 @@ void InitFonts() { ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
- lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
strncpy(cid.dbSettingsGroup, PU_FNT_AND_COLOR_DB, SIZEOF(cid.dbSettingsGroup));
- lstrcpyn(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
strncpy(cid.setting, PU_COL_BACK_SETTING, SIZEOF(cid.setting));
cid.defcolour = SETTING_BACKCOLOUR_DEFAULT;
ColourRegisterT(&cid);
- lstrcpyn(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
strncpy(cid.setting, PU_COL_AVAT_SETTING, SIZEOF(cid.setting));
cid.defcolour = SETTING_TEXTCOLOUR_DEFAULT;
ColourRegisterT(&cid);
@@ -99,36 +99,36 @@ void ReloadFonts() LOGFONT lf = {0};
FontIDT fid = {0};
fid.cbSize = sizeof(FontIDT);
- lstrcpyn(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.name));
+ mir_tstrncpy(fid.group, _T(PU_FNT_AND_COLOR), SIZEOF(fid.name));
- lstrcpyn(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TITLE), SIZEOF(fid.name));
fonts.clTitle = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.title = CreateFontIndirect(&lf);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_CLOCK), SIZEOF(fid.name));
fonts.clClock = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.clock = CreateFontIndirect(&lf);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_TEXT), SIZEOF(fid.name));
fonts.clText = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.text = CreateFontIndirect(&lf);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_ACTION), SIZEOF(fid.name));
fonts.clAction = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.action = CreateFontIndirect(&lf);
- lstrcpyn(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
+ mir_tstrncpy(fid.name, _T(PU_FNT_NAME_HOVERED_ACTION), SIZEOF(fid.name));
fonts.clActionHover = (COLORREF)CallService(MS_FONT_GETT, (WPARAM)&fid, (LPARAM)&lf);
fonts.actionHover = CreateFontIndirect(&lf);
ColourIDT cid = {0};
cid.cbSize = sizeof(ColourIDT);
- lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
- lstrcpyn(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
+ mir_tstrncpy(cid.name, PU_COL_BACK_NAME, SIZEOF(cid.name));
fonts.clBack = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
- lstrcpyn(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
- lstrcpyn(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
+ mir_tstrncpy(cid.group, _T(PU_FNT_AND_COLOR), SIZEOF(cid.group));
+ mir_tstrncpy(cid.name, PU_COL_AVAT_NAME, SIZEOF(cid.name));
fonts.clAvatarBorder = (COLORREF)CallService(MS_COLOUR_GETT, (WPARAM)&cid, (LPARAM)&lf);
//update class popupps(only temp at this point, must rework)
diff --git a/plugins/Popup/src/font.h b/plugins/Popup/src/font.h index b3b682e361..eeab5d9f65 100644 --- a/plugins/Popup/src/font.h +++ b/plugins/Popup/src/font.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define PU_FNT_AND_COLOR_DB MODULNAME //use eg strcpy(fid.dbSettingsGroup, PU_FNT_GROUP_DB);
#define PU_FNT_PREFIX "fnt%s" //use eg mir_snprintf(fid.prefix, sizeof(fid.prefix), PU_FNT_PREFIX, PU_FNT_NAME_....);
-#define PU_FNT_NAME_TITLE LPGEN("Title") //use eg lstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
+#define PU_FNT_NAME_TITLE LPGEN("Title") //use eg mir_tstrcpy(fid.name, _T(FNT_NAME_....)) for FontIDT
#define PU_FNT_NAME_CLOCK LPGEN("Clock")
#define PU_FNT_NAME_TEXT LPGEN("Text")
#define PU_FNT_NAME_ACTION LPGEN("Action")
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index f8ebfe9eda..57fbf18b62 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -46,24 +46,24 @@ void LoadNotifications() notification.actionCount = 0;
notification.lpActions = 0;
- lstrcpynA(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
- lstrcpynA(notification.lpzName, "Warning", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Warning", sizeof(notification.lpzName));
notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_WARN), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED);
notification.colorBack = RGB(210,210,150);
notification.colorText = RGB(0,0,0);
notification.iSeconds = 10;
g_hntfWarning = RegisterNotification(¬ification);
- lstrcpynA(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
- lstrcpynA(notification.lpzName, "Notification", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Notification", sizeof(notification.lpzName));
notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_INFO), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED);
notification.colorBack = RGB(230,230,230);
notification.colorText = RGB(0,0,0);
notification.iSeconds = 7;
g_hntfNotification = RegisterNotification(¬ification);
- lstrcpynA(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
- lstrcpynA(notification.lpzName, "Error", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzGroup, "Misc", sizeof(notification.lpzName));
+ mir_strncpy(notification.lpzName, "Error", sizeof(notification.lpzName));
notification.lchIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_MB_STOP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR|LR_SHARED);
notification.colorBack = RGB(191,0,0);
notification.colorText = RGB(255,245,225);
@@ -160,12 +160,12 @@ void LoadNotificationSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "{%s/%s}leftAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzLAction);
- lstrcpynA(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
+ mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
mir_free(szTmp); szTmp = NULL;
mir_snprintf(setting, sizeof(setting), "{%s/%s}rightAction", ptd->notification.lpzGroup, ptd->notification.lpzName);
szTmp = db_get_s(NULL, szModul, setting, ptd->notification.lpzRAction);
- lstrcpynA(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
+ mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
mir_free(szTmp); szTmp = NULL;
}
}
@@ -188,12 +188,12 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) FontID fontid = {0};
fontid.cbSize = sizeof(fontid);
mir_snprintf(fontid.group, sizeof(fontid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
- lstrcpyA(fontid.dbSettingsGroup, "PopupNotifications");
+ mir_strcpy(fontid.dbSettingsGroup, "PopupNotifications");
fontid.flags = FIDF_DEFAULTVALID;
fontid.deffontsettings.charset = DEFAULT_CHARSET;
fontid.deffontsettings.colour = ptd->notification.colorText;
fontid.deffontsettings.size = -11;
- lstrcpynA(fontid.deffontsettings.szFace, "MS Shell Dlg", SIZEOF(fontid.deffontsettings.szFace));
+ mir_strncpy(fontid.deffontsettings.szFace, "MS Shell Dlg", SIZEOF(fontid.deffontsettings.szFace));
fontid.deffontsettings.style = 0;
mir_snprintf(fontid.name, SIZEOF(fontid.name), "%s (colors only)", notification->lpzName);
mir_snprintf(fontid.prefix, SIZEOF(fontid.prefix), "{%s/%s}text", notification->lpzGroup, notification->lpzName);
@@ -203,7 +203,7 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) ColourID colourid = {0};
colourid.cbSize = sizeof(colourid);
mir_snprintf(colourid.group, sizeof(colourid.group), PU_FNT_AND_COLOR"/%s", notification->lpzGroup);
- lstrcpyA(colourid.dbSettingsGroup, "PopupNotifications");
+ mir_strcpy(colourid.dbSettingsGroup, "PopupNotifications");
mir_snprintf(colourid.name, SIZEOF(colourid.name), "%s (colors only)", notification->lpzName);
mir_snprintf(colourid.setting, SIZEOF(colourid.setting), "{%s/%s}backColor", notification->lpzGroup, notification->lpzName);
colourid.defcolour = ptd->notification.colorBack;
diff --git a/plugins/Popup/src/opt_class.cpp b/plugins/Popup/src/opt_class.cpp index 8289dbb279..4fd1d07894 100644 --- a/plugins/Popup/src/opt_class.cpp +++ b/plugins/Popup/src/opt_class.cpp @@ -397,13 +397,13 @@ INT_PTR CALLBACK DlgProcOptsClasses(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l case CBN_SELCHANGE: //ComboBox controls
switch(idCtrl) {
case IDC_LACTION:
- lstrcpynA(ptd->leftAction,
+ mir_strncpy(ptd->leftAction,
(char *)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)),
sizeof(ptd->leftAction));
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
break;
case IDC_RACTION:
- lstrcpynA(ptd->rightAction,
+ mir_strncpy(ptd->rightAction,
(char *)ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam)),
sizeof(ptd->rightAction));
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
@@ -508,12 +508,12 @@ void LoadClassSettings(POPUPTREEDATA *ptd, char* szModul) mir_snprintf(setting, sizeof(setting), "%s/leftAction", ptd->pupClass.pszName);
szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_NOTHING); //standart ??
- lstrcpynA(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
+ mir_strncpy(ptd->leftAction, szTmp, sizeof(ptd->leftAction));
mir_free(szTmp); szTmp = NULL;
mir_snprintf(setting, sizeof(setting), "%s/rightAction", ptd->pupClass.pszName);
szTmp = db_get_s(NULL, szModul, setting, POPUP_ACTION_DISMISS); //standart ??
- lstrcpynA(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
+ mir_strncpy(ptd->rightAction, szTmp, sizeof(ptd->rightAction));
mir_free(szTmp); szTmp = NULL;
}
diff --git a/plugins/Popup/src/opt_gen.cpp b/plugins/Popup/src/opt_gen.cpp index 781b009795..c104eb2c3a 100644 --- a/plugins/Popup/src/opt_gen.cpp +++ b/plugins/Popup/src/opt_gen.cpp @@ -47,24 +47,24 @@ int AddStatusMode(OPTTREE_OPTION *options, int pos, LPTSTR prefix, DWORD flag) if (!flag) return pos;
options[pos].dwFlag = flag;
options[pos].groupId = OPTTREE_CHECK;
- options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR) * lstrlen(prefix) + 32);
+ options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR) * mir_tstrlen(prefix) + 32);
options[pos].pszSettingName = mir_tstrdup(prefix);
options[pos].iconIndex = 0;
- lstrcpy(options[pos].pszOptionName, prefix);
- lstrcat(options[pos].pszOptionName, _T("/"));
+ mir_tstrcpy(options[pos].pszOptionName, prefix);
+ mir_tstrcat(options[pos].pszOptionName, _T("/"));
switch (flag)
{
- case PF2_IDLE: lstrcat(options[pos].pszOptionName, LPGENT("Offline")); break;
- case PF2_ONLINE: lstrcat(options[pos].pszOptionName, LPGENT("Online")); break;
- case PF2_INVISIBLE: lstrcat(options[pos].pszOptionName, LPGENT("Invisible")); break;
- case PF2_SHORTAWAY: lstrcat(options[pos].pszOptionName, LPGENT("Away")); break;
- case PF2_LONGAWAY: lstrcat(options[pos].pszOptionName, LPGENT("NA")); break;
- case PF2_LIGHTDND: lstrcat(options[pos].pszOptionName, LPGENT("Occupied")); break;
- case PF2_HEAVYDND: lstrcat(options[pos].pszOptionName, LPGENT("DND")); break;
- case PF2_FREECHAT: lstrcat(options[pos].pszOptionName, LPGENT("Free for chat")); break;
- case PF2_OUTTOLUNCH: lstrcat(options[pos].pszOptionName, LPGENT("Out to lunch")); break;
- case PF2_ONTHEPHONE: lstrcat(options[pos].pszOptionName, LPGENT("On the phone")); break;
+ case PF2_IDLE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Offline")); break;
+ case PF2_ONLINE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Online")); break;
+ case PF2_INVISIBLE: mir_tstrcat(options[pos].pszOptionName, LPGENT("Invisible")); break;
+ case PF2_SHORTAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENT("Away")); break;
+ case PF2_LONGAWAY: mir_tstrcat(options[pos].pszOptionName, LPGENT("NA")); break;
+ case PF2_LIGHTDND: mir_tstrcat(options[pos].pszOptionName, LPGENT("Occupied")); break;
+ case PF2_HEAVYDND: mir_tstrcat(options[pos].pszOptionName, LPGENT("DND")); break;
+ case PF2_FREECHAT: mir_tstrcat(options[pos].pszOptionName, LPGENT("Free for chat")); break;
+ case PF2_OUTTOLUNCH: mir_tstrcat(options[pos].pszOptionName, LPGENT("Out to lunch")); break;
+ case PF2_ONTHEPHONE: mir_tstrcat(options[pos].pszOptionName, LPGENT("On the phone")); break;
}
return pos + 1;
}
diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index e00a7a6b32..7b441978ed 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -187,8 +187,8 @@ int SkinOptionList_AddSkin(OPTTREE_OPTION* &options, int *OptionsCount, int pos options[pos].iconIndex = 0;
options[pos].pszSettingName = mir_tstrdup(_T("Skin options"));
options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR)*(
- lstrlen(options[pos].pszSettingName)+
- lstrlenA(skin->getFlagName(i)) +10 ));
+ mir_tstrlen(options[pos].pszSettingName)+
+ mir_strlen(skin->getFlagName(i)) +10 ));
wsprintf(options[pos].pszOptionName, _T("%s/%hs"), options[pos].pszSettingName, skin->getFlagName(i)); //!!!!!!!!!!!!!
options[pos].bState = skin->getFlag(i) ? TRUE : FALSE;
options[pos].Data = i; //skin flag index
@@ -248,8 +248,8 @@ int SkinOptionList_AddMain(OPTTREE_OPTION* &options, int *OptionsCount, int pos, options[pos].iconIndex = 0;
options[pos].pszSettingName = mir_tstrdup(LPGENT("Global settings"));
options[pos].pszOptionName = (LPTSTR)mir_alloc(sizeof(TCHAR)*(
- lstrlen(options[pos].pszSettingName)+
- lstrlen(mainOption[i]) + 10));
+ mir_tstrlen(options[pos].pszSettingName)+
+ mir_tstrlen(mainOption[i]) + 10));
wsprintf(options[pos].pszOptionName, _T("%s/%s"), options[pos].pszSettingName, mainOption[i]); //!!!!!!!!!!!!!
options[pos].bState = bCheck;
pos++;
@@ -559,12 +559,12 @@ static void BoxPreview_OnPaint(HWND hwnd, HDC mydc, int mode) rc.left += 30; // 10+16+4 -- icon
rc.right -= (rc.right-rc.left)/3;
rc.bottom -= (rc.bottom-rc.top)/3;
- DrawText(mydc, _T(MODULNAME_LONG), lstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+ DrawText(mydc, _T(MODULNAME_LONG), mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
GetClientRect(hwnd, &rc);
rc.left += 30; // 10+16+4 -- icon
rc.left += (rc.right-rc.left)/3;
rc.top += (rc.bottom-rc.top)/3;
- DrawText(mydc, _T(MODULNAME_LONG), lstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
+ DrawText(mydc, _T(MODULNAME_LONG), mir_tstrlen(_T(MODULNAME_LONG)), &rc, DT_CENTER|DT_NOPREFIX|DT_SINGLELINE|DT_VCENTER);
GetClientRect(hwnd, &rc);
FrameRect(mydc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH));
SelectObject(mydc, hfnt);
diff --git a/plugins/Popup/src/opttree.cpp b/plugins/Popup/src/opttree.cpp index 1c670e06b0..c7729d199d 100644 --- a/plugins/Popup/src/opttree.cpp +++ b/plugins/Popup/src/opttree.cpp @@ -101,7 +101,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, LPTSTR name, LPARAM lParam, int iconInd int sectionLevel = 0;
HTREEITEM hSection = NULL, result = NULL;
- lstrcpy(itemName, name);
+ mir_tstrcpy(itemName, name);
sectionName = itemName;
while (sectionName) {
@@ -176,7 +176,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, i int sectionLevel = 0;
HTREEITEM hSection = NULL;
- lstrcpy(itemName, options[indx].pszOptionName);
+ mir_tstrcpy(itemName, options[indx].pszOptionName);
sectionName = itemName;
while (sectionName) {
diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 70c6fa820a..16fcc7ed6d 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -282,7 +282,7 @@ void PopupWnd2::update() {
SetTextColor(hdc, m_clClock);
HFONT hfnSave = (HFONT)SelectObject(m_bmpBase->getDC(), fonts.clock);
- SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, lstrlen(m_time), &sz);
+ SIZE sz; GetTextExtentPoint32(m_bmpBase->getDC(), m_time, mir_tstrlen(m_time), &sz);
m_bmpBase->Draw_Text(m_time, this->m_sz.cx - sz.cx - STYLE_SZ_GAP - skin->getRightGap(), STYLE_SZ_GAP);
SelectObject(m_bmpBase->getDC(), hfnSave);
}
@@ -609,7 +609,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Quick reply")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_REPLY,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Quick reply");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Quick reply");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_REPLY;
++iAction;
@@ -618,7 +618,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && isIm && IsActionEnabled("General/Send message")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MESS,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Send message");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Send message");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_MESSAGE;
++iAction;
@@ -627,7 +627,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && IsActionEnabled("General/User details")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_INFO,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/User details");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/User details");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_DETAILS;
++iAction;
@@ -636,7 +636,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && IsActionEnabled("General/Contact menu")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_MENU,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Contact menu");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Contact menu");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_MENU;
++iAction;
@@ -645,7 +645,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultUsr && db_get_b(m_hContact, "CList", "NotOnList", 0) && IsActionEnabled("General/Add permanently")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_ADD,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Add permanently");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Add permanently");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_ADD;
++iAction;
@@ -654,7 +654,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && (m_iTimeout != -1) && IsActionEnabled("General/Pin popup")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = m_bIsPinned ? IcoLib_GetIcon(ICO_ACT_PINNED,iconSize) : IcoLib_GetIcon(ICO_ACT_PIN,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Pin popup");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Pin popup");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_PIN;
++iAction;
@@ -663,7 +663,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && IsActionEnabled("General/Dismiss popup")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_CLOSE,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Dismiss popup");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Dismiss popup");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_DISMISS;
++iAction;
@@ -672,7 +672,7 @@ int PopupWnd2::fixActions(POPUPACTION *theActions, int count) if (enableDefaultGen && IsActionEnabled("General/Copy to clipboard")) {
m_actions[iAction].actionA.cbSize = sizeof(POPUPACTION);
m_actions[iAction].actionA.lchIcon = IcoLib_GetIcon(ICO_ACT_COPY,iconSize);
- lstrcpyA(m_actions[iAction].actionA.lpzTitle, "General/Copy to clipboard");
+ mir_strcpy(m_actions[iAction].actionA.lpzTitle, "General/Copy to clipboard");
m_actions[iAction].actionA.wParam = 0;
m_actions[iAction].actionA.lParam = ACT_DEF_COPY;
++iAction;
@@ -886,9 +886,9 @@ void AddMessageToDB(MCONTACT hContact, char *msg, int flag/*bool utf*/) dbei.szModule = GetContactProto(hContact);
dbei.timestamp = time(NULL);
if ( !((flag & PREF_UTF) == PREF_UTF) && (flag & PREF_UNICODE) == PREF_UNICODE)
- dbei.cbBlob = (lstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR);
+ dbei.cbBlob = (mir_tstrlen((LPTSTR)msg) + 1)*sizeof(TCHAR);
else
- dbei.cbBlob = lstrlenA(msg) + 1;
+ dbei.cbBlob = mir_strlen(msg) + 1;
dbei.pBlob = (PBYTE)msg;
db_event_add(hContact, &dbei);
}
@@ -1080,9 +1080,9 @@ LRESULT CALLBACK PopupWnd2::WindowProc(UINT message, WPARAM wParam, LPARAM lPara }
OpenClipboard(m_hwnd);
EmptyClipboard();
- clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (lstrlen(text)+1) * sizeof(TCHAR));
+ clipbuffer = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (mir_tstrlen(text)+1) * sizeof(TCHAR));
buffer = (TCHAR *)GlobalLock(clipbuffer);
- lstrcpy(buffer, text);
+ mir_tstrcpy(buffer, text);
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TCHAR, clipbuffer);
CloseClipboard();
diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index fe16ce2fb4..c33a3f96a0 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -63,7 +63,7 @@ SIZE PopupSkin::measureAction(HDC hdc, POPUPACTION *act) const SIZE szText, szSpace;
LPTSTR wname = mir_a2t(name);
TCHAR *str = TranslateTS(wname);
- GetTextExtentPoint32(hdc, str, lstrlen(str), &szText);
+ GetTextExtentPoint32(hdc, str, mir_tstrlen(str), &szText);
mir_free(wname);
GetTextExtentPoint32(hdc, _T(" "), 1, &szSpace);
@@ -126,7 +126,7 @@ void PopupSkin::drawAction(MyBitmap *bmp, POPUPACTION *act, int x, int y, bool h LPTSTR wname = mir_a2t(name);
TCHAR *str = TranslateTS(wname);
- GetTextExtentPoint32(bmp->getDC(), str, lstrlen(str), &szText);
+ GetTextExtentPoint32(bmp->getDC(), str, mir_tstrlen(str), &szText);
bmp->Draw_Text(str,
(PopupOptions.actions&ACT_LARGE) ? (x + szSpace.cx + 32) : (x + szSpace.cx + 16),
max(y + 2, y + 2 + (((PopupOptions.actions&ACT_LARGE) ? 32 : 16) - szText.cy) / 2));
@@ -196,7 +196,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options }
else { //normal clock
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", sz.cy);
@@ -239,7 +239,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getText(), lstrlen(wnd->getText()), &rc,
+ DrawTextEx(hdc, wnd->getText(), mir_tstrlen(wnd->getText()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -282,7 +282,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, 0, 0, szNew.cx, 0);
- DrawTextEx(hdc, wnd->getTitle(), lstrlen(wnd->getTitle()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), mir_tstrlen(wnd->getTitle()), &rc,
DT_CALCRECT | DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
szNew.cx = rc.right;
szNew.cy = rc.bottom;
@@ -344,7 +344,7 @@ void PopupSkin::measure(HDC hdc, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *options }
else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
wnd->getArgs()->add("clock.width", sz.cx + 2 * STYLE_SZ_GAP);
wnd->getArgs()->add("clock.height", sz.cy);
@@ -438,7 +438,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o }
else {
HFONT hfnSave = (HFONT)SelectObject(hdc, fonts.clock);
- SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), lstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(hdc, wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz);
SelectObject(hdc, hfnSave);
STYLE_SZ_CLOCK = sz.cx + 2 * STYLE_SZ_GAP;
}
@@ -502,7 +502,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o case PopupWnd2::TT_UNICODE:
{
RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextEx(hdc, wnd->getText(), lstrlen(wnd->getText()), &rc,
+ DrawTextEx(hdc, wnd->getText(), mir_tstrlen(wnd->getText()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
}
break;
@@ -551,7 +551,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o {
HFONT hFntSave = (HFONT)SelectObject(hdc, fonts.title);
RECT rc; SetRect(&rc, pos.x, pos.y, pos.x + sz.cx, pos.y + sz.cy);
- DrawTextEx(hdc, wnd->getTitle(), lstrlen(wnd->getTitle()), &rc,
+ DrawTextEx(hdc, wnd->getTitle(), mir_tstrlen(wnd->getTitle()), &rc,
DT_EXPANDTABS | DT_LEFT | DT_NOPREFIX | DT_TOP | DT_WORDBREAK/*|DT_RTLREADING*/, NULL);
SelectObject(hdc, hFntSave);
}
@@ -691,7 +691,7 @@ void PopupSkin::display(MyBitmap *bmp, PopupWnd2 *wnd, int maxw, POPUPOPTIONS *o SetTextColor(hdc, wnd->getClockColor());
HFONT hfnSave = (HFONT)SelectObject(bmp->getDC(), fonts.clock);
- SIZE sz; GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), lstrlen(wnd->getTime()), &sz);
+ SIZE sz; GetTextExtentPoint32(bmp->getDC(), wnd->getTime(), mir_tstrlen(wnd->getTime()), &sz);
bmp->Draw_Text(wnd->getTime(), x, y);
SelectObject(bmp->getDC(), hfnSave);
}
@@ -760,7 +760,7 @@ void PopupSkin::loadOptions(std::wistream &f) TCHAR *p = buf;
while (isspace(*p))
p++;
- TCHAR *q = p + lstrlen(p) - 1;
+ TCHAR *q = p + mir_tstrlen(p) - 1;
while ((q >= p) && isspace(*q))
*q-- = 0;
m_flag_names[id] = mir_t2a(p);
@@ -959,7 +959,7 @@ PopupSkin::SKINELEMENT *PopupSkin::loadObject(std::wistream &f) f >> buf;
if (((element->type & ST_TYPEMASK) == ST_MYBITMAP) || ((element->type & ST_TYPEMASK) == ST_CLOCK)) {
TCHAR *alpha = mir_tstrdup(buf);
- alpha[lstrlen(alpha) - 1] = 'a';
+ alpha[mir_tstrlen(alpha) - 1] = 'a';
element->myBmp = new MyBitmap(buf, alpha);
mir_free(alpha);
}
@@ -1094,7 +1094,7 @@ bool Skins::load(LPCTSTR dir1) m_skins = skin;
m_skins->name = mir_tstrdup(_T("* Popup Classic"));
m_skins->dir = new TCHAR[1024];
- lstrcpy(m_skins->dir, _T("res:classic.popupskin"));
+ mir_tstrcpy(m_skins->dir, _T("res:classic.popupskin"));
m_skins->skin = 0;
TCHAR dir[1024] = { '\0' };
@@ -1105,8 +1105,8 @@ bool Skins::load(LPCTSTR dir1) }
else {
GetModuleFileName(hInst, dir, 1024);
- dir[lstrlen(dir) - 18] = 0;
- lstrcat(dir, _T("\\skins\\popup"));
+ dir[mir_tstrlen(dir) - 18] = 0;
+ mir_tstrcat(dir, _T("\\skins\\popup"));
DWORD fa = GetFileAttributes(dir);
if ((fa == INVALID_FILE_ATTRIBUTES) || !(fa&FILE_ATTRIBUTE_DIRECTORY))
return false;
diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index dab75c2726..b02897c206 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -400,7 +400,7 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) if (db_get_ts(hMeta == NULL ? hContact : hMeta, "CList", "Group", &dbv) == 0)
{
if (dbv.ptszVal != NULL)
- lstrcpyn(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
+ mir_tstrncpy(contact->szgroup, dbv.ptszVal, SIZEOF(contact->szgroup));
db_free(&dbv);
}
@@ -408,11 +408,11 @@ void LoadContacts(HWND hwndDlg, BOOL show_all) // Make contact name
TCHAR *tmp = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_TCHAR);
- lstrcpyn(contact->szname, tmp, SIZEOF(contact->szname));
+ mir_tstrncpy(contact->szname, tmp, SIZEOF(contact->szname));
PROTOACCOUNT *acc = ProtoGetAccount(pszProto);
if (acc != NULL)
- lstrcpyn(contact->proto, acc->tszAccountName, SIZEOF(contact->proto));
+ mir_tstrncpy(contact->proto, acc->tszAccountName, SIZEOF(contact->proto));
contact->hcontact = hContact;
contacts.insert(contact);
@@ -480,7 +480,7 @@ int CheckText(HWND hdlg, TCHAR *sztext, BOOL only_enable = FALSE) if(sztext == NULL || sztext[0] == _T('\0'))
return 0;
- int len = lstrlen(sztext);
+ int len = mir_tstrlen(sztext);
if (only_enable)
{
@@ -567,7 +567,7 @@ LRESULT CALLBACK EditProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) SendMessage(hdlg,WM_GETTEXT,(WPARAM)SIZEOF(sztext),(LPARAM)sztext);
- BOOL at_end = (lstrlen(sztext) == (int)end);
+ BOOL at_end = (mir_tstrlen(sztext) == (int)end);
if (ret != -1)
{
@@ -1041,7 +1041,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA {
RECT rcc = { 0, 0, 0x7FFF, 0x7FFF };
- DrawText(lpdis->hDC, contacts[loop]->proto, lstrlen(contacts[loop]->proto),
+ DrawText(lpdis->hDC, contacts[loop]->proto, mir_tstrlen(contacts[loop]->proto),
&rcc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_CALCRECT);
max_proto_width = max(max_proto_width, rcc.right - rcc.left);
}
@@ -1059,7 +1059,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA rc_tmp.left = rc_tmp.right - max_proto_width;
- DrawText(lpdis->hDC, contacts[lpdis->itemData]->proto, lstrlen(contacts[lpdis->itemData]->proto),
+ DrawText(lpdis->hDC, contacts[lpdis->itemData]->proto, mir_tstrlen(contacts[lpdis->itemData]->proto),
&rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
rc.right = rc_tmp.left - 5;
@@ -1081,7 +1081,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA rc.right = rc_tmp.left - 5;
}
- DrawText(lpdis->hDC, contacts[lpdis->itemData]->szgroup, lstrlen(contacts[lpdis->itemData]->szgroup),
+ DrawText(lpdis->hDC, contacts[lpdis->itemData]->szgroup, mir_tstrlen(contacts[lpdis->itemData]->szgroup),
&rc_tmp, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
}
@@ -1092,7 +1092,7 @@ static INT_PTR CALLBACK MainDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA else
name = contacts[lpdis->itemData]->szname;
- DrawText(lpdis->hDC, name, lstrlen(name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, name, mir_tstrlen(name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
diff --git a/plugins/Quotes/src/Chart.h b/plugins/Quotes/src/Chart.h index 62a658d818..8cd4718b94 100644 --- a/plugins/Quotes/src/Chart.h +++ b/plugins/Quotes/src/Chart.h @@ -91,7 +91,7 @@ public: HFONT hOldFont = static_cast<HFONT>(::SelectObject(hdc,hFont));
LPCTSTR pszText = TranslateT("There is no to show");
- int nDrawTextResult = ::DrawText(hdc,pszText,::lstrlen(pszText),&rc,DT_SINGLELINE|DT_VCENTER|DT_CENTER);
+ int nDrawTextResult = ::DrawText(hdc,pszText,::mir_tstrlen(pszText),&rc,DT_SINGLELINE|DT_VCENTER|DT_CENTER);
assert(0 != nDrawTextResult);
::SelectObject(hdc,hOldFont);
diff --git a/plugins/Quotes/src/Forex.cpp b/plugins/Quotes/src/Forex.cpp index 933e25c35b..02aaf99b39 100644 --- a/plugins/Quotes/src/Forex.cpp +++ b/plugins/Quotes/src/Forex.cpp @@ -375,7 +375,7 @@ namespace // {
// if(lParam)
// {
-// lstrcpynA(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
+// mir_strncpy(reinterpret_cast<char*>(lParam),QUOTES_PROTOCOL_NAME,wParam);
// return 0;
// }
// else
diff --git a/plugins/Quotes/src/ImportExport.cpp b/plugins/Quotes/src/ImportExport.cpp index a6c46e894f..6a01feb58f 100644 --- a/plugins/Quotes/src/ImportExport.cpp +++ b/plugins/Quotes/src/ImportExport.cpp @@ -170,12 +170,12 @@ namespace {
LPTSTR p = pszBuffer;
LPCTSTR pszXml = TranslateT("XML File (*.xml)");
- lstrcpyn(p,pszXml, (int)cBuffer);
- size_t nLen = lstrlen(pszXml)+1;
+ mir_tstrncpy(p,pszXml, (int)cBuffer);
+ size_t nLen = mir_tstrlen(pszXml)+1;
p+= nLen;
if(nLen < cBuffer)
{
- lstrcpyn(p,_T("*.xml"),(int)(cBuffer-nLen));
+ mir_tstrncpy(p,_T("*.xml"),(int)(cBuffer-nLen));
p+= 6;
nLen += 6;
}
@@ -183,15 +183,15 @@ namespace if(nLen < cBuffer)
{
LPCTSTR pszAll = TranslateT("All files (*.*)");
- lstrcpyn(p,pszAll,(int)(cBuffer-nLen));
- size_t n = lstrlen(pszAll)+1;
+ mir_tstrncpy(p,pszAll,(int)(cBuffer-nLen));
+ size_t n = mir_tstrlen(pszAll)+1;
nLen += n;
p+= n;
}
if(nLen < cBuffer)
{
- lstrcpyn(p,_T("*.*"),(int)(cBuffer-nLen));
+ mir_tstrncpy(p,_T("*.*"),(int)(cBuffer-nLen));
p+= 4;
nLen += 4;
}
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp index d05d21f304..c6553a1c68 100644 --- a/plugins/Quotes/src/QuotesProviderBase.cpp +++ b/plugins/Quotes/src/QuotesProviderBase.cpp @@ -576,7 +576,7 @@ namespace dbei.timestamp = static_cast<DWORD>(nTime);
dbei.flags = DBEF_READ|DBEF_UTF;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = ::lstrlenA(psz)+1;
+ dbei.cbBlob = ::mir_strlen(psz)+1;
dbei.pBlob = (PBYTE)(char*)psz;
db_event_add(hContact, &dbei);
}
@@ -634,11 +634,11 @@ namespace CQuotesProviderVisitorFormater visitor(hContact,_T('s'),0);
pProvider->Accept(visitor);
const tstring& sTitle = visitor.GetResult();
- lstrcpyn(ppd.lptzContactName,sTitle.c_str(),MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzContactName,sTitle.c_str(),MAX_CONTACTNAME);
mir_safe_string<TCHAR> ss(variables_parsedup((TCHAR*)rsFormat.c_str(), 0, hContact));
tstring sText = format_rate(pProvider,hContact,ss.m_p,dRate);
- lstrcpyn(ppd.lptzText,sText.c_str(),MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzText,sText.c_str(),MAX_SECONDLINE);
if(CPopupSettings::colourDefault == ps.GetColourMode())
{
diff --git a/plugins/Quotes/src/SettingsDlg.cpp b/plugins/Quotes/src/SettingsDlg.cpp index 48f190f1c4..940241b539 100644 --- a/plugins/Quotes/src/SettingsDlg.cpp +++ b/plugins/Quotes/src/SettingsDlg.cpp @@ -1066,7 +1066,7 @@ tstring GenerateLogFileName(const tstring& rsLogFilePattern, {
tstring s = rsQuoteSymbol;
std::for_each(s.begin(),s.end(),boost::bind(replace_invalid_char,_1,_T('_')));
- sPath.replace(n,lstrlen(g_pszVariableQuoteName),s.c_str());
+ sPath.replace(n,mir_tstrlen(g_pszVariableQuoteName),s.c_str());
}
}
diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 89f751dbde..28d787b4c3 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -10,7 +10,7 @@ int LoadServices(void) // Service creation
for (size_t i=0;i<SIZEOF(siPluginServices);i++)
{
- CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(lstrlenA(siPluginServices[i].lpszName)+1));
+ CopyMemory(pszServiceFunctionName,siPluginServices[i].lpszName,(mir_strlen(siPluginServices[i].lpszName)+1));
CreateServiceFunction(szServiceFunction,(MIRANDASERVICE)siPluginServices[i].lpFunc);
}
return 0;
diff --git a/plugins/SMS/src/functions.cpp b/plugins/SMS/src/functions.cpp index cdf497067e..4d40969b44 100644 --- a/plugins/SMS/src/functions.cpp +++ b/plugins/SMS/src/functions.cpp @@ -7,7 +7,7 @@ BOOL DB_GetStaticStringW(MCONTACT hContact,LPSTR lpszModule,LPSTR lpszValueName, DBVARIANT dbv={0};
if (db_get_ws(hContact, lpszModule, lpszValueName, &dbv)==0)
{
- dwReadedStringLen=lstrlenW(dbv.pwszVal);
+ dwReadedStringLen=mir_wstrlen(dbv.pwszVal);
if (lpwszRetBuff && (dwRetBuffSize>dwReadedStringLen))
{
CopyMemory(lpwszRetBuff,dbv.pszVal,(dwReadedStringLen*sizeof(WCHAR)));//include null terminated
@@ -455,9 +455,9 @@ void LoadMsgDlgFont(int i,LOGFONT *lf,COLORREF *colour) {
if (db_get(NULL,SRMMMOD,str,&dbv))
{
- lstrcpyn(lf->lfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName,fontOptionsList[0].szDefFace,SIZEOF(lf->lfFaceName));
}else{
- lstrcpyn(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName,dbv.ptszVal,SIZEOF(lf->lfFaceName));
db_free(&dbv);
}
diff --git a/plugins/SMS/src/receive.cpp b/plugins/SMS/src/receive.cpp index 49838ca61f..49d0283e59 100644 --- a/plugins/SMS/src/receive.cpp +++ b/plugins/SMS/src/receive.cpp @@ -42,7 +42,7 @@ int handleAckSMS(WPARAM wParam, LPARAM lParam) ACKDATA *ack = ((ACKDATA*)lParam);
if (lpszXML)
- dwXMLSize = lstrlenA(lpszXML);
+ dwXMLSize = mir_strlen(lpszXML);
if (GetXMLFieldEx(lpszXML,dwXMLSize,&lpszData,&dwDataSize,"sms_message", "text", NULL))
{
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp index 7035b7449f..3d2a74c756 100644 --- a/plugins/SMS/src/senddlg.cpp +++ b/plugins/SMS/src/senddlg.cpp @@ -286,7 +286,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l tvi.pszText=tszPhone;
tvi.cchTextMax=SIZEOF(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
- dwPhoneSize=lstrlen(tszPhone);
+ dwPhoneSize=mir_tstrlen(tszPhone);
}else{
dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
}
@@ -409,7 +409,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l {
if (IsContactPhone(psswdWindowData->hMyContact,tszPhone,dwPhoneSize)==FALSE)
{
- lstrcat(tszPhone, _T(" SMS"));
+ mir_tstrcat(tszPhone, _T(" SMS"));
for(DWORD i=0;bCont;i++)
{
mir_snprintf(szBuff,SIZEOF(szBuff),"MyPhone%d",i);
@@ -883,7 +883,7 @@ void SendSMSWindowNext(HWND hWndDlg) tvi.cchTextMax=SIZEOF(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
TreeView_SelectItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),tvi.hItem);
- dwPhoneSize=lstrlenW(tszPhone);
+ dwPhoneSize=mir_wstrlen(tszPhone);
SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lptszMessage,dwMessageSize);
SetTimer(hWndDlg,TIMERID_MSGSEND,TIMEOUT_MSGSEND,NULL);
diff --git a/plugins/Scriver/src/chat/log.cpp b/plugins/Scriver/src/chat/log.cpp index bb8274587b..e743e82bc6 100644 --- a/plugins/Scriver/src/chat/log.cpp +++ b/plugins/Scriver/src/chat/log.cpp @@ -33,7 +33,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (lstrdat->buffer == NULL) {
lstrdat->bufferOffset = 0;
lstrdat->buffer = pci->Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = lstrlenA(lstrdat->buffer);
+ lstrdat->bufferLen = mir_strlen(lstrdat->buffer);
}
// give the RTF to the RE control
diff --git a/plugins/Scriver/src/chat/message.cpp b/plugins/Scriver/src/chat/message.cpp index 1bcc285f79..fa228ab895 100644 --- a/plugins/Scriver/src/chat/message.cpp +++ b/plugins/Scriver/src/chat/message.cpp @@ -95,7 +95,7 @@ TCHAR* DoRtfToTags(char *pszText, SESSION_INFO *si) p1 += 5;
- MoveMemory(pszText, p1, lstrlenA(p1) + 1);
+ MoveMemory(pszText, p1, mir_strlen(p1) + 1);
p1 = pszText;
// iterate through all characters, if rtf control character found then take action
@@ -287,9 +287,9 @@ TCHAR* DoRtfToTags(char *pszText, SESSION_INFO *si) // move the memory and paste in new commands instead of the old RTF
if (InsertThis[0] || iRemoveChars) {
- MoveMemory(p1 + lstrlenA(InsertThis), p1 + iRemoveChars, lstrlenA(p1) - iRemoveChars + 1);
- CopyMemory(p1, InsertThis, lstrlenA(InsertThis));
- p1 += lstrlenA(InsertThis);
+ MoveMemory(p1 + mir_strlen(InsertThis), p1 + iRemoveChars, mir_strlen(p1) - iRemoveChars + 1);
+ CopyMemory(p1, InsertThis, mir_strlen(InsertThis));
+ p1 += mir_strlen(InsertThis);
}
else p1++;
}
diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index 938130031d..d06a6a8c50 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -465,9 +465,9 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa LPITEMIDLIST idList = SHBrowseForFolder(&bi);
if (idList) {
SHGetPathFromIDList(idList, tszDirectory);
- lstrcat(tszDirectory, _T("\\"));
+ mir_tstrcat(tszDirectory, _T("\\"));
PathToRelativeT(tszDirectory, tszTemp);
- SetWindowText(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY), mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
psMalloc->Release();
@@ -544,7 +544,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa free(pszText1);
}
else {
- lstrcpyn(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
+ mir_tstrncpy(g_Settings.pszLogDir, DEFLOGFILENAME, MAX_PATH);
db_unset(NULL, CHAT_MODULE, "LogDirectory");
}
pci->SM_InvalidateLogDirectories();
diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 5053c2b5d7..7af2a95929 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -78,10 +78,10 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s if (pszWordText)
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("&Message %s"), pszWordText);
else
- lstrcpyn(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
+ mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
- if (lstrlen(szTemp) > 40)
- lstrcpyn(szTemp + 40, _T("..."), 4);
+ if (mir_tstrlen(szTemp) > 40)
+ mir_tstrncpy(szTemp + 40, _T("..."), 4);
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index a383b869f3..0fa3c1485d 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -256,7 +256,7 @@ LBL_SkipEnd: if (dat->szSearchQuery == NULL) {
dat->szSearchQuery = (TCHAR*)mir_alloc(sizeof(TCHAR)*(end - start + 1));
- lstrcpyn(dat->szSearchQuery, pszText + start, end - start + 1);
+ mir_tstrncpy(dat->szSearchQuery, pszText + start, end - start + 1);
dat->szSearchResult = mir_tstrdup(dat->szSearchQuery);
dat->lastSession = NULL;
}
@@ -969,14 +969,14 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break;
}
else if (wParam == '\b' && si->szSearch[0]) // backspace
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0';
else if (wParam < ' ')
break;
else {
TCHAR szNew[2];
szNew[0] = (TCHAR)wParam;
szNew[1] = '\0';
- if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
+ if (mir_tstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) {
MessageBeep(MB_OK);
break;
}
@@ -991,7 +991,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (int i = 0; i < iItems; i++) {
USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i);
if (ui) {
- if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) {
+ if (!_tcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) {
SendMessage(hwnd, LB_SETCURSEL, i, 0);
InvalidateRect(hwnd, NULL, FALSE);
return 0;
@@ -1000,7 +1000,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, }
MessageBeep(MB_OK);
- si->szSearch[lstrlen(si->szSearch) - 1] = '\0';
+ si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0';
return 0;
}
break;
@@ -1441,7 +1441,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR }
SetTextColor(dis->hDC, ui->iStatusEx == 0 ? g_Settings.crUserListColor : g_Settings.crUserListHeadingsColor);
- TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, lstrlen(ui->pszNick));
+ TextOut(dis->hDC, dis->rcItem.left + x_offset, dis->rcItem.top, ui->pszNick, mir_tstrlen(ui->pszNick));
SelectObject(dis->hDC, hOldFont);
}
return TRUE;
@@ -1715,11 +1715,11 @@ LABEL_SHOWWINDOW: if (GetKeyState(VK_SHIFT) & 0x8000) {
LRESULT lResult = (LRESULT)SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_GETSEL, 0, 0);
int start = LOWORD(lResult);
- TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR)*(lstrlen(ui->pszUID) + 3));
+ TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR)*(mir_tstrlen(ui->pszUID) + 3));
if (start == 0)
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
+ mir_sntprintf(pszName, mir_tstrlen(ui->pszUID) + 3, _T("%s: "), ui->pszUID);
else
- mir_sntprintf(pszName, lstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
+ mir_sntprintf(pszName, mir_tstrlen(ui->pszUID) + 2, _T("%s "), ui->pszUID);
SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE), EM_REPLACESEL, FALSE, (LPARAM)pszName);
PostMessage(hwndDlg, WM_MOUSEACTIVATE, 0, 0);
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 9b306dac6c..f36a1d24f6 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -150,7 +150,7 @@ static int ackevent(WPARAM wParam, LPARAM lParam) dbei.flags |= DBEF_UTF;
dbei.szModule = GetContactProto(hContact);
dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(item->sendBuffer) + 1;
+ dbei.cbBlob = mir_strlen(item->sendBuffer) + 1;
if (!(item->flags & PREF_UTF))
dbei.cbBlob *= sizeof(TCHAR) + 1;
dbei.pBlob = (PBYTE)item->sendBuffer;
diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index 41e2227a7a..8c07b4dd28 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -408,8 +408,8 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * if (!OpenClipboard(hwndDlg))
break;
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1));
- lstrcpy((LPWSTR)GlobalLock(hData), tr.lpstrText);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1));
+ mir_tstrcpy((LPWSTR)GlobalLock(hData), tr.lpstrText);
GlobalUnlock(hData);
SetClipboardData(CF_UNICODETEXT, hData);
CloseClipboard();
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index e471643fc2..596af74bae 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -171,7 +171,7 @@ int RTL_Detect(WCHAR *pszwText) {
WORD *infoTypeC2;
int i;
- int iLen = lstrlenW(pszwText);
+ int iLen = mir_wstrlen(pszwText);
infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2));
@@ -201,14 +201,14 @@ static void AddToFileList(TCHAR ***pppFiles,int *totalCount,const TCHAR* szFilen WIN32_FIND_DATA fd;
HANDLE hFind;
TCHAR szPath[MAX_PATH];
- lstrcpy(szPath,szFilename);
- lstrcat(szPath,_T("\\*"));
+ mir_tstrcpy(szPath,szFilename);
+ mir_tstrcat(szPath,_T("\\*"));
if (( hFind = FindFirstFile( szPath, &fd )) != INVALID_HANDLE_VALUE ) {
do {
if ( !lstrcmp(fd.cFileName,_T(".")) || !lstrcmp(fd.cFileName,_T(".."))) continue;
- lstrcpy(szPath,szFilename);
- lstrcat(szPath,_T("\\"));
- lstrcat(szPath,fd.cFileName);
+ mir_tstrcpy(szPath,szFilename);
+ mir_tstrcat(szPath,_T("\\"));
+ mir_tstrcat(szPath,fd.cFileName);
AddToFileList(pppFiles,totalCount,szPath);
}
while( FindNextFile( hFind,&fd ));
@@ -1167,12 +1167,12 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (dat->windowData.hContact) {
char buf[128];
GetContactUniqueId(dat, buf, sizeof(buf));
- if (!OpenClipboard(hwndDlg) || !lstrlenA(buf))
+ if (!OpenClipboard(hwndDlg) || !mir_strlen(buf))
break;
EmptyClipboard();
- HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(buf) + 1);
- lstrcpyA((LPSTR)GlobalLock(hData), buf);
+ HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, mir_strlen(buf) + 1);
+ mir_strcpy((LPSTR)GlobalLock(hData), buf);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
CloseClipboard();
diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index e6a7d453d0..aa99c773d1 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -191,7 +191,7 @@ EventData* getEventFromDB(SrmmWindowData *dat, MCONTACT hContact, HANDLE hDbEven if (evt->eventType == EVENTTYPE_FILE) {
char *filename = ((char*)dbei.pBlob) + sizeof(DWORD);
- char *descr = filename + lstrlenA(filename) + 1;
+ char *descr = filename + mir_strlen(filename) + 1;
evt->pszTextT = DbGetEventStringT(&dbei, filename);
if (*descr != 0)
evt->pszText2T = DbGetEventStringT(&dbei, descr);
@@ -428,27 +428,27 @@ TCHAR* TimestampToString(DWORD dwFlags, time_t check, int mode) today = mktime(&tm_today);
if (dwFlags & SMF_RELATIVEDATE && check >= today) {
- lstrcpy(szResult, TranslateT("Today"));
+ mir_tstrcpy(szResult, TranslateT("Today"));
if (mode == 0)
- lstrcat(szResult, _T(","));
+ mir_tstrcat(szResult, _T(","));
}
else if (dwFlags & SMF_RELATIVEDATE && check > (today - 86400)) {
- lstrcpy(szResult, TranslateT("Yesterday"));
+ mir_tstrcpy(szResult, TranslateT("Yesterday"));
if (mode == 0)
- lstrcat(szResult, _T(","));
+ mir_tstrcat(szResult, _T(","));
}
else {
if (dwFlags & SMF_LONGDATE)
- lstrcpy(format, _T("D"));
+ mir_tstrcpy(format, _T("D"));
else
- lstrcpy(format, _T("d"));
+ mir_tstrcpy(format, _T("d"));
}
}
if (mode == 0 || mode == 2) {
if (mode == 0 && (dwFlags & SMF_SHOWDATE))
- lstrcat(format, _T(" "));
+ mir_tstrcat(format, _T(" "));
- lstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? _T("s") : _T("t"));
+ mir_tstrcat(format, (dwFlags & SMF_SHOWSECONDS) ? _T("s") : _T("t"));
}
if (format[0] != '\0') {
tmi.printTimeStamp(NULL, check, format, str, SIZEOF(str), 0);
@@ -812,7 +812,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG *pcb = 0;
return 0;
}
- dat->bufferLen = lstrlenA(dat->buffer);
+ dat->bufferLen = mir_strlen(dat->buffer);
}
*pcb = min(cb, dat->bufferLen - dat->bufferOffset);
CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 53d2703f72..b0773914c3 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -196,7 +196,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) ptrT tszFace(db_get_tsa(NULL, SRMMMOD, str));
if (tszFace == NULL)
- lstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
+ mir_tstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace);
else
_tcsncpy(lf->lfFaceName, tszFace, SIZEOF(lf->lfFaceName));
diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index f2e1bc7c86..bd6899a7d7 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -49,12 +49,12 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) isTemplate = 0;
if (hContact && szProto) {
tokens[0] = GetNickname(hContact, szProto);
- tokenLen[0] = lstrlen(tokens[0]);
+ tokenLen[0] = mir_tstrlen(tokens[0]);
tokens[1] = mir_tstrdup(pcli->pfnGetStatusModeDescription(szProto ? db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE) : ID_STATUS_OFFLINE, 0));
- tokenLen[1] = lstrlen(tokens[1]);
+ tokenLen[1] = mir_tstrlen(tokens[1]);
tokens[2] = db_get_tsa(hContact, "CList", "StatusMsg");
if (tokens[2] != NULL) {
- tokenLen[2] = lstrlen(tokens[2]);
+ tokenLen[2] = mir_tstrlen(tokens[2]);
for (i = j = 0; i < tokenLen[2]; i++) {
if (tokens[2][i] == '\r')
continue;
@@ -72,7 +72,7 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) PROTOACCOUNT* proto = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)accModule);
if (proto != NULL) {
tokens[3] = mir_tstrdup(proto->tszAccountName);
- tokenLen[3] = lstrlen(tokens[3]);
+ tokenLen[3] = mir_tstrlen(tokens[3]);
}
}
tmplt = db_get_tsa(NULL, SRMMMOD, SRMSGSET_WINDOWTITLE);
@@ -100,13 +100,13 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) }
}
if (!isTemplate)
- len += lstrlen(pszNewTitleEnd);
+ len += mir_tstrlen(pszNewTitleEnd);
title = (TCHAR *)mir_alloc(sizeof(TCHAR) * (len + 1));
for (len = 0, p = tmplt; *p; p++) {
if (*p == '%') {
for (i = 0; i < SIZEOF(titleTokenNames); i ++) {
- int tnlen = lstrlen(titleTokenNames[i]);
+ int tnlen = mir_tstrlen(titleTokenNames[i]);
if (!_tcsncmp(p, titleTokenNames[i], tnlen)) {
if (tokens[i] != NULL) {
memcpy(title+len, tokens[i], sizeof(TCHAR) * tokenLen[i]);
@@ -121,8 +121,8 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) title[len++] = *p;
}
if (!isTemplate) {
- memcpy(title+len, pszNewTitleEnd, sizeof(TCHAR) * lstrlen(pszNewTitleEnd));
- len += lstrlen(pszNewTitleEnd);
+ memcpy(title+len, pszNewTitleEnd, sizeof(TCHAR) * mir_tstrlen(pszNewTitleEnd));
+ len += mir_tstrlen(pszNewTitleEnd);
}
title[len] = '\0';
if (isTemplate)
diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index f7b158df80..07f033524c 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -187,7 +187,7 @@ char* GetRichTextRTF(HWND hwnd) void rtrimText(TCHAR *text)
{
static TCHAR szTrimString[] = _T(":;,.!?\'\"><()[]- \r\n");
- int iLen = lstrlen(text)-1;
+ int iLen = mir_tstrlen(text)-1;
while(iLen >= 0 && _tcschr(szTrimString, text[iLen])) {
text[iLen] = _T('\0');
iLen--;
@@ -196,7 +196,7 @@ void rtrimText(TCHAR *text) TCHAR *limitText(TCHAR *text, int limit)
{
- int len = lstrlen(text);
+ int len = mir_tstrlen(text);
if (len > g_dat.limitNamesLength)
{
TCHAR *ptszTemp = (TCHAR *)mir_alloc(sizeof(TCHAR) * (limit + 4));
diff --git a/plugins/SecureIM/src/commonheaders.cpp b/plugins/SecureIM/src/commonheaders.cpp index 615ebb5b34..8f432bb761 100644 --- a/plugins/SecureIM/src/commonheaders.cpp +++ b/plugins/SecureIM/src/commonheaders.cpp @@ -82,9 +82,9 @@ int msgbox(HWND hWnd, LPCSTR lpText, LPCSTR lpCaption, UINT uType) void CopyToClipboard(HWND hwnd, LPSTR msg)
{
- HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, lstrlenA(msg) + 1);
+ HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, mir_strlen(msg) + 1);
LPSTR lpstrCopy = (LPSTR)GlobalLock(hglbCopy);
- lstrcpyA(lpstrCopy, msg);
+ mir_strcpy(lpstrCopy, msg);
GlobalUnlock(hglbCopy);
OpenClipboard(NULL);
diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 51074118d6..318567cb90 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -233,15 +233,15 @@ void CSend::svcSendMsgExit(const char* szMessage) { Exit(res); return; }else{ mir_freeAndNil(m_szEventMsg); - m_cbEventMsg=lstrlenA(szMessage)+1; + m_cbEventMsg=mir_strlen(szMessage)+1; m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); ZeroMemory(m_szEventMsg, m_cbEventMsg); - lstrcpyA(m_szEventMsg,szMessage); + mir_strcpy(m_szEventMsg,szMessage); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char *temp = mir_t2a(m_pszFileDesc); mir_stradd(m_szEventMsg, "\r\n"); mir_stradd(m_szEventMsg, temp); - m_cbEventMsg = lstrlenA(m_szEventMsg)+1; + m_cbEventMsg = mir_strlen(m_szEventMsg)+1; mir_free(temp); } //create a HookEventObj on ME_PROTO_ACK @@ -272,15 +272,15 @@ void CSend::svcSendFileExit() { } mir_freeAndNil(m_szEventMsg); char* szFile = mir_t2a(m_pszFile); - m_cbEventMsg=lstrlenA(szFile)+2; + m_cbEventMsg=mir_strlen(szFile)+2; m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); ZeroMemory(m_szEventMsg, m_cbEventMsg); - lstrcpyA(m_szEventMsg,szFile); + mir_strcpy(m_szEventMsg,szFile); if (m_pszFileDesc && m_pszFileDesc[0] != NULL) { char* temp = mir_t2a(m_pszFileDesc); - m_cbEventMsg += lstrlenA(temp); + m_cbEventMsg += mir_strlen(temp); m_szEventMsg=(char*)mir_realloc(m_szEventMsg, sizeof(char)*m_cbEventMsg); - lstrcpyA(m_szEventMsg+lstrlenA(szFile)+1,temp); + mir_strcpy(m_szEventMsg+mir_strlen(szFile)+1,temp); m_szEventMsg[m_cbEventMsg-1] = 0; mir_free(temp); } diff --git a/plugins/ShellExt/src/main.cpp b/plugins/ShellExt/src/main.cpp index 24e1cdc736..c8e840cc48 100644 --- a/plugins/ShellExt/src/main.cpp +++ b/plugins/ShellExt/src/main.cpp @@ -128,7 +128,7 @@ STDAPI DllRegisterServer() TCHAR tszFileName[MAX_PATH];
GetModuleFileName(hInst, tszFileName, SIZEOF(tszFileName));
- if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(lstrlen(tszFileName)+1)))
+ if ( RegSetValueEx(kInprocServer, NULL, 0, REG_SZ, (LPBYTE)tszFileName, sizeof(TCHAR)*(mir_tstrlen(tszFileName)+1)))
return E_FAIL;
if ( RegSetValueExA(kInprocServer, "ThreadingModel", 0, REG_SZ, (PBYTE)str4, sizeof(str4)))
return E_FAIL;
diff --git a/plugins/ShellExt/src/shlcom.cpp b/plugins/ShellExt/src/shlcom.cpp index 2908263d46..5d200019bb 100644 --- a/plugins/ShellExt/src/shlcom.cpp +++ b/plugins/ShellExt/src/shlcom.cpp @@ -79,21 +79,21 @@ BOOL AddToList(TAddArgList& args) if (attr & FILE_ATTRIBUTE_DIRECTORY) {
// add the directory
- lstrcpyA(szBuf, args.szFile);
+ mir_strcpy(szBuf, args.szFile);
args.files = (LPSTR*)mir_realloc(args.files, (args.count + 1) * sizeof(LPSTR));
char *p = mir_strdup(szBuf);
args.files[args.count] = p;
args.count++;
// tack on ending search token
- lstrcatA(szBuf, "\\*");
+ mir_strcat(szBuf, "\\*");
WIN32_FIND_DATAA fd;
HANDLE hFind = FindFirstFileA(szBuf, &fd);
while (true) {
if (fd.cFileName[0] != '.') {
- lstrcpyA(szBuf, args.szFile);
- lstrcatA(szBuf, "\\");
- lstrcatA(szBuf, fd.cFileName);
+ mir_strcpy(szBuf, args.szFile);
+ mir_strcat(szBuf, "\\");
+ mir_strcat(szBuf, fd.cFileName);
// keep a copy of the current thing being processed
szThis = args.szFile;
args.szFile = szBuf;
@@ -200,8 +200,8 @@ void ipcGetSkinIcons(THeaderIPC *ipch) spi.pid = GetCurrentProcessId();
while (protoCount > 0) {
PROTOACCOUNT *pa = *pp;
- lstrcpyA(szTmp, pa->szModuleName);
- lstrcatA(szTmp, PS_GETCAPS);
+ mir_strcpy(szTmp, pa->szModuleName);
+ mir_strcat(szTmp, PS_GETCAPS);
DWORD dwCaps = CallService(szTmp, PFLAGNUM_1, 0);
if (dwCaps & PF1_FILESEND) {
TSlotIPC *pct = ipcAlloc(ipch, sizeof(TSlotProtoIcons));
@@ -315,9 +315,9 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) if (bGroupMode) {
rc = db_get_s(pContacts[i].hContact, "CList", "Group", &dbv);
if (!rc)
- n = lstrlenA(dbv.pszVal) + 1;
+ n = mir_strlen(dbv.pszVal) + 1;
}
- int cch = lstrlenA(szContact) + 1;
+ int cch = mir_strlen(szContact) + 1;
TSlotIPC *pct = ipcAlloc(ipch, cch + 1 + n);
if (pct == NULL) {
db_free(&dbv);
@@ -326,7 +326,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) // lie about the actual size of the TSlotIPC
pct->cbStrSection = cch;
LPSTR szSlot = LPSTR(pct) + sizeof(TSlotIPC);
- lstrcpyA(szSlot, szContact);
+ mir_strcpy(szSlot, szContact);
pct->fType = REQUEST_CONTACTS;
pct->hContact = pContacts[i].hContact;
pct->Status = pContacts[i].dwStatus;
@@ -337,7 +337,7 @@ bool ipcGetSortedContacts(THeaderIPC *ipch, int *pSlot, bool bGroupMode) szSlot += cch + 1;
if (rc == 0) {
pct->hGroup = murmur_hash(dbv.pszVal);
- lstrcpyA(szSlot, dbv.pszVal);
+ mir_strcpy(szSlot, dbv.pszVal);
db_free(&dbv);
}
else {
@@ -415,15 +415,15 @@ void __stdcall ipcService(ULONG_PTR dwParam) // see if we have a custom string for 'Miranda'
szMiranda = "Miranda";
- lstrcpynA(pMMT->MirandaName, szMiranda, sizeof(pMMT->MirandaName) - 1);
+ mir_strncpy(pMMT->MirandaName, szMiranda, sizeof(pMMT->MirandaName) - 1);
// for the MRU menu
szBuf = Translate("Recently");
- lstrcpynA(pMMT->MRUMenuName, szBuf, sizeof(pMMT->MRUMenuName) - 1);
+ mir_strncpy(pMMT->MRUMenuName, szBuf, sizeof(pMMT->MRUMenuName) - 1);
// and a custom string for "clear entries"
szBuf = Translate("Clear entries");
- lstrcpynA(pMMT->ClearEntries, szBuf, sizeof(pMMT->ClearEntries) - 1);
+ mir_strncpy(pMMT->ClearEntries, szBuf, sizeof(pMMT->ClearEntries) - 1);
// if the group mode is on, check if they want the CList setting
bool bGroupMode = (BST_CHECKED == db_get_b(0, SHLExt_Name, SHLExt_UseGroups, BST_UNCHECKED));
@@ -449,7 +449,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) _itoa(iSlot, szGroupStr, 10);
if ( db_get_s(0, "CListGroups", szGroupStr, &dbv) != 0)
break;
- pct = ipcAlloc(pMMT, lstrlenA(dbv.pszVal + 1) + 1);
+ pct = ipcAlloc(pMMT, mir_strlen(dbv.pszVal + 1) + 1);
// first byte has flags, need null term
if (pct != NULL) {
if (pMMT->GroupsBegin == NULL)
@@ -457,7 +457,7 @@ void __stdcall ipcService(ULONG_PTR dwParam) pct->fType = REQUEST_GROUPS;
pct->hContact = 0;
szBuf = LPSTR(pct) + sizeof(TSlotIPC); // get the end of the slot
- lstrcpyA(szBuf, dbv.pszVal + 1);
+ mir_strcpy(szBuf, dbv.pszVal + 1);
pct->hGroup = 0;
db_free(&dbv); // free the string
}
diff --git a/plugins/ShellExt/src/shlext.cpp b/plugins/ShellExt/src/shlext.cpp index ff8ba3d906..702f072fe4 100644 --- a/plugins/ShellExt/src/shlext.cpp +++ b/plugins/ShellExt/src/shlext.cpp @@ -169,7 +169,7 @@ void DecideMenuItemInfo(TSlotIPC *pct, TGroupNode *pg, MENUITEMINFOA &mii, TEnum if (pct != NULL) {
psd->cch = pct->cbStrSection - 1; // no null;
psd->szText = (char*)HeapAlloc(hDllHeap, 0, pct->cbStrSection);
- lstrcpyA(psd->szText, (char*)pct + sizeof(TSlotIPC));
+ mir_strcpy(psd->szText, (char*)pct + sizeof(TSlotIPC));
psd->hContact = pct->hContact;
psd->fTypes = dtContact;
// find the protocol icon array to use && which status
@@ -375,9 +375,9 @@ static void BuildMenus(TEnumData *lParam) // since it maybe Miranda\Blah\Blah and we have created the first node
// which maybe Miranda, thus giving the wrong hash
// since "Miranda" can be a group of it's own and a full path
- q->cchGroup = lstrlenA(Token);
+ q->cchGroup = mir_strlen(Token);
q->szGroup = (LPSTR)HeapAlloc(hDllHeap, 0, q->cchGroup + 1);
- lstrcpyA(q->szGroup, Token);
+ mir_strcpy(q->szGroup, Token);
q->dwItems = 0;
}
p = q;
@@ -449,7 +449,7 @@ static void BuildMenus(TEnumData *lParam) // the IPC string pointer wont be around forever, must make a copy
psd->cch = (int)strlen(lParam->ipch->MRUMenuName);
psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1);
- lstrcpynA(psd->szText, lParam->ipch->MRUMenuName, sizeof(lParam->ipch->MRUMenuName) - 1);
+ mir_strncpy(psd->szText, lParam->ipch->MRUMenuName, sizeof(lParam->ipch->MRUMenuName) - 1);
mii.dwItemData = (LPARAM)psd;
if (lParam->bOwnerDrawSupported && lParam->bShouldOwnerDraw) {
@@ -486,13 +486,13 @@ static void BuildMenus(TEnumData *lParam) psd = (TMenuDrawInfo*)HeapAlloc(hDllHeap, 0, sizeof(TMenuDrawInfo));
psd->cch = (int)strlen(lParam->ipch->MirandaName);
psd->szText = (LPSTR)HeapAlloc(hDllHeap, 0, psd->cch + 1);
- lstrcpynA(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1);
+ mir_strncpy(psd->szText, lParam->ipch->MirandaName, sizeof(lParam->ipch->MirandaName) - 1);
// there may not be a profile name
pg = lParam->ipch->DataPtr;
psd->szProfile = NULL;
if (pg != NULL && pg->Status == STATUS_PROFILENAME) {
psd->szProfile = (LPSTR)HeapAlloc(hDllHeap, 0, pg->cbStrSection);
- lstrcpyA(psd->szProfile, LPSTR(UINT_PTR(pg) + sizeof(TSlotIPC)));
+ mir_strcpy(psd->szProfile, LPSTR(UINT_PTR(pg) + sizeof(TSlotIPC)));
}
// owner draw menus need ID's
@@ -771,7 +771,7 @@ HRESULT RequestTransfer(TShellExt *Self, int idxCmd) THeaderIPC *pipch = (THeaderIPC*)MapViewOfFile(hMap, FILE_MAP_ALL_ACCESS, 0, 0, 0);
if (pipch != NULL) {
// create the name of the object to be signalled by the ST
- lstrcpyA(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf)));
+ mir_strcpy(pipch->SignalEventName, CreateUID(szBuf, sizeof(szBuf)));
// create it
HANDLE hReply = CreateEventA(NULL, false, false, pipch->SignalEventName);
if (hReply != 0) {
@@ -868,7 +868,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU GetTextExtentPoint32A(dwi->hDC, psd->szText, psd->cch, &tS);
dwi->rcItem.left += tS.cx + 8;
SetTextColor(dwi->hDC, GetSysColor(COLOR_GRAYTEXT));
- DrawTextA(dwi->hDC, psd->szProfile, lstrlenA(psd->szProfile), &dwi->rcItem, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
+ DrawTextA(dwi->hDC, psd->szProfile, mir_strlen(psd->szProfile), &dwi->rcItem, DT_NOCLIP | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER);
}
}
else {
@@ -914,7 +914,7 @@ HRESULT TShellExt::HandleMenuMsg2(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESU dx += tS.cx;
// main menu item?
if (psd->szProfile != NULL) {
- GetTextExtentPoint32A(hMemDC, psd->szProfile, lstrlenA(psd->szProfile), &tS);
+ GetTextExtentPoint32A(hMemDC, psd->szProfile, mir_strlen(psd->szProfile), &tS);
dx += tS.cx;
}
// store it
diff --git a/plugins/ShellExt/src/utils.cpp b/plugins/ShellExt/src/utils.cpp index 22e033fb42..1a71ca3fe8 100644 --- a/plugins/ShellExt/src/utils.cpp +++ b/plugins/ShellExt/src/utils.cpp @@ -20,7 +20,7 @@ void logA(const char *format, ...) UINT murmur_hash(const char *str)
{
- size_t len = lstrlenA(str);
+ size_t len = mir_strlen(str);
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index ec16743b2f..d92b88e851 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -273,7 +273,7 @@ INT addEvent(WPARAM hContact, LPARAM lParam) dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ;
dbei.szModule = pszProto;
dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(pszUtf) + 1;
+ dbei.cbBlob = mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)pszUtf;
db_event_add(hContact, &dbei);
diff --git a/plugins/SimpleStatusMsg/src/awaymsg.cpp b/plugins/SimpleStatusMsg/src/awaymsg.cpp index ab93e8b13f..84a8acda74 100644 --- a/plugins/SimpleStatusMsg/src/awaymsg.cpp +++ b/plugins/SimpleStatusMsg/src/awaymsg.cpp @@ -44,7 +44,7 @@ static char *StrNormNewlineA(char *szStr) if (!nCR)
return mir_strdup(szStr);
- char *szNewStr = (char *)mir_alloc(lstrlenA(szStr) + nCR + 1), *pszStr = szNewStr;
+ char *szNewStr = (char *)mir_alloc(mir_strlen(szStr) + nCR + 1), *pszStr = szNewStr;
while (*szStr) {
if (*szStr == 0x0A)
*pszStr++ = 0x0D;
@@ -69,7 +69,7 @@ static TCHAR *StrNormNewline(TCHAR *tszStr) if (!nCR)
return mir_tstrdup(tszStr);
- TCHAR *tszNewStr = (TCHAR *)mir_alloc((lstrlen(tszStr) + nCR + 1) * sizeof(TCHAR)), *ptszStr = tszNewStr;
+ TCHAR *tszNewStr = (TCHAR *)mir_alloc((mir_tstrlen(tszStr) + nCR + 1) * sizeof(TCHAR)), *ptszStr = tszNewStr;
while (*tszStr) {
if (*tszStr == 0x0A)
*ptszStr++ = 0x0D;
@@ -268,7 +268,7 @@ static INT_PTR CALLBACK CopyAwayMsgDlgProc(HWND hwndDlg, UINT message, WPARAM wP TCHAR *tszMsg = StrNormNewline((TCHAR *)ack->lParam);
mir_sntprintf(msg, SIZEOF(msg), _T("%s"), tszMsg);
mir_free(tszMsg);
- size_t len = lstrlen(msg);
+ size_t len = mir_tstrlen(msg);
if (len) {
LPTSTR lptstrCopy;
HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR));
@@ -351,7 +351,7 @@ static INT_PTR GoToURLMsgCommand(WPARAM wParam, LPARAM lParam) char *szMsgURL = (char *)mir_alloc(i + 1);
if (szMsgURL) {
- lstrcpynA(szMsgURL, szURL, i + 1);
+ mir_strncpy(szMsgURL, szURL, i + 1);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)szMsgURL);
mir_free(szMsgURL);
}
diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index d514176267..bbf0c7fcef 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -163,7 +163,7 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) if (i + 2 <= 1024 && msg[i + 2])
{
count++;
- MoveMemory(p, p + 1, (lstrlen(p) - 1) * sizeof(TCHAR));
+ MoveMemory(p, p + 1, (mir_tstrlen(p) - 1) * sizeof(TCHAR));
}
else
{
@@ -194,11 +194,11 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else
continue;
- if (lstrlen(ptszWinampTitle) > 12)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(ptszWinampTitle) - 12) * sizeof(TCHAR));
+ if (mir_tstrlen(ptszWinampTitle) > 12)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(ptszWinampTitle) - 12) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(ptszWinampTitle), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
- CopyMemory(msg + i, ptszWinampTitle, lstrlen(ptszWinampTitle) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(ptszWinampTitle), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
+ CopyMemory(msg + i, ptszWinampTitle, mir_tstrlen(ptszWinampTitle) * sizeof(TCHAR));
mir_free(ptszWinampTitle);
}
@@ -229,21 +229,21 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) }
else GetTimeFormat(LOCALE_USER_DEFAULT, TIME_NOSECONDS, NULL, NULL, substituteStr, SIZEOF(substituteStr));
- if (lstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 6)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 6, (lstrlen(msg) - i - 5) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg + i, _T("%date%"), 6))
{
GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, substituteStr, SIZEOF(substituteStr));
- if (lstrlen(substituteStr) > 6)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 6) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 6)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 6) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 6, (lstrlen(msg) - i - 5) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 6, (mir_tstrlen(msg) - i - 5) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg+i, _T("%rand("), 6))
{
@@ -261,11 +261,11 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) mir_sntprintf(substituteStr, SIZEOF(substituteStr), _T("%d"), GetRandom(ran_from, ran_to));
for (k = i + 1; msg[k]; k++) if (msg[k] == '%') { k++; break; }
- if (lstrlen(substituteStr) > k - i)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - (k - i)) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > k - i)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - (k - i)) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + (k - i), (lstrlen(msg) - i - (k - i - 1)) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + (k - i), (mir_tstrlen(msg) - i - (k - i - 1)) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
mir_free(temp);
}
@@ -296,12 +296,12 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) db_free(&dbv);
continue;
}
- lstrcpy(substituteStr, dbv.ptszVal);
+ mir_tstrcpy(substituteStr, dbv.ptszVal);
db_free(&dbv);
}
else continue;
- if (!lstrlen(substituteStr)) continue;
+ if (!mir_tstrlen(substituteStr)) continue;
if (_tcsstr(substituteStr, _T("%randmsg%")) != NULL || _tcsstr(substituteStr, _T("%randdefmsg%")) != NULL)
{
if (k == maxk) maxk--;
@@ -309,13 +309,13 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) lstrcpy(substituteStr, _T(""));
+ if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, _T(""));
- if (lstrlen(substituteStr) > 9)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg) + 1 + lstrlen(substituteStr) - 9) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 9)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg) + 1 + mir_tstrlen(substituteStr) - 9) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 9, (lstrlen(msg) - i - 8) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 9, (mir_tstrlen(msg) - i - 8) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
else if (!_tcsnicmp(msg+i, _T("%randdefmsg%"), 12))
{
@@ -344,12 +344,12 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) db_free(&dbv);
continue;
}
- lstrcpy(substituteStr, dbv.ptszVal);
+ mir_tstrcpy(substituteStr, dbv.ptszVal);
db_free(&dbv);
}
else continue;
- if (!lstrlen(substituteStr)) continue;
+ if (!mir_tstrlen(substituteStr)) continue;
if (_tcsstr(substituteStr, _T("%randmsg%")) != NULL || _tcsstr(substituteStr, _T("%randdefmsg%")) != NULL)
{
if (k == maxk) maxk--;
@@ -357,24 +357,24 @@ TCHAR *InsertBuiltinVarsIntoMsg(TCHAR *in, const char *szProto, int status) else rmark[0] = TRUE;
}
- if (k2 == maxk || k2 > maxk) lstrcpy(substituteStr, _T(""));
+ if (k2 == maxk || k2 > maxk) mir_tstrcpy(substituteStr, _T(""));
- if (lstrlen(substituteStr) > 12)
- msg = (TCHAR *)mir_realloc(msg, (lstrlen(msg)+1+lstrlen(substituteStr)-12) * sizeof(TCHAR));
+ if (mir_tstrlen(substituteStr) > 12)
+ msg = (TCHAR *)mir_realloc(msg, (mir_tstrlen(msg)+1+mir_tstrlen(substituteStr)-12) * sizeof(TCHAR));
- MoveMemory(msg + i + lstrlen(substituteStr), msg + i + 12, (lstrlen(msg) - i - 11) * sizeof(TCHAR));
- CopyMemory(msg + i, substituteStr, lstrlen(substituteStr) * sizeof(TCHAR));
+ MoveMemory(msg + i + mir_tstrlen(substituteStr), msg + i + 12, (mir_tstrlen(msg) - i - 11) * sizeof(TCHAR));
+ CopyMemory(msg + i, substituteStr, mir_tstrlen(substituteStr) * sizeof(TCHAR));
}
}
- if (count) msg[lstrlen(msg) - count] = 0;
+ if (count) msg[mir_tstrlen(msg) - count] = 0;
if (szProto)
{
char szSetting[80];
mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", szProto);
len = db_get_w(NULL, "SimpleStatusMsg", szSetting, 1024);
- if (len < lstrlen(msg))
+ if (len < mir_tstrlen(msg))
{
msg = (TCHAR *)mir_realloc(msg, len * sizeof(TCHAR));
msg[len] = 0;
@@ -467,7 +467,7 @@ static TCHAR *GetAwayMessageFormat(int iStatus, const char *szProto) void DBWriteMessage(char *szSetting, TCHAR *tszMsg)
{
- if (tszMsg && lstrlen(tszMsg))
+ if (tszMsg && mir_tstrlen(tszMsg))
db_set_ts(NULL, "SimpleStatusMsg", szSetting, tszMsg);
else
db_unset(NULL, "SimpleStatusMsg", szSetting);
@@ -1401,7 +1401,7 @@ VOID CALLBACK UpdateMsgTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD d db_free(&dbv);
}
- if (tszMsg && lstrlen(tszMsg))
+ if (tszMsg && mir_tstrlen(tszMsg))
{
#ifdef _DEBUG
log2file("UpdateMsgTimerProc(): Set %s status and \"%S\" status message for %s.", StatusModeToDbSetting(iCurrentStatus, ""), tszMsg, accounts->pa[i]->szModuleName);
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index 487d575ca8..f0b8941f09 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -335,7 +335,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) mir_snprintf(buff, SIZEOF(buff), "DefMsg%d", i); if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { if (dbv.ptszVal) { - if (!lstrlen(dbv.ptszVal)) { + if (!mir_tstrlen(dbv.ptszVal)) { db_free(&dbv); continue; } @@ -472,7 +472,7 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control) int len; GetMenuString(hmenu, m_selection, (LPTSTR)&item_string, 128, MF_BYCOMMAND); - len = lstrlen(item_string); + len = mir_tstrlen(item_string); if (len) { LPTSTR lptstrCopy; HGLOBAL hglbCopy = GlobalAlloc(GMEM_MOVEABLE, (len + 1) * sizeof(TCHAR)); @@ -722,7 +722,7 @@ void SetEditControlText(struct MsgBoxData *data, HWND hwndDlg, int iStatus) if (!db_get(NULL, "SimpleStatusMsg", setting, &dbv)) { if (dbv.pszVal && strlen(dbv.pszVal)) { if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2)) { - if (dbv2.ptszVal && lstrlen(dbv2.ptszVal)) { + if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal)) { SetDlgItemText(hwndDlg, IDC_EDIT1, dbv2.ptszVal); fcursel = SendMessage(data->recent_cbex, CB_FINDSTRINGEXACT, num_start, (LPARAM)dbv2.ptszVal); if (fcursel != CB_ERR) diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp index 5ad595fc8a..e6b48a54a3 100644 --- a/plugins/SimpleStatusMsg/src/options.cpp +++ b/plugins/SimpleStatusMsg/src/options.cpp @@ -138,7 +138,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L val = db_get_b(NULL, "SimpleStatusMsg", (char *)StatusModeToDbSetting(i, "Flags"), STATUS_DEFAULT);
data->status_msg[0].flags[i - ID_STATUS_ONLINE] = val;
ptrT text( db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, "Default")));
- lstrcpyn(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ mir_tstrncpy(data->status_msg[0].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
for (j = 0; j < accounts->count; j++)
{
@@ -150,7 +150,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L data->status_msg[j+1].flags[i-ID_STATUS_ONLINE] = val;
mir_snprintf(setting, SIZEOF(setting), "%sDefault", accounts->pa[j]->szModuleName);
text = db_get_tsa(NULL, "SRAway", StatusModeToDbSetting(i, setting));
- lstrcpyn(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
+ mir_tstrncpy(data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE], (text == NULL) ? GetDefaultMessage(i) : text, 1024);
}
}
}
@@ -453,7 +453,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
+ if ((dbv2.ptszVal) && (mir_tstrlen(dbv2.ptszVal)))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
@@ -608,7 +608,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -708,7 +708,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -822,7 +822,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
if (!db_get_ts(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ if (dbv2.ptszVal && mir_tstrlen(dbv2.ptszVal))
SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
db_free(&dbv2);
}
@@ -901,7 +901,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L else
{
GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- lstrcpy(data->status_msg[j].msg[i], msg);
+ mir_tstrcpy(data->status_msg[j].msg[i], msg);
}
}
break;
@@ -924,7 +924,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ mir_tstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
}
}
}
@@ -942,7 +942,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- int len = lstrlen(data->proto_msg[j].msg);
+ int len = mir_tstrlen(data->proto_msg[j].msg);
if (len > 0)
{
if (data->proto_msg[k+1].msg == NULL)
@@ -970,7 +970,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
+ mir_tstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
}
}
}
@@ -997,7 +997,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L {
data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
+ mir_tstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
}
}
break;
diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index c342fe1a0d..1f6d928d95 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -210,7 +210,7 @@ void GetSmileyCacheFolder(void) FoldersGetCustomPathT(hFolder, cachepath, MAX_PATH, _T(""));
HookEvent(ME_FOLDERS_PATH_CHANGED, FolderChanged);
}
- else lstrcpyn(cachepath, VARST( _T("%miranda_userdata%\\SmileyCache")), MAX_PATH);
+ else mir_tstrncpy(cachepath, VARST( _T("%miranda_userdata%\\SmileyCache")), MAX_PATH);
}
void DownloadInit(void)
diff --git a/plugins/SmileyAdd/src/options.cpp b/plugins/SmileyAdd/src/options.cpp index 3bf0895ab3..3c9a5df1af 100644 --- a/plugins/SmileyAdd/src/options.cpp +++ b/plugins/SmileyAdd/src/options.cpp @@ -490,12 +490,12 @@ bool OptionsDialogType::BrowseForSmileyPacks(int item) TCHAR filter[512], *pfilter;
_tcscpy(filter, TranslateT("Smiley packs"));
- lstrcat(filter, _T(" (*.msl;*.asl;*.xep)"));
+ mir_tstrcat(filter, _T(" (*.msl;*.asl;*.xep)"));
pfilter = filter + _tcslen(filter) + 1;
_tcscpy(pfilter, _T("*.msl;*.asl;*.xep"));
pfilter = pfilter + _tcslen(pfilter) + 1;
_tcscpy(pfilter, TranslateT("All files"));
- lstrcat(pfilter, _T(" (*.*)"));
+ mir_tstrcat(pfilter, _T(" (*.*)"));
pfilter = pfilter + _tcslen(pfilter) + 1;
_tcscpy(pfilter, _T("*.*"));
pfilter = pfilter + _tcslen(pfilter) + 1;
diff --git a/plugins/SpellChecker/src/RichEdit.cpp b/plugins/SpellChecker/src/RichEdit.cpp index 7971b607fd..1dca488f08 100644 --- a/plugins/SpellChecker/src/RichEdit.cpp +++ b/plugins/SpellChecker/src/RichEdit.cpp @@ -238,7 +238,7 @@ void RichEdit::ReplaceSel(const TCHAR *new_text) SuspendUndo();
- FixSel(&old_sel, sel, lstrlen(new_text));
+ FixSel(&old_sel, sel, mir_tstrlen(new_text));
SendMessage(WM_SETREDRAW, FALSE, 0);
SendMessage(EM_SETEVENTMASK, 0, old_mask & ~ENM_CHANGE);
@@ -254,7 +254,7 @@ int RichEdit::Replace(int start, int end, const TCHAR *new_text) ReplaceSel(new_text);
- int dif = FixSel(&sel, replace_sel, lstrlen(new_text));
+ int dif = FixSel(&sel, replace_sel, mir_tstrlen(new_text));
SetSel(sel);
return dif;
}
@@ -267,7 +267,7 @@ int RichEdit::Insert(int pos, const TCHAR *text) ReplaceSel(text);
- int dif = FixSel(&sel, replace_sel, lstrlen(text));
+ int dif = FixSel(&sel, replace_sel, mir_tstrlen(text));
SetSel(sel);
return dif;
}
diff --git a/plugins/SpellChecker/src/ardialog.cpp b/plugins/SpellChecker/src/ardialog.cpp index 22634c8858..1bf94a01f6 100644 --- a/plugins/SpellChecker/src/ardialog.cpp +++ b/plugins/SpellChecker/src/ardialog.cpp @@ -217,7 +217,7 @@ static INT_PTR CALLBACK AddReplacementDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa TCHAR find[256];
if (data->findReadOnly)
- lstrcpyn(find, data->find.c_str(), SIZEOF(find));
+ mir_tstrncpy(find, data->find.c_str(), SIZEOF(find));
else {
GetDlgItemText(hwndDlg, IDC_OLD, find, SIZEOF(find));
lstrtrim(find);
diff --git a/plugins/SpellChecker/src/autoreplace.cpp b/plugins/SpellChecker/src/autoreplace.cpp index aa38708d8a..a3a8425844 100644 --- a/plugins/SpellChecker/src/autoreplace.cpp +++ b/plugins/SpellChecker/src/autoreplace.cpp @@ -33,7 +33,7 @@ AutoReplacement::AutoReplacement(const TCHAR *replace, BOOL useVariables) AutoReplaceMap::AutoReplaceMap(TCHAR *aFilename, Dictionary *dict)
{
this->dict = dict;
- lstrcpyn(filename, aFilename, SIZEOF(filename));
+ mir_tstrncpy(filename, aFilename, SIZEOF(filename));
loadAutoReplaceMap();
}
@@ -145,7 +145,7 @@ TCHAR* AutoReplaceMap::autoReplace(const TCHAR * word) to = _tcsdup(ar.replace.c_str());
// Wich case to use?
- size_t len = lstrlen(word);
+ size_t len = mir_tstrlen(word);
size_t i;
for (i = 0; i < len; i++)
if (IsCharLower(word[i]))
@@ -169,7 +169,7 @@ TCHAR* AutoReplaceMap::autoReplace(const TCHAR * word) TCHAR* AutoReplaceMap::filterText(const TCHAR *find)
{
TCHAR *ret = _tcsdup(find);
- int len = lstrlen(ret);
+ int len = mir_tstrlen(ret);
int pos = 0;
for (int i = 0; i < len; i++)
if (isWordChar(find[i]))
diff --git a/plugins/SpellChecker/src/dictionary.cpp b/plugins/SpellChecker/src/dictionary.cpp index 0926273837..c794aca5f8 100644 --- a/plugins/SpellChecker/src/dictionary.cpp +++ b/plugins/SpellChecker/src/dictionary.cpp @@ -443,13 +443,13 @@ protected: public: HunspellDictionary(TCHAR *aLanguage, TCHAR *aFileWithoutExtension, TCHAR *anUserPath, TCHAR *aSource) { - lstrcpyn(language, aLanguage, SIZEOF(language)); - lstrcpyn(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension)); - lstrcpyn(userPath, anUserPath, SIZEOF(userPath)); + mir_tstrncpy(language, aLanguage, SIZEOF(language)); + mir_tstrncpy(fileWithoutExtension, aFileWithoutExtension, SIZEOF(fileWithoutExtension)); + mir_tstrncpy(userPath, anUserPath, SIZEOF(userPath)); if (aSource == NULL) source[0] = _T('\0'); else - lstrcpyn(source, aSource, SIZEOF(source)); + mir_tstrncpy(source, aSource, SIZEOF(source)); loaded = LANGUAGE_NOT_LOADED; localized_name[0] = _T('\0'); @@ -471,14 +471,14 @@ public: TCHAR * merge(TCHAR * s1, TCHAR *s2) { - int len1 = (s1 == NULL ? 0 : lstrlen(s1)); - int len2 = (s2 == NULL ? 0 : lstrlen(s2)); + int len1 = (s1 == NULL ? 0 : mir_tstrlen(s1)); + int len2 = (s2 == NULL ? 0 : mir_tstrlen(s2)); TCHAR *ret; if (len1 > 0 && len2 > 0) { ret = (TCHAR *)malloc(sizeof(TCHAR) * (len1 + len2 + 1)); - lstrcpyn(ret, s1, len1 + 1); - lstrcpyn(&ret[len1], s2, len2 + 1); + mir_tstrncpy(ret, s1, len1 + 1); + mir_tstrncpy(&ret[len1], s2, len2 + 1); FREE(s1); FREE(s2); @@ -500,7 +500,7 @@ public: } // Remove duplicated chars - int last = lstrlen(ret) - 1; + int last = mir_tstrlen(ret) - 1; for (int i = 0; i <= last; i++) { TCHAR c = ret[i]; for (int j = last; j > i; j--) { @@ -757,9 +757,9 @@ BOOL CALLBACK EnumLocalesProc(LPTSTR lpLocaleString) if (country[0] != 0) mir_sntprintf(name, SIZEOF(name), _T("%s (%s)"), dict->english_name, country); else - lstrcpyn(name, dict->english_name, SIZEOF(name)); + mir_tstrncpy(name, dict->english_name, SIZEOF(name)); - lstrcpyn(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, TranslateTS(name), SIZEOF(dict->localized_name)); } if (dict->localized_name[0] != 0) { @@ -787,14 +787,14 @@ void GetDictsInfo(LIST<Dictionary> &dicts) char lang[128]; WideCharToMultiByte(CP_ACP, 0, dict->language, -1, lang, sizeof(lang), NULL, NULL); if (!db_get_ts(NULL, MODULE_NAME, lang, &dbv)) { - lstrcpyn(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, dbv.ptszVal, SIZEOF(dict->localized_name)); db_free(&dbv); } if (dict->localized_name[0] == _T('\0')) { for (size_t j = 0; j < SIZEOF(aditionalLanguages); j++) { if (!lstrcmp(aditionalLanguages[j].language, dict->language)) { - lstrcpyn(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name)); + mir_tstrncpy(dict->localized_name, TranslateTS(aditionalLanguages[j].localized_name), SIZEOF(dict->localized_name)); break; } } @@ -804,7 +804,7 @@ void GetDictsInfo(LIST<Dictionary> &dicts) mir_sntprintf(dict->full_name, SIZEOF(dict->full_name), _T("%s [%s]"), dict->localized_name, dict->language); } else { - lstrcpyn(dict->full_name, dict->language, SIZEOF(dict->full_name)); + mir_tstrncpy(dict->full_name, dict->language, SIZEOF(dict->full_name)); } } } @@ -831,17 +831,17 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH continue; // See if .aff exists too - lstrcpy(&file[lstrlen(file) - 4], _T(".aff")); + mir_tstrcpy(&file[mir_tstrlen(file) - 4], _T(".aff")); attrib = GetFileAttributes(file); if (attrib == 0xFFFFFFFF || (attrib & FILE_ATTRIBUTE_DIRECTORY)) continue; - ffd.cFileName[lstrlen(ffd.cFileName) - 4] = _T('\0'); + ffd.cFileName[mir_tstrlen(ffd.cFileName) - 4] = _T('\0'); TCHAR *lang = ffd.cFileName; // Replace - for _ - for (int i = 0; i < lstrlen(lang); i++) + for (int i = 0; i < mir_tstrlen(lang); i++) if (lang[i] == _T('-')) lang[i] = _T('_'); @@ -853,7 +853,7 @@ void GetHunspellDictionariesFromFolder(LIST<Dictionary> &dicts, TCHAR *path, TCH if (!exists) { found = TRUE; - file[lstrlen(file) - 4] = _T('\0'); + file[mir_tstrlen(file) - 4] = _T('\0'); dicts.insert(new HunspellDictionary(lang, file, user_path, source)); } } diff --git a/plugins/SpellChecker/src/options.cpp b/plugins/SpellChecker/src/options.cpp index cba883cb3a..99f9348962 100644 --- a/plugins/SpellChecker/src/options.cpp +++ b/plugins/SpellChecker/src/options.cpp @@ -95,7 +95,7 @@ void LoadOptions() DBVARIANT dbv;
if (!db_get_ts(NULL, MODULE_NAME, "DefaultLanguage", &dbv)) {
- lstrcpyn(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
+ mir_tstrncpy(opts.default_language, dbv.ptszVal, SIZEOF(opts.default_language));
db_free(&dbv);
}
@@ -105,7 +105,7 @@ void LoadOptions() break;
if (i >= languages.getCount())
- lstrcpy(opts.default_language, languages[0]->language);
+ mir_tstrcpy(opts.default_language, languages[0]->language);
}
static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict)
@@ -152,7 +152,7 @@ static void DrawItem(HWND hwndDlg, LPDRAWITEMSTRUCT lpdis, Dictionary *dict) rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - tm.tmHeight) / 2;
rc.bottom = rc.top + tm.tmHeight;
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
@@ -215,7 +215,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP sel = 0;
db_set_ts(NULL, MODULE_NAME, "DefaultLanguage",
(TCHAR *) languages[sel]->language);
- lstrcpy(opts.default_language, languages[sel]->language);
+ mir_tstrcpy(opts.default_language, languages[sel]->language);
}
}
break;
@@ -329,7 +329,7 @@ static void SaveNewReplacements(BOOL canceled, Dictionary *dict, AutoreplaceData *data = (AutoreplaceData *) param;
- if (lstrlen(original_find) > 0)
+ if (mir_tstrlen(original_find) > 0)
data->RemoveWord(original_find);
data->AddWord(find, replace, useVariables);
@@ -352,7 +352,7 @@ static void ShowAddReplacement(HWND hwndDlg, int item = -1) else
ListView_GetItemText(GetDlgItem(hwndDlg, IDC_REPLACEMENTS), item, 0, find, SIZEOF(find));
- if (lstrlen(find) > 0) {
+ if (mir_tstrlen(find) > 0) {
AutoReplacement &ar = data->autoReplaceMap[find];
replace = ar.replace.c_str();
useVariables = ar.useVariables;
diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index d4b3fa7138..6b29b3335e 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -279,7 +279,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, int errors = 0;
TCHAR text[1024];
dlg->re->GetLine(line, text, SIZEOF(text));
- int len = lstrlen(text);
+ int len = mir_tstrlen(text);
int first_char = dlg->re->GetFirstCharOfLine(line);
// Now lets get the words
@@ -368,7 +368,7 @@ int CheckTextLine(Dialog *dlg, int line, TextParser *parser, if (dif != 0) {
// Read line again
dlg->re->GetLine(line, text, SIZEOF(text));
- len = lstrlen(text);
+ len = mir_tstrlen(text);
int old_first_char = first_char;
first_char = dlg->re->GetFirstCharOfLine(line);
@@ -689,7 +689,7 @@ int GetClosestLanguage(TCHAR *lang_name) // Try searching by the prefix only
TCHAR lang[128];
- lstrcpyn(lang, lang_name, SIZEOF(lang));
+ mir_tstrncpy(lang, lang_name, SIZEOF(lang));
TCHAR *p = _tcschr(lang, _T('_'));
if (p != NULL)
@@ -701,7 +701,7 @@ int GetClosestLanguage(TCHAR *lang_name) return i;
// Now try any suffix
- size_t len = lstrlen(lang);
+ size_t len = mir_tstrlen(lang);
for (i = 0; i < languages.getCount(); i++) {
TCHAR *p = _tcschr(languages[i]->language, _T('_'));
if (p == NULL)
@@ -747,7 +747,7 @@ void GetUserProtoLanguageSetting(Dialog *dlg, MCONTACT hContact, char *group, ch if (lstrcmpi(dict->localized_name, lang) == 0
|| lstrcmpi(dict->english_name, lang) == 0
|| lstrcmpi(dict->language, lang) == 0) {
- lstrcpyn(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dict->language, SIZEOF(dlg->lang_name));
break;
}
}
@@ -790,18 +790,18 @@ void GetContactLanguage(Dialog *dlg) if (dlg->hContact == NULL) {
if (!db_get_ts(NULL, MODULE_NAME, dlg->name, &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
}
else {
if (!db_get_ts(dlg->hContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(dlg->hContact, "eSpeak", "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
@@ -810,12 +810,12 @@ void GetContactLanguage(Dialog *dlg) MCONTACT hMetaContact = db_mc_getMeta(dlg->hContact);
if (hMetaContact != NULL) {
if (!db_get_ts(hMetaContact, MODULE_NAME, "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
if (dlg->lang_name[0] == _T('\0') && !db_get_ts(hMetaContact, "eSpeak", "TalkLanguage", &dbv)) {
- lstrcpyn(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, dbv.ptszVal, SIZEOF(dlg->lang_name));
db_free(&dbv);
}
}
@@ -833,13 +833,13 @@ void GetContactLanguage(Dialog *dlg) // Use default lang
if (dlg->lang_name[0] == _T('\0'))
- lstrcpyn(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
}
int i = GetClosestLanguage(dlg->lang_name);
if (i < 0) {
// Lost a dict?
- lstrcpyn(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
+ mir_tstrncpy(dlg->lang_name, opts.default_language, SIZEOF(dlg->lang_name));
i = GetClosestLanguage(dlg->lang_name);
}
@@ -1040,7 +1040,7 @@ void AppendSubmenu(HMENU hMenu, HMENU hSubMenu, TCHAR *name) mii.fType = MFT_STRING;
mii.hSubMenu = hSubMenu;
mii.dwTypeData = name;
- mii.cch = lstrlen(name);
+ mii.cch = mir_tstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1057,7 +1057,7 @@ void AppendMenuItem(HMENU hMenu, int id, TCHAR *name, HICON hIcon, BOOL checked) mii.hbmpChecked = iconInfo.hbmColor;
mii.hbmpUnchecked = iconInfo.hbmColor;
mii.dwTypeData = name;
- mii.cch = lstrlen(name);
+ mii.cch = mir_tstrlen(name);
InsertMenuItem(hMenu, 0, TRUE, &mii);
}
@@ -1513,12 +1513,12 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // Draw text
RECT rc_text = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc_text, DT_END_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
rc.right = lpdis->rcItem.right - 2;
rc.top = (lpdis->rcItem.bottom + lpdis->rcItem.top - (rc_text.bottom - rc_text.top)) / 2;
rc.bottom = rc.top + rc_text.bottom - rc_text.top;
- DrawText(lpdis->hDC, dict->full_name, lstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
+ DrawText(lpdis->hDC, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_END_ELLIPSIS | DT_NOPREFIX | DT_LEFT | DT_TOP | DT_SINGLELINE);
// Restore old colors
SetTextColor(lpdis->hDC, clrfore);
@@ -1546,7 +1546,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rc = { 0, 0, 0xFFFF, 0xFFFF };
- DrawText(hdc, dict->full_name, lstrlen(dict->full_name), &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
+ DrawText(hdc, dict->full_name, mir_tstrlen(dict->full_name), &rc, DT_NOPREFIX | DT_SINGLELINE | DT_LEFT | DT_TOP | DT_CALCRECT);
lpmis->itemHeight = max(ICON_SIZE, max(bmpChecked.bmHeight, rc.bottom));
lpmis->itemWidth = 2 + bmpChecked.bmWidth + 2 + ICON_SIZE + 4 + rc.right + 2;
@@ -1563,7 +1563,7 @@ LRESULT CALLBACK MenuWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) TCHAR* lstrtrim(TCHAR *str)
{
- int len = lstrlen(str);
+ int len = mir_tstrlen(str);
int i;
for (i = len - 1; i >= 0 && (str[i] == ' ' || str[i] == '\t'); --i);
diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index f6f2ce5f4b..d7c489669d 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -162,7 +162,7 @@ void MyBitmap::Blend(MyBitmap *bmp, int x, int y, int w, int h) void MyBitmap::DrawText(TCHAR *str, int x, int y)
{
- SIZE sz; GetTextExtentPoint32(this->getDC(), str, lstrlen(str), &sz);
+ SIZE sz; GetTextExtentPoint32(this->getDC(), str, mir_tstrlen(str), &sz);
RECT rc; SetRect(&rc, x, y, x+10000, y+10000);
this->saveAlpha(x-2,y-2,sz.cx+2,sz.cy+2);
::DrawText(this->getDC(), str, (int)_tcslen(str), &rc, DT_LEFT | DT_TOP | DT_SINGLELINE | DT_NOPREFIX);
@@ -208,7 +208,7 @@ bool MyBitmap::loadFromFile(TCHAR *fn, TCHAR *fnAlpha) SIZE sz;
TCHAR *ext;
- ext = &fn[lstrlen(fn)-4];
+ ext = &fn[mir_tstrlen(fn)-4];
if (!lstrcmpi(ext, _T(".png")))
{
diff --git a/plugins/SplashScreen/src/options.cpp b/plugins/SplashScreen/src/options.cpp index 1ebb02c105..fddf1bb56a 100644 --- a/plugins/SplashScreen/src/options.cpp +++ b/plugins/SplashScreen/src/options.cpp @@ -214,7 +214,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // Make path relative
int result = PathToRelativeT(szTempPath, szPath2Spash);
- if(result && lstrlen(szPath2Spash) > 0)
+ if(result && mir_tstrlen(szPath2Spash) > 0)
{
if (options.random)
{
@@ -278,7 +278,7 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP // Make path relative
int result = PathToRelativeT(szTempPath, szSoundFilePath);
- if(result && lstrlen(szSoundFile) > 0)
+ if(result && mir_tstrlen(szSoundFile) > 0)
SetWindowText(GetDlgItem(hwndDlg, IDC_SNDPATH),szSoundFilePath);
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
diff --git a/plugins/StatusPlugins/commonstatus.cpp b/plugins/StatusPlugins/commonstatus.cpp index 74218f4ebf..7020509cad 100644 --- a/plugins/StatusPlugins/commonstatus.cpp +++ b/plugins/StatusPlugins/commonstatus.cpp @@ -54,7 +54,7 @@ char *StatusModeToDbSetting(int status,const char *suffix) case ID_STATUS_OUTTOLUNCH: prefix="Otl"; break;
default: return NULL;
}
- lstrcpyA(str,prefix); lstrcatA(str,suffix);
+ mir_strcpy(str,prefix); mir_strcat(str,suffix);
return str;
}
@@ -183,10 +183,10 @@ static void SetStatusMsg(PROTOCOLSETTINGEX *ps, int newstatus) else
continue;
- if (lstrlen(substituteStr) > 6)
- tszMsg = (TCHAR*)mir_realloc(tszMsg, sizeof(TCHAR)*(lstrlen(tszMsg) + 1 + lstrlen(substituteStr) - 6));
- MoveMemory(tszMsg + j + lstrlen(substituteStr), tszMsg + j + 6, sizeof(TCHAR)*(lstrlen(tszMsg) - j - 5));
- CopyMemory(tszMsg + j, substituteStr, sizeof(TCHAR)*lstrlen(substituteStr));
+ if (mir_tstrlen(substituteStr) > 6)
+ tszMsg = (TCHAR*)mir_realloc(tszMsg, sizeof(TCHAR)*(mir_tstrlen(tszMsg) + 1 + mir_tstrlen(substituteStr) - 6));
+ MoveMemory(tszMsg + j + mir_tstrlen(substituteStr), tszMsg + j + 6, sizeof(TCHAR)*(mir_tstrlen(tszMsg) - j - 5));
+ CopyMemory(tszMsg + j, substituteStr, sizeof(TCHAR)*mir_tstrlen(substituteStr));
}
TCHAR *szFormattedMsg = variables_parsedup(tszMsg, ps->tszAccName, NULL);
diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index a2e3a22b6b..5897463b61 100755 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -129,8 +129,8 @@ const int Stricmp(const TCHAR *str, const TCHAR *substr) TCHAR *str_up = NEWTSTR_MALLOC(str);
TCHAR *substr_up = NEWTSTR_MALLOC(substr);
- CharUpperBuff(str_up, lstrlen(str_up));
- CharUpperBuff(substr_up, lstrlen(substr_up));
+ CharUpperBuff(str_up, mir_tstrlen(str_up));
+ CharUpperBuff(substr_up, mir_tstrlen(substr_up));
i = _tcscmp(str_up, substr_up);
@@ -189,7 +189,7 @@ BOOL IsUrlContains(TCHAR * Str) if(Str && _tcslen(Str)>0) {
TCHAR *StrLower = NEWTSTR_MALLOC(Str);
- CharLowerBuff(StrLower, lstrlen(StrLower));
+ CharLowerBuff(StrLower, mir_tstrlen(StrLower));
for (int i=0; i<CountUrl; i++)
if(_tcsstr (StrLower, URL[i]))
{
@@ -247,7 +247,7 @@ void LogSpamToFile(MCONTACT hContact, tstring message) if (hStopSpamLogDirH)
FoldersGetCustomPathT(hStopSpamLogDirH, pszName, MAX_PATH, _T(""));
else
- lstrcpyn(pszName, VARST( _T("%miranda_logpath%")), SIZEOF(pszName));
+ mir_tstrncpy(pszName, VARST( _T("%miranda_logpath%")), SIZEOF(pszName));
filename = pszName;
filename = filename + _T("\\stopspam_mod.log");
diff --git a/plugins/TabSRMM/src/TSButton.cpp b/plugins/TabSRMM/src/TSButton.cpp index 58fe1c4301..5538eb690f 100644 --- a/plugins/TabSRMM/src/TSButton.cpp +++ b/plugins/TabSRMM/src/TSButton.cpp @@ -292,7 +292,7 @@ nonflat_themed: }
SIZE sz;
- GetTextExtentPoint32(hdcMem, szText, lstrlen(szText), &sz);
+ GetTextExtentPoint32(hdcMem, szText, mir_tstrlen(szText), &sz);
if (ctl->cHot) {
SIZE szHot;
GetTextExtentPoint32A(hdcMem, "&", 1, &szHot);
@@ -301,7 +301,7 @@ nonflat_themed: if (ctl->arrow)
DrawState(hdcMem, NULL, NULL, (LPARAM)ctl->arrow, 0, rcClient.right - rcClient.left - 5 - PluginConfig.m_smcxicon + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), (rcClient.bottom - rcClient.top) / 2 - PluginConfig.m_smcyicon / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), PluginConfig.m_smcxicon, PluginConfig.m_smcyicon, IsWindowEnabled(ctl->hwnd) ? DST_ICON : DST_ICON | DSS_DISABLED);
SelectObject(hdcMem, ctl->hFont);
- DrawState(hdcMem, NULL, NULL, (LPARAM)szText, lstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
+ DrawState(hdcMem, NULL, NULL, (LPARAM)szText, mir_tstrlen(szText), (rcText.right - rcText.left - sz.cx) / 2 + (!ctl->hThemeButton && ctl->stateId == PBS_PRESSED ? 1 : 0), ctl->hThemeButton ? (rcText.bottom - rcText.top - sz.cy) / 2 : (rcText.bottom - rcText.top - sz.cy) / 2 - (ctl->stateId == PBS_PRESSED ? 0 : 1), sz.cx, sz.cy, IsWindowEnabled(ctl->hwnd) || ctl->hThemeButton ? DST_PREFIXTEXT | DSS_NORMAL : DST_PREFIXTEXT | DSS_DISABLED);
SelectObject(hdcMem, hOldFont);
}
diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 37987d4278..cdc0a8af53 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -144,7 +144,7 @@ static int Log_AppendIEView(LOGSTREAMDATA* streamData, BOOL simpleMode, TCHAR ** }
if ( szTemp[0] ) {
- size_t iLen = lstrlen(szTemp);
+ size_t iLen = mir_tstrlen(szTemp);
memcpy( d, szTemp, iLen * sizeof(TCHAR));
d += iLen;
}
@@ -432,9 +432,9 @@ static TCHAR * _tcsrplc(TCHAR **src, const TCHAR *ptrn, const TCHAR *rplc) size_t lSrc, lPtrn, lRplc;
TCHAR *tszFound, *tszTail;
- lSrc = lstrlen(*src);
- lPtrn = lstrlen(ptrn);
- lRplc = lstrlen(rplc);
+ lSrc = mir_tstrlen(*src);
+ lPtrn = mir_tstrlen(ptrn);
+ lRplc = mir_tstrlen(rplc);
if (lPtrn && lSrc && lSrc >= lPtrn && (tszFound = _tcsstr(*src, ptrn)) != NULL) {
if (lRplc > lPtrn)
*src = (TCHAR*) mir_realloc((void*) * src,
@@ -463,9 +463,9 @@ static TCHAR * _tcsnrplc(TCHAR *src, size_t n, const TCHAR *ptrn, const TCHAR *r size_t lSrc, lPtrn, lRplc;
TCHAR *tszFound, *tszTail;
- lSrc = lstrlen(src);
- lPtrn = lstrlen(ptrn);
- lRplc = lstrlen(rplc);
+ lSrc = mir_tstrlen(src);
+ lPtrn = mir_tstrlen(ptrn);
+ lRplc = mir_tstrlen(rplc);
if (lPtrn && lSrc && lSrc >= lPtrn && /* lengths are ok */
(tszFound = _tcsstr(src, ptrn)) != NULL && /* pattern was found in string */
(n < 0 || lSrc - lPtrn + lRplc < n) && /* there is enough room in the string */
@@ -591,7 +591,7 @@ static int Log_AppendRTF(LOGSTREAMDATA* streamData, BOOL simpleMode, char **buff }
if (szTemp[0]) {
- int iLen = lstrlenA(szTemp);
+ int iLen = mir_strlen(szTemp);
memcpy(d, szTemp, iLen);
d += iLen;
}
@@ -623,11 +623,11 @@ static void AddEventToBuffer(char **buffer, int *bufferEnd, int *bufferAlloced, return;
if (streamData->lin->ptszNick) {
- if (g_Settings.bLogLimitNames && lstrlen(streamData->lin->ptszNick) > 20) {
- lstrcpyn(szTemp, streamData->lin->ptszNick, 20);
- lstrcpyn(szTemp + 20, _T("..."), 4);
+ if (g_Settings.bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
+ mir_tstrncpy(szTemp, streamData->lin->ptszNick, 20);
+ mir_tstrncpy(szTemp + 20, _T("..."), 4);
}
- else lstrcpyn(szTemp, streamData->lin->ptszNick, 511);
+ else mir_tstrncpy(szTemp, streamData->lin->ptszNick, 511);
if (g_Settings.bClickableNicks)
mir_sntprintf(szTemp2, SIZEOF(szTemp2), _T("~~++#%s#++~~"), szTemp);
@@ -883,8 +883,8 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bShowTime) {
TCHAR szTimeStamp[30], szOldTimeStamp[30];
- lstrcpyn(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), 30);
- lstrcpyn(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), 30);
+ mir_tstrncpy(szTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, lin->time), 30);
+ mir_tstrncpy(szOldTimeStamp, pci->MakeTimeStamp(g_Settings.pszTimeStamp, streamData->si->LastTime), 30);
if (!g_Settings.bShowTimeIfChanged || streamData->si->LastTime == 0 || lstrcmp(szTimeStamp, szOldTimeStamp)) {
streamData->si->LastTime = lin->time;
Log_AppendRTF(streamData, TRUE, &buffer, &bufferEnd, &bufferAlloced, _T("%s"), szTimeStamp);
@@ -906,7 +906,7 @@ static char* Log_CreateRTF(LOGSTREAMDATA *streamData) if (g_Settings.bLogClassicIndicators)
Log_Append(&buffer, &bufferEnd, &bufferAlloced, "%s", pszIndicator);
- lstrcpyn(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299);
+ mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings.pszOutgoingNick : g_Settings.pszIncomingNick, 299);
p1 = _tcsstr(pszTemp, _T("%n"));
if (p1)
p1[1] = 's';
@@ -950,7 +950,7 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG if (lstrdat->buffer == NULL) {
lstrdat->bufferOffset = 0;
lstrdat->buffer = Log_CreateRTF(lstrdat);
- lstrdat->bufferLen = lstrlenA(lstrdat->buffer);
+ lstrdat->bufferLen = mir_strlen(lstrdat->buffer);
}
// give the RTF to the RE control
diff --git a/plugins/TabSRMM/src/chat/message.cpp b/plugins/TabSRMM/src/chat/message.cpp index 605341583d..4c45d5bb11 100644 --- a/plugins/TabSRMM/src/chat/message.cpp +++ b/plugins/TabSRMM/src/chat/message.cpp @@ -107,7 +107,7 @@ TCHAR* Chat_DoRtfToTags(char* pszText, SESSION_INFO *si) }
else p1 += 7;
- MoveMemory(pszText, p1, lstrlenA(p1) + 1);
+ MoveMemory(pszText, p1, mir_strlen(p1) + 1);
p1 = pszText;
// iterate through all characters, if rtf control character found then take action
@@ -295,9 +295,9 @@ TCHAR* Chat_DoRtfToTags(char* pszText, SESSION_INFO *si) // move the memory and paste in new commands instead of the old RTF
if (InsertThis[0] || iRemoveChars) {
- MoveMemory(p1 + lstrlenA(InsertThis) , p1 + iRemoveChars, lstrlenA(p1) - iRemoveChars + 1);
- CopyMemory(p1, InsertThis, lstrlenA(InsertThis));
- p1 += lstrlenA(InsertThis);
+ MoveMemory(p1 + mir_strlen(InsertThis) , p1 + iRemoveChars, mir_strlen(p1) - iRemoveChars + 1);
+ CopyMemory(p1, InsertThis, mir_strlen(InsertThis));
+ p1 += mir_strlen(InsertThis);
}
else p1++;
}
diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 12567262b6..1103d33dd8 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -224,14 +224,14 @@ void LoadMsgDlgFont(int section, int i, LOGFONT *lf, COLORREF* colour, char *szM mir_snprintf(str, SIZEOF(str), "Font%d", i);
if ((i == 17 && !strcmp(szMod, CHATFONT_MODULE)) || ((i == 20 || i == 21) && !strcmp(szMod, FONTMODULE))) {
lf->lfCharSet = SYMBOL_CHARSET;
- lstrcpyn(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName, _T("Webdings"), SIZEOF(lf->lfFaceName));
}
else {
ptrT tszDefFace(db_get_tsa(NULL, szMod, str));
if (tszDefFace == NULL)
- lstrcpy(lf->lfFaceName, fol[j].szDefFace);
+ mir_tstrcpy(lf->lfFaceName, fol[j].szDefFace);
else
- lstrcpyn(lf->lfFaceName, tszDefFace, SIZEOF(lf->lfFaceName));
+ mir_tstrncpy(lf->lfFaceName, tszDefFace, SIZEOF(lf->lfFaceName));
}
}
}
@@ -885,11 +885,11 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM if (idList) {
const TCHAR *szUserDir = M.getUserDir();
SHGetPathFromIDList(idList, tszDirectory);
- lstrcat(tszDirectory, _T("\\"));
+ mir_tstrcat(tszDirectory, _T("\\"));
TCHAR tszTemp[MAX_PATH];
PathToRelativeT(tszDirectory, tszTemp, szUserDir);
- SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), lstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
+ SetWindowText(GetDlgItem(hwndDlg, IDC_LOGDIRECTORY), mir_tstrlen(tszTemp) > 1 ? tszTemp : DEFLOGFILENAME);
}
psMalloc->Free(idList);
psMalloc->Release();
diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 722d902956..6e76d1a302 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -58,15 +58,15 @@ HWND CreateNewRoom(TContainerData *pContainer, SESSION_INFO *si, BOOL bActivateT // cut nickname if larger than x chars...
TCHAR newcontactname[128];
- if (lstrlen(contactName) > 0) {
+ if (mir_tstrlen(contactName) > 0) {
if (M.GetByte("cuttitle", 0))
CutContactName(contactName, newcontactname, SIZEOF(newcontactname));
else {
- lstrcpyn(newcontactname, contactName, SIZEOF(newcontactname));
+ mir_tstrncpy(newcontactname, contactName, SIZEOF(newcontactname));
newcontactname[127] = 0;
}
}
- else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname));
+ else mir_tstrncpy(newcontactname, _T("_U_"), SIZEOF(newcontactname));
newData.item.pszText = newcontactname;
newData.item.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
diff --git a/plugins/TabSRMM/src/chat/tools.cpp b/plugins/TabSRMM/src/chat/tools.cpp index 2c803e4b98..dcbb4947e2 100644 --- a/plugins/TabSRMM/src/chat/tools.cpp +++ b/plugins/TabSRMM/src/chat/tools.cpp @@ -103,7 +103,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa va_list marker;
static TCHAR szBuf[4 * 1024];
- if (!fmt || lstrlen(fmt) == 0 || lstrlen(fmt) > 2000)
+ if (!fmt || mir_tstrlen(fmt) == 0 || mir_tstrlen(fmt) > 2000)
return 0;
va_start(marker, fmt);
@@ -122,7 +122,7 @@ int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoNa (pa == NULL) ? _A2T(pszProtoName) : pa->tszAccountName,
pcli->pfnGetContactDisplayName(hContact, 0));
- lstrcpyn(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
+ mir_tstrncpy(pd.lptzText, TranslateTS(szBuf), MAX_SECONDLINE);
pd.iSeconds = g_Settings.iPopupTimeout;
if (g_Settings.iPopupStyle == 2) {
@@ -554,10 +554,10 @@ UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO if (pszWordText)
mir_sntprintf(szTemp, SIZEOF(szTemp), TranslateT("&Message %s"), pszWordText);
else
- lstrcpyn(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
+ mir_tstrncpy(szTemp, TranslateT("&Message"), SIZEOF(szTemp) - 1);
- if (lstrlen(szTemp) > 40)
- lstrcpyn(szTemp + 40, _T("..."), 4);
+ if (mir_tstrlen(szTemp) > 40)
+ mir_tstrncpy(szTemp + 40, _T("..."), 4);
ModifyMenu(*hMenu, ID_MESS, MF_STRING | MF_BYCOMMAND, ID_MESS, szTemp);
gcmi.Type = MENU_ON_NICKLIST;
}
diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 23489fd0c9..1fb1a58d68 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -208,7 +208,7 @@ bool IsStringValidLink(TCHAR* pszText) { if (pszText == NULL) return false; - if (lstrlen(pszText) < 5 || _tcschr(pszText, '"')) + if (mir_tstrlen(pszText) < 5 || _tcschr(pszText, '"')) return false; if (_totlower(pszText[0]) == 'w' && _totlower(pszText[1]) == 'w' && _totlower(pszText[2]) == 'w' && pszText[3] == '.' && _istalnum(pszText[4])) @@ -1535,11 +1535,11 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, break; } if (wParam == '\b' && si->szSearch[0]) // backspace - si->szSearch[lstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; else if (wParam < ' ') break; else { - if (lstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) { + if (mir_tstrlen(si->szSearch) >= SIZEOF(si->szSearch) - 2) { MessageBeep(MB_OK); break; } @@ -1557,7 +1557,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (i=0; i < iItems; i++) { USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i); if (ui) { - if (!_tcsnicmp(ui->pszNick, si->szSearch, lstrlen(si->szSearch))) { + if (!_tcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) { SendMessage(hwnd, LB_SETSEL, FALSE, -1); SendMessage(hwnd, LB_SETSEL, TRUE, i); si->iSearchItem = i; @@ -1568,7 +1568,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, } if (i == iItems) { MessageBeep(MB_OK); - si->szSearch[lstrlen(si->szSearch) - 1] = '\0'; + si->szSearch[mir_tstrlen(si->szSearch) - 1] = '\0'; return 0; } } @@ -1994,11 +1994,11 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar dat->wStatus = si->wStatus; const TCHAR *szNick = dat->cache->getNick(); - if (lstrlen(szNick) > 0) { + if (mir_tstrlen(szNick) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(szNick, dat->newtitle, SIZEOF(dat->newtitle)); else { - lstrcpyn(dat->newtitle, szNick, SIZEOF(dat->newtitle)); + mir_tstrncpy(dat->newtitle, szNick, SIZEOF(dat->newtitle)); dat->newtitle[129] = 0; } } @@ -2096,7 +2096,7 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar if (si->ptszStatusbarText) mir_sntprintf(szFinalStatusBarText, SIZEOF(szFinalStatusBarText), _T("%s %s"), mi->ptszModDispName, si->ptszStatusbarText); else { - lstrcpyn(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText)); + mir_tstrncpy(szFinalStatusBarText, mi->ptszModDispName, SIZEOF(szFinalStatusBarText)); szFinalStatusBarText[511] = 0; } } @@ -2332,16 +2332,16 @@ INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPar SIZE sz; if (si->iSearchItem != -1 && si->iSearchItem == index && si->szSearch[0]) { COLORREF clr_orig = GetTextColor(dis->hDC); - GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(si->szSearch), &sz); + GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(si->szSearch), &sz); SetTextColor(dis->hDC, RGB(250, 250, 0)); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(si->szSearch)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(si->szSearch)); SetTextColor(dis->hDC, clr_orig); x_offset += sz.cx; - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + lstrlen(si->szSearch), lstrlen(ui->pszNick) - lstrlen(si->szSearch)); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick + mir_tstrlen(si->szSearch), mir_tstrlen(ui->pszNick) - mir_tstrlen(si->szSearch)); } else { - GetTextExtentPoint32(dis->hDC, ui->pszNick, lstrlen(ui->pszNick), &sz); - TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, lstrlen(ui->pszNick)); + GetTextExtentPoint32(dis->hDC, ui->pszNick, mir_tstrlen(ui->pszNick), &sz); + TextOut(dis->hDC, x_offset, (dis->rcItem.top + dis->rcItem.bottom - sz.cy) / 2, ui->pszNick, mir_tstrlen(ui->pszNick)); SelectObject(dis->hDC, hOldFont); } return TRUE; @@ -2665,7 +2665,7 @@ LABEL_SHOWWINDOW: int iRes = SendMessage(GetDlgItem(hwndDlg, IDC_CHAT_LOG), EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (iRes > 0) { - int iLen = lstrlen(pszWord) - 1; + int iLen = mir_tstrlen(pszWord) - 1; while (iLen >= 0 && strchr(szTrimString, pszWord[iLen])) { pszWord[iLen] = '\0'; iLen--; @@ -2785,8 +2785,8 @@ LABEL_SHOWWINDOW: break; EmptyClipboard(); { - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (lstrlen(tr.lpstrText) + 1)); - lstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR) * (mir_tstrlen(tr.lpstrText) + 1)); + mir_tstrcpy((TCHAR*)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); } @@ -2842,7 +2842,7 @@ LABEL_SHOWWINDOW: else if (msg == WM_LBUTTONUP) { USERINFO *ui = si->pUsers; SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_EXGETSEL, 0, (LPARAM)&chr); - size_t bufSize = lstrlen(tr.lpstrText) + lstrlen(tszAplTmpl) + 3; + size_t bufSize = mir_tstrlen(tr.lpstrText) + mir_tstrlen(tszAplTmpl) + 3; tszTmp = tszAppeal = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR)); tr2.lpstrText = (LPTSTR) mir_alloc(sizeof(TCHAR) * 2); if (chr.cpMin) { @@ -2857,7 +2857,7 @@ LABEL_SHOWWINDOW: else /* in the beginning of the message window */ mir_sntprintf(tszAppeal, bufSize, tszAplTmpl, tr.lpstrText); - st = lstrlen(tszAppeal); + st = mir_tstrlen(tszAppeal); if (chr.cpMax != -1) { tr2.chrg.cpMin = chr.cpMax; tr2.chrg.cpMax = chr.cpMax + 1; diff --git a/plugins/TabSRMM/src/contactcache.cpp b/plugins/TabSRMM/src/contactcache.cpp index 22a445fe3d..df70c33104 100644 --- a/plugins/TabSRMM/src/contactcache.cpp +++ b/plugins/TabSRMM/src/contactcache.cpp @@ -467,7 +467,7 @@ void CContactCache::updateStatusMsg(const char *szKey) m_szStatusMsg = 0; ptrT szStatus(db_get_tsa(hContact, "CList", "StatusMsg")); if (szStatus != 0) - m_szStatusMsg = (lstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0); + m_szStatusMsg = (mir_tstrlen(szStatus) > 0 ? getNormalizedStatusMsg(szStatus) : 0); } if (szKey == 0 || (szKey && !strcmp("ListeningTo", szKey))) { if (m_ListeningInfo) @@ -545,7 +545,7 @@ TCHAR* CContactCache::getNormalizedStatusMsg(const TCHAR *src, bool fStripAll) size_t k = 0, i = 0; TCHAR* tszResult = 0; - if (src == 0 || lstrlen(src) < 2) + if (src == 0 || mir_tstrlen(src) < 2) return 0; tstring dest; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 929308b88d..727a1d09ca 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -1865,7 +1865,7 @@ panel_found: char szCName[40]; mir_snprintf(szCName, 40, "%s_theme", CONTAINER_PREFIX); - if (lstrlen(pContainer->szRelThemeFile) > 1) { + if (mir_tstrlen(pContainer->szRelThemeFile) > 1) { if (pContainer->fPrivateThemeChanged == TRUE) { PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath()); db_set_ts(hContact, SRMSGMOD_T, szCName, pContainer->szRelThemeFile); @@ -1990,8 +1990,8 @@ int TSAPI CutContactName(const TCHAR *oldname, TCHAR *newname, unsigned int size { int cutMax = PluginConfig.m_CutContactNameTo; - if (lstrlen(oldname) <= cutMax) { - lstrcpyn(newname, oldname, size); + if (mir_tstrlen(oldname) <= cutMax) { + mir_tstrncpy(newname, oldname, size); newname[size - 1] = 0; } else { @@ -2023,7 +2023,7 @@ static TContainerData* TSAPI AppendToContainerList(TContainerData *pContainer) TContainerData* TSAPI FindContainerByName(const TCHAR *name) { - if (name == NULL || lstrlen(name) == 0) + if (name == NULL || mir_tstrlen(name) == 0) return 0; if (M.GetByte("singlewinmode", 0)) // single window mode - always return 0 and force a new container @@ -2188,7 +2188,7 @@ void TSAPI DeleteContainer(int iIndex) void TSAPI RenameContainer(int iIndex, const TCHAR *szNew) { - if (lstrlen(szNew) == 0) + if (mir_tstrlen(szNew) == 0) return; char szIndex[10]; diff --git a/plugins/TabSRMM/src/eventpopups.cpp b/plugins/TabSRMM/src/eventpopups.cpp index 7af5e2671e..173308a77f 100644 --- a/plugins/TabSRMM/src/eventpopups.cpp +++ b/plugins/TabSRMM/src/eventpopups.cpp @@ -491,7 +491,7 @@ static TCHAR* ShortenPreview(DBEVENTINFO* dbe) iPreviewLimit = 500;
TCHAR* buf = DbGetEventTextT(dbe, CP_ACP);
- if (lstrlen(buf) > iPreviewLimit) {
+ if (mir_tstrlen(buf) > iPreviewLimit) {
fAddEllipsis = true;
int iIndex = iPreviewLimit;
int iWordThreshold = 20;
@@ -501,7 +501,7 @@ static TCHAR* ShortenPreview(DBEVENTINFO* dbe) buf[iIndex] = 0;
}
if (fAddEllipsis) {
- buf = (TCHAR*)mir_realloc(buf, (lstrlen(buf) + 5) * sizeof(TCHAR));
+ buf = (TCHAR*)mir_realloc(buf, (mir_tstrlen(buf) + 5) * sizeof(TCHAR));
_tcscat(buf, _T("..."));
}
return buf;
@@ -602,12 +602,12 @@ static int PopupUpdateT(MCONTACT hContact, HANDLE hEvent) int i, available = MAX_SECONDLINE - 1;
if (pdata->pluginOptions->bShowHeaders) {
_tcsncpy(lpzText, szHeader, MAX_SECONDLINE);
- available -= lstrlen(szHeader);
+ available -= mir_tstrlen(szHeader);
}
else lpzText[0] = 0;
for (i = pdata->nrMerged; i >= 0; i--) {
- available -= lstrlen(pdata->eventData[i].tszText);
+ available -= mir_tstrlen(pdata->eventData[i].tszText);
if (available <= 0)
break;
}
@@ -748,7 +748,7 @@ void TSAPI UpdateTrayMenuState(TWindowData *dat, BOOL bForced) mii.dwItemData = 0;
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = lstrlen(szMenuEntry) + 1;
+ mii.cch = mir_tstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)dat->hContact, FALSE, &mii);
@@ -814,7 +814,7 @@ int TSAPI UpdateTrayMenu(const TWindowData *dat, WORD wStatus, const char *szPro if (fromEvent == 2)
mii.dwItemData |= 0x10000000;
mir_sntprintf(szMenuEntry, SIZEOF(szMenuEntry), _T("%s: %s (%s) [%d]"), tszFinalProto, szNick, szMyStatus, mii.dwItemData & 0x0000ffff);
- mii.cch = lstrlen(szMenuEntry) + 1;
+ mii.cch = mir_tstrlen(szMenuEntry) + 1;
mii.dwTypeData = (LPTSTR)szMenuEntry;
}
SetMenuItemInfo(PluginConfig.g_hMenuTrayUnread, (UINT_PTR)hContact, FALSE, &mii);
diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index a36fb66943..3f95a9d939 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -1064,8 +1064,8 @@ void TSAPI DM_UpdateLastMessage(const TWindowData *dat) else if (dat->lastMessage) { TCHAR date[64], time[64]; tmi.printTimeStamp(NULL, dat->lastMessage, _T("d"), date, SIZEOF(date), 0); - if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && lstrlen(date) > 6) - date[lstrlen(date) - 5] = 0; + if (dat->pContainer->dwFlags & CNT_UINSTATUSBAR && mir_tstrlen(date) > 6) + date[mir_tstrlen(date) - 5] = 0; tmi.printTimeStamp(NULL, dat->lastMessage, _T("t"), time, SIZEOF(time), 0); mir_sntprintf(szBuf, SIZEOF(szBuf), TranslateT("Last received: %s at %s"), date, time); } @@ -1109,16 +1109,16 @@ LRESULT TSAPI DM_WMCopyHandler(HWND hwnd, WNDPROC oldWndProc, UINT msg, WPARAM w HANDLE hClip = GetClipboardData(CF_UNICODETEXT); if (!hClip) goto err_out; - TCHAR *tszText = (TCHAR*)mir_alloc((lstrlen((TCHAR*)hClip) + 2) * sizeof(TCHAR)); + TCHAR *tszText = (TCHAR*)mir_alloc((mir_tstrlen((TCHAR*)hClip) + 2) * sizeof(TCHAR)); if (!tszText) goto err_out; - lstrcpy(tszText, (TCHAR*)hClip); + mir_tstrcpy(tszText, (TCHAR*)hClip); Utils::FilterEventMarkers(tszText); EmptyClipboard(); - HGLOBAL hgbl = GlobalAlloc(GMEM_MOVEABLE, (lstrlen(tszText) + 1) * sizeof(TCHAR)); + HGLOBAL hgbl = GlobalAlloc(GMEM_MOVEABLE, (mir_tstrlen(tszText) + 1) * sizeof(TCHAR)); TCHAR *tszLocked = (TCHAR*)GlobalLock(hgbl); - lstrcpy(tszLocked, tszText); + mir_tstrcpy(tszLocked, tszText); GlobalUnlock(hgbl); SetClipboardData(CF_UNICODETEXT, hgbl); mir_free(tszText); @@ -1763,11 +1763,11 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (PluginConfig.m_CutContactNameOnTabs) CutContactName(szNick, newcontactname, SIZEOF(newcontactname)); else - lstrcpyn(newcontactname, szNick, SIZEOF(newcontactname)); + mir_tstrncpy(newcontactname, szNick, SIZEOF(newcontactname)); Utils::DoubleAmpersands(newcontactname); - if (lstrlen(newcontactname) != 0 && dat->szStatus != NULL) { + if (mir_tstrlen(newcontactname) != 0 && dat->szStatus != NULL) { if (PluginConfig.m_StatusOnTabs) mir_sntprintf(newtitle, 127, _T("%s (%s)"), newcontactname, dat->szStatus); else @@ -1792,7 +1792,7 @@ void TSAPI DM_UpdateTitle(TWindowData *dat, WPARAM wParam, LPARAM lParam) SendMessage(GetDlgItem(hwndDlg, IDC_NAME), BUTTONADDTOOLTIP, (WPARAM)fulluin, BATF_TCHAR); } } - else lstrcpyn(newtitle, _T("Message Session"), SIZEOF(newtitle)); + else mir_tstrncpy(newtitle, _T("Message Session"), SIZEOF(newtitle)); if (dat->idle != dwOldIdle || lParam != 0) { if (item.mask & TCIF_TEXT) { diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 2be3094c7a..03d1ff2daf 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -429,7 +429,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) fChanged = c->updateStatus();
fNickChanged = c->updateNick();
}
- if (lstrlenA(setting) > 6 && lstrlenA(setting) < 9 && !strncmp(setting, "Status", 6)) {
+ if (mir_strlen(setting) > 6 && mir_strlen(setting) < 9 && !strncmp(setting, "Status", 6)) {
fChanged = true;
if (c) {
c->updateMeta();
@@ -443,7 +443,7 @@ int CGlobals::DBSettingChanged(WPARAM hContact, LPARAM lParam) c->updateUIN();
PostMessage(hwnd, DM_UPDATEUIN, 0, 0);
}
- else if (lstrlenA(setting) > 6 && strstr("StatusMsg,XStatusMsg,XStatusName,XStatusId,ListeningTo", setting)) {
+ else if (mir_strlen(setting) > 6 && strstr("StatusMsg,XStatusMsg,XStatusName,XStatusId,ListeningTo", setting)) {
if (c) {
c->updateStatusMsg(setting);
fExtendedStatusChange = true;
@@ -624,7 +624,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) ptrA szMsg(mir_utf8encodeT(text));
DBEVENTINFO dbei = { sizeof(dbei) };
dbei.pBlob = (PBYTE)(char*)szMsg;
- dbei.cbBlob = lstrlenA(szMsg) + 1;
+ dbei.cbBlob = mir_strlen(szMsg) + 1;
dbei.flags = DBEF_UTF | DBEF_READ;
dbei.eventType = EVENTTYPE_STATUSCHANGE;
dbei.timestamp = time(NULL);
diff --git a/plugins/TabSRMM/src/infopanel.cpp b/plugins/TabSRMM/src/infopanel.cpp index 30fafd3cd5..19bce88c6e 100644 --- a/plugins/TabSRMM/src/infopanel.cpp +++ b/plugins/TabSRMM/src/infopanel.cpp @@ -431,9 +431,9 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT& rcItem) if (szStatusMsg) {
SIZE sStatusMsg, sMask;
- ::GetTextExtentPoint32(hdc, szTextToShow, lstrlen(szTextToShow), &m_szNick);
+ ::GetTextExtentPoint32(hdc, szTextToShow, mir_tstrlen(szTextToShow), &m_szNick);
::GetTextExtentPoint32(hdc, _T("A"), 1, &sMask);
- ::GetTextExtentPoint32(hdc, szStatusMsg, lstrlen(szStatusMsg), &sStatusMsg);
+ ::GetTextExtentPoint32(hdc, szStatusMsg, mir_tstrlen(szStatusMsg), &sStatusMsg);
DWORD dtFlagsNick = DT_SINGLELINE | DT_WORD_ELLIPSIS | DT_NOPREFIX;
if ((m_szNick.cx + sStatusMsg.cx + 6) < (rcItem.right - rcItem.left) || (rcItem.bottom - rcItem.top) < (2 * sMask.cy)) {
@@ -466,7 +466,7 @@ void CInfoPanel::RenderIPNickname(const HDC hdc, RECT& rcItem) CSkin::RenderText(hdc, m_dat->hThemeIP, szStatusMsg, &rcItem, dtFlags, CSkin::m_glowSize, clr);
}
else {
- GetTextExtentPoint32(hdc, szTextToShow, lstrlen(szTextToShow), &m_szNick);
+ GetTextExtentPoint32(hdc, szTextToShow, mir_tstrlen(szTextToShow), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
setUnderlinedFont(hdc, fShowUin ? m_ipConfig.hFonts[IPFONTID_UIN] : m_ipConfig.hFonts[IPFONTID_NICK]);
@@ -522,7 +522,7 @@ void CInfoPanel::RenderIPUIN(const HDC hdc, RECT& rcItem) }
SIZE sUIN;
- ::GetTextExtentPoint32(hdc, szBuf, lstrlen(szBuf), &sUIN);
+ ::GetTextExtentPoint32(hdc, szBuf, mir_tstrlen(szBuf), &sUIN);
mapRealRect(rcItem, m_rcUIN, sUIN);
CSkin::RenderText(hdc, m_dat->hThemeIP, szBuf, &rcItem, DT_SINGLELINE | DT_VCENTER, CSkin::m_glowSize, clr);
}
@@ -545,7 +545,7 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) DWORD oldPanelStatusCX = m_dat->panelStatusCX;
if (m_dat->szStatus[0])
- GetTextExtentPoint32(hdc, m_dat->szStatus, lstrlen(m_dat->szStatus), &sStatus);
+ GetTextExtentPoint32(hdc, m_dat->szStatus, mir_tstrlen(m_dat->szStatus), &sStatus);
/*
* figure out final account name
@@ -553,13 +553,13 @@ void CInfoPanel::RenderIPStatus(const HDC hdc, RECT& rcItem) const TCHAR *szFinalProto = m_dat->cache->getRealAccount();
if (szFinalProto) {
SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_PROTO]);
- GetTextExtentPoint32(hdc, szFinalProto, lstrlen(szFinalProto), &sProto);
+ GetTextExtentPoint32(hdc, szFinalProto, mir_tstrlen(szFinalProto), &sProto);
}
TCHAR szResult[80]; szResult[0] = 0;
if (m_dat->hTimeZone) {
tmi.printDateTime(m_dat->hTimeZone, _T("t"), szResult, SIZEOF(szResult), 0);
- GetTextExtentPoint32(hdc, szResult, lstrlen(szResult), &sTime);
+ GetTextExtentPoint32(hdc, szResult, mir_tstrlen(szResult), &sTime);
}
m_dat->panelStatusCX = 3 + sStatus.cx + sProto.cx + 14 + (m_dat->hClientIcon ? 20 : 0) + sTime.cx + 13;
@@ -641,7 +641,7 @@ void CInfoPanel::Chat_RenderIPNickname(const HDC hdc, RECT& rcItem) const TCHAR *tszNick = m_dat->cache->getNick();
hOldFont = reinterpret_cast<HFONT>(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(hdc, tszNick, lstrlen(tszNick), &m_szNick);
+ ::GetTextExtentPoint32(hdc, tszNick, mir_tstrlen(tszNick), &m_szNick);
mapRealRect(rcItem, m_rcNick, m_szNick);
if (m_hoverFlags & HOVER_NICK)
@@ -689,7 +689,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) SIZE szTitle;
TCHAR szPrefix[100];
mir_sntprintf(szPrefix, 100, TranslateT("Topic is: %s"), _T(""));
- ::GetTextExtentPoint32(hdc, szPrefix, lstrlen(szPrefix), &szTitle);
+ ::GetTextExtentPoint32(hdc, szPrefix, mir_tstrlen(szPrefix), &szTitle);
mapRealRect(rcItem, m_rcUIN, szTitle);
if (m_hoverFlags & HOVER_UIN)
setUnderlinedFont(hdc, m_ipConfig.hFonts[IPFONTID_UIN]);
@@ -698,7 +698,7 @@ void CInfoPanel::Chat_RenderIPSecondLine(const HDC hdc, RECT& rcItem) rcItem.left += (szTitle.cx + 4);
if (m_hoverFlags & HOVER_UIN)
::DeleteObject(::SelectObject(hdc, m_ipConfig.hFonts[IPFONTID_UIN]));
- if (si->ptszTopic && lstrlen(si->ptszTopic) > 1)
+ if (si->ptszTopic && mir_tstrlen(si->ptszTopic) > 1)
CSkin::RenderText(hdc, m_dat->hThemeIP, si->ptszTopic, &rcItem, DT_WORDBREAK | DT_END_ELLIPSIS | DT_NOPREFIX | DT_TOP, CSkin::m_glowSize, clr);
else
CSkin::RenderText(hdc, m_dat->hThemeIP, TranslateT("no topic set."), &rcItem, DT_TOP| DT_SINGLELINE | DT_NOPREFIX, CSkin::m_glowSize, clr);
diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index bdf6efb0a5..f0ff2f09d4 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -133,9 +133,9 @@ const TCHAR* CMimAPI::getUserDir() { if (m_userDir[0] == 0) { if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) - lstrcpyn(m_userDir, L"%miranda_userdata%", SIZEOF(m_userDir)); + mir_tstrncpy(m_userDir, L"%miranda_userdata%", SIZEOF(m_userDir)); else - lstrcpyn(m_userDir, VARST(_T("%miranda_userdata%")), SIZEOF(m_userDir)); + mir_tstrncpy(m_userDir, VARST(_T("%miranda_userdata%")), SIZEOF(m_userDir)); Utils::ensureTralingBackslash(m_userDir); } @@ -152,12 +152,12 @@ void CMimAPI::InitPaths() mir_sntprintf(m_szProfilePath, MAX_PATH, _T("%stabSRMM"), szUserdataDir); if (ServiceExists(MS_FOLDERS_REGISTER_PATH)) { - lstrcpyn(m_szChatLogsPath, _T("%miranda_logpath%"), MAX_PATH); - lstrcpyn(m_szSkinsPath, _T("%miranda_path%\\Skins\\TabSRMM"), MAX_PATH); + mir_tstrncpy(m_szChatLogsPath, _T("%miranda_logpath%"), MAX_PATH); + mir_tstrncpy(m_szSkinsPath, _T("%miranda_path%\\Skins\\TabSRMM"), MAX_PATH); } else { - lstrcpyn(m_szChatLogsPath, VARST(_T("%miranda_logpath%")), MAX_PATH); - lstrcpyn(m_szSkinsPath, VARST(_T("%miranda_path%\\Skins\\TabSRMM")), MAX_PATH); + mir_tstrncpy(m_szChatLogsPath, VARST(_T("%miranda_logpath%")), MAX_PATH); + mir_tstrncpy(m_szSkinsPath, VARST(_T("%miranda_path%\\Skins\\TabSRMM")), MAX_PATH); } Utils::ensureTralingBackslash(m_szChatLogsPath); diff --git a/plugins/TabSRMM/src/modplus.cpp b/plugins/TabSRMM/src/modplus.cpp index 5b6e109612..1e91712136 100644 --- a/plugins/TabSRMM/src/modplus.cpp +++ b/plugins/TabSRMM/src/modplus.cpp @@ -122,7 +122,7 @@ static int CustomButtonPressed(WPARAM wParam, LPARAM lParam) if (res == 0)
break;
- bufSize = textlenght + lstrlen(pszMenu[res - 1]) + 2;
+ bufSize = textlenght + mir_tstrlen(pszMenu[res - 1]) + 2;
pszFormatedText = (TCHAR*)_alloca(bufSize*sizeof(TCHAR));
mir_sntprintf(pszFormatedText, bufSize, pszMenu[res-1], pszText);
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 9b334fb22f..1735b763a8 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -624,7 +624,7 @@ static LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wPar if (OpenClipboard(hwnd)) { HANDLE hClip = GetClipboardData(CF_TEXT); if (hClip) { - if (lstrlenA((char*)hClip) > mwdat->nMax) { + if (mir_strlen((char*)hClip) > mwdat->nMax) { TCHAR szBuffer[512]; if (M.GetByte("autosplit", 0)) mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("WARNING: The message you are trying to paste exceeds the message size limit for the active protocol. It will be sent in chunks of max %d characters"), mwdat->nMax - 10); @@ -2112,9 +2112,9 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP break; EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(lstrlen(tr.lpstrText) + 1)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1)); TCHAR *buf = (TCHAR*)GlobalLock(hData); - lstrcpy(buf, tr.lpstrText); + mir_tstrcpy(buf, tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); CloseClipboard(); @@ -2751,7 +2751,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP int memRequired = 0, flags = 0; if (!IsUtfSendAvailable(dat->hContact)) { flags |= PREF_UNICODE; - memRequired = bufSize + ((lstrlenW(decoded) + 1) * sizeof(WCHAR)); + memRequired = bufSize + ((mir_wstrlen(decoded) + 1) * sizeof(WCHAR)); } else { flags |= PREF_UTF; @@ -2788,7 +2788,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP else { WideCharToMultiByte(dat->codePage, 0, decoded, -1, dat->sendBuffer, bufSize, 0, 0); if (flags & PREF_UNICODE) - CopyMemory(&dat->sendBuffer[bufSize], decoded, (lstrlenW(decoded) + 1) * sizeof(WCHAR)); + CopyMemory(&dat->sendBuffer[bufSize], decoded, (mir_wstrlen(decoded) + 1) * sizeof(WCHAR)); } if (memRequired == 0 || dat->sendBuffer[0] == 0) @@ -2896,13 +2896,13 @@ quote_from_last: } } if (dbei.eventType == EVENTTYPE_FILE) { - int iDescr = lstrlenA((char *)(szText + sizeof(DWORD))); + int iDescr = mir_strlen((char *)(szText + sizeof(DWORD))); MoveMemory(szText, szText + sizeof(DWORD), iDescr); MoveMemory(szText + iDescr + 2, szText + sizeof(DWORD)+iDescr, dbei.cbBlob - iDescr - sizeof(DWORD)-1); szText[iDescr] = '\r'; szText[iDescr + 1] = '\n'; - szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + lstrlenA((char *)szText))); - MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + lstrlenA((char *)szText)); + szConverted = (TCHAR*)mir_alloc(sizeof(TCHAR)* (1 + mir_strlen((char *)szText))); + MultiByteToWideChar(CP_ACP, 0, (char *)szText, -1, szConverted, 1 + mir_strlen((char *)szText)); iAlloced = true; } ptrT szQuoted(QuoteText(szConverted, iCharsPerLine, 0)); @@ -3078,7 +3078,7 @@ quote_from_last: case DM_MYAVATARCHANGED: { const char *szProto = dat->cache->getActiveProto(); - if (!strcmp((char *)wParam, szProto) && lstrlenA(szProto) == lstrlenA((char *)wParam)) + if (!strcmp((char *)wParam, szProto) && mir_strlen(szProto) == mir_strlen((char *)wParam)) LoadOwnAvatar(dat); } break; diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 85bad73929..07bc06b0b0 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -291,7 +291,7 @@ int TSAPI MsgWindowUpdateMenu(TWindowData *dat, HMENU submenu, int menuID) szText = TranslateT("Set Your Avatar...");
}
mii.dwTypeData = szText;
- mii.cch = lstrlen(szText) + 1;
+ mii.cch = mir_tstrlen(szText) + 1;
SetMenuItemInfo(submenu, ID_PICMENU_SETTINGS, FALSE, &mii);
}
else if (menuID == MENU_PANELPICMENU) {
@@ -453,13 +453,13 @@ void TSAPI UpdateReadChars(const TWindowData *dat) TCHAR szBuf[20]; szBuf[0] = 0;
if (dat->fInsertMode)
- lstrcat(szBuf, _T("O"));
+ mir_tstrcat(szBuf, _T("O"));
if (fCaps)
- lstrcat(szBuf, _T("C"));
+ mir_tstrcat(szBuf, _T("C"));
if (fNum)
- lstrcat(szBuf, _T("N"));
+ mir_tstrcat(szBuf, _T("N"));
if (dat->fInsertMode || fCaps || fNum)
- lstrcat(szBuf, _T(" | "));
+ mir_tstrcat(szBuf, _T(" | "));
mir_sntprintf(buf, SIZEOF(buf), _T("%s%s %d/%d"), szBuf, dat->lcID, dat->iOpenJobs, len);
SendMessage(dat->pContainer->hwndStatus, SB_SETTEXT, 1, (LPARAM)buf);
@@ -663,7 +663,7 @@ TCHAR* TSAPI QuoteText(const TCHAR *text, int charsPerLine, int removeExistingQu int justDoneLineBreak, bufSize;
TCHAR *strout;
- bufSize = lstrlenW(text) + 23;
+ bufSize = mir_wstrlen(text) + 23;
strout = (TCHAR*)mir_alloc(bufSize * sizeof(TCHAR));
inChar = 0;
justDoneLineBreak = 1;
@@ -887,7 +887,7 @@ BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) TCHAR InsertThis[50];
p1 += 5;
- MoveMemory(pszText, p1, (lstrlen(p1) + 1) * sizeof(TCHAR));
+ MoveMemory(pszText, p1, (mir_tstrlen(p1) + 1) * sizeof(TCHAR));
p1 = pszText;
// iterate through all characters, if rtf control character found then take action
while (*p1 != '\0') {
@@ -903,7 +903,7 @@ BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) bJustRemovedRTF = TRUE;
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol);
- iRemoveChars = 3 + lstrlen(szTemp);
+ iRemoveChars = 3 + mir_tstrlen(szTemp);
if (bTextHasStarted || iCol)
mir_sntprintf(InsertThis, SIZEOF(InsertThis), (iInd > 0) ? (inColor ? _T("[/color][color=%s]") : _T("[color=%s]")) : (inColor ? _T("[/color]") : _T("")), Utils::rtf_ctable[iInd - 1].szName);
inColor = iInd > 0 ? 1 : 0;
@@ -914,7 +914,7 @@ BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) bJustRemovedRTF = TRUE;
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("%d"), iCol);
- iRemoveChars = 10 + lstrlen(szTemp);
+ iRemoveChars = 10 + mir_tstrlen(szTemp);
}
else if (!_tcsncmp(p1, _T("\\par"), 4)) { // newline
bTextHasStarted = TRUE;
@@ -1079,7 +1079,7 @@ BOOL TSAPI DoRtfToTags(TCHAR *pszText, const TWindowData *dat) // move the memory and paste in new commands instead of the old RTF
if (InsertThis[0] || iRemoveChars) {
size_t cbLen = _tcslen(InsertThis);
- MoveMemory(p1 + cbLen, p1 + iRemoveChars, (lstrlen(p1) - iRemoveChars + 1) * sizeof(TCHAR));
+ MoveMemory(p1 + cbLen, p1 + iRemoveChars, (mir_tstrlen(p1) - iRemoveChars + 1) * sizeof(TCHAR));
CopyMemory(p1, InsertThis, cbLen * sizeof(TCHAR));
p1 += cbLen;
}
@@ -1709,7 +1709,7 @@ void TSAPI LoadOverrideTheme(TContainerData *pContainer) BOOL bReadTemplates = TRUE;
ZeroMemory(&pContainer->theme, sizeof(TLogTheme));
- if (lstrlen(pContainer->szAbsThemeFile) > 1) {
+ if (mir_tstrlen(pContainer->szAbsThemeFile) > 1) {
if (PathFileExists(pContainer->szAbsThemeFile)) {
if (CheckThemeVersion(pContainer->szAbsThemeFile) == 0) {
LoadThemeDefaults(pContainer);
@@ -1828,7 +1828,7 @@ void TSAPI GetMyNick(TWindowData *dat) if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
if (ci.type == CNFT_ASCIIZ) {
- if (lstrlen(reinterpret_cast<TCHAR *>(ci.pszVal)) < 1 || !_tcscmp(reinterpret_cast<TCHAR *>(ci.pszVal),
+ if (mir_tstrlen(reinterpret_cast<TCHAR *>(ci.pszVal)) < 1 || !_tcscmp(reinterpret_cast<TCHAR *>(ci.pszVal),
TranslateT("'(Unknown Contact)'"))) {
mir_sntprintf(dat->szMyNickname, SIZEOF(dat->szMyNickname), _T("%s"), dat->myUin[0] ? dat->myUin : TranslateT("'(Unknown Contact)'"));
if (ci.pszVal) {
diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index e5299a53da..d7999714e6 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -114,7 +114,7 @@ __forceinline char *GetRTFFont(DWORD dwIndex) static void TrimMessage(TCHAR *msg)
{
- size_t iLen = lstrlen(msg) - 1;
+ size_t iLen = mir_tstrlen(msg) - 1;
size_t i = iLen;
while (i && (msg[i] == '\r' || msg[i] == '\n')) {
@@ -594,7 +594,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, }
if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.markedRead())
- dat->cache->updateStats(TSessionStats::SET_LAST_RCV, lstrlenA((char *)dbei.pBlob));
+ dat->cache->updateStats(TSessionStats::SET_LAST_RCV, mir_strlen((char *)dbei.pBlob));
TCHAR *formatted = NULL;
if (rtfMessage == NULL) {
@@ -693,7 +693,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, szTemplate = isSent ? this_templateset->szTemplates[TMPL_MSGOUT] : this_templateset->szTemplates[TMPL_MSGIN];
}
- size_t iTemplateLen = lstrlen(szTemplate);
+ size_t iTemplateLen = mir_tstrlen(szTemplate);
BOOL showTime = dwEffectiveFlags & MWF_LOG_SHOWTIME;
BOOL showDate = dwEffectiveFlags & MWF_LOG_SHOWDATES;
@@ -997,7 +997,7 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, MCONTACT hContact, AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMISC + iFontIDOffset : MSGFONTID_YOURMISC + iFontIDOffset));
{
char *szFileName = (char *)dbei.pBlob + sizeof(DWORD);
- char *szDescr = szFileName + lstrlenA(szFileName) + 1;
+ char *szDescr = szFileName + mir_strlen(szFileName) + 1;
TCHAR *tszFileName = DbGetEventStringT(&dbei, szFileName);
if (*szDescr != 0) {
TCHAR *tszDescr = DbGetEventStringT(&dbei, szDescr);
@@ -1188,7 +1188,7 @@ static DWORD CALLBACK LogStreamInEvents(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG *pcb = 0;
return 0;
}
- dat->bufferLen = lstrlenA(dat->buffer);
+ dat->bufferLen = mir_strlen(dat->buffer);
}
*pcb = min(cb, dat->bufferLen - dat->bufferOffset);
CopyMemory(pbBuff, dat->buffer + dat->bufferOffset, *pcb);
diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index aa1e922fcf..f498505fec 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -109,7 +109,7 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox) WIN32_FIND_DATA fd = { 0 };
HANDLE h = FindFirstFile(tszMask, &fd);
while (h != INVALID_HANDLE_VALUE) {
- if (lstrlen(fd.cFileName) >= 5 && !_tcsnicmp(fd.cFileName + lstrlen(fd.cFileName) - 4, _T(".tsk"), 4)) {
+ if (mir_tstrlen(fd.cFileName) >= 5 && !_tcsnicmp(fd.cFileName + mir_tstrlen(fd.cFileName) - 4, _T(".tsk"), 4)) {
fValid = true;
break;
}
@@ -128,13 +128,13 @@ static int TSAPI ScanSkinDir(const TCHAR* tszFolder, HWND hwndCombobox) GetPrivateProfileString(_T("Global"), _T("Name"), _T("None"), szBuf, 500, tszFinalName);
if (!_tcscmp(szBuf, _T("None"))) {
- fd.cFileName[lstrlen(fd.cFileName) - 4] = 0;
+ fd.cFileName[mir_tstrlen(fd.cFileName) - 4] = 0;
mir_sntprintf(szBuf, 255, _T("%s"), fd.cFileName);
}
PathToRelativeT(tszFinalName, tszRel, M.getSkinPath());
if ((lr = SendMessage(hwndCombobox, CB_INSERTSTRING, -1, (LPARAM)szBuf)) != CB_ERR) {
- TCHAR *idata = (TCHAR*)mir_alloc((lstrlen(tszRel) + 1) * sizeof(TCHAR));
+ TCHAR *idata = (TCHAR*)mir_alloc((mir_tstrlen(tszRel) + 1) * sizeof(TCHAR));
_tcscpy(idata, tszRel);
SendMessage(hwndCombobox, CB_SETITEMDATA, lr, (LPARAM)idata);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index 8356b7f1fd..93caf5f1bf 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -68,14 +68,14 @@ static INT_PTR GetWindowClass(WPARAM wParam, LPARAM lParam) return 0; } -//wparam = (MessageWindowInputData*)
-//lparam = (MessageWindowData*)
+//wparam = (MessageWindowInputData*) +//lparam = (MessageWindowData*) //returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact static INT_PTR GetWindowData(WPARAM wParam, LPARAM lParam) { MessageWindowInputData *mwid = (MessageWindowInputData*)wParam; - if (mwid == NULL || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == NULL) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH))
+ if (mwid == NULL || (mwid->cbSize != sizeof(MessageWindowInputData)) || (mwid->hContact == NULL) || (mwid->uFlags != MSG_WINDOW_UFLAG_MSG_BOTH)) return 1; MessageWindowData *mwd = (MessageWindowData*)lParam; @@ -562,16 +562,16 @@ HWND TSAPI CreateNewTabForContact(TContainerData *pContainer, MCONTACT hContact, // cut nickname if larger than x chars... TCHAR newcontactname[128], tabtitle[128]; - if (contactName && lstrlen(contactName) > 0) { + if (contactName && mir_tstrlen(contactName) > 0) { if (M.GetByte("cuttitle", 0)) CutContactName(contactName, newcontactname, SIZEOF(newcontactname)); else { - lstrcpyn(newcontactname, contactName, SIZEOF(newcontactname)); + mir_tstrncpy(newcontactname, contactName, SIZEOF(newcontactname)); newcontactname[127] = 0; } Utils::DoubleAmpersands(newcontactname); } - else lstrcpyn(newcontactname, _T("_U_"), SIZEOF(newcontactname)); + else mir_tstrncpy(newcontactname, _T("_U_"), SIZEOF(newcontactname)); WORD wStatus = (szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE)); TCHAR *szStatus = pcli->pfnGetStatusModeDescription(szProto == NULL ? ID_STATUS_OFFLINE : db_get_w(newData.hContact, szProto, "Status", ID_STATUS_OFFLINE), 0); diff --git a/plugins/TabSRMM/src/selectcontainer.cpp b/plugins/TabSRMM/src/selectcontainer.cpp index 4cc465c702..efd3803e87 100644 --- a/plugins/TabSRMM/src/selectcontainer.cpp +++ b/plugins/TabSRMM/src/selectcontainer.cpp @@ -117,7 +117,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L if (iItem != LB_ERR) {
TCHAR szOldName[CONTAINER_NAMELEN + 1];
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szOldName);
- if (lstrlen(szOldName) == lstrlen(szNewName)) {
+ if (mir_tstrlen(szOldName) == mir_tstrlen(szNewName)) {
MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINERNAME));
break;
@@ -132,7 +132,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L RenameContainer(iIndex, szNewName);
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_RESETCONTENT, 0, 0);
for (TContainerData *p = pFirstContainer; p; p = p->pNext) {
- if (!_tcsncmp(p->szName, szName, CONTAINER_NAMELEN) && lstrlen(p->szName) == lstrlen(szName)) {
+ if (!_tcsncmp(p->szName, szName, CONTAINER_NAMELEN) && mir_tstrlen(p->szName) == mir_tstrlen(szName)) {
_tcsncpy(p->szName, szNewName, CONTAINER_NAMELEN);
SendMessage(p->hwnd, DM_CONFIGURECONTAINER, 0, 0);
}
@@ -153,7 +153,7 @@ INT_PTR CALLBACK SelectContainerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L int iItem = SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_FINDSTRING, (WPARAM)- 1, (LPARAM)szNewName);
if (iItem != LB_ERR || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
SendDlgItemMessage(hwndDlg, IDC_CNTLIST, LB_GETTEXT, (WPARAM)iItem, (LPARAM)szName);
- if (lstrlen(szName) == lstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
+ if (mir_tstrlen(szName) == mir_tstrlen(szNewName) || !_tcsncmp(szNewName, CGlobals::m_default_container_name, CONTAINER_NAMELEN)) {
MessageBox(0, TranslateT("This name is already in use"), TranslateT("Error"), MB_OK | MB_ICONERROR);
SetFocus(GetDlgItem(hwndDlg, IDC_NEWCONTAINER));
break;
diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index 6dd8cbb01c..abe3a03f2b 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -131,7 +131,7 @@ CSendLaterJob::~CSendLaterJob() POPUPDATAT ppd = {0};
ppd.lchContact = hContact;
mir_sntprintf(ppd.lptzContactName, MAX_CONTACTNAME, _T("%s"), tszName ? tszName : TranslateT("'(Unknown Contact)'"));
- TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[lstrlenA((char *)pBuf) + 1]), 100);
+ TCHAR *msgPreview = Utils::GetPreviewWithEllipsis(reinterpret_cast<TCHAR *>(&pBuf[mir_strlen((char *)pBuf) + 1]), 100);
if (fSuccess) {
mir_sntprintf(ppd.lptzText, MAX_SECONDLINE, TranslateT("A send later job completed successfully.\nThe original message: %s"),
msgPreview);
@@ -298,7 +298,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) DBVARIANT dbv = {0};
char *szOrig_Utf = 0;
- if (!m_fAvail || !szSetting || !strcmp(szSetting, "count") || lstrlenA(szSetting) < 8)
+ if (!m_fAvail || !szSetting || !strcmp(szSetting, "count") || mir_strlen(szSetting) < 8)
return 0;
if (szSetting[0] != 'S' && szSetting[0] != 'M')
@@ -333,7 +333,7 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) job->hContact = hContact;
job->created = atol(&szSetting[1]);
- int iLen = lstrlenA(szOrig_Utf);
+ int iLen = mir_strlen(szOrig_Utf);
job->sendBuffer = reinterpret_cast<char *>(mir_alloc(iLen + 1));
strncpy(job->sendBuffer, szOrig_Utf, iLen);
job->sendBuffer[iLen] = 0;
@@ -341,17 +341,17 @@ int CSendLater::addJob(const char *szSetting, LPARAM lParam) // construct conventional send buffer
wchar_t *szWchar = 0;
char *szAnsi = mir_utf8decodecp(szOrig_Utf, CP_ACP, &szWchar);
- iLen = lstrlenA(szAnsi);
+ iLen = mir_strlen(szAnsi);
UINT required = iLen + 1;
if (szWchar)
- required += ((lstrlenW(szWchar) + 1) * sizeof(wchar_t));
+ required += ((mir_wstrlen(szWchar) + 1) * sizeof(wchar_t));
job->pBuf = (PBYTE)mir_calloc(required);
strncpy((char *)job->pBuf, szAnsi, iLen);
job->pBuf[iLen] = 0;
if (szWchar)
- wcsncpy((wchar_t *)&job->pBuf[iLen + 1], szWchar, lstrlenW(szWchar));
+ wcsncpy((wchar_t *)&job->pBuf[iLen + 1], szWchar, mir_wstrlen(szWchar));
if (szSetting[0] == 'S')
db_free(&dbv);
@@ -475,7 +475,7 @@ HANDLE CSendLater::processAck(const ACKDATA *ack) dbei.flags = DBEF_SENT;
dbei.szModule = GetContactProto((p->hContact));
dbei.timestamp = time(NULL);
- dbei.cbBlob = lstrlenA(p->sendBuffer) + 1;
+ dbei.cbBlob = mir_strlen(p->sendBuffer) + 1;
dbei.flags |= DBEF_UTF;
dbei.pBlob = (PBYTE)(p->sendBuffer);
db_event_add(p->hContact, &dbei);
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index d9a47724af..a8b9b3f271 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -127,7 +127,7 @@ entry_found: static int SendChunkW(WCHAR *chunk, MCONTACT hContact, DWORD dwFlags) { - int wLen = lstrlenW(chunk); + int wLen = mir_wstrlen(chunk); DWORD memRequired = (wLen + 1) * sizeof(WCHAR); DWORD codePage = db_get_dw(hContact, SRMSGMOD_T, "ANSIcodepage", CP_ACP); @@ -157,10 +157,10 @@ static void DoSplitSendW(LPVOID param) int chunkSize = job->chunkSize / 2; char *szProto = GetContactProto(hContact); - int iLen = lstrlenA(job->szSendBuffer); + int iLen = mir_strlen(job->szSendBuffer); WCHAR *wszBegin = (WCHAR*) & job->szSendBuffer[iLen + 1]; - WCHAR *wszTemp = (WCHAR*)mir_alloc(sizeof(WCHAR) * (lstrlenW(wszBegin) + 1)); - CopyMemory(wszTemp, wszBegin, sizeof(WCHAR) * (lstrlenW(wszBegin) + 1)); + WCHAR *wszTemp = (WCHAR*)mir_alloc(sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1)); + CopyMemory(wszTemp, wszBegin, sizeof(WCHAR) * (mir_wstrlen(wszBegin) + 1)); wszBegin = wszTemp; do { @@ -231,7 +231,7 @@ static void DoSplitSendA(LPVOID param) DWORD dwFlags = job->dwFlags; int chunkSize = job->chunkSize; - iLen = lstrlenA(job->szSendBuffer); + iLen = mir_strlen(job->szSendBuffer); szTemp = (char *)mir_alloc(iLen + 1); CopyMemory(szTemp, job->szSendBuffer, iLen + 1); szBegin = szTemp; @@ -293,15 +293,15 @@ static void DoSplitSendA(LPVOID param) int SendQueue::getSendLength(const int iEntry, int sendMode) { if (m_jobs[iEntry].dwFlags & PREF_UNICODE && !(sendMode & SMODE_FORCEANSI)) { - int iLen = lstrlenA(m_jobs[iEntry].szSendBuffer); + int iLen = mir_strlen(m_jobs[iEntry].szSendBuffer); WCHAR *wszBuf = (WCHAR *) & m_jobs[iEntry].szSendBuffer[iLen + 1]; char *utf8 = mir_utf8encodeT(wszBuf); - m_jobs[iEntry].iSendLength = lstrlenA(utf8); + m_jobs[iEntry].iSendLength = mir_strlen(utf8); mir_free(utf8); return(m_jobs[iEntry].iSendLength); } else { - m_jobs[iEntry].iSendLength = lstrlenA(m_jobs[iEntry].szSendBuffer); + m_jobs[iEntry].iSendLength = mir_strlen(m_jobs[iEntry].szSendBuffer); return(m_jobs[iEntry].iSendLength); } } @@ -487,7 +487,7 @@ void SendQueue::logError(const TWindowData *dat, int iSendJobIndex, const TCHAR dbei.eventType = EVENTTYPE_ERRMSG; if (iSendJobIndex >= 0) { dbei.pBlob = (BYTE *)m_jobs[iSendJobIndex].szSendBuffer; - iMsgLen = lstrlenA(m_jobs[iSendJobIndex].szSendBuffer) + 1; + iMsgLen = mir_strlen(m_jobs[iSendJobIndex].szSendBuffer) + 1; } else { iMsgLen = 0; @@ -568,7 +568,7 @@ void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const /* message area is empty, so we can recall the failed message... */ SETTEXTEX stx = {ST_DEFAULT, 1200}; if (m_jobs[iEntry].dwFlags & PREF_UNICODE) - SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)&m_jobs[iEntry].szSendBuffer[lstrlenA(m_jobs[iEntry].szSendBuffer) + 1]); + SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)&m_jobs[iEntry].szSendBuffer[mir_strlen(m_jobs[iEntry].szSendBuffer) + 1]); else { stx.codepage = (m_jobs[iEntry].dwFlags & PREF_UTF) ? CP_UTF8 : CP_ACP; SendDlgItemMessage(dat->hwnd, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&stx, (LPARAM)m_jobs[iEntry].szSendBuffer); @@ -618,8 +618,8 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat) POPUPDATAT ppd = { 0 }; ppd.lchContact = dat->hContact; - lstrcpyn(ppd.lptzContactName, dat->cache->getNick(), MAX_CONTACTNAME); - lstrcpyn(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), MAX_SECONDLINE); + mir_tstrncpy(ppd.lptzContactName, dat->cache->getNick(), MAX_CONTACTNAME); + mir_tstrncpy(ppd.lptzText, TranslateT("A message delivery has failed.\nClick to open the message window."), MAX_SECONDLINE); if (!(BOOL)M.GetByte(MODULE, OPT_COLDEFAULT_ERR, TRUE)) { ppd.colorText = (COLORREF)M.GetDword(MODULE, OPT_COLTEXT_ERR, DEFAULT_COLTEXT); @@ -641,7 +641,7 @@ void SendQueue::NotifyDeliveryFailure(const TWindowData *dat) int SendQueue::RTL_Detect(const WCHAR *pszwText) { int i, n = 0; - int iLen = lstrlenW(pszwText); + int iLen = mir_wstrlen(pszwText); WORD *infoTypeC2 = (WORD *)mir_alloc(sizeof(WORD) * (iLen + 2)); if (infoTypeC2) { @@ -712,7 +712,7 @@ inform_and_discard: dbei.flags = DBEF_SENT; dbei.szModule = GetContactProto(job.hContact); dbei.timestamp = time(NULL); - dbei.cbBlob = lstrlenA(job.szSendBuffer) + 1; + dbei.cbBlob = mir_strlen(job.szSendBuffer) + 1; if (dat) dat->cache->updateStats(TSessionStats::BYTES_SENT, dbei.cbBlob - 1); @@ -810,7 +810,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = GetContactProto(dat->hContact); dbei.timestamp = time(NULL); - dbei.cbBlob = lstrlenA(utfText) + 1; + dbei.cbBlob = mir_strlen(utfText) + 1; dbei.pBlob = (PBYTE) utfText; StreamInEvents(dat->hwnd, 0, 1, 1, &dbei); if (dat->hDbEventFirst == NULL) @@ -845,7 +845,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b if (job->dwFlags & PREF_UTF || !(job->dwFlags & PREF_UNICODE)) { char *utf_header = mir_utf8encodeT(tszHeader); - UINT required = lstrlenA(utf_header) + lstrlenA(job->szSendBuffer) + 10; + UINT required = mir_strlen(utf_header) + mir_strlen(job->szSendBuffer) + 10; char *tszMsg = reinterpret_cast<char *>(mir_alloc(required)); if (fIsSendLater) { @@ -860,10 +860,10 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b mir_free(tszMsg); } else if (job->dwFlags & PREF_UNICODE) { - int iLen = lstrlenA(job->szSendBuffer); + int iLen = mir_strlen(job->szSendBuffer); wchar_t *wszMsg = (wchar_t *)&job->szSendBuffer[iLen + 1]; - UINT required = sizeof(TCHAR) * (lstrlen(tszHeader) + lstrlenW(wszMsg) + 10); + UINT required = sizeof(TCHAR) * (mir_tstrlen(tszHeader) + mir_wstrlen(wszMsg) + 10); TCHAR *tszMsg = reinterpret_cast<TCHAR *>(mir_alloc(required)); if (fIsSendLater) diff --git a/plugins/TabSRMM/src/sidebar.cpp b/plugins/TabSRMM/src/sidebar.cpp index b55e905536..834cc122b5 100644 --- a/plugins/TabSRMM/src/sidebar.cpp +++ b/plugins/TabSRMM/src/sidebar.cpp @@ -148,7 +148,7 @@ const SIZE& CSideBarButton::measureItem() HFONT oldFont = reinterpret_cast<HFONT>(::SelectObject(dc, ::GetStockObject(DEFAULT_GUI_FONT)));
mir_sntprintf(tszLabel, 255, _T("%s"), m_dat->newtitle);
- ::GetTextExtentPoint32(dc, tszLabel, lstrlen(tszLabel), &sz);
+ ::GetTextExtentPoint32(dc, tszLabel, mir_tstrlen(tszLabel), &sz);
sz.cx += 28;
if (m_dat->pContainer->dwFlagsEx & TCF_CLOSEBUTTON)
@@ -1180,9 +1180,9 @@ const SIZE& __fastcall CSideBar::m_measureAdvancedVertical(CSideBarButton* item) HDC dc = ::GetDC(dat->hwnd);
HFONT hOldFont = reinterpret_cast<HFONT>(::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_NICK]));
- ::GetTextExtentPoint32(dc, dat->cache->getNick(), lstrlen(dat->cache->getNick()), &szFirstLine);
+ ::GetTextExtentPoint32(dc, dat->cache->getNick(), mir_tstrlen(dat->cache->getNick()), &szFirstLine);
::SelectObject(dc, CInfoPanel::m_ipConfig.hFonts[IPFONTID_STATUS]);
- ::GetTextExtentPoint32(dc, dat->szStatus, lstrlen(dat->szStatus), &szSecondLine);
+ ::GetTextExtentPoint32(dc, dat->szStatus, mir_tstrlen(dat->szStatus), &szSecondLine);
::SelectObject(dc, hOldFont);
ReleaseDC(dat->hwnd, dc);
diff --git a/plugins/TabSRMM/src/srmm.cpp b/plugins/TabSRMM/src/srmm.cpp index 06fc9c878b..1c6f9e4af2 100644 --- a/plugins/TabSRMM/src/srmm.cpp +++ b/plugins/TabSRMM/src/srmm.cpp @@ -152,7 +152,7 @@ int _DebugTraceA(const char *fmt, ...) va_list va; va_start(va, fmt); - lstrcpyA(debug, "TABSRMM: "); + mir_strcpy(debug, "TABSRMM: "); mir_vsnprintf(&debug[9], ibsize - 10, fmt, va); #ifdef _DEBUG OutputDebugStringA(debug); diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 0ee0234859..62cd362119 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -336,7 +336,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP SetTextColor(dis->hDC, GetSysColor(COLOR_WINDOWTEXT)); } char *pszName = Translate(TemplateNames[iItem]); - TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, lstrlenA(pszName)); + TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszName, (int)mir_strlen(pszName)); } return TRUE; @@ -357,7 +357,7 @@ INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LP dbei.szModule = "Sample error message"; dbei.cbSize = sizeof(dbei); dbei.pBlob = (iIndex == 6) ? (BYTE *)"is now offline (was online)" : (BYTE *)"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."; - dbei.cbBlob = lstrlenA((char *)dbei.pBlob) + 1; + dbei.cbBlob = (int)mir_strlen((char *)dbei.pBlob) + 1; dbei.flags = (iIndex == 1 || iIndex == 3 || iIndex == 5) ? DBEF_SENT : 0; dbei.flags |= (teInfo->rtl ? DBEF_RTL : 0); dat->lastEventTime = (iIndex == 4 || iIndex == 5) ? time(NULL) - 1 : 0; diff --git a/plugins/TabSRMM/src/themeio.cpp b/plugins/TabSRMM/src/themeio.cpp index 301a031f21..11a91b80d7 100644 --- a/plugins/TabSRMM/src/themeio.cpp +++ b/plugins/TabSRMM/src/themeio.cpp @@ -135,7 +135,7 @@ static void TSAPI LoadLogfontFromINI(int i, char *szKey, LOGFONTA *lf, COLORREF lf->lfQuality = DEFAULT_QUALITY;
lf->lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT) {
- lstrcpynA(lf->lfFaceName, "Webdings", LF_FACESIZE);
+ mir_strncpy(lf->lfFaceName, "Webdings", LF_FACESIZE);
lf->lfCharSet = SYMBOL_CHARSET;
} else
GetPrivateProfileStringA(szKey, "Face", "Tahoma", lf->lfFaceName, LF_FACESIZE - 1, szIniFilename);
@@ -287,7 +287,7 @@ void TSAPI ReadThemeFromINI(const TCHAR *szIniFilenameT, TContainerData *dat, in mir_snprintf(szAppname, SIZEOF(szAppname), fontBlocks[n].szIniTemp, firstIndex + i);
if (GetPrivateProfileStringA(szAppname, "Face", "Verdana", szBuf, sizeof(szBuf), szIniFilename) != 0) {
if (i == MSGFONTID_SYMBOLS_IN || i == MSGFONTID_SYMBOLS_OUT)
- lstrcpynA(szBuf, "Arial", sizeof(szBuf));
+ mir_strncpy(szBuf, "Arial", sizeof(szBuf));
db_set_s(NULL, szModule, szTemp, szBuf);
}
diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 7e2e4833ae..829897679a 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -1408,9 +1408,9 @@ void CSkin::Load(void) GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName);
szSections[3001] = szSections[3000] = 0;
TCHAR *p = szSections;
- while (lstrlen(p) > 1) {
+ while (mir_tstrlen(p) > 1) {
if (p[0] != '%') {
- p += (lstrlen(p) + 1);
+ p += (mir_tstrlen(p) + 1);
continue;
}
for (i = 0; i <= ID_EXTBK_LAST; i++) {
@@ -1419,7 +1419,7 @@ void CSkin::Load(void) break;
}
}
- p += (lstrlen(p) + 1);
+ p += (mir_tstrlen(p) + 1);
j++;
}
@@ -1543,7 +1543,7 @@ void CSkin::LoadItems() szSections[SECT_BUFFER_SIZE] = 0;
p = szSections;
- while (lstrlen(p) > 1) {
+ while (mir_tstrlen(p) > 1) {
p1 = _tcschr(p, (int)'=');
if (p1)
*p1 = 0;
@@ -1553,14 +1553,14 @@ void CSkin::LoadItems() ZeroMemory(&m_skinIcons[m_nrSkinIcons], sizeof(TIconDesc));
m_skinIcons[m_nrSkinIcons].uId = tmpIconDesc.uId;
m_skinIcons[m_nrSkinIcons].phIcon = (HICON *)(&m_skinIcons[m_nrSkinIcons].uId);
- m_skinIcons[m_nrSkinIcons].szName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (lstrlen(p) + 1));
- lstrcpy(m_skinIcons[m_nrSkinIcons].szName, p);
+ m_skinIcons[m_nrSkinIcons].szName = (TCHAR*)mir_alloc(sizeof(TCHAR) * (mir_tstrlen(p) + 1));
+ mir_tstrcpy(m_skinIcons[m_nrSkinIcons].szName, p);
m_nrSkinIcons++;
}
}
if (p1)
*p1 = '=';
- p += (lstrlen(p) + 1);
+ p += (mir_tstrlen(p) + 1);
}
ZeroMemory(szSections, (SECT_BUFFER_SIZE + 2) * sizeof(TCHAR));
@@ -1568,10 +1568,10 @@ void CSkin::LoadItems() szSections[SECT_BUFFER_SIZE] = 0;
p = szSections;
- while (lstrlen(p) > 1) {
+ while (mir_tstrlen(p) > 1) {
if (p[0] == '$')
ReadImageItem(p);
- p += (lstrlen(p) + 1);
+ p += (mir_tstrlen(p) + 1);
}
nextButtonID = IDC_TBFIRSTUID;
@@ -1672,7 +1672,7 @@ void CSkin::setupAeroSkins() TCHAR tszFilename[MAX_PATH], tszBasePath[MAX_PATH];
_tcsncpy_s(tszBasePath, M.getDataPath(), _TRUNCATE);
- if (tszBasePath[lstrlen(tszBasePath) - 1] != '\\')
+ if (tszBasePath[mir_tstrlen(tszBasePath) - 1] != '\\')
_tcscat(tszBasePath, _T("\\"));
// load unknown avatar..
@@ -2443,7 +2443,7 @@ void CSkin::extractSkinsAndLogo(bool fForceOverwrite) const {
TCHAR tszBasePath[MAX_PATH];
mir_sntprintf(tszBasePath, MAX_PATH, _T("%s"), M.getDataPath());
- if (tszBasePath[lstrlen(tszBasePath) - 1] != '\\')
+ if (tszBasePath[mir_tstrlen(tszBasePath) - 1] != '\\')
_tcscat(tszBasePath, _T("\\"));
CreateDirectoryTreeT(tszBasePath);
diff --git a/plugins/TabSRMM/src/trayicon.cpp b/plugins/TabSRMM/src/trayicon.cpp index c495de5f87..51ed8267fb 100644 --- a/plugins/TabSRMM/src/trayicon.cpp +++ b/plugins/TabSRMM/src/trayicon.cpp @@ -308,7 +308,7 @@ void TSAPI AddContactToFavorites(MCONTACT hContact, const TCHAR *szNickname, con if (!mode) {
mii.fMask |= MIIM_STRING;
mii.dwTypeData = (LPTSTR)szMenuEntry;
- mii.cch = lstrlen(szMenuEntry) + 1;
+ mii.cch = mir_tstrlen(szMenuEntry) + 1;
}
mii.hbmpItem = HBMMENU_CALLBACK;
mii.dwItemData = (ULONG_PTR)hIcon;
diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 2a697ce0c5..51a6d33086 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -115,16 +115,16 @@ void TN_TypingMessage(MCONTACT hContact, int iMode) if (iMode == PROTOTYPE_CONTACTTYPING_OFF) {
if (StopDisabled)
return;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, szStop, MAX_SECONDLINE);
ppd.hNotification = hntfStopped;
notyping = 1;
}
else {
if (StartDisabled)
return;
- lstrcpyn(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, szContactName, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, szStart, MAX_SECONDLINE);
ppd.hNotification = hntfStarted;
notyping = 0;
}
@@ -307,13 +307,13 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (i=0; i < 2; i++) {
int notyping;
if (i == PROTOTYPE_CONTACTTYPING_OFF) {
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStop, MAX_SECONDLINE);
+ mir_tstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ mir_tstrncpy(ppd.lptzText, szStop, MAX_SECONDLINE);
notyping = 1;
}
else {
- lstrcpy(ppd.lptzContactName, TranslateT("Contact"));
- lstrcpyn(ppd.lptzText, szStart, MAX_SECONDLINE);
+ mir_tstrcpy(ppd.lptzContactName, TranslateT("Contact"));
+ mir_tstrncpy(ppd.lptzText, szStart, MAX_SECONDLINE);
notyping = 0;
}
diff --git a/plugins/TabSRMM/src/utils.cpp b/plugins/TabSRMM/src/utils.cpp index 62c99da38c..511614cd6d 100644 --- a/plugins/TabSRMM/src/utils.cpp +++ b/plugins/TabSRMM/src/utils.cpp @@ -81,7 +81,7 @@ TCHAR* Utils::FilterEventMarkers(TCHAR *wszText) break;
}
- lstrcpy(wszText, text.c_str());
+ mir_tstrcpy(wszText, text.c_str());
return wszText;
}
@@ -126,8 +126,8 @@ const TCHAR* Utils::FormatRaw(TWindowData *dat, const TCHAR *msg, int flags, BOO search_again:
bool clr_found = false;
for (int ii = 0; ii < rtf_ctable_size; ii++) {
- if (!_tcsnicmp((TCHAR*)colorname.c_str(), rtf_ctable[ii].szName, lstrlen(rtf_ctable[ii].szName))) {
- closing = beginmark + 7 + lstrlen(rtf_ctable[ii].szName);
+ if (!_tcsnicmp((TCHAR*)colorname.c_str(), rtf_ctable[ii].szName, mir_tstrlen(rtf_ctable[ii].szName))) {
+ closing = beginmark + 7 + mir_tstrlen(rtf_ctable[ii].szName);
if (endmark != message.npos) {
message.erase(endmark, 4);
message.replace(endmark, 4, _T("c0 "));
@@ -286,7 +286,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (tszNick[0])
title.insert(tempmark + 2, tszNick);
title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(tszNick);
+ curpos = tempmark + mir_tstrlen(tszNick);
break;
}
case 'p':
@@ -295,14 +295,14 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (szAcc)
title.insert(tempmark + 2, szAcc);
title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(szAcc);
+ curpos = tempmark + mir_tstrlen(szAcc);
break;
}
case 's': {
if (dat->szStatus && dat->szStatus[0])
title.insert(tempmark + 2, dat->szStatus);
title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(dat->szStatus);
+ curpos = tempmark + mir_tstrlen(dat->szStatus);
break;
}
case 'u': {
@@ -310,14 +310,14 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (szUIN[0])
title.insert(tempmark + 2, szUIN);
title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(szUIN);
+ curpos = tempmark + mir_tstrlen(szUIN);
break;
}
case 'c': {
TCHAR *c = (!_tcscmp(dat->pContainer->szName, _T("default")) ? TranslateT("Default container") : dat->pContainer->szName);
title.insert(tempmark + 2, c);
title.erase(tempmark, 2);
- curpos = tempmark + lstrlen(c);
+ curpos = tempmark + mir_tstrlen(c);
break;
}
case 'o': {
@@ -325,7 +325,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (szProto)
title.insert(tempmark + 2, _A2T(szProto));
title.erase(tempmark, 2);
- curpos = tempmark + (szProto ? lstrlenA(szProto) : 0);
+ curpos = tempmark + (szProto ? mir_strlen(szProto) : 0);
break;
}
case 'x': {
@@ -340,11 +340,11 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat szTemp[500] = 0;
db_free(&dbv);
title.insert(tempmark + 2, szTemp);
- curpos = tempmark + lstrlen(szTemp);
+ curpos = tempmark + mir_tstrlen(szTemp);
}
else {
title.insert(tempmark + 2, xStatusDescr[xStatus - 1]);
- curpos = tempmark + lstrlen(xStatusDescr[xStatus - 1]);
+ curpos = tempmark + mir_tstrlen(xStatusDescr[xStatus - 1]);
}
}
title.erase(tempmark, 2);
@@ -368,7 +368,7 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat if (szFinalStatus) {
title.insert(tempmark + 2, szFinalStatus);
- curpos = tempmark + lstrlen(szFinalStatus);
+ curpos = tempmark + mir_tstrlen(szFinalStatus);
}
title.erase(tempmark, 2);
@@ -381,12 +381,12 @@ const TCHAR* Utils::FormatTitleBar(const TWindowData *dat, const TCHAR *szFormat TCHAR *tszStatusMsg = dat->cache->getNormalizedStatusMsg(dat->cache->getStatusMsg(), true);
if (tszStatusMsg) {
title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + lstrlen(tszStatusMsg);
+ curpos = tempmark + mir_tstrlen(tszStatusMsg);
}
else if (title[curpos] == 't') {
const TCHAR* tszStatusMsg = TranslateT("No status message");
title.insert(tempmark + 2, tszStatusMsg);
- curpos = tempmark + lstrlen(tszStatusMsg);
+ curpos = tempmark + mir_tstrlen(tszStatusMsg);
}
title.erase(tempmark, 2);
if (tszStatusMsg)
@@ -437,7 +437,7 @@ char* Utils::FilterEventMarkers(char *szText) break;
}
//
- lstrcpyA(szText, text.c_str());
+ mir_strcpy(szText, text.c_str());
return szText;
}
@@ -707,7 +707,7 @@ void Utils::SaveContainerSettings(TContainerData *pContainer, const char *szSett WriteContainerSettingsToDB(0, pContainer->settings, szCName);
}
mir_snprintf(szCName, 40, "%s%d_theme", szSetting, pContainer->iContainerIndex);
- if (lstrlen(pContainer->szRelThemeFile) > 1) {
+ if (mir_tstrlen(pContainer->szRelThemeFile) > 1) {
if (pContainer->fPrivateThemeChanged == TRUE) {
PathToRelativeT(pContainer->szRelThemeFile, pContainer->szAbsThemeFile, M.getDataPath());
db_set_ts(NULL, SRMSGMOD_T, szCName, pContainer->szAbsThemeFile);
@@ -852,7 +852,7 @@ void Utils::addMenuItem(const HMENU& m, MENUITEMINFO& mii, HICON hIcon, const TC mii.wID = uID;
mii.dwItemData = (ULONG_PTR)hIcon;
mii.dwTypeData = const_cast<TCHAR *>(szText);
- mii.cch = lstrlen(mii.dwTypeData) + 1;
+ mii.cch = mir_tstrlen(mii.dwTypeData) + 1;
::InsertMenuItem(m, pos, TRUE, &mii);
}
@@ -1018,7 +1018,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename) {
static wchar_t *forbiddenCharacters = L"%/\\':|\"<>?";
- for (int i=0; i < lstrlenW(forbiddenCharacters); i++) {
+ for (int i=0; i < mir_wstrlen(forbiddenCharacters); i++) {
wchar_t* szFound = 0;
while ((szFound = wcschr(tszFilename, (int)forbiddenCharacters[i])) != NULL)
@@ -1032,7 +1032,7 @@ void Utils::sanitizeFilename(wchar_t* tszFilename) void Utils::ensureTralingBackslash(wchar_t *szPathname)
{
- if (szPathname[lstrlenW(szPathname) - 1] != '\\')
+ if (szPathname[mir_wstrlen(szPathname) - 1] != '\\')
wcscat(szPathname, L"\\");
}
@@ -1052,7 +1052,7 @@ HMODULE Utils::loadSystemLibrary(const wchar_t* szFilename) if (wcslen(sysPathName) + wcslen(szFilename) >= MAX_PATH)
return 0;
- lstrcatW(sysPathName, szFilename);
+ mir_wstrcat(sysPathName, szFilename);
HMODULE _h = LoadLibraryW(sysPathName);
if (0 == _h)
return 0;
@@ -1077,7 +1077,7 @@ size_t Utils::CopyToClipBoard(const wchar_t *str, const HWND hwndOwner) if (!OpenClipboard(hwndOwner) || str == 0)
return 0;
- size_t i = sizeof(TCHAR) * (lstrlen(str) + 1);
+ size_t i = sizeof(TCHAR) * (mir_tstrlen(str) + 1);
EmptyClipboard();
HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, i);
@@ -1102,15 +1102,15 @@ void Utils::AddToFileList(TCHAR ***pppFiles, int *totalCount, LPCTSTR szFilename WIN32_FIND_DATA fd;
HANDLE hFind;
TCHAR szPath[MAX_PATH];
- lstrcpy(szPath, szFilename);
- lstrcat(szPath, _T("\\*"));
+ mir_tstrcpy(szPath, szFilename);
+ mir_tstrcat(szPath, _T("\\*"));
if ((hFind = FindFirstFile(szPath, &fd)) != INVALID_HANDLE_VALUE) {
do {
if (!lstrcmp(fd.cFileName, _T(".")) || !lstrcmp(fd.cFileName, _T("..")))
continue;
- lstrcpy(szPath, szFilename);
- lstrcat(szPath, _T("\\"));
- lstrcat(szPath, fd.cFileName);
+ mir_tstrcpy(szPath, szFilename);
+ mir_tstrcat(szPath, _T("\\"));
+ mir_tstrcat(szPath, fd.cFileName);
AddToFileList(pppFiles, totalCount, szPath);
}
while (FindNextFile(hFind, &fd));
diff --git a/plugins/TipperYM/src/message_pump.cpp b/plugins/TipperYM/src/message_pump.cpp index a969d48251..6ad04e4af4 100644 --- a/plugins/TipperYM/src/message_pump.cpp +++ b/plugins/TipperYM/src/message_pump.cpp @@ -327,7 +327,7 @@ int ProtoAck(WPARAM wParam, LPARAM lParam) if (ack->type == ACKTYPE_AWAYMSG) {
TCHAR *tszMsg = (TCHAR*)ack->lParam;
- if (lstrlen(tszMsg))
+ if (mir_tstrlen(tszMsg))
PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)mir_tstrdup(tszMsg));
}
else if (ack->type == ICQACKTYPE_XSTATUS_RESPONSE)
diff --git a/plugins/TipperYM/src/mir_smileys.cpp b/plugins/TipperYM/src/mir_smileys.cpp index 074df144f1..2086ef13b8 100644 --- a/plugins/TipperYM/src/mir_smileys.cpp +++ b/plugins/TipperYM/src/mir_smileys.cpp @@ -41,7 +41,7 @@ SMILEYPARSEINFO Smileys_PreParse(LPCTSTR lpString, int nCount, const char *proto return NULL;
if (nCount == -1)
- nCount = lstrlen(lpString);
+ nCount = mir_tstrlen(lpString);
SMILEYPARSEINFO info = (SMILEYPARSEINFO) mir_calloc(sizeof(tagSMILEYPARSEINFO));
info->pieces = ReplaceSmileys(lpString, nCount, protocol, &info->max_height);
@@ -72,7 +72,7 @@ void Smileys_FreeParse(SMILEYPARSEINFO parseInfo) int Smileys_DrawText(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRect, UINT uFormat, const char *protocol, SMILEYPARSEINFO parseInfo)
{
if (nCount == -1)
- nCount = lstrlen(lpString);
+ nCount = mir_tstrlen(lpString);
if (uFormat & DT_CALCRECT) {
SIZE text_size = GetTextSize(hDC, lpString, parseInfo, uFormat, parseInfo->max_height, (lpRect->right - lpRect->left));
diff --git a/plugins/TooltipNotify/src/Tooltip.cpp b/plugins/TooltipNotify/src/Tooltip.cpp index fd7610bc59..d55ad2c156 100644 --- a/plugins/TooltipNotify/src/Tooltip.cpp +++ b/plugins/TooltipNotify/src/Tooltip.cpp @@ -84,7 +84,7 @@ LRESULT CALLBACK CTooltip::WindowProc(HWND hWnd, UINT message, WPARAM wParam, LP SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, m_dwTextColor);
SelectObject(hDC, m_hFont);
- DrawText(hDC, m_szText, lstrlen(m_szText), &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
+ DrawText(hDC, m_szText, mir_tstrlen(m_szText), &rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
EndPaint(hWnd, &ps);
@@ -147,7 +147,7 @@ void CTooltip::Validate() SIZE Size;
HDC hDC = GetDC(m_hWnd);
SelectObject(hDC, m_hFont);
- GetTextExtentPoint32(hDC, m_szText, lstrlen(m_szText), &Size);
+ GetTextExtentPoint32(hDC, m_szText, mir_tstrlen(m_szText), &Size);
SetWindowPos(m_hWnd, 0, 0, 0, Size.cx+6, Size.cy+4,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOREDRAW);
ReleaseDC(m_hWnd, hDC);
diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index b46e11d61d..4a44de9750 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -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, lstrlen(szProto),
+ long lLen = WideCharToMultiByte(CP_ACP, 0, szProto, mir_tstrlen(szProto),
szMultiByteProto, sizeof(szMultiByteProto), NULL, NULL);
szMultiByteProto[lLen] = '\0';
@@ -869,26 +869,26 @@ TCHAR *CTooltipNotify::StatusToString(int iStatus, TCHAR *szStatus, int iBufSize {
if((iStatus>=ID_STATUS_OFFLINE) && (iStatus<=ID_STATUS_OUTTOLUNCH))
{
- lstrcpyn(szStatus, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,iStatus,GSMDF_TCHAR), iBufSize);
+ mir_tstrncpy(szStatus, (TCHAR*)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION,iStatus,GSMDF_TCHAR), iBufSize);
}
else
{
switch(iStatus)
{
case ID_TTNTF_STATUS_TYPING:
- lstrcpyn(szStatus, TranslateT("Typing"), iBufSize);
+ mir_tstrncpy(szStatus, TranslateT("Typing"), iBufSize);
break;
case ID_TTNTF_STATUS_IDLE:
- lstrcpyn(szStatus, TranslateT("Idle"), iBufSize);
+ mir_tstrncpy(szStatus, TranslateT("Idle"), iBufSize);
break;
case ID_TTNTF_STATUS_NOT_IDLE:
- lstrcpyn(szStatus, TranslateT("Not Idle"), iBufSize);
+ mir_tstrncpy(szStatus, TranslateT("Not Idle"), iBufSize);
break;
default:
- lstrcpyn(szStatus, TranslateT("Unknown"), iBufSize);
+ mir_tstrncpy(szStatus, TranslateT("Unknown"), iBufSize);
break;
}
}
diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 342a5557a9..50aa0b2ac9 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -213,8 +213,8 @@ int TrafficCounterModulesLoaded(WPARAM wParam, LPARAM lParam) // Формат счётчика для каждого активного протокола
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_COUNTER_FORMAT, &dbv) == 0)
{
- if(lstrlen(dbv.ptszVal) > 0)
- lstrcpyn(Traffic_CounterFormat, dbv.ptszVal, SIZEOF(Traffic_CounterFormat));
+ if(mir_tstrlen(dbv.ptszVal) > 0)
+ mir_tstrncpy(Traffic_CounterFormat, dbv.ptszVal, SIZEOF(Traffic_CounterFormat));
//
db_free(&dbv);
}
@@ -231,8 +231,8 @@ int TrafficCounterModulesLoaded(WPARAM wParam, LPARAM lParam) // Формат всплывающих подсказок
if (db_get_ts(NULL, TRAFFIC_SETTINGS_GROUP, SETTINGS_TOOLTIP_FORMAT, &dbv) == 0)
{
- if(lstrlen(dbv.ptszVal) > 0)
- lstrcpyn(Traffic_TooltipFormat, dbv.ptszVal, SIZEOF(Traffic_TooltipFormat));
+ if(mir_tstrlen(dbv.ptszVal) > 0)
+ mir_tstrncpy(Traffic_TooltipFormat, dbv.ptszVal, SIZEOF(Traffic_TooltipFormat));
//
db_free(&dbv);
}
@@ -392,7 +392,7 @@ int TrafficCounter_Draw(HWND hwnd, HDC hDC) static void TC_AlphaText(HDC hDC, LPCTSTR lpString, RECT* lpRect, UINT format, BYTE ClistModernPresent)
{
- int nCount = lstrlen( lpString );
+ int nCount = mir_tstrlen( lpString );
if (ClistModernPresent)
AlphaText(hDC, lpString, nCount, lpRect, format, Traffic_FontColor);
diff --git a/plugins/TrafficCounter/src/opttree.cpp b/plugins/TrafficCounter/src/opttree.cpp index 34d7c9f418..57e9dfdcaa 100644 --- a/plugins/TrafficCounter/src/opttree.cpp +++ b/plugins/TrafficCounter/src/opttree.cpp @@ -109,7 +109,7 @@ HTREEITEM OptTree_AddItem(HWND hwndTree, TCHAR *name, LPARAM lParam, int iconInd int sectionLevel = 0;
HTREEITEM hSection = NULL, result = NULL;
- lstrcpy(itemName, name);
+ mir_tstrcpy(itemName, name);
sectionName = itemName;
while (sectionName)
@@ -193,7 +193,7 @@ BOOL OptTree_ProcessMessage(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, HTREEITEM hSection = NULL;
if (options[indx].szOptionName)
- lstrcpy(itemName, options[indx].szOptionName);
+ mir_tstrcpy(itemName, options[indx].szOptionName);
else
itemName[0] = 0;
diff --git a/plugins/TranslitSwitcher/src/Layoutproc.cpp b/plugins/TranslitSwitcher/src/Layoutproc.cpp index c5697bb615..f0d7764e0e 100644 --- a/plugins/TranslitSwitcher/src/Layoutproc.cpp +++ b/plugins/TranslitSwitcher/src/Layoutproc.cpp @@ -400,7 +400,7 @@ VOID SwitchLayout(bool lastword) event.iType = IEE_GET_SELECTION;
event.hwnd = hwnd3;
selected = (TCHAR *)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event);
- lstrcpy(buf, selected);
+ mir_tstrcpy(buf, selected);
}
else
SendMessage(hwnd2, WM_GETTEXT, SIZEOF(buf), (LPARAM)buf); // gimme, gimme, gimme...
diff --git a/plugins/UserInfoEx/src/psp_profile.cpp b/plugins/UserInfoEx/src/psp_profile.cpp index e9d8944e13..6748e4de04 100644 --- a/plugins/UserInfoEx/src/psp_profile.cpp +++ b/plugins/UserInfoEx/src/psp_profile.cpp @@ -826,7 +826,7 @@ static LRESULT CALLBACK ProfileList_SubclassProc(HWND hwnd, UINT msg, WPARAM wPa // calculate size of text on the screen
if ((hDC = GetDC(GetParent(hwnd)))) {
SelectObject(hDC, (HFONT)SendMessage(GetParent(hwnd), WM_GETFONT, NULL, NULL));
- GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], lstrlen(pItem->pszText[hi.iSubItem]), &textSize);
+ GetTextExtentPoint32(hDC, pItem->pszText[hi.iSubItem], mir_tstrlen(pItem->pszText[hi.iSubItem]), &textSize);
ReleaseDC(GetParent(hwnd), hDC);
}
// show tip only for text that is larger than te listview can display
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<char>(const char *str) template<>
static inline size_t __blen<wchar_t>(const wchar_t *str)
{
- return lstrlenW(str);
+ return mir_wstrlen(str);
}
template<class T>
@@ -479,7 +479,7 @@ static void ReplaceVars(Buffer<TCHAR> *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)
diff --git a/plugins/Variables/src/parse_regexp.cpp b/plugins/Variables/src/parse_regexp.cpp index acb4a1c642..025daeb84a 100644 --- a/plugins/Variables/src/parse_regexp.cpp +++ b/plugins/Variables/src/parse_regexp.cpp @@ -39,7 +39,7 @@ static TCHAR *parseRegExpCheck(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], lstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat > 0) {
ai->flags &= ~AIF_FALSE;
_ltoa(nmat, szVal, 10);
@@ -72,7 +72,7 @@ static TCHAR *parseRegExpSubstr(ARGUMENTSINFO *ai) return NULL;
pcre16_extra *extra = pcre16_study(ppat, 0, &err);
- int nmat = pcre16_exec(ppat, extra, ai->targv[2], lstrlen(ai->targv[2]), 0, 0, offsets, 99);
+ int nmat = pcre16_exec(ppat, extra, ai->targv[2], mir_tstrlen(ai->targv[2]), 0, 0, offsets, 99);
if (nmat >= 0)
ai->flags &= ~AIF_FALSE;
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 3329dcfe3a..61904d5a9e 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -252,10 +252,10 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb cfFM.dwEffects = bold | italic | underline;
if (!db_get_ts(NULL, MODULENAME, FONT_FACE_KEY, &dbv)) {
- lstrcpy(cfFM.szFaceName, dbv.ptszVal);
+ mir_tstrcpy(cfFM.szFaceName, dbv.ptszVal);
db_free(&dbv);
}
- else lstrcpy(cfFM.szFaceName, Def_font_face);
+ else mir_tstrcpy(cfFM.szFaceName, Def_font_face);
HDC hDC = GetDC(hWindow);
cfFM.yHeight = (BYTE)MulDiv(abs(lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
@@ -338,7 +338,7 @@ void FontSettings(void) lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- lstrcpy(lf.lfFaceName, Def_font_face);
+ mir_tstrcpy(lf.lfFaceName, Def_font_face);
}
/*****************************************************************************/
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index 35378816ba..6d879a0b42 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -116,10 +116,10 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) if( ((HANDLE)wParam) != NULL) {
DBVARIANT dbv;
db_get_ts(wParam, MODULENAME, PRESERVE_NAME_KEY, &dbv);
- lstrcpyn(ppd.lptzContactName, dbv.ptszVal, SIZEOF(ppd.lptzContactName));
+ mir_tstrncpy(ppd.lptzContactName, dbv.ptszVal, SIZEOF(ppd.lptzContactName));
db_free(&dbv);
}
- else lstrcpy(ppd.lptzContactName, _T(MODULENAME));
+ else mir_tstrcpy(ppd.lptzContactName, _T(MODULENAME));
ppd.lchContact = wParam;
ppd.lchIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_SITE));
diff --git a/plugins/WebView/src/webview_cleanup.cpp b/plugins/WebView/src/webview_cleanup.cpp index bf34ef46d5..f6336cb83f 100644 --- a/plugins/WebView/src/webview_cleanup.cpp +++ b/plugins/WebView/src/webview_cleanup.cpp @@ -689,10 +689,10 @@ void FastTagFilter(char *truncated) if (truncated)
strncpy(tempraw, truncated, MAXSIZE1);
- for (int counter = 0; counter < lstrlenA(tempraw); counter++) {
+ for (int counter = 0; counter < mir_strlen(tempraw); counter++) {
if (tempraw[counter] == '<') {
while (tempraw[counter] != '>') {
- if (counter >= lstrlenA(tempraw))
+ if (counter >= mir_strlen(tempraw))
break;
tempraw[counter] = ' ';
@@ -729,7 +729,7 @@ void RemoveInvis(char *truncated, int AmountWspcRem) break;
}
- for (int counter = 0; counter < lstrlenA(tempraw); counter++) {
+ for (int counter = 0; counter < mir_strlen(tempraw); counter++) {
if (AmountWspcRem != 0 && AmountWspcRem != 4) {
if ((tempraw[counter] == '\n') || (tempraw[counter] == ' ') || (tempraw[counter] == '\r'))
erase = erase + 1;
@@ -756,7 +756,7 @@ void RemoveTabs(char *truncated) if (truncated)
strncpy(tempraw, truncated, MAXSIZE1);
- for (int counter = 0; counter < lstrlenA(tempraw); counter++)
+ for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if (tempraw[counter] == '\t')
tempraw[counter] = ' ';
@@ -770,7 +770,7 @@ void Removewhitespace(char *truncated) int counter2 = 0;
int pos1 = 0, pos2 = 0;
- for (int counter = 0; counter < lstrlenA(truncated); counter++) {
+ for (int counter = 0; counter < mir_strlen(truncated); counter++) {
if (truncated[counter] == ' ' && truncated[counter + 1] == ' ') {
pos1 = counter + 1;
counter2 = counter;
@@ -790,7 +790,7 @@ void Filter(char *truncated) char tempraw[MAXSIZE1];
strncpy(tempraw, truncated, SIZEOF(tempraw));
- for (int counter = 0; counter < lstrlenA(tempraw); counter++)
+ for (int counter = 0; counter < mir_strlen(tempraw); counter++)
if ((tempraw[counter] == '\n') || (tempraw[counter] == '\r') || (tempraw[counter] == '\t'))
strncpy(&tempraw[counter], &tempraw[counter + 1], strlen(&tempraw[counter]) - 1);
diff --git a/plugins/WebView/src/webview_datawnd.cpp b/plugins/WebView/src/webview_datawnd.cpp index a7dee35823..2731f9a263 100644 --- a/plugins/WebView/src/webview_datawnd.cpp +++ b/plugins/WebView/src/webview_datawnd.cpp @@ -62,10 +62,10 @@ INT_PTR CALLBACK DlgProcFind(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara free(tempbuffer);
Filter(buff);
- CharUpperBuffA(buff, lstrlenA(buff));
+ CharUpperBuffA(buff, mir_strlen(buff));
GetDlgItemTextA(hwndDlg, IDC_FINDWHAT, NewSearchstr, SIZEOF(NewSearchstr));
- CharUpperBuffA(NewSearchstr, lstrlenA(NewSearchstr));
+ CharUpperBuffA(NewSearchstr, mir_strlen(NewSearchstr));
OLDstartposition = startposition;
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index eef98ee250..9de894fd3e 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -37,7 +37,6 @@ void GetData(void *param) int MallocSize = 0;
int DownloadSuccess = 0;
char*raw;
- char*szInfo;
char truncated[MAXSIZE1];
char truncated2[MAXSIZE2];
int trunccount = 0;
@@ -64,7 +63,6 @@ void GetData(void *param) ZeroMemory(&contactname, sizeof(contactname));
ZeroMemory(&tempstring, sizeof(tempstring));
ZeroMemory(&tempstring2, sizeof(tempstring2));
- ZeroMemory(&szInfo, sizeof(szInfo));
ZeroMemory(&dbv, sizeof(dbv));
ZeroMemory(&tstr, sizeof(tstr));
ZeroMemory(×tring, sizeof(timestring));
@@ -148,13 +146,13 @@ void GetData(void *param) db_set_ts(hContact, "CList", "StatusMsg", statusText);
}
if (nlhrReply->dataLength) {
- int cbLen = lstrlenA(nlhrReply->pData);
- szInfo = (char*)malloc(cbLen + 2);
- lstrcpynA(szInfo, nlhrReply->pData, cbLen);
- downloadsize = lstrlenA(nlhrReply->pData);
+ size_t cbLen = mir_strlen(nlhrReply->pData);
+ char *szInfo = (char*)malloc(cbLen + 2);
+ mir_strncpy(szInfo, nlhrReply->pData, cbLen);
+ downloadsize = mir_strlen(nlhrReply->pData);
trunccount = 0;
- lstrcpynA(truncated2, szInfo, MAXSIZE2);
+ mir_strncpy(truncated2, szInfo, MAXSIZE2);
free(szInfo);
////////////////////////////////////////////
@@ -193,7 +191,7 @@ void GetData(void *param) if (DownloadSuccess) {
// all the site
if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 1)
- lstrcpynA(truncated, truncated2, MAXSIZE1);
+ mir_strncpy(truncated, truncated2, MAXSIZE1);
else { // use start and end string
// putting data into string
if (((strstr(truncated2, tempstring)) != 0) && ((strstr(truncated2, tempstring2)) != 0)) {
@@ -240,7 +238,7 @@ void GetData(void *param) trunccount = 0;
- lstrcpynA(truncated, raw, MAXSIZE1);
+ mir_strncpy(truncated, raw, MAXSIZE1);
free(raw);
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 1b9e8ae0e7..924b8ab9e6 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -225,7 +225,7 @@ INT_PTR GetCaps(WPARAM wParam, LPARAM) INT_PTR GetName(WPARAM wParam, LPARAM lParam) { - lstrcpynA((char*) lParam, MODULENAME, wParam); + mir_strncpy((char*) lParam, MODULENAME, wParam); return 0; } @@ -248,7 +248,7 @@ INT_PTR SetStatus(WPARAM wParam, LPARAM lParam) bpStatus = wParam; ProtoBroadcastAck(MODULENAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, wParam); -
+ // Make sure no contact has offline status for any reason on first time run if ( db_get_b(NULL, MODULENAME, "FirstTime", 100) == 100) { for (MCONTACT hContact = db_find_first(MODULENAME); hContact != NULL; hContact = db_find_next(hContact, MODULENAME)) @@ -319,12 +319,12 @@ INT_PTR BasicSearch(WPARAM wParam, LPARAM lParam) static TCHAR buf[300]; if (lParam) - lstrcpyn(buf, (const TCHAR*) lParam, 256); + mir_tstrncpy(buf, (const TCHAR*) lParam, 256); if (searchId != -1) return 0; // only one search at a time - lstrcpyn(sID, (TCHAR*)lParam, SIZEOF(sID)); + mir_tstrncpy(sID, (TCHAR*)lParam, SIZEOF(sID)); searchId = 1; // create a thread for the ID search diff --git a/plugins/WhoUsesMyFiles/src/wumfplug.cpp b/plugins/WhoUsesMyFiles/src/wumfplug.cpp index 6d7c207b70..9ac45b6711 100644 --- a/plugins/WhoUsesMyFiles/src/wumfplug.cpp +++ b/plugins/WhoUsesMyFiles/src/wumfplug.cpp @@ -137,8 +137,8 @@ void ShowThePopup(PWumf w, LPTSTR title, LPTSTR text) else if (WumfOptions.DelaySet)
ppd.iSeconds = WumfOptions.DelaySec;
- lstrcpyn(ppd.lptzContactName, title, MAX_CONTACTNAME);
- lstrcpyn(ppd.lptzText, text, MAX_SECONDLINE);
+ mir_tstrncpy(ppd.lptzContactName, title, MAX_CONTACTNAME);
+ mir_tstrncpy(ppd.lptzText, text, MAX_SECONDLINE);
if (WumfOptions.UseWinColor) {
ppd.colorBack = GetSysColor(COLOR_WINDOW);
ppd.colorText = GetSysColor(COLOR_WINDOWTEXT);
@@ -275,7 +275,7 @@ void ChooseFile(HWND hDlg) HANDLE hf = CreateFile(szFile,GENERIC_WRITE,0,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL, NULL);
if (hf != INVALID_HANDLE_VALUE) {
SetDlgItemText(hDlg,IDC_FILE,szFile);
- lstrcpyn(WumfOptions.LogFile, szFile, MAX_PATH);
+ mir_tstrncpy(WumfOptions.LogFile, szFile, MAX_PATH);
CloseHandle(hf);
}
}
diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index 7470a1b969..32b44dcd33 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -1250,7 +1250,7 @@ void WINAPI GetStatusFcn(HACCOUNT Which,TCHAR *Value) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"\tGetStatus:AccountStatusCS-cs enter\n"); #endif - lstrcpy(Value,Which->Status); + mir_tstrcpy(Value,Which->Status); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"\tGetStatus:AccountStatusCS-cs done\n"); #endif @@ -1270,7 +1270,7 @@ void WINAPI SetStatusFcn(HACCOUNT Which,TCHAR *Value) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"\tSetStatus:AccountStatusCS-cs enter\n"); #endif - lstrcpy(Which->Status,Value); + mir_tstrcpy(Which->Status,Value); WindowList_BroadcastAsync(YAMNVar.MessageWnds,WM_YAMN_CHANGESTATUS,(WPARAM)Which,0); #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"\tSetStatus:AccountStatusCS-cs done\n"); diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index f113392917..3387028fc8 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -38,11 +38,11 @@ LRESULT CALLBACK BadConnectPopupProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lPa Command = new WCHAR[wcslen(ActualAccount->BadConnectN.App)+6];
if (Command != NULL) {
- lstrcpyW(Command,L"\"");
- lstrcatW(Command,ActualAccount->BadConnectN.App);
- lstrcatW(Command,L"\" ");
+ mir_wstrcpy(Command,L"\"");
+ mir_wstrcat(Command,ActualAccount->BadConnectN.App);
+ mir_wstrcat(Command,L"\" ");
if (ActualAccount->BadConnectN.AppParam != NULL)
- lstrcatW(Command,ActualAccount->BadConnectN.AppParam);
+ mir_wstrcat(Command,ActualAccount->BadConnectN.AppParam);
CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi);
delete[] Command;
}
@@ -119,13 +119,13 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA BadConnectPopup.PluginWindowProc = BadConnectPopupProc;
BadConnectPopup.PluginData = ActualAccount;
- lstrcpyn(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(BadConnectPopup.lptzContactName));
+ mir_tstrncpy(BadConnectPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(BadConnectPopup.lptzContactName));
}
if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) {
Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
- lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
+ mir_tstrncpy(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
if (ShowPopup)
PUAddPopupT(&BadConnectPopup);
}
@@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA {
Message1W=ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode);
SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
- lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
+ mir_tstrncpy(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
if (ShowPopup)
PUAddPopupT(&BadConnectPopup);
}
@@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg,UINT msg,WPARAM wParam,LPARA {
Message1W=TranslateT("Unknown error");
SetDlgItemText(hDlg,IDC_STATICMSG,Message1W);
- lstrcpyn(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
+ mir_tstrncpy(BadConnectPopup.lptzText,Message1W,sizeof(BadConnectPopup.lptzText));
if (ShowPopup)
PUAddPopupT(&BadConnectPopup);
}
diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index cda180d5ac..c983eadddf 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -601,8 +601,8 @@ int AddNewMailsToListView(HWND hListView,HACCOUNT ActualAccount,struct CMailNumb } if ((nflags & YAMN_ACC_POP) && (ActualAccount->Flags & YAMN_ACC_POPN) && (msgq->Flags & YAMN_MSG_POPUP) && (msgq->Flags & YAMN_MSG_NEW)) { - lstrcpyn(NewMailPopup.lptzContactName, FromStr, SIZEOF(NewMailPopup.lptzContactName)); - lstrcpyn(NewMailPopup.lptzText, UnicodeHeader.Subject, SIZEOF(NewMailPopup.lptzText)); + mir_tstrncpy(NewMailPopup.lptzContactName, FromStr, SIZEOF(NewMailPopup.lptzContactName)); + mir_tstrncpy(NewMailPopup.lptzText, UnicodeHeader.Subject, SIZEOF(NewMailPopup.lptzText)); PYAMN_MAILSHOWPARAM MailParam = (PYAMN_MAILSHOWPARAM)malloc(sizeof(YAMN_MAILSHOWPARAM)); if (MailParam) { @@ -690,7 +690,7 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR NewMailPopup.PluginWindowProc = NewMailPopupProc; NewMailPopup.PluginData = (void *)0; //multiple popups - lstrcpyn(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(NewMailPopup.lptzContactName)); + mir_tstrncpy(NewMailPopup.lptzContactName, _A2T(ActualAccount->Name), SIZEOF(NewMailPopup.lptzContactName)); mir_sntprintf(NewMailPopup.lptzText, SIZEOF(NewMailPopup.lptzText), TranslateT("%d new mail message(s), %d total"), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); PUAddPopupT(&NewMailPopup); } @@ -764,11 +764,11 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR if (Command != NULL) { - lstrcpyW(Command,L"\""); - lstrcatW(Command,ActualAccount->NewMailN.App); - lstrcatW(Command,L"\" "); + mir_wstrcpy(Command,L"\""); + mir_wstrcat(Command,ActualAccount->NewMailN.App); + mir_wstrcat(Command,L"\" "); if (ActualAccount->NewMailN.AppParam != NULL) - lstrcatW(Command,ActualAccount->NewMailN.AppParam); + mir_wstrcat(Command,ActualAccount->NewMailN.AppParam); CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi); delete[] Command; } @@ -793,11 +793,11 @@ void DoMailActions(HWND hDlg,HACCOUNT ActualAccount,struct CMailNumbers *MN,DWOR NoNewMailPopup.PluginWindowProc=NoNewMailPopupProc; NoNewMailPopup.PluginData=(void *)0; //it's not new mail popup - lstrcpyn(NoNewMailPopup.lptzContactName,_A2T(ActualAccount->Name),SIZEOF(NoNewMailPopup.lptzContactName)); + mir_tstrncpy(NoNewMailPopup.lptzContactName,_A2T(ActualAccount->Name),SIZEOF(NoNewMailPopup.lptzContactName)); if (MN->Real.PopupSL2NC+MN->Virtual.PopupSL2NC) mir_sntprintf(NoNewMailPopup.lptzText, SIZEOF(NoNewMailPopup.lptzText), TranslateT("No new mail message, %d spam(s)"), MN->Real.PopupSL2NC + MN->Virtual.PopupSL2NC); else - lstrcpyn(NoNewMailPopup.lptzText,TranslateT("No new mail message"),SIZEOF(NoNewMailPopup.lptzText)); + mir_tstrncpy(NoNewMailPopup.lptzText,TranslateT("No new mail message"),SIZEOF(NoNewMailPopup.lptzText)); PUAddPopupT(&NoNewMailPopup); } @@ -2077,11 +2077,11 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg,UINT msg,WPARAM wParam,LPARAM if (Command != NULL) { - lstrcpyW(Command,L"\""); - lstrcatW(Command,ActualAccount->NewMailN.App); - lstrcatW(Command,L"\" "); + mir_wstrcpy(Command,L"\""); + mir_wstrcat(Command,ActualAccount->NewMailN.App); + mir_wstrcat(Command,L"\" "); if (ActualAccount->NewMailN.AppParam != NULL) - lstrcatW(Command,ActualAccount->NewMailN.AppParam); + mir_wstrcat(Command,ActualAccount->NewMailN.AppParam); CreateProcessW(NULL,Command,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si,&pi); delete[] Command; } diff --git a/plugins/YAMN/src/mails/mails.cpp b/plugins/YAMN/src/mails/mails.cpp index 716d1905f0..70fa4f8321 100644 --- a/plugins/YAMN/src/mails/mails.cpp +++ b/plugins/YAMN/src/mails/mails.cpp @@ -417,9 +417,9 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) Item->Next=NULL;
Item->name=new char [prev2-prev1+1];
- lstrcpynA(Item->name,prev1,prev2-prev1+1);
+ mir_strncpy(Item->name,prev1,prev2-prev1+1);
Item->value=new char [finder-prev3+1];
- lstrcpynA(Item->value,prev3,finder-prev3+1);
+ mir_strncpy(Item->value,prev3,finder-prev3+1);
if (EOS(finder))
break;
@@ -440,7 +440,7 @@ void WINAPI TranslateHeaderFcn(char *stream,int len,struct CMimeItem **head) Item->Next=NULL;//just in case;
Item->name=new char[5]; strncpy(Item->name,"Body",5);
Item->value=new char [prev2-prev1];
- lstrcpynA(Item->value,prev1,prev2-prev1-1);
+ mir_strncpy(Item->value,prev1,prev2-prev1-1);
}
break; // there is nothing else
}
diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 14b1a8af9c..369940ae67 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -220,7 +220,7 @@ static void LoadPlugins() continue; // we have a dot - int len = lstrlen(fd.cFileName); // find the length of the string + int len = mir_tstrlen(fd.cFileName); // find the length of the string TCHAR* end = fd.cFileName+len; // get a pointer to the NULL int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 7dbdaff8ee..455a981ca0 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -684,7 +684,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara SendDlgItemMessage(hDlg, IDC_COMBOCP, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default"));
for (i=1; i < CPLENSUPP; i++) {
CPINFOEX info; GetCPInfoEx(CodePageNamesSupp[i].CP,0,&info);
- size_t len = lstrlen(info.CodePageName+7);
+ size_t len = mir_tstrlen(info.CodePageName+7);
info.CodePageName[len+6]=0;
SendDlgItemMessage(hDlg,IDC_COMBOCP,CB_ADDSTRING,0,(LPARAM)(info.CodePageName+7));
}
@@ -745,7 +745,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPara if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput))) {
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
EnableWindow(GetDlgItem(hDlg,IDC_BTNDEL),FALSE);
- if (lstrlenA(DlgInput))
+ if (mir_strlen(DlgInput))
DlgEnableAccount(hDlg,TRUE,TRUE);
else
DlgEnableAccount(hDlg,FALSE,FALSE);
@@ -1262,7 +1262,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa if (NULL==(ActualAccount=(HPOP3ACCOUNT)CallService(MS_YAMN_FINDACCOUNTBYNAME,(WPARAM)POP3Plugin,(LPARAM)DlgInput)))
{
DlgSetItemText(hDlg,(WPARAM)IDC_STTIMELEFT,0);
- if (lstrlenA(DlgInput))
+ if (mir_strlen(DlgInput))
DlgEnableAccountPopup(hDlg,TRUE,TRUE);
else
DlgEnableAccountPopup(hDlg,FALSE,FALSE);
@@ -1339,12 +1339,12 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg,UINT msg,WPARAM wParam,LPARAM lPa TesterF.lchIcon=g_LoadIconEx(3);
TesterN.lchIcon=g_LoadIconEx(1);
- lstrcpyn(Tester.lptzContactName,TranslateT("Account Test"),MAX_CONTACTNAME);
- lstrcpyn(TesterF.lptzContactName,TranslateT("Account Test (failed)"),MAX_CONTACTNAME);
- lstrcpyn(TesterN.lptzContactName,TranslateT("Account Test"),MAX_CONTACTNAME);
- lstrcpyn(Tester.lptzText,TranslateT("You have N new mail messages"),MAX_SECONDLINE);
- lstrcpyn(TesterF.lptzText,TranslateT("Connection failed message"),MAX_SECONDLINE);
- lstrcpyn(TesterN.lptzText,TranslateT("No new mail message"),MAX_SECONDLINE);
+ mir_tstrncpy(Tester.lptzContactName,TranslateT("Account Test"),MAX_CONTACTNAME);
+ mir_tstrncpy(TesterF.lptzContactName,TranslateT("Account Test (failed)"),MAX_CONTACTNAME);
+ mir_tstrncpy(TesterN.lptzContactName,TranslateT("Account Test"),MAX_CONTACTNAME);
+ mir_tstrncpy(Tester.lptzText,TranslateT("You have N new mail messages"),MAX_SECONDLINE);
+ mir_tstrncpy(TesterF.lptzText,TranslateT("Connection failed message"),MAX_SECONDLINE);
+ mir_tstrncpy(TesterN.lptzText,TranslateT("No new mail message"),MAX_SECONDLINE);
if (TesterC)
{
Tester.colorBack=SendDlgItemMessage(hDlg,IDC_CPB,CPM_GETCOLOUR,0,0);
diff --git a/plugins/YAMN/src/services.cpp b/plugins/YAMN/src/services.cpp index 399424fd0f..cb158fdc9e 100644 --- a/plugins/YAMN/src/services.cpp +++ b/plugins/YAMN/src/services.cpp @@ -39,7 +39,7 @@ static INT_PTR Service_SetStatus(WPARAM wParam, LPARAM lParam) static INT_PTR Service_GetName(WPARAM wParam, LPARAM lParam)
{
- lstrcpynA((char *) lParam, YAMN_DBMODULE, wParam);
+ mir_strncpy((char *) lParam, YAMN_DBMODULE, wParam);
return 0;
}
@@ -93,11 +93,11 @@ static INT_PTR ContactApplication(WPARAM wParam, LPARAM lParam) Command = new WCHAR[wcslen(ActualAccount->NewMailN.App)+6];
if (Command != NULL) {
- lstrcpyW(Command, L"\"");
- lstrcatW(Command, ActualAccount->NewMailN.App);
- lstrcatW(Command, L"\" ");
+ mir_wstrcpy(Command, L"\"");
+ mir_wstrcat(Command, ActualAccount->NewMailN.App);
+ mir_wstrcat(Command, L"\" ");
if (ActualAccount->NewMailN.AppParam != NULL)
- lstrcatW(Command, ActualAccount->NewMailN.AppParam);
+ mir_wstrcat(Command, ActualAccount->NewMailN.AppParam);
PROCESS_INFORMATION pi;
CreateProcessW(NULL, Command, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi);
diff --git a/plugins/mTextControl/src/FormattedTextDraw.cpp b/plugins/mTextControl/src/FormattedTextDraw.cpp index 247b688189..6555e8d0a0 100644 --- a/plugins/mTextControl/src/FormattedTextDraw.cpp +++ b/plugins/mTextControl/src/FormattedTextDraw.cpp @@ -67,7 +67,7 @@ HRESULT CFormattedTextDraw::putRTFTextA(char *newVal) m_editCookie.isUnicode = false;
m_editCookie.ansi = newVal;
- m_editCookie.dwSize = lstrlenA(m_editCookie.ansi);
+ m_editCookie.dwSize = mir_strlen(m_editCookie.ansi);
m_editCookie.dwCount = 0;
editStream.dwCookie = (DWORD_PTR) &m_editCookie;
editStream.dwError = 0;
@@ -88,7 +88,7 @@ HRESULT CFormattedTextDraw::putRTFTextW(WCHAR *newVal) m_editCookie.isUnicode = true;
m_editCookie.unicode = newVal;
- m_editCookie.dwSize = lstrlenW(m_editCookie.unicode);
+ m_editCookie.dwSize = mir_wstrlen(m_editCookie.unicode);
m_editCookie.dwCount = 0;
editStream.dwCookie = (DWORD_PTR) &m_editCookie;
editStream.dwError = 0;
@@ -109,7 +109,7 @@ HRESULT CFormattedTextDraw::putTextA(char *newVal) m_editCookie.isUnicode = false;
m_editCookie.ansi = newVal;
- m_editCookie.dwSize = lstrlenA(m_editCookie.ansi);
+ m_editCookie.dwSize = mir_strlen(m_editCookie.ansi);
m_editCookie.dwCount = 0;
editStream.dwCookie = (DWORD_PTR) &m_editCookie;
editStream.dwError = 0;
@@ -138,7 +138,7 @@ HRESULT CFormattedTextDraw::putTextW(WCHAR *newVal) m_editCookie.isUnicode = true;
m_editCookie.unicode = newVal;
- m_editCookie.dwSize = lstrlenW(m_editCookie.unicode);
+ m_editCookie.dwSize = mir_wstrlen(m_editCookie.unicode);
m_editCookie.dwCount = 0;
editStream.dwCookie = (DWORD_PTR) &m_editCookie;
editStream.dwError = 0;
@@ -507,7 +507,7 @@ HRESULT CFormattedTextDraw::CharFormatFromHFONT(CHARFORMAT2W* pCF, HFONT hFont) pCF->bPitchAndFamily = lf.lfPitchAndFamily;
- lstrcpyW(pCF->szFaceName, lf.lfFaceName);
+ mir_wstrcpy(pCF->szFaceName, lf.lfFaceName);
return S_OK;
diff --git a/plugins/mTextControl/src/textusers.cpp b/plugins/mTextControl/src/textusers.cpp index 3f2c2f0f0f..96dad7d8c6 100644 --- a/plugins/mTextControl/src/textusers.cpp +++ b/plugins/mTextControl/src/textusers.cpp @@ -44,8 +44,8 @@ HANDLE DLL_CALLCONV MTI_TextUserAdd(const char *userTitle, DWORD options)
{
TextUser *textUserNew = new TextUser;
- textUserNew->name = new char [lstrlenA(userTitle)+1];
- lstrcpyA(textUserNew->name, userTitle);
+ textUserNew->name = new char [mir_strlen(userTitle)+1];
+ mir_strcpy(textUserNew->name, userTitle);
textUserNew->options =
(db_get_dw(0, MODULNAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK);
db_set_dw(0, MODULNAME, userTitle, textUserNew->options);
|