diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Db3x_mmap/src/database.cpp | 15 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbcache.cpp | 10 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbevents.cpp | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/src/dbsettings.cpp | 18 |
4 files changed, 28 insertions, 17 deletions
diff --git a/plugins/Db3x_mmap/src/database.cpp b/plugins/Db3x_mmap/src/database.cpp index 5971c1c68b..c9a4793c0f 100644 --- a/plugins/Db3x_mmap/src/database.cpp +++ b/plugins/Db3x_mmap/src/database.cpp @@ -123,6 +123,21 @@ void CDb3Base::DatabaseCorruption(TCHAR *text) /////////////////////////////////////////////////////////////////////////////////////////
#ifdef DBLOGGING
+char* printVariant(DBVARIANT* p)
+{
+ static char boo[1000];
+
+ switch (p->type) {
+ case DBVT_BYTE: mir_snprintf(boo, sizeof(boo), "byte: %d", p->bVal ); break;
+ case DBVT_WORD: mir_snprintf(boo, sizeof(boo), "word: %d", p->wVal ); break;
+ case DBVT_DWORD: mir_snprintf(boo, sizeof(boo), "dword: %d", p->dVal ); break;
+ case DBVT_UTF8:
+ case DBVT_ASCIIZ: mir_snprintf(boo, sizeof(boo), "string: '%s'", p->pszVal); break;
+ default: mir_snprintf(boo, sizeof(boo), "crap: %d", p->type ); break;
+ }
+ return boo;
+}
+
void DBLog(const char *file,int line,const char *fmt,...)
{
FILE *fp;
diff --git a/plugins/Db3x_mmap/src/dbcache.cpp b/plugins/Db3x_mmap/src/dbcache.cpp index 4e09335bae..a107b502ef 100644 --- a/plugins/Db3x_mmap/src/dbcache.cpp +++ b/plugins/Db3x_mmap/src/dbcache.cpp @@ -67,7 +67,7 @@ void CDb3Mmap::ReMap(DWORD needed) void CDb3Mmap::DBMoveChunk(DWORD ofsDest,DWORD ofsSource,int bytes)
{
int x = 0;
- log3("move %d %08x->%08x",bytes,ofsSource,ofsDest);
+ //log3("move %d %08x->%08x",bytes,ofsSource,ofsDest);
if (ofsDest+bytes > m_dwFileSize) ReMap(ofsDest+bytes-m_dwFileSize);
if (ofsSource+bytes > m_dwFileSize) {
x = ofsSource+bytes-m_dwFileSize;
@@ -86,11 +86,11 @@ PBYTE CDb3Mmap::DBRead(DWORD ofs,int bytesRequired,int *bytesAvail) {
// buggy read
if (ofs>= m_dwFileSize) {
- log2("read from outside %d@%08x",bytesRequired,ofs);
+ //log2("read from outside %d@%08x",bytesRequired,ofs);
if (bytesAvail != NULL) *bytesAvail = m_ChunkSize;
return m_pNull;
}
- log3((ofs+bytesRequired > m_dwFileSize)?"read %d@%08x, only %d avaliable":"read %d@%08x",bytesRequired,ofs,m_dwFileSize-ofs);
+ //log3((ofs+bytesRequired > m_dwFileSize)?"read %d@%08x, only %d avaliable":"read %d@%08x",bytesRequired,ofs,m_dwFileSize-ofs);
if (bytesAvail != NULL) *bytesAvail = m_dwFileSize - ofs;
return m_pDbCache+ofs;
}
@@ -98,7 +98,7 @@ PBYTE CDb3Mmap::DBRead(DWORD ofs,int bytesRequired,int *bytesAvail) //we are assumed to be in a mutex here
void CDb3Mmap::DBWrite(DWORD ofs,PVOID pData,int bytes)
{
- log2("write %d@%08x",bytes,ofs);
+ //log2("write %d@%08x",bytes,ofs);
if (ofs+bytes > m_dwFileSize) ReMap(ofs+bytes-m_dwFileSize);
MoveMemory(m_pDbCache+ofs,pData,bytes);
logg();
@@ -107,7 +107,7 @@ void CDb3Mmap::DBWrite(DWORD ofs,PVOID pData,int bytes) //we are assumed to be in a mutex here
void CDb3Mmap::DBFill(DWORD ofs,int bytes)
{
- log2("zerofill %d@%08x",bytes,ofs);
+ //log2("zerofill %d@%08x",bytes,ofs);
if (ofs+bytes <= m_dwFileSize)
ZeroMemory(m_pDbCache+ofs,bytes);
logg();
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index e6681d6a75..078837085d 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -269,7 +269,7 @@ STDMETHODIMP_(BOOL) CDb3Base::MarkEventRead(HANDLE hContact, HANDLE hDbEvent) if ((dbe->flags & DBEF_READ) || (dbe->flags & DBEF_SENT))
return (INT_PTR)dbe->flags;
- log1("mark read @ %08x", hContact);
+ //log1("mark read @ %08x", hContact);
dbe->flags |= DBEF_READ;
DBWrite((DWORD)hDbEvent,dbe,sizeof(DBEvent));
BOOL ret = dbe->flags;
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp index 47bfef5e08..d648a5756f 100644 --- a/plugins/Db3x_mmap/src/dbsettings.cpp +++ b/plugins/Db3x_mmap/src/dbsettings.cpp @@ -99,15 +99,7 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs else
memcpy( dbcgs->pValue, pCachedValue, sizeof( DBVARIANT ));
- switch( dbcgs->pValue->type ) {
- case DBVT_BYTE: log1( "get cached byte: %d", dbcgs->pValue->bVal ); break;
- case DBVT_WORD: log1( "get cached word: %d", dbcgs->pValue->wVal ); break;
- case DBVT_DWORD: log1( "get cached dword: %d", dbcgs->pValue->dVal ); break;
- case DBVT_UTF8:
- case DBVT_ASCIIZ: log1( "get cached string: '%s'", dbcgs->pValue->pszVal); break;
- default: log1( "get cached crap: %d", dbcgs->pValue->type ); break;
- }
-
+ log1("get cached %s", printVariant(dbcgs->pValue));
return ( pCachedValue->type == DBVT_DELETED ) ? 1 : 0;
} }
@@ -416,10 +408,12 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT mir_cslockfull lck(m_csDbAccess);
char* szCachedSettingName = m_cache->GetCachedSetting(tmp.szModule, tmp.szSetting, moduleNameLen, settingNameLen);
+ log2("[%08x] write setting '%s'", hContact, szCachedSettingName);
+
if ( tmp.value.type != DBVT_BLOB ) {
DBVARIANT* pCachedValue = m_cache->GetCachedValuePtr(hContact, szCachedSettingName, 1);
if ( pCachedValue != NULL ) {
- BOOL bIsIdentical = FALSE;
+ bool bIsIdentical = false;
if ( pCachedValue->type == tmp.value.type ) {
switch(tmp.value.type) {
case DBVT_BYTE: bIsIdentical = pCachedValue->bVal == tmp.value.bVal; break;
@@ -435,12 +429,15 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT }
if ( szCachedSettingName[-1] != 0 ) {
lck.unlock();
+ log1(" set resident as %s", printVariant(&tmp.value));
NotifyEventHooks(hSettingChangeEvent, (WPARAM)hContact, (LPARAM)&tmp);
return 0;
}
}
else m_cache->GetCachedValuePtr(hContact, szCachedSettingName, -1);
+ log1(" write database as %s", printVariant(&tmp.value));
+
ofsModuleName = GetModuleNameOfs(tmp.szModule);
if (hContact == 0) ofsContact = m_dbHeader.ofsUser;
else ofsContact = (DWORD)hContact;
@@ -449,7 +446,6 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT if (dbc.signature != DBCONTACT_SIGNATURE)
return 1;
- log0("write setting");
//make sure the module group exists
ofsSettingsGroup = GetSettingsGroupOfsByModuleNameOfs(&dbc,ofsContact,ofsModuleName);
if (ofsSettingsGroup == 0) { //module group didn't exist - make it
|