mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Electron patch
- fixes issue with, message offsets not being calculated in loop correctly, resulted in only invalid message offset in db after calling message removal git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6819 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
a50c899ff3
commit
55bbfb29da
@ -1092,26 +1092,26 @@ int RsDataService::removeMsgs(const GxsMsgReq& msgIds)
|
|||||||
|
|
||||||
std::vector<MsgOffset>::iterator vit = msgOffsets.begin();
|
std::vector<MsgOffset>::iterator vit = msgOffsets.begin();
|
||||||
|
|
||||||
uint32_t maxSize = 0;
|
uint32_t maxSize = 0;// größe aller msgs, newbuf könnte aber kleiner sein, weil msgs weggehen
|
||||||
for(; vit != msgOffsets.end(); vit++)
|
for(; vit != msgOffsets.end(); vit++)
|
||||||
maxSize += vit->msgLen;
|
maxSize += vit->msgLen;
|
||||||
|
|
||||||
// may be preferable to determine file len reality
|
// may be preferable to determine file len reality
|
||||||
// from file? corrupt db?
|
// from file? corrupt db?
|
||||||
dataBuff.resize(maxSize);
|
dataBuff.reserve(maxSize);// dataBuff.resize(maxSize);
|
||||||
newBuffer.resize(maxSize);
|
newBuffer.reserve(maxSize);// newBuffer.resize(maxSize);
|
||||||
|
|
||||||
dataBuff.insert(dataBuff.end(),
|
dataBuff.insert(dataBuff.end(),
|
||||||
std::istreambuf_iterator<char>(in),
|
std::istreambuf_iterator<char>(in),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
in.close();
|
in.close();
|
||||||
|
uint32_t newOffset = 0;// am anfang der liste ist offset=0, jetzt gehen wir die msgs liste durch
|
||||||
for(std::vector<MsgOffset>::size_type i = 0; i < msgOffsets.size(); i++)
|
for(std::vector<MsgOffset>::size_type i = 0; i < msgOffsets.size(); i++)
|
||||||
{
|
{
|
||||||
const MsgOffset& m = msgOffsets[i];
|
const MsgOffset& m = msgOffsets[i];
|
||||||
|
|
||||||
uint32_t newOffset = 0;
|
//uint32_t newOffset = 0;//hier ist es zu spät, offset muss hochgezählt werden
|
||||||
if(std::find(msgIdV.begin(), msgIdV.end(), m.msgId) == msgIdV.end())
|
if(std::find(msgIdV.begin(), msgIdV.end(), m.msgId) == msgIdV.end())
|
||||||
{
|
{
|
||||||
MsgUpdate up;
|
MsgUpdate up;
|
||||||
|
@ -42,8 +42,8 @@ class MsgUpdate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
MsgUpdate(){}
|
//MsgUpdate(){}
|
||||||
MsgUpdate(const MsgUpdate& ){}
|
//MsgUpdate(const MsgUpdate& ){}//hier müsste ein echter constructor sein
|
||||||
RsGxsMessageId msgId;
|
RsGxsMessageId msgId;
|
||||||
ContentValue cv;
|
ContentValue cv;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ ContentValue::~ContentValue(){
|
|||||||
clearData();
|
clearData();
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentValue::ContentValue(ContentValue &from){
|
ContentValue::ContentValue(const ContentValue &from){
|
||||||
|
|
||||||
std::map<std::string, uint8_t> keyTypeMap;
|
std::map<std::string, uint8_t> keyTypeMap;
|
||||||
from.getKeyTypeMap(keyTypeMap);
|
from.getKeyTypeMap(keyTypeMap);
|
||||||
|
@ -51,7 +51,7 @@ public:
|
|||||||
* makes a deep copy of raw data
|
* makes a deep copy of raw data
|
||||||
* @param from ContentValue instance to copy key value set from
|
* @param from ContentValue instance to copy key value set from
|
||||||
*/
|
*/
|
||||||
ContentValue(ContentValue& from);
|
ContentValue(const ContentValue& from);//const damit die äußere klasse einen konstruktor com compielr bekommt
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user