Fixes for gxsupdate item serialisation

- now works

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs_finale@6947 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2013-12-15 20:11:39 +00:00
parent 972674173d
commit dab782fbaa
3 changed files with 11 additions and 11 deletions

View file

@ -325,8 +325,8 @@ RsGxsGrpUpdateItem* RsGxsUpdateSerialiser::deserialGxsGrpUpddate(void* data,
/* skip the header */ /* skip the header */
offset += 8; offset += 8;
ok &= getRawUInt32(data, *size, &offset, &(item->grpUpdateTS));
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_PEERID, item->peerId); ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_PEERID, item->peerId);
ok &= getRawUInt32(data, *size, &offset, &(item->grpUpdateTS));
if (offset != rssize) if (offset != rssize)
{ {
@ -482,7 +482,7 @@ bool RsGxsUpdateSerialiser::serialiseGxsMsgUpdate(RsGxsMsgUpdateItem* item,
for(; cit != msgUpdateTS.end(); cit++) for(; cit != msgUpdateTS.end(); cit++)
{ {
ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_PEERID, cit->first); ok &= SetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, cit->first);
ok &= setRawUInt32(data, *size, &offset, cit->second); ok &= setRawUInt32(data, *size, &offset, cit->second);
} }
@ -599,7 +599,7 @@ RsGxsMsgUpdateItem* RsGxsUpdateSerialiser::deserialGxsMsgUpdate(void* data,
std::map<std::string, uint32_t>& msgUpdateItem = item->msgUpdateTS; std::map<std::string, uint32_t>& msgUpdateItem = item->msgUpdateTS;
std::string grpId; std::string grpId;
uint32_t updateTS; uint32_t updateTS;
for(uint32_t i; i < numUpdateItems; i++) for(uint32_t i = 0; i < numUpdateItems; i++)
{ {
ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, grpId); ok &= GetTlvString(data, *size, &offset, TLV_TYPE_STR_GROUPID, grpId);

View file

@ -15,7 +15,7 @@ RsSerialType* init_item(RsGxsGrpUpdateItem& i)
i.clear(); i.clear();
i.grpUpdateTS = rand()%2424; i.grpUpdateTS = rand()%2424;
randString(SHORT_STR, i.peerId); randString(SHORT_STR, i.peerId);
return new RsGxsUpdateSerialiser(0); return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
} }
RsSerialType* init_item(RsGxsMsgUpdateItem& i) RsSerialType* init_item(RsGxsMsgUpdateItem& i)
@ -31,7 +31,7 @@ RsSerialType* init_item(RsGxsMsgUpdateItem& i)
i.msgUpdateTS.insert(std::make_pair(peer, rand()%45)); i.msgUpdateTS.insert(std::make_pair(peer, rand()%45));
} }
return new RsGxsUpdateSerialiser(0); return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
} }
RsSerialType* init_item(RsGxsServerGrpUpdateItem& i) RsSerialType* init_item(RsGxsServerGrpUpdateItem& i)
@ -39,7 +39,7 @@ RsSerialType* init_item(RsGxsServerGrpUpdateItem& i)
i.clear(); i.clear();
i.grpUpdateTS = rand()%2424; i.grpUpdateTS = rand()%2424;
return new RsGxsUpdateSerialiser(0); return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
} }
RsSerialType* init_item(RsGxsServerMsgUpdateItem& i) RsSerialType* init_item(RsGxsServerMsgUpdateItem& i)
@ -47,7 +47,7 @@ RsSerialType* init_item(RsGxsServerMsgUpdateItem& i)
i.clear(); i.clear();
randString(SHORT_STR, i.grpId); randString(SHORT_STR, i.grpId);
i.msgUpdateTS = rand()%4252; i.msgUpdateTS = rand()%4252;
return new RsGxsUpdateSerialiser(0); return new RsGxsUpdateSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
} }
bool operator ==(const RsGxsGrpUpdateItem& l, const RsGxsGrpUpdateItem& r) bool operator ==(const RsGxsGrpUpdateItem& l, const RsGxsGrpUpdateItem& r)

View file

@ -39,7 +39,7 @@ RsSerialType* init_item(RsNxsSyncGrp& rsg)
{ {
rsg.clear(); rsg.clear();
rsg.flag = RsNxsSyncGrp::FLAG_USE_SYNC_HASH; rsg.flag = RsNxsSyncGrp::FLAG_USE_SYNC_HASH;
rsg.syncAge = rand()%2423; rsg.createdSince = rand()%2423;
randString(3124,rsg.syncHash); randString(3124,rsg.syncHash);
return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM); return new RsNxsSerialiser(RS_SERVICE_TYPE_PLUGIN_SIMPLE_FORUM);
@ -50,7 +50,7 @@ RsSerialType* init_item(RsNxsSyncMsg& rsgm)
rsgm.clear(); rsgm.clear();
rsgm.flag = RsNxsSyncMsg::FLAG_USE_SYNC_HASH; rsgm.flag = RsNxsSyncMsg::FLAG_USE_SYNC_HASH;
rsgm.syncAge = rand()%24232; rsgm.createdSince = rand()%24232;
rsgm.transactionNumber = rand()%23; rsgm.transactionNumber = rand()%23;
randString(SHORT_STR, rsgm.grpId); randString(SHORT_STR, rsgm.grpId);
randString(SHORT_STR, rsgm.syncHash); randString(SHORT_STR, rsgm.syncHash);
@ -120,7 +120,7 @@ bool operator==(const RsNxsSyncGrp& l, const RsNxsSyncGrp& r)
if(l.syncHash != r.syncHash) return false; if(l.syncHash != r.syncHash) return false;
if(l.flag != r.flag) return false; if(l.flag != r.flag) return false;
if(l.syncAge != r.syncAge) return false; if(l.createdSince != r.createdSince) return false;
if(l.transactionNumber != r.transactionNumber) return false; if(l.transactionNumber != r.transactionNumber) return false;
return true; return true;
@ -130,7 +130,7 @@ bool operator==(const RsNxsSyncMsg& l, const RsNxsSyncMsg& r)
{ {
if(l.flag != r.flag) return false; if(l.flag != r.flag) return false;
if(l.syncAge != r.syncAge) return false; if(l.createdSince != r.createdSince) return false;
if(l.syncHash != r.syncHash) return false; if(l.syncHash != r.syncHash) return false;
if(l.grpId != r.grpId) return false; if(l.grpId != r.grpId) return false;
if(l.transactionNumber != r.transactionNumber) return false; if(l.transactionNumber != r.transactionNumber) return false;