summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-11-22 08:43:10 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-11-22 08:43:10 +0000
commit004ffa40c522d3d8ce825c8a190587f28d9e5420 (patch)
tree3235dc11aabca7049822ce12ac6b323aeb73d56e
parent966de6f48098ae0a11067c7f1eca262712118531 (diff)
clutches for mmap_sa to remove
git-svn-id: http://svn.miranda-ng.org/main/trunk@6957 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/src/dbcrypt.cpp20
-rw-r--r--plugins/Db3x_mmap/src/dbevents.cpp6
-rw-r--r--plugins/Db3x_mmap/src/dbintf.h4
-rw-r--r--plugins/Db3x_mmap/src/dbsettings.cpp28
-rw-r--r--plugins/Db3x_mmap/src/dbtool/eventchain.cpp4
5 files changed, 19 insertions, 43 deletions
diff --git a/plugins/Db3x_mmap/src/dbcrypt.cpp b/plugins/Db3x_mmap/src/dbcrypt.cpp
index 047eaf6cc8..c2b8e1ec36 100644
--- a/plugins/Db3x_mmap/src/dbcrypt.cpp
+++ b/plugins/Db3x_mmap/src/dbcrypt.cpp
@@ -82,23 +82,3 @@ LBL_SetNewKey:
}
return 0;
}
-
-void CDb3Base::EncodeCopyMemory(void *dst, void *src, size_t size)
-{
- MoveMemory(dst, src, size);
-}
-
-void CDb3Base::DecodeCopyMemory(void *dst, void *src, size_t size)
-{
- MoveMemory(dst, src, size);
-}
-
-void CDb3Base::EncodeDBWrite(DWORD ofs, void *src, int size)
-{
- DBWrite(ofs, src, size);
-}
-
-void CDb3Base::DecodeDBWrite(DWORD ofs, void *src, int size)
-{
- DBWrite(ofs, src, size);
-}
diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp
index 2d46f54ca2..7f9e55cdae 100644
--- a/plugins/Db3x_mmap/src/dbevents.cpp
+++ b/plugins/Db3x_mmap/src/dbevents.cpp
@@ -123,7 +123,7 @@ STDMETHODIMP_(HANDLE) CDb3Base::AddEvent(HANDLE hContact, DBEVENTINFO *dbei)
DBWrite(ofsContact,&dbc,sizeof(DBContact));
DBWrite(ofsNew,&dbe,offsetof(DBEvent,blob));
- EncodeDBWrite(ofsNew+offsetof(DBEvent,blob),dbei->pBlob,dbei->cbBlob);
+ DBWrite(ofsNew+offsetof(DBEvent,blob),dbei->pBlob,dbei->cbBlob); // encode
DBFlush(0);
lck.unlock();
@@ -243,10 +243,10 @@ STDMETHODIMP_(BOOL) CDb3Base::GetEvent(HANDLE hDbEvent, DBEVENTINFO *dbei)
if (bytesToCopy && dbei->pBlob) {
for (int i = 0;;i += MAXCACHEDREADSIZE) {
if (bytesToCopy-i <= MAXCACHEDREADSIZE) {
- DecodeCopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i,bytesToCopy-i,NULL), bytesToCopy-i);
+ MoveMemory(dbei->pBlob + i, DBRead(DWORD(hDbEvent) + offsetof(DBEvent, blob) + i, bytesToCopy - i, NULL), bytesToCopy - i); // decode
break;
}
- DecodeCopyMemory(dbei->pBlob+i, DBRead(DWORD(hDbEvent)+offsetof(DBEvent,blob)+i, MAXCACHEDREADSIZE, NULL), MAXCACHEDREADSIZE);
+ MoveMemory(dbei->pBlob + i, DBRead(DWORD(hDbEvent) + offsetof(DBEvent, blob) + i, MAXCACHEDREADSIZE, NULL), MAXCACHEDREADSIZE); // decode
}
}
return 0;
diff --git a/plugins/Db3x_mmap/src/dbintf.h b/plugins/Db3x_mmap/src/dbintf.h
index de26d64923..9e8b04e549 100644
--- a/plugins/Db3x_mmap/src/dbintf.h
+++ b/plugins/Db3x_mmap/src/dbintf.h
@@ -205,10 +205,6 @@ protected:
protected:
int InitCrypt(void);
- 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);
public: // Check functions
int WorkInitialChecks(int);
diff --git a/plugins/Db3x_mmap/src/dbsettings.cpp b/plugins/Db3x_mmap/src/dbsettings.cpp
index 915975388e..1ef2931267 100644
--- a/plugins/Db3x_mmap/src/dbsettings.cpp
+++ b/plugins/Db3x_mmap/src/dbsettings.cpp
@@ -170,8 +170,8 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs
return 2;
case DBVT_BYTE: dbcgs->pValue->bVal = 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_WORD: MoveMemory(&(dbcgs->pValue->wVal), (PWORD)(pBlob + 1), 2); break;
+ case DBVT_DWORD: MoveMemory(&(dbcgs->pValue->dVal), (PDWORD)(pBlob + 1), 4); break;
case DBVT_UTF8:
case DBVT_ASCIIZ:
bEncrypted = isEncrypted(dbcgs->szModule, dbcgs->szSetting);
@@ -179,13 +179,13 @@ int CDb3Base::GetContactSettingWorker(HANDLE hContact,DBCONTACTGETSETTING *dbcgs
if (isStatic) {
dbcgs->pValue->cchVal--;
if (*(PWORD)(pBlob+1)<dbcgs->pValue->cchVal) dbcgs->pValue->cchVal = *(PWORD)(pBlob+1);
- DecodeCopyMemory(dbcgs->pValue->pszVal,pBlob+3,dbcgs->pValue->cchVal);
+ MoveMemory(dbcgs->pValue->pszVal, pBlob + 3, dbcgs->pValue->cchVal); // decode
dbcgs->pValue->pszVal[dbcgs->pValue->cchVal] = 0;
dbcgs->pValue->cchVal = *(PWORD)(pBlob+1);
}
else {
dbcgs->pValue->pszVal = (char*)mir_alloc(1+*(PWORD)(pBlob+1));
- DecodeCopyMemory(dbcgs->pValue->pszVal,pBlob+3,*(PWORD)(pBlob+1));
+ MoveMemory(dbcgs->pValue->pszVal, pBlob + 3, *(PWORD)(pBlob + 1));
dbcgs->pValue->pszVal[*(PWORD)(pBlob+1)] = 0;
}
break;
@@ -193,11 +193,11 @@ int CDb3Base::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);
- DecodeCopyMemory(dbcgs->pValue->pbVal,pBlob+3,dbcgs->pValue->cpbVal);
+ MoveMemory(dbcgs->pValue->pbVal, pBlob + 3, dbcgs->pValue->cpbVal); // decode
}
else {
dbcgs->pValue->pbVal = (BYTE *)mir_alloc(*(PWORD)(pBlob+1));
- DecodeCopyMemory(dbcgs->pValue->pbVal,pBlob+3,*(PWORD)(pBlob+1));
+ MoveMemory(dbcgs->pValue->pbVal, pBlob + 3, *(PWORD)(pBlob + 1)); // decode
}
dbcgs->pValue->cpbVal = *(PWORD)(pBlob+1);
break;
@@ -545,14 +545,14 @@ STDMETHODIMP_(BOOL) CDb3Base::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: EncodeDBWrite(ofsBlobPtr,&tmp.value.wVal,2); break;
- case DBVT_DWORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.dVal,4); break;
- case DBVT_BLOB: EncodeDBWrite(ofsBlobPtr + 2, tmp.value.pbVal, tmp.value.cpbVal); break;
+ case DBVT_WORD: DBWrite(ofsBlobPtr,&tmp.value.wVal,2); break;
+ case DBVT_DWORD: DBWrite(ofsBlobPtr,&tmp.value.dVal,4); break;
+ case DBVT_BLOB: DBWrite(ofsBlobPtr + 2, tmp.value.pbVal, tmp.value.cpbVal); break; // encode
case DBVT_UTF8:
case DBVT_ASCIIZ:
if (isEncrypted(dbcws->szModule, dbcws->szSetting))
EncodeString(tmp.value.pszVal);
- EncodeDBWrite(ofsBlobPtr+2,tmp.value.pszVal,(int)strlen(tmp.value.pszVal));
+ DBWrite(ofsBlobPtr+2,tmp.value.pszVal,(int)strlen(tmp.value.pszVal)); // encode
break;
}
//quit
@@ -620,8 +620,8 @@ STDMETHODIMP_(BOOL) CDb3Base::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: EncodeDBWrite(ofsBlobPtr,&tmp.value.wVal,2); MoveAlong(2); break;
- case DBVT_DWORD: EncodeDBWrite(ofsBlobPtr,&tmp.value.dVal,4); MoveAlong(4); 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_UTF8:
case DBVT_ASCIIZ:
{
@@ -629,13 +629,13 @@ STDMETHODIMP_(BOOL) CDb3Base::WriteContactSetting(HANDLE hContact, DBCONTACTWRIT
if (isEncrypted(dbcws->szModule, dbcws->szSetting))
EncodeString(tmp.value.pszVal);
DBWrite(ofsBlobPtr,&len,2);
- EncodeDBWrite(ofsBlobPtr+2,tmp.value.pszVal,len);
+ DBWrite(ofsBlobPtr+2,tmp.value.pszVal,len); // encode
MoveAlong(2+len);
}
break;
case DBVT_BLOB:
DBWrite(ofsBlobPtr,&tmp.value.cpbVal,2) ;
- EncodeDBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal);
+ DBWrite(ofsBlobPtr+2,tmp.value.pbVal,tmp.value.cpbVal); // encode
MoveAlong(2+tmp.value.cpbVal);
break;
}
diff --git a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
index 1811d8ee9e..ee35fec362 100644
--- a/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
+++ b/plugins/Db3x_mmap/src/dbtool/eventchain.cpp
@@ -232,12 +232,12 @@ int CDb3Base::WorkEventChain(DWORD ofsContact,DBContact *dbc,int firstTime)
DWORD oldSize = dbeNew->cbBlob;
BYTE* pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob);
memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob);
- DecodeCopyMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob);
+ CopyMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // decode
ConvertOldEvent(dbeNew);
if (dbeNew->cbBlob > oldSize)
pOldMemo = (BYTE*)_alloca(dbeNew->cbBlob);
memcpy(pOldMemo, dbeNew->blob, dbeNew->cbBlob);
- EncodeCopyMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob);
+ MoveMemory(dbeNew->blob, pOldMemo, dbeNew->cbBlob); // encode
}
if (dbePrev) {