diff options
author | George Hazan <george.hazan@gmail.com> | 2012-07-21 18:25:03 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-07-21 18:25:03 +0000 |
commit | c2df6e7bbf6efdb36f751379c154623191864a1f (patch) | |
tree | 5c48d94f0072a91e137838bee6b04b9623bdad25 /plugins/Db3x_mmap | |
parent | f8d3f34a53fbd10eab110b77d3260c38ee5e0f01 (diff) |
Dbx_mmap_SA ready
git-svn-id: http://svn.miranda-ng.org/main/trunk@1094 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Db3x_mmap')
-rw-r--r-- | plugins/Db3x_mmap/commonheaders.h | 2 | ||||
-rw-r--r-- | plugins/Db3x_mmap/database.h | 129 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbevents.cpp | 6 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbheaders.cpp | 4 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbintf.cpp | 27 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbintf.h | 141 | ||||
-rw-r--r-- | plugins/Db3x_mmap/dbsettings.cpp | 46 | ||||
-rw-r--r-- | plugins/Db3x_mmap/init.cpp | 5 |
8 files changed, 198 insertions, 162 deletions
diff --git a/plugins/Db3x_mmap/commonheaders.h b/plugins/Db3x_mmap/commonheaders.h index acdc888725..4a31de1cc2 100644 --- a/plugins/Db3x_mmap/commonheaders.h +++ b/plugins/Db3x_mmap/commonheaders.h @@ -52,6 +52,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "resource.h"
#include "version.h"
+extern LIST<CDdxMmap> g_Dbs;
+
#ifdef __GNUC__
#define mir_i64(x) (x##LL)
#else
diff --git a/plugins/Db3x_mmap/database.h b/plugins/Db3x_mmap/database.h index 1a10285c01..83c2fcaea9 100644 --- a/plugins/Db3x_mmap/database.h +++ b/plugins/Db3x_mmap/database.h @@ -47,135 +47,6 @@ DBHeader \--> ...
*/
-//#define DB_RESIZE_GRANULARITY 16384
-#define DB_THIS_VERSION 0x00000700u
-#define DB_SETTINGS_RESIZE_GRANULARITY 128
-
-struct DBSignature {
- char name[15];
- BYTE eof;
-};
-
-static struct DBSignature dbSignature = {"Miranda ICQ DB",0x1A};
-
-#include <pshpack1.h>
-struct DBHeader {
- BYTE signature[16]; // 'Miranda ICQ DB',0,26
- DWORD version; //as 4 bytes, ie 1.2.3.10 = 0x0102030a
- //this version is 0x00000700
- DWORD ofsFileEnd; //offset of the end of the database - place to write
- //new structures
- DWORD slackSpace; //a counter of the number of bytes that have been
- //wasted so far due to deleting structures and/or
- //re-making them at the end. We should compact when
- //this gets above a threshold
- DWORD contactCount; //number of contacts in the chain,excluding the user
- DWORD ofsFirstContact; //offset to first DBContact in the chain
- DWORD ofsUser; //offset to DBContact representing the user
- DWORD ofsFirstModuleName; //offset to first struct DBModuleName in the chain
-};
-
-#define DBCONTACT_SIGNATURE 0x43DECADEu
-
-struct DBContact
-{
- DWORD signature;
- DWORD ofsNext; //offset to the next contact in the chain. zero if
- //this is the 'user' contact or the last contact
- //in the chain
- DWORD ofsFirstSettings; //offset to the first DBContactSettings in the
- //chain for this contact.
- DWORD eventCount; //number of events in the chain for this contact
- DWORD ofsFirstEvent,ofsLastEvent; //offsets to the first and last DBEvent in
- //the chain for this contact
- DWORD ofsFirstUnreadEvent; //offset to the first (chronological) unread event
- //in the chain, 0 if all are read
- DWORD timestampFirstUnread; //timestamp of the event at ofsFirstUnreadEvent
-};
-
-#define DBMODULENAME_SIGNATURE 0x4DDECADEu
-struct DBModuleName
-{
- DWORD signature;
- DWORD ofsNext; //offset to the next module name in the chain
- BYTE cbName; //number of characters in this module name
- char name[1]; //name, no nul terminator
-};
-
-#define DBCONTACTSETTINGS_SIGNATURE 0x53DECADEu
-struct DBContactSettings
-{
- DWORD signature;
- DWORD ofsNext; //offset to the next contactsettings in the chain
- DWORD ofsModuleName; //offset to the DBModuleName of the owner of these
- //settings
- DWORD cbBlob; //size of the blob in bytes. May be larger than the
- //actual size for reducing the number of moves
- //required using granularity in resizing
- BYTE blob[1]; //the blob. a back-to-back sequence of DBSetting
- //structs, the last has cbName = 0
-};
-
-/* not a valid structure, content is figured out on the fly
-struct DBSetting {
- BYTE cbName; //number of bytes in the name of this setting
- //this = 0 marks the end
- char szName[...]; //setting name, excluding nul
- BYTE dataType; //type of data. see m_database.h, db/contact/getsetting
- union { //a load of types of data, length is defined by dataType
- BYTE bVal; WORD wVal; DWORD dVal;
- struct {
- WORD cbString;
- char szVal[...]; //excludes nul terminator
- };
- struct {
- WORD cbBlob;
- BYTE blobVal[...];
- };
- };
-};
-*/
-
-#define DBEVENT_SIGNATURE 0x45DECADEu
-struct DBEvent
-{
- DWORD signature;
- DWORD ofsPrev,ofsNext; //offset to the previous and next events in the
- //chain. Chain is sorted chronologically
- DWORD ofsModuleName; //offset to a DBModuleName struct of the name of
- //the owner of this event
- DWORD timestamp; //seconds since 00:00:00 01/01/1970
- DWORD flags; //see m_database.h, db/event/add
- WORD eventType; //module-defined event type
- DWORD cbBlob; //number of bytes in the blob
- BYTE blob[1]; //the blob. module-defined formatting
-};
-
-#include <poppack.h>
-
-struct DBCachedGlobalValue
-{
- char* name;
- DBVARIANT value;
-};
-
-struct DBCachedContactValue
-{
- char* name;
- DBVARIANT value;
- DBCachedContactValue* next;
-};
-
-struct DBCachedContactValueList
-{
- HANDLE hContact;
- HANDLE hNext;
- DBCachedContactValue* first;
- DBCachedContactValue* last;
-};
-
-#define MAXCACHEDREADSIZE 65536
-
//#define DBLOGGING
#ifdef _DEBUG
diff --git a/plugins/Db3x_mmap/dbevents.cpp b/plugins/Db3x_mmap/dbevents.cpp index 22245d4515..917d1680b2 100644 --- a/plugins/Db3x_mmap/dbevents.cpp +++ b/plugins/Db3x_mmap/dbevents.cpp @@ -125,7 +125,7 @@ STDMETHODIMP_(HANDLE) CDdxMmap::AddEvent(HANDLE hContact, DBEVENTINFO *dbei) DBWrite(ofsContact,&dbc,sizeof(DBContact));
DBWrite(ofsNew,&dbe,offsetof(DBEvent,blob));
- DBWrite(ofsNew+offsetof(DBEvent,blob),dbei->pBlob,dbei->cbBlob);
+ EncodeDBWrite(ofsNew+offsetof(DBEvent,blob),dbei->pBlob,dbei->cbBlob);
DBFlush(0);
lck.unlock();
@@ -245,10 +245,10 @@ STDMETHODIMP_(BOOL) CDdxMmap::GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbei) if (bytesToCopy && dbei->pBlob) {
for (int i = 0;;i += MAXCACHEDREADSIZE) {
if (bytesToCopy-i <= MAXCACHEDREADSIZE) {
- CopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i,bytesToCopy-i,NULL), bytesToCopy-i);
+ DecodeCopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i,bytesToCopy-i,NULL), bytesToCopy-i);
break;
}
- CopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i, MAXCACHEDREADSIZE, NULL), MAXCACHEDREADSIZE);
+ DecodeCopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i, MAXCACHEDREADSIZE, NULL), MAXCACHEDREADSIZE);
}
}
return 0;
diff --git a/plugins/Db3x_mmap/dbheaders.cpp b/plugins/Db3x_mmap/dbheaders.cpp index 32ed0091cb..3d18a373fa 100644 --- a/plugins/Db3x_mmap/dbheaders.cpp +++ b/plugins/Db3x_mmap/dbheaders.cpp @@ -25,12 +25,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //the cache has not been loaded when these functions are used
+extern DBSignature dbSignature;
+
int CDdxMmap::CreateDbHeaders()
{
DBContact user;
DWORD bytesWritten;
- CopyMemory(m_dbHeader.signature,&dbSignature,sizeof(m_dbHeader.signature));
+ CopyMemory(m_dbHeader.signature, &dbSignature,sizeof(m_dbHeader.signature));
m_dbHeader.version = DB_THIS_VERSION;
m_dbHeader.ofsFileEnd = sizeof(struct DBHeader);
m_dbHeader.slackSpace = 0;
diff --git a/plugins/Db3x_mmap/dbintf.cpp b/plugins/Db3x_mmap/dbintf.cpp index fffc01d728..83ae3aa4ca 100644 --- a/plugins/Db3x_mmap/dbintf.cpp +++ b/plugins/Db3x_mmap/dbintf.cpp @@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "commonheaders.h"
+DBSignature dbSignature = {"Miranda ICQ DB",0x1A};
+
static int stringCompare(const char* p1, const char* p2)
{
return strcmp(p1+1, p2+1);
@@ -98,8 +100,8 @@ CDdxMmap::~CDdxMmap() // update profile last modified time
DWORD bytesWritten;
- SetFilePointer(m_hDbFile,0,NULL,FILE_BEGIN);
- WriteFile(m_hDbFile,&dbSignature,1,&bytesWritten,NULL);
+ SetFilePointer(m_hDbFile, 0, NULL, FILE_BEGIN);
+ WriteFile(m_hDbFile, &dbSignature, 1, &bytesWritten, NULL);
CloseHandle(m_hDbFile);
DeleteCriticalSection(&m_csDbAccess);
@@ -149,3 +151,24 @@ STDMETHODIMP_(void) CDdxMmap::SetCacheSafetyMode(BOOL bIsSet) }
DBFlush(1);
}
+
+void CDdxMmap::EncodeCopyMemory(void *dst, void *src, size_t size)
+{
+ MoveMemory(dst, src, size);
+}
+
+void CDdxMmap::DecodeCopyMemory(void *dst, void *src, size_t size)
+{
+ MoveMemory(dst, src, size);
+}
+
+void CDdxMmap::EncodeDBWrite(DWORD ofs, void *src, int size)
+{
+ DBWrite(ofs, src, size);
+}
+
+void CDdxMmap::DecodeDBWrite(DWORD ofs, void *src, int size)
+{
+ DBWrite(ofs, src, size);
+}
+
diff --git a/plugins/Db3x_mmap/dbintf.h b/plugins/Db3x_mmap/dbintf.h index ac5a1c25b5..4dff427516 100644 --- a/plugins/Db3x_mmap/dbintf.h +++ b/plugins/Db3x_mmap/dbintf.h @@ -23,12 +23,139 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include <m_db_int.h>
+/* tree diagram
+
+DBHeader
+ |-->end of file (plain offset)
+ |-->first contact (DBContact)
+ | |-->next contact (DBContact)
+ | | \--> ...
+ | |-->first settings (DBContactSettings)
+ | | |-->next settings (DBContactSettings)
+ | | | \--> ...
+ | | \-->module name (DBModuleName)
+ | \-->first/last/firstunread event
+ |-->user contact (DBContact)
+ | |-->next contact = NULL
+ | |-->first settings as above
+ | \-->first/last/firstunread event as above
+ \-->first module name (DBModuleName)
+ \-->next module name (DBModuleName)
+ \--> ...
+*/
+
+#define DB_THIS_VERSION 0x00000700u
+#define DB_SETTINGS_RESIZE_GRANULARITY 128
+
+struct DBSignature {
+ char name[15];
+ BYTE eof;
+};
+
struct ModuleName
{
char *name;
DWORD ofs;
};
+#include <pshpack1.h>
+struct DBHeader {
+ BYTE signature[16]; // 'Miranda ICQ DB',0,26
+ DWORD version; //as 4 bytes, ie 1.2.3.10 = 0x0102030a
+ //this version is 0x00000700
+ DWORD ofsFileEnd; //offset of the end of the database - place to write
+ //new structures
+ DWORD slackSpace; //a counter of the number of bytes that have been
+ //wasted so far due to deleting structures and/or
+ //re-making them at the end. We should compact when
+ //this gets above a threshold
+ DWORD contactCount; //number of contacts in the chain,excluding the user
+ DWORD ofsFirstContact; //offset to first DBContact in the chain
+ DWORD ofsUser; //offset to DBContact representing the user
+ DWORD ofsFirstModuleName; //offset to first struct DBModuleName in the chain
+};
+
+#define DBCONTACT_SIGNATURE 0x43DECADEu
+
+struct DBContact
+{
+ DWORD signature;
+ DWORD ofsNext; //offset to the next contact in the chain. zero if
+ //this is the 'user' contact or the last contact
+ //in the chain
+ DWORD ofsFirstSettings; //offset to the first DBContactSettings in the
+ //chain for this contact.
+ DWORD eventCount; //number of events in the chain for this contact
+ DWORD ofsFirstEvent,ofsLastEvent; //offsets to the first and last DBEvent in
+ //the chain for this contact
+ DWORD ofsFirstUnreadEvent; //offset to the first (chronological) unread event
+ //in the chain, 0 if all are read
+ DWORD timestampFirstUnread; //timestamp of the event at ofsFirstUnreadEvent
+};
+
+#define DBMODULENAME_SIGNATURE 0x4DDECADEu
+struct DBModuleName
+{
+ DWORD signature;
+ DWORD ofsNext; //offset to the next module name in the chain
+ BYTE cbName; //number of characters in this module name
+ char name[1]; //name, no nul terminator
+};
+
+#define DBCONTACTSETTINGS_SIGNATURE 0x53DECADEu
+struct DBContactSettings
+{
+ DWORD signature;
+ DWORD ofsNext; //offset to the next contactsettings in the chain
+ DWORD ofsModuleName; //offset to the DBModuleName of the owner of these
+ //settings
+ DWORD cbBlob; //size of the blob in bytes. May be larger than the
+ //actual size for reducing the number of moves
+ //required using granularity in resizing
+ BYTE blob[1]; //the blob. a back-to-back sequence of DBSetting
+ //structs, the last has cbName = 0
+};
+
+#define DBEVENT_SIGNATURE 0x45DECADEu
+struct DBEvent
+{
+ DWORD signature;
+ DWORD ofsPrev,ofsNext; //offset to the previous and next events in the
+ //chain. Chain is sorted chronologically
+ DWORD ofsModuleName; //offset to a DBModuleName struct of the name of
+ //the owner of this event
+ DWORD timestamp; //seconds since 00:00:00 01/01/1970
+ DWORD flags; //see m_database.h, db/event/add
+ WORD eventType; //module-defined event type
+ DWORD cbBlob; //number of bytes in the blob
+ BYTE blob[1]; //the blob. module-defined formatting
+};
+
+#include <poppack.h>
+
+struct DBCachedGlobalValue
+{
+ char* name;
+ DBVARIANT value;
+};
+
+struct DBCachedContactValue
+{
+ char* name;
+ DBVARIANT value;
+ DBCachedContactValue* next;
+};
+
+struct DBCachedContactValueList
+{
+ HANDLE hContact;
+ HANDLE hNext;
+ DBCachedContactValue* first;
+ DBCachedContactValue* last;
+};
+
+#define MAXCACHEDREADSIZE 65536
+
struct CDdxMmap : public MIDatabase, public MZeroedObject
{
CDdxMmap(const TCHAR* tszFileName);
@@ -39,7 +166,6 @@ struct CDdxMmap : public MIDatabase, public MZeroedObject int CreateDbHeaders();
int CheckDbHeaders();
void DatabaseCorruption(TCHAR *text);
-
protected:
STDMETHODIMP_(void) SetCacheSafetyMode(BOOL);
@@ -75,7 +201,13 @@ protected: STDMETHODIMP_(BOOL) SetSettingResident(BOOL bIsResident, const char *pszSettingName);
STDMETHODIMP_(BOOL) EnumResidentSettings(DBMODULEENUMPROC pFunc, void *pParam);
-private:
+protected:
+ virtual void EncodeCopyMemory(void *dst, void *src, size_t size);
+ virtual void DecodeCopyMemory(void *dst, void *src, size_t size);
+ virtual void EncodeDBWrite(DWORD ofs, void *src, int size);
+ virtual void DecodeDBWrite(DWORD ofs, void *src, int size);
+
+protected:
TCHAR* m_tszProfileName;
HANDLE m_hDbFile;
DBHeader m_dbHeader;
@@ -88,8 +220,7 @@ public: UINT_PTR m_flushBuffersTimerId;
DWORD m_flushFailTick;
PBYTE m_pDbCache;
-
-private:
+protected:
PBYTE m_pNull;
HANDLE m_hMap;
DWORD m_dwFileSize;
@@ -156,5 +287,3 @@ private: DWORD GetModuleNameOfs(const char *szName);
char *GetModuleNameByOfs(DWORD ofs);
};
-
-extern LIST<CDdxMmap> g_Dbs;
diff --git a/plugins/Db3x_mmap/dbsettings.cpp b/plugins/Db3x_mmap/dbsettings.cpp index 9423d7141c..49ac018047 100644 --- a/plugins/Db3x_mmap/dbsettings.cpp +++ b/plugins/Db3x_mmap/dbsettings.cpp @@ -26,6 +26,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. DWORD GetModuleNameOfs(const char *szName);
DBCachedContactValueList* AddToCachedContactList(HANDLE hContact, int index);
+int DBPreset_QuerySetting(const char *szModule, const char *szSetting, DBVARIANT *dbv, BOOL isStatic);
+
DWORD CDdxMmap::GetSettingsGroupOfsByModuleNameOfs(DBContact *dbc,DWORD ofsModuleName)
{
DWORD ofsThis = dbc->ofsFirstSettings;
@@ -298,21 +300,21 @@ int CDdxMmap::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs return 2;
case DBVT_BYTE: dbcgs->pValue->bVal = pBlob[1]; break;
- case DBVT_WORD: dbcgs->pValue->wVal = *(PWORD)(pBlob+1); break;
- case DBVT_DWORD: dbcgs->pValue->dVal = *(PDWORD)(pBlob+1); break;
+ case DBVT_WORD: DecodeCopyMemory(&(dbcgs->pValue->wVal), (PWORD)(pBlob+1), 2); break;
+ case DBVT_DWORD: DecodeCopyMemory(&(dbcgs->pValue->dVal), (PDWORD)(pBlob+1), 4); break;
case DBVT_UTF8:
case DBVT_ASCIIZ:
NeedBytes(3+*(PWORD)(pBlob+1));
if (isStatic) {
dbcgs->pValue->cchVal--;
if (*(PWORD)(pBlob+1)<dbcgs->pValue->cchVal) dbcgs->pValue->cchVal = *(PWORD)(pBlob+1);
- CopyMemory(dbcgs->pValue->pszVal,pBlob+3,dbcgs->pValue->cchVal);
+ DecodeCopyMemory(dbcgs->pValue->pszVal,pBlob+3,dbcgs->pValue->cchVal);
dbcgs->pValue->pszVal[dbcgs->pValue->cchVal] = 0;
dbcgs->pValue->cchVal = *(PWORD)(pBlob+1);
}
else {
dbcgs->pValue->pszVal = (char*)mir_alloc(1+*(PWORD)(pBlob+1));
- CopyMemory(dbcgs->pValue->pszVal,pBlob+3,*(PWORD)(pBlob+1));
+ DecodeCopyMemory(dbcgs->pValue->pszVal,pBlob+3,*(PWORD)(pBlob+1));
dbcgs->pValue->pszVal[*(PWORD)(pBlob+1)] = 0;
}
break;
@@ -320,19 +322,18 @@ int CDdxMmap::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs NeedBytes(3+*(PWORD)(pBlob+1));
if (isStatic) {
if (*(PWORD)(pBlob+1)<dbcgs->pValue->cpbVal) dbcgs->pValue->cpbVal = *(PWORD)(pBlob+1);
- CopyMemory(dbcgs->pValue->pbVal,pBlob+3,dbcgs->pValue->cpbVal);
+ DecodeCopyMemory(dbcgs->pValue->pbVal,pBlob+3,dbcgs->pValue->cpbVal);
}
else {
dbcgs->pValue->pbVal = (BYTE *)mir_alloc(*(PWORD)(pBlob+1));
- CopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1));
+ DecodeCopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1));
}
dbcgs->pValue->cpbVal = *(PWORD)(pBlob+1);
break;
}
/**** add to cache **********************/
- if ( dbcgs->pValue->type != DBVT_BLOB )
- {
+ if ( dbcgs->pValue->type != DBVT_BLOB ) {
DBVARIANT* pCachedValue = GetCachedValuePtr( hContact, szCachedSettingName, 1 );
if ( pCachedValue != NULL )
SetCachedVariant(dbcgs->pValue,pCachedValue);
@@ -348,6 +349,19 @@ int CDdxMmap::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs NeedBytes(1);
} }
+ #ifndef DB3X_EXPORTS
+ /**** nullbie: query info from preset **********************/
+ if (!hContact && DBPreset_QuerySetting(dbcgs->szModule, dbcgs->szSetting, dbcgs->pValue, isStatic)) {
+ /**** add to cache **********************/
+ if ( dbcgs->pValue->type != DBVT_BLOB ) {
+ DBVARIANT* pCachedValue = GetCachedValuePtr( hContact, szCachedSettingName, 1 );
+ if ( pCachedValue != NULL )
+ SetCachedVariant(dbcgs->pValue,pCachedValue);
+ }
+ return 0;
+ }
+ #endif
+
/**** add missing setting to cache **********************/
if ( dbcgs->pValue->type != DBVT_BLOB )
{
@@ -675,11 +689,11 @@ STDMETHODIMP_(BOOL) CDdxMmap::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT MoveAlong(1); //skip data type
switch(tmp.value.type) {
case DBVT_BYTE: DBWrite(ofsBlobPtr,&tmp.value.bVal,1); break;
- case DBVT_WORD: DBWrite(ofsBlobPtr,&tmp.value.wVal,2); break;
- case DBVT_DWORD: DBWrite(ofsBlobPtr,&tmp.value.dVal,4); break;
+ case DBVT_WORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.wVal,2); break;
+ case DBVT_DWORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.dVal,4); break;
case DBVT_UTF8:
- case DBVT_ASCIIZ: DBWrite(ofsBlobPtr+2,tmp.value.pszVal,(int)strlen(tmp.value.pszVal)); break;
- case DBVT_BLOB: DBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal); break;
+ case DBVT_ASCIIZ: EncodeDBWrite(ofsBlobPtr+2,tmp.value.pszVal,(int)strlen(tmp.value.pszVal)); break;
+ case DBVT_BLOB: EncodeDBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal); break;
}
//quit
DBFlush(1);
@@ -745,19 +759,19 @@ STDMETHODIMP_(BOOL) CDdxMmap::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT MoveAlong(1);
switch(tmp.value.type) {
case DBVT_BYTE: DBWrite(ofsBlobPtr,&tmp.value.bVal,1); MoveAlong(1); break;
- case DBVT_WORD: DBWrite(ofsBlobPtr,&tmp.value.wVal,2); MoveAlong(2); break;
- case DBVT_DWORD: DBWrite(ofsBlobPtr,&tmp.value.dVal,4); MoveAlong(4); break;
+ case DBVT_WORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.wVal,2); MoveAlong(2); break;
+ case DBVT_DWORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.dVal,4); MoveAlong(4); break;
case DBVT_UTF8:
case DBVT_ASCIIZ:
{ int len = (int)strlen(tmp.value.pszVal);
DBWrite(ofsBlobPtr,&len,2);
- DBWrite(ofsBlobPtr+2,tmp.value.pszVal,len);
+ EncodeDBWrite(ofsBlobPtr+2,tmp.value.pszVal,len);
MoveAlong(2+len);
}
break;
case DBVT_BLOB:
DBWrite(ofsBlobPtr,&tmp.value.cpbVal,2) ;
- DBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal);
+ EncodeDBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal);
MoveAlong(2+tmp.value.cpbVal);
break;
}
diff --git a/plugins/Db3x_mmap/init.cpp b/plugins/Db3x_mmap/init.cpp index 03f4f3c3bb..b38fab0ce2 100644 --- a/plugins/Db3x_mmap/init.cpp +++ b/plugins/Db3x_mmap/init.cpp @@ -45,11 +45,6 @@ LIST<CDdxMmap> g_Dbs(1, (LIST<CDdxMmap>::FTSortFunc)HandleKeySort); /////////////////////////////////////////////////////////////////////////////////////////
-static int getCapability( int flag )
-{
- return 0;
-}
-
// returns 0 if the profile is created, EMKPRF*
static int makeDatabase(const TCHAR *profile, int *error)
{
|