From 688f55ba998c19304a29727c910504903f4cc49a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Nov 2014 18:51:36 +0000 Subject: lstr* replacements git-svn-id: http://svn.miranda-ng.org/main/trunk@11176 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AssocMgr/src/assoclist.cpp | 2 +- plugins/AssocMgr/src/dde.cpp | 4 +-- plugins/AssocMgr/src/main.cpp | 10 +++--- plugins/AssocMgr/src/reg.cpp | 72 +++++++++++++++++++------------------- plugins/AssocMgr/src/test.cpp | 14 ++++---- plugins/AssocMgr/src/utils.cpp | 2 +- 6 files changed, 52 insertions(+), 52 deletions(-) (limited to 'plugins/AssocMgr/src') 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