diff options
author | George Hazan <george.hazan@gmail.com> | 2013-09-21 13:37:19 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-09-21 13:37:19 +0000 |
commit | 8b6824e3ec3ed7340db33bcbe592321b6afb0a00 (patch) | |
tree | 3c23f231d3126e85798f602be4b89c347d9ca36d /plugins/AssocMgr/src/reg.cpp | |
parent | 0bb0ce1ac12784d4d119619dc6915666f590946d (diff) |
- warning fixes;
- memleak fixes;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@6154 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/AssocMgr/src/reg.cpp')
-rw-r--r-- | plugins/AssocMgr/src/reg.cpp | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/plugins/AssocMgr/src/reg.cpp b/plugins/AssocMgr/src/reg.cpp index be921d8c3a..c285c65221 100644 --- a/plugins/AssocMgr/src/reg.cpp +++ b/plugins/AssocMgr/src/reg.cpp @@ -535,37 +535,39 @@ static void DeleteRegTreeBackup(const char *pszSubKey,const char *pszDbPrefix) void CleanupRegTreeBackupSettings(void)
{
+ /* delete old bak_* settings and try to restore backups */
int nSettingsCount;
char **ppszSettings;
- char *pszClassName,*pszBuf,*pszFileExt;
- int i,j;
-
- /* delete old bak_* settings and try to restore backups */
- if (EnumDbPrefixSettings("AssocMgr","bak_",&ppszSettings,&nSettingsCount)) {
- for(i=0;i<nSettingsCount;++i) {
- pszClassName=&ppszSettings[i][4];
- pszBuf=strchr(pszClassName,'\\');
- if (pszBuf!=NULL) {
- *pszBuf='\0';
- /* remove others in list with same class name */
- for(j=i;j<nSettingsCount;++j) {
- pszBuf=strchr(&ppszSettings[j][4],'\\');
- if (pszBuf!=NULL) *pszBuf='\0';
- if (lstrcmpA(pszClassName,&ppszSettings[j][4])) continue;
- MoveMemory(&ppszSettings[j],&ppszSettings[j+1],((--nSettingsCount)-j)*sizeof(TCHAR*));
- --j; /* reiterate current index */
- }
- /* no longer registered? */
- if (!IsRegisteredAssocItem(pszClassName)) {
- if (IsFileClassName(pszClassName,&pszFileExt))
- RemoveRegFileExt(pszFileExt,pszClassName);
- else RemoveRegClass(pszClassName);
- }
+ if ( !EnumDbPrefixSettings("AssocMgr", "bak_", &ppszSettings, &nSettingsCount))
+ return;
+
+ for(int i=0; i < nSettingsCount; ++i) {
+ char *pszClassName = &ppszSettings[i][4];
+ char *pszBuf = strchr(pszClassName,'\\');
+ if (pszBuf != NULL) {
+ *pszBuf = '\0';
+ /* remove others in list with same class name */
+ for(int j=i; j < nSettingsCount; ++j) {
+ pszBuf = strchr(&ppszSettings[j][4],'\\');
+ if (pszBuf != NULL) *pszBuf='\0';
+ if ( lstrcmpA(pszClassName, &ppszSettings[j][4])) continue;
+
+ mir_free(ppszSettings[j]);
+ MoveMemory(&ppszSettings[j],&ppszSettings[j+1],((--nSettingsCount)-j)*sizeof(TCHAR*));
+ --j; /* reiterate current index */
+ }
+ /* no longer registered? */
+ if ( !IsRegisteredAssocItem(pszClassName)) {
+ char *pszFileExt;
+ if ( IsFileClassName(pszClassName, &pszFileExt))
+ RemoveRegFileExt(pszFileExt, pszClassName);
+ else
+ RemoveRegClass(pszClassName);
}
- mir_free(ppszSettings[i]);
}
- mir_free(ppszSettings);
+ mir_free(ppszSettings[i]);
}
+ mir_free(ppszSettings);
}
/************************* Opera Support **************************/
|