summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-06 10:23:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-06 10:23:34 +0000
commit77778c2b9236077c7e79f06aa798affa2f90a1db (patch)
tree84522dfa63e6f5982614e61a0b1ff2467620d441 /plugins
parent70cbc6e77f935b7116c1080033f5d7d5b604b5a7 (diff)
fix for some warnings
git-svn-id: http://svn.miranda-ng.org/main/trunk@14023 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/AssocMgr/src/assoclist.cpp2
-rw-r--r--plugins/AssocMgr/src/main.cpp4
-rw-r--r--plugins/AssocMgr/src/reg.cpp164
-rw-r--r--plugins/AssocMgr/src/reg.h2
-rw-r--r--plugins/AssocMgr/src/utils.cpp22
-rw-r--r--plugins/Db_autobackups/src/backup.cpp3
-rw-r--r--plugins/Db_autobackups/src/options.cpp4
-rw-r--r--plugins/Db_autobackups/src/options.h2
-rw-r--r--plugins/SMS/src/recvdlg.cpp20
-rw-r--r--plugins/SMS/src/send.cpp8
-rw-r--r--plugins/SMS/src/senddlg.cpp32
-rw-r--r--plugins/SimpleAR/src/Main.cpp2
12 files changed, 86 insertions, 179 deletions
diff --git a/plugins/AssocMgr/src/assoclist.cpp b/plugins/AssocMgr/src/assoclist.cpp
index e85385a2f5..2e7dcffe9c 100644
--- a/plugins/AssocMgr/src/assoclist.cpp
+++ b/plugins/AssocMgr/src/assoclist.cpp
@@ -320,7 +320,7 @@ static BOOL EnsureAssocRegistered(const ASSOCDATA *assoc)
if(fSuccess && !fIsUrl) {
/* register mime type */
if(assoc->pszMimeType!= NULL)
- if(AddRegMimeType(assoc->pszMimeType, assoc->pszFileExt, assoc->pszDescription))
+ if(AddRegMimeType(assoc->pszMimeType, assoc->pszFileExt))
RememberMimeTypeAdded(assoc->pszMimeType, assoc->pszFileExt, TRUE);
/* register file ext */
fSuccess = AddRegFileExt(assoc->pszFileExt, assoc->pszClassName, assoc->pszMimeType, assoc->flags&FTDF_ISTEXT);
diff --git a/plugins/AssocMgr/src/main.cpp b/plugins/AssocMgr/src/main.cpp
index 4d57f89a76..ea21bc1c59 100644
--- a/plugins/AssocMgr/src/main.cpp
+++ b/plugins/AssocMgr/src/main.cpp
@@ -48,7 +48,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID)
static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
{
TCHAR szFileFrom[MAX_PATH+1],szFileTo[MAX_PATH+1];
- if ( !GetModuleFileName(hInst,szFileFrom,SIZEOF(szFileFrom)-mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(hInst, szFileFrom, SIZEOF(szFileFrom) - (int)mir_tstrlen(pszFileName)))
return;
TCHAR *p = _tcsrchr(szFileFrom,_T('\\'));
@@ -61,7 +61,7 @@ static void InstallFile(const TCHAR *pszFileName,const TCHAR *pszDestSubDir)
return;
CloseHandle(hFile);
- if ( !GetModuleFileName(NULL,szFileTo,SIZEOF(szFileTo)-mir_tstrlen(pszDestSubDir)-mir_tstrlen(pszFileName)))
+ if (!GetModuleFileName(NULL, szFileTo, SIZEOF(szFileTo)-(int)mir_tstrlen(pszDestSubDir)-(int)mir_tstrlen(pszFileName)))
return;
p = _tcsrchr(szFileTo,_T('\\'));
if (p)
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp
index 5ebba3dea9..0917af9c93 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 = mir_strlen(pszFileExt)+12;
+ size_t cbLen = mir_strlen(pszFileExt)+12;
char *pszClass = (char*)mir_alloc(cbLen);
if (pszClass != NULL)
/* using correctly formated PROGID */
@@ -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 = mir_tstrlen(szExe);
+ size_t len = mir_tstrlen(szExe);
if ( _tcschr(szExe,_T(' ')) != NULL && (len+2) < SIZEOF(szExe)) {
memmove(szExe, szExe+1, (len+1)*sizeof(TCHAR));
szExe[len+2] = szExe[0] = _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,(mir_tstrlen(pszVal)+1)*sizeof(TCHAR));
+ res=RegSetValueEx(hSubKey,NULL,0,REG_SZ,(BYTE*)pszVal,(int)(mir_tstrlen(pszVal)+1)*sizeof(TCHAR));
RegCloseKey(hSubKey);
}
return res;
@@ -262,12 +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=(mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(TCHAR);
- TCHAR *pszStr=(TCHAR*)mir_alloc(dwSize);
- if (pszStr==NULL) return;
- mir_tstrcat(mir_tstrcpy(pszStr,pszValPrefix),pszVal); /* buffer safe */
- RegSetValueEx(hKey,NULL,0,REG_SZ,(BYTE*)pszStr,dwSize);
- mir_free(pszStr);
+ size_t dwSize = (mir_tstrlen(pszVal)+mir_tstrlen(pszValPrefix)+1)*sizeof(TCHAR);
+ TCHAR *pszStr = (TCHAR*)_alloca(dwSize);
+ mir_tstrcat(mir_tstrcpy(pszStr, pszValPrefix), pszVal); /* buffer safe */
+ RegSetValueEx(hKey, NULL, 0, REG_SZ, (BYTE*)pszStr, (int)dwSize);
}
// hKey must have been opened with KEY_QUERY_VALUE access right
@@ -381,8 +379,8 @@ 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)mir_strlen(*param->ppszDbPrefix)+mir_strlen(pszSubKey)+1;
- cchName=nDbPrefixLen+nMaxValNameLen+3;
+ 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);
if (pszName==NULL) return;
@@ -435,19 +433,16 @@ static void BackupRegTree_Worker(HKEY hKey,const char *pszSubKey,struct BackupRe
}
}
-static void BackupRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPrefix)
+static void BackupRegTree(HKEY hKey, const char *pszSubKey, const char *pszDbPrefix)
{
struct BackupRegTreeParam param;
DWORD dwDbPrefixSize;
- param.level=0;
- param.pdwDbPrefixSize=&dwDbPrefixSize;
- param.ppszDbPrefix=(char**)&pszDbPrefix;
- pszDbPrefix=mir_strdup(pszDbPrefix);
- if (pszDbPrefix!=NULL) {
- dwDbPrefixSize=mir_strlen(pszDbPrefix)+1;
- BackupRegTree_Worker(hKey,pszSubKey,&param);
- mir_free((char*)pszDbPrefix);
- }
+ param.level = 0;
+ param.pdwDbPrefixSize = &dwDbPrefixSize;
+ param.ppszDbPrefix = (char**)&pszDbPrefix;
+ pszDbPrefix = NEWSTR_ALLOCA(pszDbPrefix);
+ dwDbPrefixSize = (int)mir_strlen(pszDbPrefix)+1;
+ BackupRegTree_Worker(hKey, pszSubKey, &param);
}
static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPrefix)
@@ -461,10 +456,12 @@ static LONG RestoreRegTree(HKEY hKey,const char *pszSubKey,const char *pszDbPref
DWORD dwType,cbData;
BYTE *pData;
- 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;
+ int nDbPrefixLen = (int)mir_strlen(pszDbPrefix);
+ int nPrefixWithSubKeyLen = nDbPrefixLen + (int)mir_strlen(pszSubKey) + 1;
+ char *pszPrefixWithSubKey = (char*)mir_alloc(nPrefixWithSubKeyLen+1);
+ if (pszPrefixWithSubKey == NULL)
+ return ERROR_OUTOFMEMORY;
+
mir_strcat(mir_strcat(mir_strcpy(pszPrefixWithSubKey,pszDbPrefix),pszSubKey),"\\"); /* buffer safe */
LONG res=ERROR_NO_MORE_ITEMS;
if (pszPrefixWithSubKey!=NULL) {
@@ -571,93 +568,6 @@ void CleanupRegTreeBackupSettings(void)
mir_free(ppszSettings);
}
-/************************* Opera Support **************************/
-
-/*
-* These are helpers accessing the Opera settings file.
-* Should work with Opera 6 up to 9.10 (current)
-*/
-
-static BOOL Opera6_GetIniFilePath(TCHAR *szIniFile)
-{
- HKEY hExeKey;
- TCHAR szPath[MAX_PATH],*p;
- BOOL fSuccess=FALSE;
- DWORD len;
-
- /* 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)) {
- /* exe name */
- p=GetRegStrValue(hExeKey,NULL);
- if (p!=NULL && _tcsstr(p,_T("Opera.exe"))!=NULL) {
- /* path */
- mir_free(p);
- p=GetRegStrValue(hExeKey,_T("Path"));
- len=mir_tstrlen(p);
- if (p[len-1]==_T('\\')) p[len-1]=0;
- fSuccess=(p!=NULL && ExpandEnvironmentStrings(p,szPath,MAX_PATH));
- }
- mir_free(p); /* does NULL check */
- RegCloseKey(hExeKey);
- }
- if (fSuccess) {
- TCHAR szFileBuf[MAX_PATH+34];
- /* operadef6.ini */
- 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,'\\');
- mir_tstrcpy(szFileBuf,_T("%APPDATA%\\Opera")); /* buffer safe */
- if (p!=NULL) mir_tstrcat(szFileBuf,p); /* buffer safe */
- } else mir_tstrcpy(szFileBuf,szPath);
- /* opera6.ini */
- mir_tstrcat(szFileBuf,_T("\\profile\\opera6.ini")); /* buffer safe */
- fSuccess=ExpandEnvironmentStrings(szFileBuf,szIniFile,MAX_PATH)!=0;
- }
- /* check file existstance */
- if (fSuccess) {
- HANDLE hFile;
- hFile=CreateFile(szIniFile,0,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,0,NULL);
- if (hFile==INVALID_HANDLE_VALUE) fSuccess=FALSE;
- else CloseHandle(hFile);
- }
- return fSuccess;
-}
-
-// pszProtoPrefix is expected to have no trailing :
-static void Opera6_AddTrustedProto(const char *pszProtoPrefix)
-{
- TCHAR szIniFile[MAX_PATH],*ptszProtoPrefix;
- if (Opera6_GetIniFilePath(szIniFile)) {
- /* trusted protocols */
- ptszProtoPrefix=a2t(pszProtoPrefix);
- if (ptszProtoPrefix!=NULL) {
- WritePrivateProfileString(_T("Trusted Protocols"),ptszProtoPrefix,_T("1,0,"),szIniFile);
- mir_free(ptszProtoPrefix);
- }
- }
-}
-
-static void Opera6_AddKnownMimeType(const char *pszMimeType,const char *pszFileExt,const TCHAR *pszDescription)
-{
- TCHAR szIniFile[MAX_PATH],szVal[256],*ptszMimeType;
- if (Opera6_GetIniFilePath(szIniFile)) {
- /* section version */
- if (GetPrivateProfileInt(_T("File Types Section Info"),_T("Version"),0,szIniFile)==2) {
- ptszMimeType=a2t(pszMimeType);
- if (ptszMimeType!=NULL) {
- /* file type */
- mir_sntprintf(szVal,SIZEOF(szVal),_T("4,,,,%.15hs,|%.128s (%.16hs)"),&pszFileExt[1],pszDescription,pszFileExt);
- WritePrivateProfileString(_T("File Types"),ptszMimeType,szVal,szIniFile);
- /* file type extension */
- WritePrivateProfileString(_T("File Types Extension"),ptszMimeType,_T(",0"),szIniFile);
- mir_free(ptszMimeType);
- }
- }
- }
-}
-
/************************* Class **********************************/
/*
@@ -690,7 +600,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,(mir_tstrlen(pszTypeDescription)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hClassKey,NULL,0,REG_SZ,(BYTE*)pszTypeDescription,(int)(mir_tstrlen(pszTypeDescription)+1)*sizeof(TCHAR));
/* default icon */
if (pszIconLoc!=NULL) SetRegSubKeyStrDefValue(hClassKey,_T("DefaultIcon"),pszIconLoc);
/* url protocol */
@@ -718,16 +628,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,(mir_tstrlen(pszVerbDesc)+1)*sizeof(TCHAR));
+ else RegSetValueEx(hVerbKey,NULL,0,REG_SZ,(BYTE*)pszVerbDesc,(int)(mir_tstrlen(pszVerbDesc)+1)*sizeof(TCHAR));
/* friendly appname (mui string) */
- RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(int)(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,(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,_T("application"),pszDdeApp);
/* topic */
@@ -753,8 +663,6 @@ BOOL AddRegClass(const char *pszClassName,const TCHAR *pszTypeDescription,const
RegCloseKey(hVerbKey);
}
RegCloseKey(hShellKey);
- /* Opera support */
- if (fUrlProto) Opera6_AddTrustedProto(pszClassName);
}
RegCloseKey(hClassKey);
}
@@ -922,9 +830,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,mir_strlen(pszClassName)+1);
+ fSuccess=!RegSetValueExA(hExtKey, NULL, 0, REG_SZ, (BYTE*)pszClassName, (int)mir_strlen(pszClassName)+1);
/* mime type e.g. "application/x-icq" */
- if (pszMimeType!=NULL) RegSetValueExA(hExtKey,"Content Type",0,REG_SZ,(BYTE*)pszMimeType,mir_strlen(pszMimeType)+1);
+ if (pszMimeType!=NULL) RegSetValueExA(hExtKey, "Content Type", 0, REG_SZ, (BYTE*)pszMimeType, (int)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);
@@ -1009,7 +917,7 @@ BOOL IsRegFileExt(const char *pszFileExt,const char *pszClassName)
// returns TRUE if the mime type was not yet registered on the system,
// it needs to be removed when the file extension gets removed
-BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt,const TCHAR *pszDescription)
+BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt)
{
BOOL fSuccess=FALSE;
HKEY hRootKey,hDbKey,hTypeKey;
@@ -1028,10 +936,8 @@ 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,mir_strlen(pszFileExt)+1);
+ fSuccess=!RegSetValueExA(hTypeKey,"Extension",0,REG_SZ,(BYTE*)pszFileExt,(int)mir_strlen(pszFileExt)+1);
RegCloseKey(hTypeKey);
- /* Opera support */
- Opera6_AddKnownMimeType(pszMimeType,pszFileExt,pszDescription);
}
RegCloseKey(hDbKey);
}
@@ -1086,7 +992,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,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hExeKey,NULL,0,REG_SZ,(BYTE*)pszAppName,(int)(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 +1005,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,(mir_tstrlen(pszAppName)+1)*sizeof(TCHAR));
+ RegSetValueEx(hVerbKey,_T("FriendlyAppName"),0,REG_SZ,(BYTE*)pszAppName,(int)(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,(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
+ RegSetValueEx(hDdeKey,NULL,0,REG_SZ,(BYTE*)pszDdeCmd,(int)(mir_tstrlen(pszDdeCmd)+1)*sizeof(TCHAR));
/* application */
SetRegSubKeyStrDefValue(hDdeKey,_T("application"),pszDdeApp);
/* topic */
@@ -1194,7 +1100,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,(mir_tstrlen(pszFileDesc)+1)*sizeof(TCHAR));
+ RegSetValueEx(hTypesKey,ptszFileExt,0,REG_SZ,(BYTE*)pszFileDesc,(int)(mir_tstrlen(pszFileDesc)+1)*sizeof(TCHAR));
mir_free(ptszFileExt); /* does NULL check */
RegCloseKey(hTypesKey);
}
@@ -1247,7 +1153,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,(mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR));
+ fSuccess=!RegSetValueEx(hRunKey,pszAppName,0,REG_SZ,(BYTE*)pszRunCmd,(int)(mir_tstrlen(pszRunCmd)+1)*sizeof(TCHAR));
RegCloseKey(hRunKey);
}
return fSuccess;
diff --git a/plugins/AssocMgr/src/reg.h b/plugins/AssocMgr/src/reg.h
index 98884a3224..f593221b8e 100644
--- a/plugins/AssocMgr/src/reg.h
+++ b/plugins/AssocMgr/src/reg.h
@@ -31,7 +31,7 @@ BOOL AddRegFileExt(const char *pszFileExt,const char *pszClassName,const char *p
void RemoveRegFileExt(const char *pszFileExt,const char *pszClassName);
BOOL IsRegFileExt(const char *pszFileExt,const char *pszClassName);
/* Mime Type */
-BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt,const TCHAR *pszDescription);
+BOOL AddRegMimeType(const char *pszMimeType,const char *pszFileExt);
void RemoveRegMimeType(const char *pszMimeType,const char *pszFileExt);
/* Open-With App */
void AddRegOpenWith(const TCHAR *pszAppFileName,BOOL fAllowOpenWith,const TCHAR *pszAppName,const TCHAR *pszIconLoc,const TCHAR *pszRunCmd,const TCHAR *pszDdeCmd,const TCHAR *pszDdeApp,const TCHAR *pszDdeTopic);
diff --git a/plugins/AssocMgr/src/utils.cpp b/plugins/AssocMgr/src/utils.cpp
index 5c6d08da24..993f0bbaa9 100644
--- a/plugins/AssocMgr/src/utils.cpp
+++ b/plugins/AssocMgr/src/utils.cpp
@@ -112,17 +112,17 @@ BOOL EnumDbPrefixSettings(const char *pszModule,const char *pszSettingPrefix,cha
{
DBCONTACTENUMSETTINGS dbces;
struct EnumPrefixSettingsParams param;
- dbces.szModule=pszModule;
- dbces.pfnEnumProc=EnumPrefixSettingsProc;
- dbces.lParam=(LPARAM)&param;
- param.settings=NULL;
- param.nSettingsCount=0;
- param.pszPrefix=pszSettingPrefix;
- param.nPrefixLen=mir_strlen(pszSettingPrefix);
- CallService(MS_DB_CONTACT_ENUMSETTINGS,0,(LPARAM)&dbces);
- *pnSettingsCount=param.nSettingsCount;
- *pSettings=param.settings;
- return param.nSettingsCount!=0;
+ dbces.szModule = pszModule;
+ dbces.pfnEnumProc = EnumPrefixSettingsProc;
+ dbces.lParam = (LPARAM)&param;
+ param.settings = NULL;
+ param.nSettingsCount = 0;
+ param.pszPrefix = pszSettingPrefix;
+ param.nPrefixLen = (int)mir_strlen(pszSettingPrefix);
+ CallService(MS_DB_CONTACT_ENUMSETTINGS, 0, (LPARAM)&dbces);
+ *pnSettingsCount = param.nSettingsCount;
+ *pSettings = param.settings;
+ return param.nSettingsCount != 0;
}
/************************* Error Output ***************************/
diff --git a/plugins/Db_autobackups/src/backup.cpp b/plugins/Db_autobackups/src/backup.cpp
index d18693c2f0..b63690ac72 100644
--- a/plugins/Db_autobackups/src/backup.cpp
+++ b/plugins/Db_autobackups/src/backup.cpp
@@ -174,7 +174,6 @@ int Comp(const void *i, const void *j)
int RotateBackups(TCHAR *backupfolder, TCHAR *dbname)
{
- size_t i = 0;
backupFile *bf = NULL, *bftmp;
HANDLE hFind;
TCHAR backupfolderTmp[MAX_PATH];
@@ -186,6 +185,8 @@ int RotateBackups(TCHAR *backupfolder, TCHAR *dbname)
hFind = FindFirstFile(backupfolderTmp, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
return 0;
+
+ int i = 0;
do {
if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue;
diff --git a/plugins/Db_autobackups/src/options.cpp b/plugins/Db_autobackups/src/options.cpp
index f274d346de..d02bb47032 100644
--- a/plugins/Db_autobackups/src/options.cpp
+++ b/plugins/Db_autobackups/src/options.cpp
@@ -56,7 +56,7 @@ int LoadOptions(void)
else
mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s%s"), DIR, SUB_DIR);
}
- options.num_backups = (unsigned int)db_get_w(0, "AutoBackups", "NumBackups", 3);
+ options.num_backups = db_get_w(0, "AutoBackups", "NumBackups", 3);
options.disable_progress = (BOOL)db_get_b(0, "AutoBackups", "NoProgress", 0);
options.disable_popups = (BOOL)db_get_b(0, "AutoBackups", "NoPopups", 0);
@@ -92,7 +92,7 @@ int SaveOptions(void)
mir_sntprintf(options.folder, SIZEOF(options.folder), _T("%s\\%s"), profilePath, prof_dir);
}
mir_free(tmp);
- db_set_w(0, "AutoBackups", "NumBackups", (WORD)options.num_backups);
+ db_set_w(0, "AutoBackups", "NumBackups", options.num_backups);
db_set_b(0, "AutoBackups", "NoProgress", (BYTE)options.disable_progress);
db_set_b(0, "AutoBackups", "NoPopups", (BYTE)options.disable_popups);
db_set_b(0, "AutoBackups", "UseZip", (BYTE)options.use_zip);
diff --git a/plugins/Db_autobackups/src/options.h b/plugins/Db_autobackups/src/options.h
index d497912330..1b1a94938a 100644
--- a/plugins/Db_autobackups/src/options.h
+++ b/plugins/Db_autobackups/src/options.h
@@ -30,7 +30,7 @@ typedef struct Options_tag {
unsigned int period;
PeriodType period_type;
TCHAR folder[MAX_PATH];
- size_t num_backups;
+ int num_backups;
BOOL disable_progress;
BOOL disable_popups;
BOOL use_zip;
diff --git a/plugins/SMS/src/recvdlg.cpp b/plugins/SMS/src/recvdlg.cpp
index 0409ba6693..f8f401f26f 100644
--- a/plugins/SMS/src/recvdlg.cpp
+++ b/plugins/SMS/src/recvdlg.cpp
@@ -166,7 +166,7 @@ INT_PTR CALLBACK RecvSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
//This function create a new SMS receive window, and insert it to the list.
//The function gets void and return the window HWND
-HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size_t dwPhoneSize,LPSTR lpszMessage,size_t dwMessageSize)
+HWND RecvSMSWindowAdd(MCONTACT hContact, DWORD dwEventType, LPWSTR lpwszPhone, size_t dwPhoneSize, LPSTR lpszMessage, size_t dwMessageSize)
{
HWND hRet = NULL;
@@ -207,22 +207,21 @@ HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size
hIcon=(HICON)LoadImage(ssSMSSettings.hInstance,MAKEINTRESOURCE(iIcon),IMAGE_ICON,0,0,LR_SHARED);
break;
default:
- lpwszTitlepart=_T("Unknown event type");
+ lpwszTitlepart = _T("Unknown event type");
hIcon = 0;
}
- wszPhoneLocal[0]='+';
+ wszPhoneLocal[0] = '+';
if (dwPhoneSize)
- {
- dwPhoneSize=CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
- }else{
+ dwPhoneSize = CopyNumberW((wszPhoneLocal+1),lpwszPhone,dwPhoneSize);
+ else {
GetDataFromMessage(lpszMessage,dwMessageSize,NULL,(wszPhoneLocal+1),(SIZEOF(wszPhoneLocal)-1),&dwPhoneSize,NULL);
dwPhoneSize++;
}
- lpwszContactDisplayName=GetContactNameW(hContact);
- mir_sntprintf(wszTitle,SIZEOF(wszTitle),_T("%s - %s"),lpwszContactDisplayName,lpwszTitlepart);
- MultiByteToWideChar(CP_UTF8,0,lpszMessage,dwMessageSize,lpwszMessage,(dwMessageSize+MAX_PATH));
+ lpwszContactDisplayName = GetContactNameW(hContact);
+ mir_sntprintf(wszTitle, SIZEOF(wszTitle),_T("%s - %s"), lpwszContactDisplayName, lpwszTitlepart);
+ MultiByteToWideChar(CP_UTF8, 0, lpszMessage, (int)dwMessageSize, lpwszMessage, (int)dwMessageSize+MAX_PATH);
SetWindowText(prswdWindowData->hWnd, wszTitle);
SetDlgItemText(prswdWindowData->hWnd,IDC_NAME,lpwszContactDisplayName);
@@ -232,9 +231,8 @@ HWND RecvSMSWindowAdd(MCONTACT hContact,DWORD dwEventType,LPWSTR lpwszPhone,size
SetFocus(GetDlgItem(prswdWindowData->hWnd,IDC_MESSAGE));
hRet=prswdWindowData->hWnd;
- }else{
- MEMFREE(prswdWindowData);
}
+ else MEMFREE(prswdWindowData);
}
MEMFREE(lpwszMessage);
return(hRet);
diff --git a/plugins/SMS/src/send.cpp b/plugins/SMS/src/send.cpp
index f1a7afc41b..f07fb812b4 100644
--- a/plugins/SMS/src/send.cpp
+++ b/plugins/SMS/src/send.cpp
@@ -49,7 +49,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP
lpszMessageUTF = (LPSTR)MEMALLOC(dwMessageUTFBuffSize);
if (lpszMessageUTF)
{
- dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, dwMessageSize, lpszMessageUTF, dwMessageUTFBuffSize, NULL, NULL));
+ dwBuffSize = (dwPhoneSize + MAX_PATH+WideCharToMultiByte(CP_UTF8, 0, lpwszMessage, (int)dwMessageSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL));
pdbei = (DBEVENTINFO*)MEMALLOC((sizeof(DBEVENTINFO) + dwBuffSize));
if (pdbei)
{
@@ -57,7 +57,7 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP
LPSTR lpszBuff = (LPSTR)(pdbei + 1);
HANDLE hProcess;
- WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL);
+ WideCharToMultiByte(CP_UTF8, 0, lpwszPhone, (int)dwPhoneSize, szPhone, MAX_PHONE_LEN, NULL, NULL);
dwPhoneSize=CopyNumberA(szPhone, szPhone, dwPhoneSize);
pdbei->timestamp = time(NULL);
@@ -68,8 +68,8 @@ void StartSmsSend(HWND hWndDlg,size_t dwModuleIndex,LPWSTR lpwszPhone,size_t dwP
SendSMSWindowDbeiSet(hWndDlg, pdbei);
char *szProto = ssSMSSettings.ppaSMSAccounts[dwModuleIndex]->szModuleName;
- if ( ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) {
- WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, dwMessageXMLEncodedSize, lpszMessageUTF, dwMessageUTFBuffSize, NULL, NULL);
+ if (ProtoServiceExists(szProto, MS_ICQ_SENDSMS)) {
+ WideCharToMultiByte(CP_UTF8, 0, lpwszMessageXMLEncoded, (int)dwMessageXMLEncodedSize, lpszMessageUTF, (int)dwMessageUTFBuffSize, NULL, NULL);
hProcess = (HANDLE)CallProtoService(szProto, MS_ICQ_SENDSMS, (WPARAM)szPhone, (LPARAM)lpszMessageUTF);
SendSMSWindowHProcessSet(hWndDlg, hProcess);
}
diff --git a/plugins/SMS/src/senddlg.cpp b/plugins/SMS/src/senddlg.cpp
index 6f336ecdf9..73b3457cb2 100644
--- a/plugins/SMS/src/senddlg.cpp
+++ b/plugins/SMS/src/senddlg.cpp
@@ -150,8 +150,9 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
{
SetDlgItemText(hWndDlg,IDC_MESSAGE,tszSign);
- if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS)) SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen);
- EnableWindow(GetDlgItem(hWndDlg,IDOK),dwSignLen);
+ if (DB_SMS_GetByte(NULL,"SignaturePos",SMS_DEFAULT_SIGNATUREPOS))
+ SendDlgItemMessage(hWndDlg,IDC_MESSAGE,EM_SETSEL,dwSignLen,dwSignLen);
+ EnableWindow(GetDlgItem(hWndDlg,IDOK), dwSignLen != 0);
}
mir_sntprintf(tszSign,SIZEOF(tszSign),_T("%d/%d"),dwSignLen,GetSMSMessageLenMax(hWndDlg));
@@ -281,16 +282,16 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
if (psswdWindowData->bMultiple)
{
TVITEM tvi;
- tvi.mask=TVIF_TEXT;
- tvi.hItem=psswdWindowData->hItemSend;
- tvi.pszText=tszPhone;
- tvi.cchTextMax=SIZEOF(tszPhone);
+ tvi.mask = TVIF_TEXT;
+ tvi.hItem = psswdWindowData->hItemSend;
+ tvi.pszText = tszPhone;
+ tvi.cchTextMax = SIZEOF(tszPhone);
TreeView_GetItem(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),&tvi);
- dwPhoneSize=mir_tstrlen(tszPhone);
- }else{
- dwPhoneSize=GetDlgItemText(hWndDlg,IDC_ADDRESS,tszPhone,SIZEOF(tszPhone));
+ dwPhoneSize = mir_tstrlen(tszPhone);
}
- dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+ else dwPhoneSize = GetDlgItemText(hWndDlg, IDC_ADDRESS, tszPhone, SIZEOF(tszPhone));
+
+ dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(int)dwMessageSize+2);
SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
StartSmsSend(hWndDlg,SendDlgItemMessage(hWndDlg,IDC_ACCOUNTS,CB_GETCURSEL,0,0),tszPhone,dwPhoneSize,lpwszMessage,dwMessageSize);
MEMFREE(lpwszMessage);
@@ -358,7 +359,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
LPTSTR lpwszMessage=(LPTSTR)MEMALLOC((dwMessageSize+4)*sizeof(WCHAR));
if (lpwszMessage)
{
- dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lpwszMessage,(dwMessageSize+2));
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lpwszMessage, (int)dwMessageSize+2);
SendSMSWindowNumberSet(hWndDlg,tszPhone,dwPhoneSize);
EnableWindow(GetDlgItem(hWndDlg,IDOK),FALSE);
EnableWindow(GetDlgItem(hWndDlg,IDC_NUMBERSLIST),FALSE);
@@ -392,7 +393,7 @@ INT_PTR CALLBACK SendSmsDlgProc(HWND hWndDlg,UINT message,WPARAM wParam,LPARAM l
TCHAR tszBuff[MAX_PATH];
size_t dwMessageSize=GET_DLG_ITEM_TEXT_LENGTH(hWndDlg,IDC_MESSAGE);
- EnableWindow(GetDlgItem(hWndDlg,IDOK),dwMessageSize);
+ EnableWindow(GetDlgItem(hWndDlg,IDOK), dwMessageSize != 0);
mir_sntprintf(tszBuff, SIZEOF(tszBuff), _T("%d/%d"), dwMessageSize,GetSMSMessageLenMax(hWndDlg));
SetDlgItemText(hWndDlg,IDC_COUNT,tszBuff);
}
@@ -874,7 +875,7 @@ void SendSMSWindowNext(HWND hWndDlg)
if ( !lptszMessage)
return;
- dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,dwMessageSize+2);
+ dwMessageSize = GetDlgItemText(hWndDlg,IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2);
// if (SendSMSWindowNextHItemGet(hWndDlg,SendSMSWindowHItemSendGet(hWndDlg))==NULL) SendSMSWindowMultipleSet(hWndDlg,FALSE);
tvi.mask=TVIF_TEXT;
@@ -1115,8 +1116,9 @@ size_t GetSMSMessageLenMax(HWND hWndDlg)
LPTSTR lptszMessage=(LPTSTR)MEMALLOC(((dwMessageSize+4)*sizeof(TCHAR)));
if (lptszMessage)
{
- dwMessageSize=GetDlgItemText(hWndDlg,IDC_MESSAGE,lptszMessage,(dwMessageSize+2));
- if (dwMessageSize!=WideCharToMultiByte(CP_UTF8,0,lptszMessage,dwMessageSize,NULL,0,NULL,NULL)) dwLenght=70;
+ dwMessageSize = GetDlgItemText(hWndDlg, IDC_MESSAGE, lptszMessage, (int)dwMessageSize+2);
+ if (dwMessageSize != WideCharToMultiByte(CP_UTF8, 0, lptszMessage, (int)dwMessageSize, NULL, 0, NULL, NULL))
+ dwLenght = 70;
MEMFREE(lptszMessage);
}
return(dwLenght);
diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp
index 904cf42461..c6a38af98c 100644
--- a/plugins/SimpleAR/src/Main.cpp
+++ b/plugins/SimpleAR/src/Main.cpp
@@ -236,7 +236,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent)
dbei.flags = DBEF_UTF | DBEF_SENT; //DBEF_READ;
dbei.szModule = pszProto;
dbei.timestamp = time(NULL);
- dbei.cbBlob = mir_strlen(pszUtf) + 1;
+ dbei.cbBlob = (int)mir_strlen(pszUtf) + 1;
dbei.pBlob = (PBYTE)pszUtf;
db_event_add(hContact, &dbei);