diff options
-rw-r--r-- | plugins/AssocMgr/src/assoclist.cpp | 18 | ||||
-rw-r--r-- | plugins/AssocMgr/src/reg.cpp | 13 |
2 files changed, 13 insertions, 18 deletions
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp index 4124b493f4..310a396522 100644 --- a/plugins/AssocMgr/src/assoclist.cpp +++ b/plugins/AssocMgr/src/assoclist.cpp @@ -486,23 +486,19 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) /************************* Services *******************************/
-static INT_PTR ServiceAddNewFileType(WPARAM wParam, LPARAM lParam)
+static INT_PTR ServiceAddNewFileType(WPARAM, LPARAM lParam)
{
const FILETYPEDESC *ftd = (FILETYPEDESC*)lParam;
- char *pszClassName, *pszFileExt, *pszMimeType;
- TCHAR *pszVerbDesc;
- UNREFERENCED_PARAMETER(wParam);
-
- if(ftd->cbSize<sizeof(FILETYPEDESC))
+ if(ftd->cbSize < sizeof(FILETYPEDESC))
return 1;
- if(ftd->pszFileExt == NULL || ftd->pszFileExt[0]!= '.')
+ if(ftd->pszFileExt == NULL || ftd->pszFileExt[0] != '.')
return 2;
- pszFileExt = mir_strdup(ftd->pszFileExt);
- pszClassName = MakeFileClassName(ftd->pszFileExt);
+ char *pszFileExt = mir_strdup(ftd->pszFileExt);
+ char *pszClassName = MakeFileClassName(ftd->pszFileExt);
if(pszFileExt!= NULL && pszClassName!= NULL) {
- pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); /* does NULL check */
- pszMimeType = mir_strdup(ftd->pszMimeType); /* does NULL check */
+ TCHAR *pszVerbDesc = s2t(ftd->ptszVerbDesc, ftd->flags&FTDF_UNICODE, TRUE); /* does NULL check */
+ char *pszMimeType = mir_strdup(ftd->pszMimeType); /* does NULL check */
if(AddNewAssocItem_Worker(pszClassName, (TYPEDESCHEAD*)ftd, pszFileExt, pszVerbDesc, pszMimeType))
/* no need to free pszClassName, pszFileExt, pszVerbDesc and pszMimeType,
* as their ownership got transfered to storage list */
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index 5f97defa14..be921d8c3a 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -98,20 +98,19 @@ static __inline LONG regchk(LONG res, const char *pszFunc, const void *pszInfo, // mir_free() the return value
char *MakeFileClassName(const char *pszFileExt)
{
- char *pszClass;
- pszClass=(char*)mir_alloc((lstrlenA(pszFileExt)+12)*sizeof(TCHAR));
- if (pszClass!=NULL)
+ int cbLen = lstrlenA(pszFileExt)+12;
+ char *pszClass = (char*)mir_alloc(cbLen);
+ if (pszClass != NULL)
/* using correctly formated PROGID */
- mir_snprintf(pszClass, strlen(pszClass), "miranda%sfile", pszFileExt); /* includes dot, buffer safe */
+ mir_snprintf(pszClass, cbLen, "miranda%sfile", pszFileExt); /* includes dot, buffer safe */
return pszClass;
}
// mir_free() the return value
char *MakeUrlClassName(const char *pszUrl)
{
- char *pszClass;
- pszClass=mir_strdup(pszUrl);
- if (pszClass!=NULL)
+ char *pszClass = mir_strdup(pszUrl);
+ if (pszClass != NULL)
/* remove trailing : */
pszClass[lstrlenA(pszClass)-1]=0;
return pszClass;
|