summaryrefslogtreecommitdiff
path: root/plugins/Db3x_mmap/dbmodulechain.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-07-18 14:11:28 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-07-18 14:11:28 +0000
commit4bc88d46fa9859615521f436511d4f102f20eb67 (patch)
tree3a6ee91b74be2a4f5e60520885aa601c74bc3fa7 /plugins/Db3x_mmap/dbmodulechain.cpp
parent4f8f5427687792492ee49e06cafb9bd50cfc53d4 (diff)
databases are still static, but are controlled via classes
git-svn-id: http://svn.miranda-ng.org/main/trunk@1014 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap/dbmodulechain.cpp')
-rw-r--r--plugins/Db3x_mmap/dbmodulechain.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/plugins/Db3x_mmap/dbmodulechain.cpp b/plugins/Db3x_mmap/dbmodulechain.cpp
index 5ad05b5abd..ce835c3f94 100644
--- a/plugins/Db3x_mmap/dbmodulechain.cpp
+++ b/plugins/Db3x_mmap/dbmodulechain.cpp
@@ -75,12 +75,12 @@ int InitModuleNames(void)
lOfs.sortFunc = (FSortFunc)OfsCompare;
lOfs.increment = 50;
- ofsThis=dbHeader.ofsFirstModuleName;
- dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
+ ofsThis = dbHeader.ofsFirstModuleName;
+ dbmn = (struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
while(ofsThis) {
- if(dbmn->signature!=DBMODULENAME_SIGNATURE) DatabaseCorruption(NULL);
+ if (dbmn->signature != DBMODULENAME_SIGNATURE) DatabaseCorruption(NULL);
- nameLen=dbmn->cbName;
+ nameLen = dbmn->cbName;
mod = (char*)HeapAlloc(hModHeap,0,nameLen+1);
CopyMemory(mod,DBRead(ofsThis+offsetof(struct DBModuleName,name),nameLen,NULL),nameLen);
@@ -88,10 +88,9 @@ int InitModuleNames(void)
AddToList(mod, nameLen, ofsThis);
- ofsThis=dbmn->ofsNext;
- dbmn=(struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
+ ofsThis = dbmn->ofsNext;
+ dbmn = (struct DBModuleName*)DBRead(ofsThis,sizeof(struct DBModuleName),NULL);
}
- CreateServiceFunction(MS_DB_MODULES_ENUM,EnumModuleNames);
return 0;
}
@@ -131,17 +130,17 @@ DWORD GetModuleNameOfs(const char *szName)
DWORD ofsNew,ofsExisting;
char *mod;
- ofsExisting=FindExistingModuleNameOfs(szName);
- if(ofsExisting) return ofsExisting;
+ ofsExisting = FindExistingModuleNameOfs(szName);
+ if (ofsExisting) return ofsExisting;
nameLen = (int)strlen(szName);
//need to create the module name
- ofsNew=CreateNewSpace(nameLen+offsetof(struct DBModuleName,name));
- dbmn.signature=DBMODULENAME_SIGNATURE;
- dbmn.cbName=nameLen;
- dbmn.ofsNext=dbHeader.ofsFirstModuleName;
- dbHeader.ofsFirstModuleName=ofsNew;
+ ofsNew = CreateNewSpace(nameLen+offsetof(struct DBModuleName,name));
+ dbmn.signature = DBMODULENAME_SIGNATURE;
+ dbmn.cbName = nameLen;
+ dbmn.ofsNext = dbHeader.ofsFirstModuleName;
+ dbHeader.ofsFirstModuleName = ofsNew;
DBWrite(0,&dbHeader,sizeof(dbHeader));
DBWrite(ofsNew,&dbmn,offsetof(struct DBModuleName,name));
DBWrite(ofsNew+offsetof(struct DBModuleName,name),(PVOID)szName,nameLen);
@@ -178,15 +177,15 @@ char *GetModuleNameByOfs(DWORD ofs)
return NULL;
}
-static INT_PTR EnumModuleNames(WPARAM wParam,LPARAM lParam)
+STDMETHODIMP_(BOOL) CDdxMmap::EnumModuleNames(DBMODULEENUMPROC pFunc, void *pParam)
{
- int i;
int ret;
ModuleName *pmn;
- for(i = 0; i < lMods.realCount; i++) {
+ for(int i = 0; i < lMods.realCount; i++) {
pmn = (ModuleName *)lMods.items[i];
- ret=((DBMODULEENUMPROC)lParam)(pmn->name,pmn->ofs,wParam);
- if(ret) return ret;
+ ret = pFunc(pmn->name, pmn->ofs, (LPARAM)pParam);
+ if (ret)
+ return ret;
}
return 0;
}