diff options
Diffstat (limited to 'plugins/AssocMgr')
-rw-r--r-- | plugins/AssocMgr/assoclist.c | 42 | ||||
-rw-r--r-- | plugins/AssocMgr/dde.c | 16 | ||||
-rw-r--r-- | plugins/AssocMgr/main.c | 8 | ||||
-rw-r--r-- | plugins/AssocMgr/reg.c | 166 | ||||
-rw-r--r-- | plugins/AssocMgr/test.c | 92 | ||||
-rw-r--r-- | plugins/AssocMgr/utils.c | 16 |
6 files changed, 170 insertions, 170 deletions
diff --git a/plugins/AssocMgr/assoclist.c b/plugins/AssocMgr/assoclist.c index 206f2cdd6d..26a72a43da 100644 --- a/plugins/AssocMgr/assoclist.c +++ b/plugins/AssocMgr/assoclist.c @@ -95,7 +95,7 @@ void CleanupAssocEnabledSettings(void) for(i = 0;i<nSettingsCount;++i) {
pszSuffix = &ppszSettings[i][8];
mir_snprintf(szSetting, sizeof(szSetting), "module_%s", pszSuffix);
- if(!DBGetContactSettingTString(NULL, "AssocMgr", szSetting, &dbv)) {
+ if (!DBGetContactSettingTString(NULL, "AssocMgr", szSetting, &dbv)) {
if(CallService(MS_UTILS_PATHTOABSOLUTET, (WPARAM)dbv.ptszVal, (LPARAM)szDLL)) {
/* file still exists? */
hFile = CreateFile(szDLL, 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
@@ -129,7 +129,7 @@ static __inline BOOL WasMimeTypeAdded(const char *pszMimeType) DBVARIANT dbv;
BOOL fAdded = FALSE;
mir_snprintf(szSetting, sizeof(szSetting), "mime_%s", pszMimeType);
- if(!DBGetContactSetting(NULL, "AssocMgr", szSetting, &dbv)) fAdded = TRUE;
+ if (!DBGetContactSetting(NULL, "AssocMgr", szSetting, &dbv)) fAdded = TRUE;
else DBFreeVariant(&dbv);
return fAdded;
}
@@ -147,10 +147,10 @@ void CleanupMimeTypeAddedSettings(void) for(i = 0;i<nSettingsCount;++i) {
pszSuffix = &ppszSettings[i][5];
for(j = 0;j<nAssocListCount;++j)
- if(!lstrcmpA(pszSuffix, pAssocList[j].pszMimeType))
+ if (!lstrcmpA(pszSuffix, pAssocList[j].pszMimeType))
break; /* mime type in current list */
if(j == nAssocListCount) { /* mime type not in current list */
- if(!DBGetContactSetting(NULL, "AssocMgr", ppszSettings[i], &dbv)) {
+ if (!DBGetContactSetting(NULL, "AssocMgr", ppszSettings[i], &dbv)) {
if(dbv.type == DBVT_ASCIIZ)
RemoveRegMimeType(pszSuffix, dbv.pszVal);
DBFreeVariant(&dbv);
@@ -201,7 +201,7 @@ static int FindAssocItem(const char *pszClassName) {
int i;
for(i = 0;i<nAssocListCount;++i)
- if(!lstrcmpA(pszClassName, pAssocList[i].pszClassName))
+ if (!lstrcmpA(pszClassName, pAssocList[i].pszClassName))
return i;
return -1;
}
@@ -292,7 +292,7 @@ static BOOL IsAssocRegistered(const ASSOCDATA *assoc) fSuccess = IsRegClass(assoc->pszClassName, pszRunCmd);
mir_free(pszRunCmd); /* does NULL check */
/* file ext */
- if(!fIsUrl)
+ if (!fIsUrl)
fSuccess = IsRegFileExt(assoc->pszFileExt, assoc->pszClassName);
return fSuccess;
@@ -312,10 +312,10 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc) if(pszRunCmd!= NULL) {
fSuccess = TRUE; /* tentatively */
/* do not overwrite user customized settings */
- if(!IsRegClass(assoc->pszClassName, pszRunCmd)) {
+ if (!IsRegClass(assoc->pszClassName, pszRunCmd)) {
/* class icon */
- if(!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(NULL, 0); /* miranda logo */
- else if(!assoc->nIconResID) pszIconLoc = MakeIconLocation(hInst, IDI_MIRANDAFILE); /* generic file */
+ if (!assoc->nIconResID && fIsUrl) pszIconLoc = MakeIconLocation(NULL, 0); /* miranda logo */
+ else if (!assoc->nIconResID) pszIconLoc = MakeIconLocation(hInst, IDI_MIRANDAFILE); /* generic file */
else pszIconLoc = MakeIconLocation(assoc->hInstance, assoc->nIconResID);
/* register class */
if(fUseMainCmdLine) pszDdeCmd = NULL;
@@ -362,7 +362,7 @@ static BOOL UnregisterAssoc(const ASSOCDATA *assoc) mir_free(pszRunCmd); /* does NULL check */
/* file type */
- if(!fIsUrl) {
+ if (!fIsUrl) {
/* file extension */
RemoveRegFileExt(assoc->pszFileExt, assoc->pszClassName);
/* mime type */
@@ -473,7 +473,7 @@ static BOOL RemoveAssocItem_Worker(const char *pszClassName) mir_free(assoc->pszMimeType); /* does NULL check */
/* resize storage array */
- if((index+1)<nAssocListCount)
+ if ((index+1)<nAssocListCount)
MoveMemory(assoc, &pAssocList[index+1], ((nAssocListCount-index-1)*sizeof(ASSOCDATA)));
pAssocListBuf = (ASSOCDATA*)mir_realloc(pAssocList, (nAssocListCount-1)*sizeof(ASSOCDATA));
if(pAssocListBuf!= NULL) pAssocList = pAssocListBuf;
@@ -518,7 +518,7 @@ static INT_PTR ServiceRemoveFileType(WPARAM wParam, LPARAM lParam) char *pszClassName;
UNREFERENCED_PARAMETER(wParam);
- if((char*)lParam == NULL) return 2;
+ if ((char*)lParam == NULL) return 2;
pszClassName = MakeFileClassName((char*)lParam);
if(pszClassName!= NULL)
if(RemoveAssocItem_Worker(pszClassName)) {
@@ -557,7 +557,7 @@ static INT_PTR ServiceRemoveUrlType(WPARAM wParam, LPARAM lParam) char *pszClassName;
UNREFERENCED_PARAMETER(wParam);
- if((char*)lParam == NULL) return 2;
+ if ((char*)lParam == NULL) return 2;
pszClassName = MakeUrlClassName((char*)lParam);
if(pszClassName!= NULL)
if(RemoveAssocItem_Worker(pszClassName)) {
@@ -590,7 +590,7 @@ static BOOL InvokeHandler_Worker(const char *pszClassName, const TCHAR *pszParam EnsureAssocRegistered(assoc);
NotifyAssocChange(FALSE);
/* try main command line */
- if((int)ShellExecute(NULL, NULL, pszParam, NULL, NULL, SW_SHOWNORMAL) >= 32)
+ if ((int)ShellExecute(NULL, NULL, pszParam, NULL, NULL, SW_SHOWNORMAL) >= 32)
*res = 0; /* success */
return TRUE;
}
@@ -621,7 +621,7 @@ INT_PTR InvokeFileHandler(const TCHAR *pszFileName) /* class name */
pszClassName = MakeFileClassName(pszFileExt);
if(pszClassName!= NULL)
- if(!InvokeHandler_Worker(pszClassName, pszFileName, &res)) {
+ if (!InvokeHandler_Worker(pszClassName, pszFileName, &res)) {
/* correct registry on error (no longer in list) */
RemoveRegFileExt(pszFileExt, pszClassName);
RemoveRegClass(pszClassName);
@@ -647,7 +647,7 @@ INT_PTR InvokeUrlHandler(const TCHAR *pszUrl) /* class name */
pszClassName = MakeUrlClassName(pszProtoPrefix);
if(pszClassName!= NULL)
- if(!InvokeHandler_Worker(pszClassName, pszUrl, &res))
+ if (!InvokeHandler_Worker(pszClassName, pszUrl, &res))
/* correct registry on error (no longer in list) */
RemoveRegClass(pszClassName);
mir_free(pszClassName); /* does NULL check */
@@ -662,9 +662,9 @@ INT_PTR InvokeUrlHandler(const TCHAR *pszUrl) static int CALLBACK ListViewSortDesc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
int cmp;
- if(((ASSOCDATA*)lParam1)->pszFileExt!= NULL && ((ASSOCDATA*)lParam2)->pszFileExt!= NULL)
+ if (((ASSOCDATA*)lParam1)->pszFileExt!= NULL && ((ASSOCDATA*)lParam2)->pszFileExt!= NULL)
cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszFileExt, -1, ((ASSOCDATA*)lParam2)->pszFileExt, -1);
- else if(((ASSOCDATA*)lParam1)->pszFileExt == ((ASSOCDATA*)lParam2)->pszFileExt) /* both NULL */
+ else if (((ASSOCDATA*)lParam1)->pszFileExt == ((ASSOCDATA*)lParam2)->pszFileExt) /* both NULL */
cmp = CompareStringA((LCID)lParamSort, 0, ((ASSOCDATA*)lParam1)->pszClassName, -1, ((ASSOCDATA*)lParam2)->pszClassName, -1);
else /* different types, incomparable */
cmp = (((ASSOCDATA*)lParam1)->pszFileExt == NULL)?CSTR_LESS_THAN:CSTR_GREATER_THAN;
@@ -821,7 +821,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara HTHEME hTheme;
hTheme = pfnGetWindowTheme((HWND)lParam);
if(hTheme!= NULL)
- if(!pfnGetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) {
+ if (!pfnGetThemeColor(hTheme, BP_GROUPBOX, GBS_NORMAL, TMT_TEXTCOLOR, &clr)) {
SetBkMode((HDC)wParam, TRANSPARENT);
SetTextColor((HDC)wParam, clr);
}
@@ -877,7 +877,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem = ListView_GetNextItem(nmhdr->hwndFrom, lvi.iItem, LVNI_ABOVE);
if(lvi.iItem!= -1)
if(ListView_GetItem(nmhdr->hwndFrom, &lvi))
- if((ASSOCDATA*)lvi.lParam == NULL) /* groups */
+ if ((ASSOCDATA*)lvi.lParam == NULL) /* groups */
lvi.iItem = -1;
if(lvi.iItem == -1) {
SetWindowLong(hwndDlg, DWLP_MSGRESULT, TRUE); /* eat it */
@@ -893,7 +893,7 @@ static INT_PTR CALLBACK AssocListOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara lvi.iItem-= ListView_GetCountPerPage(nmhdr->hwndFrom);
if(lvi.iItem>= 0)
if(ListView_GetItem(nmhdr->hwndFrom, &lvi))
- if((ASSOCDATA*)lvi.lParam == NULL) /* groups */
+ if ((ASSOCDATA*)lvi.lParam == NULL) /* groups */
lvi.iItem = -1;
if(lvi.iItem<0) {
ListView_SetItemState(nmhdr->hwndFrom, 0, LVIS_SELECTED|LVIS_FOCUSED, LVIS_SELECTED|LVIS_FOCUSED);
diff --git a/plugins/AssocMgr/dde.c b/plugins/AssocMgr/dde.c index 7be9f1fbcf..0804be855c 100644 --- a/plugins/AssocMgr/dde.c +++ b/plugins/AssocMgr/dde.c @@ -90,7 +90,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM { ATOM hSzApp,hSzTopic;
hSzApp=LOWORD(lParam); /* no UnpackDDElParam() here */
hSzTopic=HIWORD(lParam);
- if((hSzApp==GlobalFindAtom(DDEAPP) && hSzTopic==GlobalFindAtom(DDETOPIC)) || !hSzApp) {
+ if ((hSzApp==GlobalFindAtom(DDEAPP) && hSzTopic==GlobalFindAtom(DDETOPIC)) || !hSzApp) {
hSzApp=GlobalAddAtom(DDEAPP);
hSzTopic=GlobalAddAtom(DDETOPIC);
if(hSzApp && hSzTopic)
@@ -119,11 +119,11 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM if(pszArg!=NULL) {
/* we are inside miranda here, we make it async so the shell does
* not timeout regardless what the plugins try to do. */
- if(!lstrcmpi(pszAction,_T("file")))
+ if (!lstrcmpi(pszAction,_T("file")))
ack.fAck=(short)(CallFunctionAsync(FileActionAsync,pszArg)!=0);
- else if(!lstrcmpi(pszAction,_T("url")))
+ else if (!lstrcmpi(pszAction,_T("url")))
ack.fAck=(short)(CallFunctionAsync(UrlActionAsync,pszArg)!=0);
- if(!ack.fAck) mir_free(pszArg); /* otherwise freed by asyncproc */
+ if (!ack.fAck) mir_free(pszArg); /* otherwise freed by asyncproc */
}
GlobalUnlock(hCommand);
}
@@ -131,7 +131,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM }
#endif
lParam=ReuseDDElParam(lParam,msg,WM_DDE_ACK,*(PUINT)&ack,(UINT)hCommand);
- if(!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
+ if (!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
GlobalFree(hCommand);
FreeDDElParam(WM_DDE_ACK,lParam);
}
@@ -151,7 +151,7 @@ static LRESULT CALLBACK DdeMessageWindow(HWND hwnd,UINT msg,WPARAM wParam,LPARAM ZeroMemory(&ack,sizeof(ack));
if(UnpackDDElParam(msg,lParam,NULL,(PUINT)&hSzItem)) {
lParam=ReuseDDElParam(lParam,msg,WM_DDE_ACK,*(PUINT)&ack,(UINT)hSzItem);
- if(!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
+ if (!PostMessage((HWND)wParam,WM_DDE_ACK,(WPARAM)hwnd,lParam)) {
if(hSzItem) GlobalDeleteAtom(hSzItem);
FreeDDElParam(WM_DDE_ACK,lParam);
}
@@ -170,7 +170,7 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath) STARTUPINFO si;
/* we are inside RunDll32 here */
- if(!GetModuleFileName(hInst,szPath,SIZEOF(szPath))) return NULL;
+ if (!GetModuleFileName(hInst,szPath,SIZEOF(szPath))) return NULL;
p=_tcsrchr(szPath,_T('\\'));
if(p!=NULL) { *p=0; p=_tcsrchr(szPath,_T('\\')); }
if(p==NULL) return NULL;
@@ -178,7 +178,7 @@ static HANDLE StartupMainProcess(TCHAR *pszDatabasePath) /* inherit startup data from RunDll32 process */
GetStartupInfo(&si);
- if(!CreateProcess(szPath,pszDatabasePath,NULL,NULL,TRUE,GetPriorityClass(GetCurrentProcess()),NULL,NULL,&si,&pi))
+ if (!CreateProcess(szPath,pszDatabasePath,NULL,NULL,TRUE,GetPriorityClass(GetCurrentProcess()),NULL,NULL,&si,&pi))
return NULL;
CloseHandle(pi.hThread);
return pi.hProcess;
diff --git a/plugins/AssocMgr/main.c b/plugins/AssocMgr/main.c index 60d6a8b5a0..55c93fa40d 100644 --- a/plugins/AssocMgr/main.c +++ b/plugins/AssocMgr/main.c @@ -72,7 +72,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1],*p;
HANDLE hFile;
- if(!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
+ if (!GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-lstrlen(pszFileName)))
return;
p=_tcsrchr(szFileFrom,_T('\\'));
if(p!=NULL) *(++p)=0;
@@ -82,7 +82,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) if(hFile==INVALID_HANDLE_VALUE) return;
CloseHandle(hFile);
- if(!GetModuleFileNameWorkaround(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
+ if (!GetModuleFileNameWorkaround(NULL,szFileTo,SIZEOF(szFileTo)-lstrlen(pszDestSubDir)-lstrlen(pszFileName)))
return;
p=_tcsrchr(szFileTo,_T('\\'));
if(p!=NULL) *(++p)=0;
@@ -90,7 +90,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir) CreateDirectory(szFileTo,NULL);
lstrcat(szFileTo,pszFileName); /* buffer safe */
- if(!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) {
+ if (!MoveFile(szFileFrom,szFileTo) && GetLastError()==ERROR_ALREADY_EXISTS) {
DeleteFile(szFileTo);
MoveFile(szFileFrom,szFileTo);
}
@@ -147,7 +147,7 @@ __declspec(dllexport) int Load(PLUGINLINK *link) return 1;
}
- if(!ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) return 1; /* dbx3x v0.5.1.0 */
+ if (!ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) return 1; /* dbx3x v0.5.1.0 */
if(mir_getMMI(&mmi)) return 1;
if(mir_getUTFI(&utfi)) return 1;
InitAssocList();
diff --git a/plugins/AssocMgr/reg.c b/plugins/AssocMgr/reg.c index a4fadd2ef4..09b58a1462 100644 --- a/plugins/AssocMgr/reg.c +++ b/plugins/AssocMgr/reg.c @@ -128,10 +128,10 @@ TCHAR *MakeRunCommand(BOOL fMirExe,BOOL fFixedDbProfile) TCHAR szExe[MAX_PATH],*pszFmt,*pszRunCmd=NULL;
char szDbFile[MAX_PATH];
int cch;
- if(!fFixedDbProfile || !CallService(MS_DB_GETPROFILENAME,SIZEOF(szDbFile),(LPARAM)szDbFile))
+ if (!fFixedDbProfile || !CallService(MS_DB_GETPROFILENAME,SIZEOF(szDbFile),(LPARAM)szDbFile))
if(GetModuleFileNameWorkaround(fMirExe?NULL:hInst,szExe,SIZEOF(szExe))) {
/* db file */
- if(!fFixedDbProfile)
+ if (!fFixedDbProfile)
lstrcpyA(szDbFile,"%1"); /* buffer safe */
/* size */
cch=lstrlen(szExe)+lstrlenA(szDbFile);
@@ -171,7 +171,7 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd) pargs=_tcschr(&buf[1],_T('\"'));
if(pargs!=NULL) *(pargs++)=0;
pexe=&buf[1];
- if(*pargs==_T(' ')) ++pargs;
+ if (*pargs==_T(' ')) ++pargs;
} else {
pargs=_tcschr(buf,_T(' '));
if(pargs!=NULL) *pargs=0;
@@ -179,7 +179,7 @@ static BOOL IsValidRunCommand(const TCHAR *pszRunCmd) }
if(SearchPath(NULL,pexe,_T(".exe"),SIZEOF(szFullExe),szFullExe,&pszFilePart)) {
if(pszFilePart!=NULL)
- if(!lstrcmpi(pszFilePart,_T("rundll32.exe")) || !lstrcmpi(pszFilePart,_T("rundll.exe"))) {
+ if (!lstrcmpi(pszFilePart,_T("rundll32.exe")) || !lstrcmpi(pszFilePart,_T("rundll.exe"))) {
/* split into dll path and arguments */
if(pargs[0]==_T('\"')) {
++pargs;
@@ -201,7 +201,7 @@ TCHAR *MakeIconLocation(HMODULE hModule,WORD nIconResID) {
TCHAR szModule[MAX_PATH],*pszIconLoc=NULL;
int cch;
- if((cch=GetModuleFileNameWorkaround(hModule,szModule,SIZEOF(szModule)))!=0) {
+ if ((cch=GetModuleFileNameWorkaround(hModule,szModule,SIZEOF(szModule)))!=0) {
pszIconLoc=(TCHAR*)mir_alloc((cch+=8)*sizeof(TCHAR));
if(pszIconLoc!=NULL)
wsprintf(pszIconLoc,_T("%s,%i"),szModule,-(int)nIconResID); /* id may be 0, buffer safe */
@@ -231,13 +231,13 @@ static LONG DeleteRegSubTree(HKEY hKey,const TCHAR *pszSubKey) DWORD nMaxSubKeyLen,cchSubKey;
TCHAR *pszSubKeyBuf;
HKEY hSubKey;
- if((res=RegOpenKeyEx(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|DELETE,&hSubKey))==ERROR_SUCCESS) {
- if((res=RegQueryInfoKey(hSubKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
+ if ((res=RegOpenKeyEx(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS|DELETE,&hSubKey))==ERROR_SUCCESS) {
+ if ((res=RegQueryInfoKey(hSubKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
pszSubKeyBuf=(TCHAR*)mir_alloc((nMaxSubKeyLen+1)*sizeof(TCHAR));
if(pszSubKeyBuf==NULL) res=ERROR_NOT_ENOUGH_MEMORY;
while(!res) {
cchSubKey=nMaxSubKeyLen+1;
- if((res=RegEnumKeyEx(hSubKey,0,pszSubKeyBuf,&cchSubKey,NULL,NULL,NULL,NULL))==ERROR_SUCCESS)
+ if ((res=RegEnumKeyEx(hSubKey,0,pszSubKeyBuf,&cchSubKey,NULL,NULL,NULL,NULL))==ERROR_SUCCESS)
res=DeleteRegSubTree(hSubKey,pszSubKeyBuf); /* recursion */
}
mir_free(pszSubKeyBuf); /* does NULL check */
@@ -245,7 +245,7 @@ static LONG DeleteRegSubTree(HKEY hKey,const TCHAR *pszSubKey) }
RegCloseKey(hSubKey);
}
- if(!res) res=RegDeleteKey(hKey,pszSubKey);
+ if (!res) res=RegDeleteKey(hKey,pszSubKey);
return res;
}
@@ -255,7 +255,7 @@ static LONG SetRegSubKeyStrDefValue(HKEY hMainKey,const TCHAR *pszSubKey,const T HKEY hSubKey;
LONG res;
res=RegCreateKeyEx(hMainKey,pszSubKey,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE,NULL,&hSubKey,NULL);
- if(!res) {
+ if (!res) {
res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(lstrlen(pszVal)+1)*sizeof(TCHAR));
RegCloseKey(hSubKey);
}
@@ -282,11 +282,11 @@ static TCHAR *GetRegStrValue(HKEY hKey,const TCHAR *pszValName) TCHAR *pszVal,*pszVal2;
DWORD dwSize,dwType;
/* get size */
- if(!RegQueryValueEx(hKey,pszValName,NULL,NULL,NULL,&dwSize) && dwSize>sizeof(TCHAR)) {
+ if (!RegQueryValueEx(hKey,pszValName,NULL,NULL,NULL,&dwSize) && dwSize>sizeof(TCHAR)) {
pszVal=(TCHAR*)mir_alloc(dwSize+sizeof(TCHAR));
if(pszVal!=NULL) {
/* get value */
- if(!RegQueryValueEx(hKey,pszValName,NULL,&dwType,(BYTE*)pszVal,&dwSize)) {
+ if (!RegQueryValueEx(hKey,pszValName,NULL,&dwType,(BYTE*)pszVal,&dwSize)) {
pszVal[dwSize/sizeof(TCHAR)]=0;
if(dwType==REG_EXPAND_SZ) {
dwSize=MAX_PATH;
@@ -363,7 +363,7 @@ static BOOL ReadDbBackupData(const char *pszSetting,DWORD *pdwType,BYTE **ppData dbcgs.szModule="AssocMgr";
dbcgs.szSetting=pszSetting;
dbcgs.pValue=&dbv;
- if(!CallService(MS_DB_CONTACT_GETSETTING,0,(LPARAM)&dbcgs)) {
+ if (!CallService(MS_DB_CONTACT_GETSETTING,0,(LPARAM)&dbcgs)) {
if(dbv.type==DBVT_BLOB && dbv.cpbVal>=sizeof(DWORD)) {
*pdwType=*(DWORD*)dbv.pbVal;
*ppData=dbv.pbVal;
@@ -391,8 +391,8 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe char *pszName;
register TCHAR *ptszName;
DWORD nDbPrefixLen;
- if((res=RegOpenKeyExA(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,&hKey))==ERROR_SUCCESS) {
- if((res=RegQueryInfoKey(hKey,NULL,NULL,NULL,NULL,&nMaxSubKeyLen,NULL,NULL,&nMaxValNameLen,&nMaxValSize,NULL,NULL))==ERROR_SUCCESS) {
+ if ((res=RegOpenKeyExA(hKey,pszSubKey,0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,&hKey))==ERROR_SUCCESS) {
+ 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;
@@ -413,16 +413,16 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe while(!res) {
cchName=nMaxValNameLen+1;
cbData=nMaxValSize;
- if((res=RegEnumValueA(hKey,index++,pszName,&cchName,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
+ if ((res=RegEnumValueA(hKey,index++,pszName,&cchName,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
(*param->ppszDbPrefix)[nDbPrefixLen]=0;
lstrcatA(*param->ppszDbPrefix,pszName); /* buffer safe */
ptszName=a2t(pszName);
if(ptszName!=NULL) {
- if(!RegQueryValueEx(hKey,ptszName,NULL,&dwType,pData,&cbData)) {
+ if (!RegQueryValueEx(hKey,ptszName,NULL,&dwType,pData,&cbData)) {
#ifdef _UNICODE
WriteDbBackupData(*param->ppszDbPrefix,dwType,pData,cbData);
#else
- if(!(dwType®F_ANSI)) /* sanity check, never happens */
+ if (!(dwType®F_ANSI)) /* sanity check, never happens */
WriteDbBackupData(*param->ppszDbPrefix,dwType®F_ANSI,pData,cbData);
#endif
}
@@ -439,7 +439,7 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe index=0;
while(!res) {
cchName=nMaxSubKeyLen+1;
- if((res=RegEnumKeyExA(hKey,index++,pszName,&cchName,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
+ if ((res=RegEnumKeyExA(hKey,index++,pszName,&cchName,NULL,NULL,NULL,NULL))==ERROR_SUCCESS) {
(*param->ppszDbPrefix)[nDbPrefixLen]=0;
BackupRegTree_Worker(hKey,pszName,param); /* recursion */
}
@@ -498,13 +498,13 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref *(pslash++)=0;
hSubKey=hKey;
if(pslash!=pkeys+1)
- if((res=RegCreateKeyExA(hKey,pkeys,0,NULL,0,KEY_SET_VALUE,NULL,&hSubKey,NULL))!=ERROR_SUCCESS)
+ if ((res=RegCreateKeyExA(hKey,pkeys,0,NULL,0,KEY_SET_VALUE,NULL,&hSubKey,NULL))!=ERROR_SUCCESS)
break;
pszValName=pslash;
/* read data */
if(ReadDbBackupData(ppszSettings[i],&dwType,&pData,&cbData)) {
/* set value */
- if(!(dwType®F_ANSI)) {
+ if (!(dwType®F_ANSI)) {
pwszValName=a2u(pszValName,FALSE);
if(pwszValName!=NULL) res=RegSetValueExW(hSubKey,pwszValName,0,dwType,pData,cbData);
else res=ERROR_NOT_ENOUGH_MEMORY;
@@ -568,7 +568,7 @@ void CleanupRegTreeBackupSettings(void) --j; /* reiterate current index */
}
/* no longer registered? */
- if(!IsRegisteredAssocItem(pszClassName)) {
+ if (!IsRegisteredAssocItem(pszClassName)) {
if(IsFileClassName(pszClassName,&pszFileExt))
RemoveRegFileExt(pszFileExt,pszClassName);
else RemoveRegClass(pszClassName);
@@ -596,7 +596,7 @@ static BOOL Opera6_GetIniFilePath(TCHAR *szIniFile) /* Info: http://opera-info.de/forum/thread.php?threadid=2905 */
/* app path */
- if(!RegOpenKeyExA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Netscape.exe",0,KEY_QUERY_VALUE,&hExeKey)) {
+ if (!RegOpenKeyExA(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Netscape.exe",0,KEY_QUERY_VALUE,&hExeKey)) {
/* exe name */
p=GetRegStrValue(hExeKey,NULL);
if(p!=NULL && _tcsstr(p,_T("Opera.exe"))!=NULL) {
@@ -690,11 +690,11 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const return FALSE;
}
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_CREATE_SUB_KEY,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_CREATE_SUB_KEY,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT; /* might be write protected by security settings */
/* class */
- if((res=RegCreateKeyExA(hRootKey,pszClassName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE|KEY_QUERY_VALUE,NULL,&hClassKey,NULL))==ERROR_SUCCESS) {
+ if ((res=RegCreateKeyExA(hRootKey,pszClassName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE|KEY_QUERY_VALUE,NULL,&hClassKey,NULL))==ERROR_SUCCESS) {
/* backup class if shared */
if(fUrlProto) BackupRegTree(hRootKey,pszClassName,"bak_");
/* type description */
@@ -703,7 +703,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const /* default icon */
if(pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hClassKey,_T("DefaultIcon"),pszIconLoc);
/* url protocol */
- if(!fUrlProto) RegDeleteValue(hClassKey,_T("URL Protocol"));
+ if (!fUrlProto) RegDeleteValue(hClassKey,_T("URL Protocol"));
else RegSetValueEx(hClassKey,_T("URL Protocol"),0,REG_SZ,NULL,0);
/* moniker clsid */
RegDeleteKey(hClassKey,_T("CLSID"));
@@ -711,7 +711,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const { DWORD dwFlags=0,dwSize=sizeof(dwFlags);
RegQueryValueEx(hClassKey,_T("EditFlags"),NULL,NULL,(BYTE*)&dwFlags,&dwSize);
if(fBrowserAutoOpen) dwFlags=(dwFlags&~FTA_AlwaysUnsafe)|FTA_OpenIsSafe;
- if(!fUrlProto) dwFlags|=FTA_HasExtension;
+ if (!fUrlProto) dwFlags|=FTA_HasExtension;
else dwFlags=(dwFlags&~FTA_HasExtension)|FTA_Show; /* show classes without extension */
RegSetValueEx(hClassKey,_T("EditFlags"),0,REG_DWORD,(BYTE*)&dwFlags,sizeof(dwFlags));
}
@@ -720,11 +720,11 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const RegSetValueExA(hClassKey,"NeverShowExt",0,REG_SZ,NULL,0);
}
/* shell */
- if((res=RegCreateKeyEx(hClassKey,_T("shell"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL))==ERROR_SUCCESS) {
+ if ((res=RegCreateKeyEx(hClassKey,_T("shell"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL))==ERROR_SUCCESS) {
/* default verb (when empty "open" is used) */
RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)_T("open"),5*sizeof(TCHAR));
/* verb */
- if((res=RegCreateKeyEx(hShellKey,_T("open"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY|DELETE,NULL,&hVerbKey,NULL))==ERROR_SUCCESS) {
+ 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));
@@ -734,7 +734,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const 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)) {
+ 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));
/* application */
@@ -746,7 +746,7 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const RegCloseKey(hDdeKey);
}
} else {
- if(!RegOpenKeyEx(hVerbKey,_T("ddeexec"),0,DELETE,&hDdeKey)) {
+ if (!RegOpenKeyEx(hVerbKey,_T("ddeexec"),0,DELETE,&hDdeKey)) {
/* application */
RegDeleteKey(hDdeKey,_T("application"));
/* topic */
@@ -782,7 +782,7 @@ BOOL RemoveRegClass(const char *pszClassName) TCHAR *ptszClassName,*ptszPrevRunCmd;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,DELETE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,DELETE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* class name */
@@ -793,14 +793,14 @@ BOOL RemoveRegClass(const char *pszClassName) mir_free(ptszClassName); /* does NULL check */
/* backup only saved/restored for fUrlProto */
- if(!res) {
- if((res=RestoreRegTree(hRootKey,pszClassName,"bak_"))==ERROR_SUCCESS)
+ if (!res) {
+ if ((res=RestoreRegTree(hRootKey,pszClassName,"bak_"))==ERROR_SUCCESS)
/* class */
- if(!RegOpenKeyExA(hRootKey,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
+ if (!RegOpenKeyExA(hRootKey,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
/* shell */
- if(!RegOpenKeyEx(hClassKey,_T("shell"),0,KEY_QUERY_VALUE,&hShellKey)) {
+ if (!RegOpenKeyEx(hClassKey,_T("shell"),0,KEY_QUERY_VALUE,&hShellKey)) {
/* verb */
- if(!RegOpenKeyEx(hShellKey,_T("open"),0,KEY_QUERY_VALUE,&hVerbKey)) {
+ if (!RegOpenKeyEx(hShellKey,_T("open"),0,KEY_QUERY_VALUE,&hVerbKey)) {
/* command */
ptszPrevRunCmd=GetRegStrValue(hVerbKey,_T("command"));
if(ptszPrevRunCmd!=NULL && !IsValidRunCommand(ptszPrevRunCmd))
@@ -836,13 +836,13 @@ BOOL IsRegClass(const char *pszClassName,const TCHAR *pszRunCmd) /* using the merged view classes key for reading */
/* class */
- if(!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
+ if (!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
/* shell */
- if(!RegOpenKeyEx(hClassKey,_T("shell"),0,KEY_QUERY_VALUE,&hShellKey)) {
+ if (!RegOpenKeyEx(hClassKey,_T("shell"),0,KEY_QUERY_VALUE,&hShellKey)) {
/* verb */
- if(!RegOpenKeyEx(hShellKey,_T("open"),0,KEY_QUERY_VALUE,&hVerbKey)) {
+ if (!RegOpenKeyEx(hShellKey,_T("open"),0,KEY_QUERY_VALUE,&hVerbKey)) {
/* command */
- if(!RegOpenKeyEx(hVerbKey,_T("command"),0,KEY_QUERY_VALUE,&hCmdKey)) {
+ if (!RegOpenKeyEx(hVerbKey,_T("command"),0,KEY_QUERY_VALUE,&hCmdKey)) {
/* it is enough to check if the command is right */
fSuccess=IsRegStrValue(hCmdKey,NULL,pszRunCmd);
RegCloseKey(hCmdKey);
@@ -870,9 +870,9 @@ HICON LoadRegClassSmallIcon(const char *pszClassName) /* using the merged view classes key for reading */
/* class */
- if(!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
+ if (!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszClassName,0,KEY_QUERY_VALUE,&hClassKey)) {
/* default icon */
- if(!RegOpenKeyEx(hClassKey,_T("DefaultIcon"),0,KEY_QUERY_VALUE,&hIconKey)) {
+ if (!RegOpenKeyEx(hClassKey,_T("DefaultIcon"),0,KEY_QUERY_VALUE,&hIconKey)) {
/* extract icon */
pszIconLoc=GetRegStrValue(hIconKey,NULL);
if(pszIconLoc!=NULL) {
@@ -912,11 +912,11 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p return FALSE;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_CREATE_SUB_KEY,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_CREATE_SUB_KEY,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* file ext */
- if(!RegCreateKeyExA(hRootKey,pszFileExt,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExtKey,NULL)) {
+ if (!RegCreateKeyExA(hRootKey,pszFileExt,0,NULL,0,KEY_SET_VALUE|KEY_QUERY_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExtKey,NULL)) {
TCHAR *pszPrevClass;
/* backup previous app */
BackupRegTree(hRootKey,pszFileExt,"bak_");
@@ -925,7 +925,7 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p /* open with progids */
pszPrevClass=GetRegStrValue(hExtKey,NULL);
if(pszPrevClass!=NULL && !IsRegStrValueA(hExtKey,NULL,pszClassName))
- if(!RegCreateKeyEx(hExtKey,_T("OpenWithProgids"),0,NULL,0,KEY_SET_VALUE,NULL,&hOpenWithKey,NULL)) {
+ if (!RegCreateKeyEx(hExtKey,_T("OpenWithProgids"),0,NULL,0,KEY_SET_VALUE,NULL,&hOpenWithKey,NULL)) {
/* previous class (backup) */
RegSetValueEx(hOpenWithKey,pszPrevClass,0,REG_NONE,NULL,0);
RegCloseKey(hOpenWithKey);
@@ -953,18 +953,18 @@ void RemoveRegFileExt(const char *pszFileExt,const char *pszClassName) BOOL fRestored=FALSE;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,DELETE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,DELETE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* file ext */
- if(!RegOpenKeyExA(hRootKey,pszFileExt,0,KEY_QUERY_VALUE|KEY_SET_VALUE|DELETE,&hExtKey)) {
+ if (!RegOpenKeyExA(hRootKey,pszFileExt,0,KEY_QUERY_VALUE|KEY_SET_VALUE|DELETE,&hExtKey)) {
/* class name (the important part) */
- if(!RestoreRegTree(hRootKey,pszFileExt,"bak_")) {
+ if (!RestoreRegTree(hRootKey,pszFileExt,"bak_")) {
pszPrevClassName=GetRegStrValue(hExtKey,NULL);
if(pszPrevClassName!=NULL) {
/* previous class name still exists? */
/* using the merged view classes key for reading */
- if(!RegOpenKeyEx(HKEY_CLASSES_ROOT,pszPrevClassName,0,KEY_QUERY_VALUE,&hSubKey)) {
+ if (!RegOpenKeyEx(HKEY_CLASSES_ROOT,pszPrevClassName,0,KEY_QUERY_VALUE,&hSubKey)) {
fRestored=TRUE;
RegCloseKey(hSubKey);
} else RegDeleteValue(hExtKey,NULL);
@@ -974,16 +974,16 @@ void RemoveRegFileExt(const char *pszFileExt,const char *pszClassName) if(pszPrevClassName==NULL) RegDeleteValue(hExtKey,NULL);
/* open with progids (remove if empty) */
nOpenWithCount=0;
- if(!RegOpenKeyEx(hExtKey,_T("OpenWithProgids"),0,KEY_SET_VALUE|KEY_QUERY_VALUE,&hSubKey)) {
+ if (!RegOpenKeyEx(hExtKey,_T("OpenWithProgids"),0,KEY_SET_VALUE|KEY_QUERY_VALUE,&hSubKey)) {
/* remove current class (if set by another app) */
RegDeleteValueA(hSubKey,pszClassName);
RegQueryInfoKey(hSubKey,NULL,NULL,NULL,NULL,NULL,NULL,NULL,&nOpenWithCount,NULL,NULL,NULL);
RegCloseKey(hSubKey);
}
- if(!nOpenWithCount) RegDeleteKey(hExtKey,_T("OpenWithProgids")); /* delete if no values */
+ if (!nOpenWithCount) RegDeleteKey(hExtKey,_T("OpenWithProgids")); /* delete if no values */
RegCloseKey(hExtKey);
} else DeleteRegTreeBackup(pszFileExt,"bak_");
- if(!fRestored) RegDeleteKeyA(hRootKey,pszFileExt); /* try to remove it all */
+ if (!fRestored) RegDeleteKeyA(hRootKey,pszFileExt); /* try to remove it all */
if(hRootKey!=HKEY_CLASSES_ROOT)
RegCloseKey(hRootKey);
@@ -1002,7 +1002,7 @@ BOOL IsRegFileExt(const char *pszFileExt,const char *pszClassName) /* using the merged view classes key for reading */
/* file ext */
- if(!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszFileExt,0,KEY_QUERY_VALUE,&hExtKey)) {
+ if (!RegOpenKeyExA(HKEY_CLASSES_ROOT,pszFileExt,0,KEY_QUERY_VALUE,&hExtKey)) {
/* class name */
/* it is enough to check if the class is right */
fSuccess=IsRegStrValueA(hExtKey,NULL,pszClassName);
@@ -1029,13 +1029,13 @@ BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt,const TCHAR * return FALSE;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* database */
- if(!RegOpenKeyEx(hRootKey,_T("MIME\\Database\\Content Type"),0,KEY_CREATE_SUB_KEY,&hDbKey)) {
+ if (!RegOpenKeyEx(hRootKey,_T("MIME\\Database\\Content Type"),0,KEY_CREATE_SUB_KEY,&hDbKey)) {
/* mime type */
- if(!RegCreateKeyExA(hDbKey,pszMimeType,0,NULL,0,KEY_QUERY_VALUE|KEY_SET_VALUE,NULL,&hTypeKey,NULL)) {
+ 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);
@@ -1057,13 +1057,13 @@ void RemoveRegMimeType(const char *pszMimeType,const char *pszFileExt) BOOL fDelete=TRUE;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* database */
- if(!RegOpenKeyEx(hRootKey,_T("MIME\\Database\\Content Type"),0,DELETE,&hDbKey)) {
+ if (!RegOpenKeyEx(hRootKey,_T("MIME\\Database\\Content Type"),0,DELETE,&hDbKey)) {
/* mime type */
- if(!RegOpenKeyExA(hDbKey,pszMimeType,0,KEY_QUERY_VALUE,&hTypeKey)) {
+ if (!RegOpenKeyExA(hDbKey,pszMimeType,0,KEY_QUERY_VALUE,&hTypeKey)) {
/* file ext */
fDelete=IsRegStrValueA(hTypeKey,_T("Extension"),pszFileExt);
RegCloseKey(hTypeKey);
@@ -1088,13 +1088,13 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR HKEY hRootKey,hAppsKey,hExeKey,hShellKey,hVerbKey,hDdeKey;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* database */
- if(!RegCreateKeyEx(hRootKey,_T("Applications"),0,NULL,0,KEY_CREATE_SUB_KEY,NULL,&hAppsKey,NULL)) {
+ if (!RegCreateKeyEx(hRootKey,_T("Applications"),0,NULL,0,KEY_CREATE_SUB_KEY,NULL,&hAppsKey,NULL)) {
/* filename */
- if(!RegCreateKeyEx(hAppsKey,pszAppFileName,0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hExeKey,NULL)) {
+ 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));
/* no open-with flag */
@@ -1103,18 +1103,18 @@ void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR /* default icon */
if(pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hExeKey,_T("DefaultIcon"),pszIconLoc);
/* shell */
- if(!RegCreateKeyEx(hExeKey,_T("shell"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL)) {
+ if (!RegCreateKeyEx(hExeKey,_T("shell"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hShellKey,NULL)) {
/* default verb (when empty "open" is used) */
RegSetValueEx(hShellKey,NULL,0,REG_SZ,(BYTE*)_T("open"),5*sizeof(TCHAR));
/* verb */
- if(!RegCreateKeyEx(hShellKey,_T("open"),0,NULL,0,KEY_SET_VALUE|KEY_CREATE_SUB_KEY,NULL,&hVerbKey,NULL)) {
+ 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));
/* 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)) {
+ 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));
/* application */
@@ -1141,23 +1141,23 @@ void RemoveRegOpenWith(const TCHAR *pszAppFileName) HKEY hRootKey,hAppsKey,hExeKey,hShellKey,hVerbKey,hDdeKey;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* applications */
- if(!RegOpenKeyEx(hRootKey,_T("Applications"),0,DELETE,&hAppsKey)) {
+ if (!RegOpenKeyEx(hRootKey,_T("Applications"),0,DELETE,&hAppsKey)) {
/* filename */
- if(!RegOpenKeyEx(hAppsKey,pszAppFileName,0,DELETE,&hExeKey)) {
+ if (!RegOpenKeyEx(hAppsKey,pszAppFileName,0,DELETE,&hExeKey)) {
/* default icon */
RegDeleteKey(hExeKey,_T("DefaultIcon"));
/* shell */
- if(!RegOpenKeyEx(hExeKey,_T("shell"),0,DELETE,&hShellKey)) {
+ if (!RegOpenKeyEx(hExeKey,_T("shell"),0,DELETE,&hShellKey)) {
/* verb */
- if(!RegOpenKeyEx(hShellKey,_T("open"),0,DELETE,&hVerbKey)) {
+ if (!RegOpenKeyEx(hShellKey,_T("open"),0,DELETE,&hVerbKey)) {
/* command */
RegDeleteKey(hVerbKey,_T("command"));
/* ddeexec */
- if(!RegOpenKeyEx(hVerbKey,_T("ddeexec"),0,DELETE,&hDdeKey)) {
+ if (!RegOpenKeyEx(hVerbKey,_T("ddeexec"),0,DELETE,&hDdeKey)) {
/* application */
RegDeleteKey(hDdeKey,_T("application"));
/* topic */
@@ -1192,15 +1192,15 @@ void AddRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileExt,c HKEY hRootKey,hAppsKey,hExeKey,hTypesKey;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* applications */
- if(!RegOpenKeyEx(hRootKey,_T("Applications"),0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,&hAppsKey)) {
+ if (!RegOpenKeyEx(hRootKey,_T("Applications"),0,KEY_QUERY_VALUE|KEY_ENUMERATE_SUB_KEYS,&hAppsKey)) {
/* filename */
- if(!RegOpenKeyEx(hAppsKey,pszAppFileName,0,KEY_CREATE_SUB_KEY,&hExeKey)) {
+ if (!RegOpenKeyEx(hAppsKey,pszAppFileName,0,KEY_CREATE_SUB_KEY,&hExeKey)) {
/* supported types */
- if(!RegCreateKeyEx(hExeKey,_T("SupportedTypes"),0,NULL,0,KEY_SET_VALUE,NULL,&hTypesKey,NULL)) {
+ if (!RegCreateKeyEx(hExeKey,_T("SupportedTypes"),0,NULL,0,KEY_SET_VALUE,NULL,&hTypesKey,NULL)) {
TCHAR *ptszFileExt;
ptszFileExt=a2t(pszFileExt);
if(ptszFileExt!=NULL)
@@ -1222,15 +1222,15 @@ void RemoveRegOpenWithExtEntry(const TCHAR *pszAppFileName,const char *pszFileEx HKEY hRootKey,hAppsKey,hExeKey,hTypesKey;
/* try to open interactive user's classes key */
- if(!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
+ if (!IsWinVer2000Plus() || RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Classes"),0,KEY_QUERY_VALUE,&hRootKey))
hRootKey=HKEY_CLASSES_ROOT;
/* applications */
- if(!RegOpenKeyEx(hRootKey,_T("Applications"),0,KEY_QUERY_VALUE,&hAppsKey)) {
+ if (!RegOpenKeyEx(hRootKey,_T("Applications"),0,KEY_QUERY_VALUE,&hAppsKey)) {
/* filename */
- if(!RegOpenKeyEx(hAppsKey,pszAppFileName,0,KEY_QUERY_VALUE,&hExeKey)) {
+ if (!RegOpenKeyEx(hAppsKey,pszAppFileName,0,KEY_QUERY_VALUE,&hExeKey)) {
/* supported types */
- if(!RegOpenKeyEx(hExeKey,_T("SupportedTypes"),0,KEY_SET_VALUE,&hTypesKey)) {
+ if (!RegOpenKeyEx(hExeKey,_T("SupportedTypes"),0,KEY_SET_VALUE,&hTypesKey)) {
RegDeleteValueA(hTypesKey,pszFileExt);
RegCloseKey(hTypesKey);
}
@@ -1255,7 +1255,7 @@ BOOL AddRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd) HKEY hRunKey;
/* run */
- if(!RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,NULL,0,KEY_SET_VALUE,NULL,&hRunKey,NULL)) {
+ 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));
RegCloseKey(hRunKey);
@@ -1270,7 +1270,7 @@ BOOL RemoveRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd) /* run */
res=RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,KEY_QUERY_VALUE|KEY_SET_VALUE,&hRunKey);
- if(!res) {
+ if (!res) {
/* appname */
if(IsRegStrValue(hRunKey,pszAppName,pszRunCmd))
res=RegDeleteValue(hRunKey,pszAppName); /* only remove if current */
@@ -1289,7 +1289,7 @@ BOOL IsRegRunEntry(const TCHAR *pszAppName,const TCHAR *pszRunCmd) HKEY hRunKey;
/* Run */
- if(!RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,KEY_QUERY_VALUE,&hRunKey)) {
+ if (!RegOpenKeyEx(HKEY_CURRENT_USER,_T("Software\\Microsoft\\Windows\\CurrentVersion\\Run"),0,KEY_QUERY_VALUE,&hRunKey)) {
/* appname */
fState=IsRegStrValue(hRunKey,pszAppName,pszRunCmd);
RegCloseKey(hRunKey);
diff --git a/plugins/AssocMgr/test.c b/plugins/AssocMgr/test.c index 0da578d4ec..73112af5a5 100644 --- a/plugins/AssocMgr/test.c +++ b/plugins/AssocMgr/test.c @@ -92,23 +92,23 @@ static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam) /* skip leading prefix */
arg=strchr(arg,':');
if(arg==NULL) return 1; /* parse failed */
- for(++arg;*arg=='/';++arg);
+ for (++arg;*arg=='/';++arg);
/*
add user: aim:addbuddy?screenname=NICK&groupname=GROUP
send message: aim:goim?screenname=NICK&message=MSG
open chatroom: aim:gochat?roomname=ROOM&exchange=NUM
*/
/* add a contact to the list */
- if(!_strnicmp(arg,"addbuddy?",9)) {
+ if (!_strnicmp(arg,"addbuddy?",9)) {
char *tok,*sn=NULL,*group=NULL;
ADDCONTACTSTRUCT acs;
PROTOSEARCHRESULT psr;
- if(*(arg+=9)==0) return 1; /* parse failed */
+ if (*(arg+=9)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"screenname=",11) && *(tok+11)!=0)
+ if (!_strnicmp(tok,"screenname=",11) && *(tok+11)!=0)
sn=Netlib_UrlDecode(tok+11);
- if(!_strnicmp(tok,"groupname=",10) && *(tok+10)!=0)
+ if (!_strnicmp(tok,"groupname=",10) && *(tok+10)!=0)
group=Netlib_UrlDecode(tok+10); /* group is currently ignored */
tok=strtok(NULL,"&"); /* next token */
}
@@ -125,15 +125,15 @@ static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam) return 0;
}
/* send a message to a contact */
- else if(!_strnicmp(arg,"goim?",5)) {
+ else if (!_strnicmp(arg,"goim?",5)) {
char *tok,*sn=NULL,*msg=NULL;
HANDLE hContact;
- if(*(arg+=5)==0) return 1; /* parse failed */
+ if (*(arg+=5)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"screenname=",11) && *(tok+11)!=0)
+ if (!_strnicmp(tok,"screenname=",11) && *(tok+11)!=0)
sn=Netlib_UrlDecode(tok+11);
- if(!_strnicmp(tok,"message=",8) && *(tok+8)!=0)
+ if (!_strnicmp(tok,"message=",8) && *(tok+8)!=0)
msg=Netlib_UrlDecode(tok+8);
tok=strtok(NULL,"&"); /* next token */
}
@@ -151,15 +151,15 @@ static int ServiceParseAimLink(WPARAM wParam,LPARAM lParam) return 0;
}
/* open a chatroom */
- else if(!_strnicmp(arg,"gochat?",7)) {
+ else if (!_strnicmp(arg,"gochat?",7)) {
char *tok,*rm=NULL;
int exchange=0;
- if(*(arg+=7)==0) return 1; /* parse failed */
+ if (*(arg+=7)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"roomname=",9) && *(tok+9)!=0)
+ if (!_strnicmp(tok,"roomname=",9) && *(tok+9)!=0)
rm=Netlib_UrlDecode(tok+9);
- if(!_strnicmp(tok,"exchange=",9))
+ if (!_strnicmp(tok,"exchange=",9))
exchange=atoi(Netlib_UrlDecode(tok+9));
tok=strtok(NULL,"&"); /* next token */
}
@@ -341,9 +341,9 @@ static int IcqOpenFile(WPARAM wParam,LPARAM lParam) if(IsEmpty(line)) continue;
if(line[0]=='[') {
ZeroMemory(&info,sizeof(info));
- if(!lstrcmpiA(line,"[ICQ Message User]"))
+ if (!lstrcmpiA(line,"[ICQ Message User]"))
info.type=ICQFILE_MESSAGEUSER;
- else if(!lstrcmpiA(line,"[ICQ User]"))
+ else if (!lstrcmpiA(line,"[ICQ User]"))
info.type=ICQFILE_ADDUSER;
continue;
}
@@ -351,11 +351,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)) 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 */
}
fclose(fp);
switch(info.type) {
@@ -424,13 +424,13 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) /* skip leading prefix */
arg=strchr(arg,':');
if(arg==NULL) return 1; /* parse failed */
- for(++arg;*arg=='/';++arg);
+ for (++arg;*arg=='/';++arg);
/* add a contact to the list */
- if(!_strnicmp(arg,"addfriend?",10)) {
+ if (!_strnicmp(arg,"addfriend?",10)) {
char *tok,*id=NULL;
ADDCONTACTSTRUCT acs;
PROTOSEARCHRESULT psr;
- if(*(arg+=10)==0) return 1; /* parse failed */
+ if (*(arg+=10)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
if(tok!=NULL) id=Netlib_UrlDecode(tok);
if(id==NULL || *id==0) return 1; /* parse failed */
@@ -446,14 +446,14 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) return 0;
}
/* send a message to a contact */
- else if(!_strnicmp(arg,"sendim?",7)) {
+ else if (!_strnicmp(arg,"sendim?",7)) {
char *tok,*id=NULL,*msg=NULL;
HANDLE hContact;
- if(*(arg+=7)==0) return 1; /* parse failed */
+ if (*(arg+=7)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
if(tok!=NULL) id=tok;
while(tok!=NULL) {
- if(!_strnicmp(tok,"m=",2) && *(tok+2)!=0)
+ if (!_strnicmp(tok,"m=",2) && *(tok+2)!=0)
msg=Netlib_UrlDecode(tok+2);
tok=strtok(NULL,"&"); /* next token */
}
@@ -466,9 +466,9 @@ static int ServiceParseYmsgrLink(WPARAM wParam,LPARAM lParam) return 0;
}
/* open a chatroom */
- else if(!_strnicmp(arg,"chat?",5)) {
+ else if (!_strnicmp(arg,"chat?",5)) {
char *tok,*rm=NULL;
- if(*(arg+=5)==0) return 1; /* parse failed */
+ if (*(arg+=5)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
if(tok!=NULL) rm=Netlib_UrlDecode(tok);
if(rm==NULL) return 1; /* parse failed */
@@ -536,16 +536,16 @@ static int ServiceParseMsnimLink(WPARAM wParam,LPARAM lParam) /* skip leading prefix */
arg=strchr(arg,':');
if(arg==NULL) return 1; /* parse failed */
- for(++arg;*arg=='/';++arg);
+ for (++arg;*arg=='/';++arg);
/* add a contact to the list */
- if(!_strnicmp(arg,"add?",4)) {
+ if (!_strnicmp(arg,"add?",4)) {
char *tok,*email=NULL;
ADDCONTACTSTRUCT acs;
PROTOSEARCHRESULT psr;
- if(*(arg+=4)==0) return 1; /* parse failed */
+ if (*(arg+=4)==0) return 1; /* parse failed */
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"contact=",8) && *(tok+11)!=0)
+ if (!_strnicmp(tok,"contact=",8) && *(tok+11)!=0)
email=Netlib_UrlDecode(tok+11);
tok=strtok(NULL,"&"); /* next token */
}
@@ -564,14 +564,14 @@ static int ServiceParseMsnimLink(WPARAM wParam,LPARAM lParam) }
/* send a message to a contact */
/* "voice" and "video" not yet implemented, perform same action as "chat" */
- else if(!_strnicmp(arg,"chat?",5) || !_strnicmp(arg,"voice?",6) || !_strnicmp(arg,"video?",6)) {
+ else if (!_strnicmp(arg,"chat?",5) || !_strnicmp(arg,"voice?",6) || !_strnicmp(arg,"video?",6)) {
char *tok,*email=NULL;
HANDLE hContact;
- if(*(arg+=5)==0) return 1; /* parse failed */
- if(*arg=='?' && *(++arg)==0) return 1; /* for "voice?" and "video?" */
+ if (*(arg+=5)==0) return 1; /* parse failed */
+ if (*arg=='?' && *(++arg)==0) return 1; /* for "voice?" and "video?" */
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"contact=",8) && *(tok+11)!=0)
+ if (!_strnicmp(tok,"contact=",8) && *(tok+11)!=0)
email=Netlib_UrlDecode(tok+11);
tok=strtok(NULL,"&"); /* next token */
}
@@ -640,7 +640,7 @@ static int ServiceParseLink(WPARAM wParam,LPARAM lParam) /* skip leading prefix */
arg=strchr(arg,':');
if(arg==NULL) return 1; /* parse failed */
- for(++arg;*arg=='/';++arg);
+ for (++arg;*arg=='/';++arg);
/* send a message to a contact */
{ HANDLE hContact;
if(ServiceExists(MS_MSG_SENDMESSAGE)) {
@@ -705,7 +705,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) /* skip leading prefix */
arg=strchr(arg,':');
if(arg==NULL) return 1; /* parse failed */
- for(++arg;*arg=='/';++arg);
+ for (++arg;*arg=='/';++arg);
/*
complete specification: http://www.xmpp.org/extensions/xep-0147.html
send message: xmpp:JID?message;subject=TEXT&body=TEXT
@@ -716,9 +716,9 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) arg=strchr(jid=arg,'?');
if(arg==NULL) arg+=lstrlenA(arg); /* points to terminating nul */
else *(arg++)=0;
- if(*jid==0) return 1; /* parse failed */
+ if (*jid==0) return 1; /* parse failed */
/* send a message to a contact */
- else if(*arg==0 || (!_strnicmp(arg,"message",7) && (*(arg+7)==';' || *(arg+7)==0))) {
+ else if (*arg==0 || (!_strnicmp(arg,"message",7) && (*(arg+7)==';' || *(arg+7)==0))) {
char *tok,*subj=NULL,*body=NULL;
HANDLE hContact;
char msg[1024];
@@ -726,9 +726,9 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) while(*arg==';') ++arg;
tok=strtok(arg,"&"); /* first token */
while(tok!=NULL) {
- if(!_strnicmp(tok,"subject=",8) && *(tok+8)!=0)
+ if (!_strnicmp(tok,"subject=",8) && *(tok+8)!=0)
subj=Netlib_UrlDecode(tok+8);
- if(!_strnicmp(tok,"body=",5) && *(tok+5)!=0)
+ if (!_strnicmp(tok,"body=",5) && *(tok+5)!=0)
body=Netlib_UrlDecode(tok+5);
tok=strtok(NULL,"&"); /* next token */
}
@@ -744,7 +744,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) return 0;
}
/* add user to contact list */
- else if(!_strnicmp(arg,"roster",6) && (*(arg+6)==';' || *(arg+6)==0)) {
+ else if (!_strnicmp(arg,"roster",6) && (*(arg+6)==';' || *(arg+6)==0)) {
ADDCONTACTSTRUCT acs;
PROTOSEARCHRESULT psr;
if(JabberHContactFromJID(jid)==NULL) { /* does not yet check if jid belongs to current user */
@@ -759,7 +759,7 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) return 0;
}
/* remove user from contact list */
- else if(!_strnicmp(arg,"remove",6) && (*(arg+6)==';' || *(arg+6)==0)) {
+ else if (!_strnicmp(arg,"remove",6) && (*(arg+6)==';' || *(arg+6)==0)) {
HANDLE hContact;
hContact=JabberHContactFromJID(jid);
if(hContact==NULL) /* not yet implemented: show standard miranda dialog here */
@@ -767,12 +767,12 @@ static int ServiceParseXmppURI(WPARAM wParam,LPARAM lParam) return 0;
}
/* add user subscription */
- else if(!_strnicmp(arg,"subscribe",9) && (*(arg+9)==';' || *(arg+9)==0)) {
+ else if (!_strnicmp(arg,"subscribe",9) && (*(arg+9)==';' || *(arg+9)==0)) {
/* not yet implemented */
return 0;
}
/* remove user subscription */
- else if(!_strnicmp(arg,"unsubscribe",11) && (*(arg+11)==';' || *(arg+11)==0)) {
+ else if (!_strnicmp(arg,"unsubscribe",11) && (*(arg+11)==';' || *(arg+11)==0)) {
/* not yet implemented */
return 0;
}
diff --git a/plugins/AssocMgr/utils.c b/plugins/AssocMgr/utils.c index d5ae8b7327..89e0867a59 100644 --- a/plugins/AssocMgr/utils.c +++ b/plugins/AssocMgr/utils.c @@ -41,7 +41,7 @@ WCHAR* a2u(const char *pszAnsi,BOOL fMirCp) if(pszAnsi==NULL) return NULL;
codepage=fMirCp?CallService(MS_LANGPACK_GETCODEPAGE,0,0):CP_ACP;
cch=MultiByteToWideChar(codepage,0,pszAnsi,-1,NULL,0);
- if(!cch) return NULL;
+ if (!cch) return NULL;
psz=(WCHAR*)mir_alloc(cch*sizeof(WCHAR));
if(psz!=NULL && !MultiByteToWideChar(codepage,0,pszAnsi,-1,psz,cch)) {
@@ -62,11 +62,11 @@ char* u2a(const WCHAR *pszUnicode,BOOL fMirCp) codepage=fMirCp?CallService(MS_LANGPACK_GETCODEPAGE,0,0):CP_ACP;
/* without WC_COMPOSITECHECK some characters might get out strange (see MS blog) */
cch=WideCharToMultiByte(codepage,flags=WC_COMPOSITECHECK,pszUnicode,-1,NULL,0,NULL,NULL);
- if(!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL);
- if(!cch) return NULL;
+ if (!cch) cch=WideCharToMultiByte(codepage,flags=0,pszUnicode,-1,NULL,0,NULL,NULL);
+ if (!cch) return NULL;
psz=(char*)mir_alloc(cch);
- if(psz!=NULL && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,NULL,NULL)){
+ if(psz!=NULL && !WideCharToMultiByte(codepage,flags,pszUnicode,-1,psz,cch,NULL,NULL)) {
mir_free(psz);
return NULL;
}
@@ -89,7 +89,7 @@ TCHAR* s2t(const void *pszStr,DWORD fUnicode,BOOL fMirCp) void* t2s(const TCHAR *pszStr,DWORD fUnicode,BOOL fMirCp)
{
#if defined(_UNICODE)
- if(!fUnicode) return (void*)u2a(pszStr,fMirCp);
+ if (!fUnicode) return (void*)u2a(pszStr,fMirCp);
return (void*)mir_wstrdup(pszStr);
#else
if(fUnicode) return (void*)a2u(pszStr,fMirCp);
@@ -109,7 +109,7 @@ struct EnumPrefixSettingsParams { static int EnumPrefixSettingsProc(const char *pszSetting,LPARAM lParam)
{
struct EnumPrefixSettingsParams *param=(struct EnumPrefixSettingsParams*)lParam;
- if(!strncmp(pszSetting,param->pszPrefix,param->nPrefixLen)) {
+ if (!strncmp(pszSetting,param->pszPrefix,param->nPrefixLen)) {
char **buf;
/* resize storage array */
buf=mir_realloc(param->settings,(param->nSettingsCount+1)*sizeof(char*));
@@ -168,7 +168,7 @@ void ShowInfoMessage(BYTE flags,const char *pszTitle,const char *pszTextFmt,...) msn.szInfo=(char*)szText;
msn.uTimeout=30000; /* max timeout */
msn.dwInfoFlags=flags;
- if(!CallServiceSync(MS_CLIST_SYSTRAY_NOTIFY,0,(LPARAM)&msn))
+ if (!CallServiceSync(MS_CLIST_SYSTRAY_NOTIFY,0,(LPARAM)&msn))
return; /* success */
}
@@ -192,7 +192,7 @@ char* GetWinErrorDescription(DWORD dwLastError) {
char *buf=NULL;
DWORD flags=FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM;
- if(!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0)),(char*)&buf,0,NULL))
+ if (!FormatMessageA(flags,NULL,dwLastError,LANGIDFROMLCID((LCID)CallService(MS_LANGPACK_GETLOCALE,0,0)),(char*)&buf,0,NULL))
if(GetLastError()==ERROR_RESOURCE_LANG_NOT_FOUND)
FormatMessageA(flags,NULL,dwLastError,0,(char*)&buf,0,NULL);
return buf;
|