mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed a few bugs (uninitialized memory mostly)
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7234 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2a5854188e
commit
f2380d0926
@ -135,7 +135,8 @@ TEST(libretroshare_serialiser, RsTlvFileData)
|
|||||||
d1.file.age = 0;
|
d1.file.age = 0;
|
||||||
d1.file.pop = 0;
|
d1.file.pop = 0;
|
||||||
|
|
||||||
char data[15];
|
unsigned char data[15];
|
||||||
|
RSRandom::random_bytes(data,15) ;
|
||||||
d1.binData.setBinData(data, 15);
|
d1.binData.setBinData(data, 15);
|
||||||
|
|
||||||
d1.file_offset = 222;
|
d1.file_offset = 222;
|
||||||
|
@ -40,7 +40,7 @@ RsSerialType* init_item(RsChatMsgItem& cmi)
|
|||||||
|
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
}
|
}
|
||||||
RsSerialType* init_item(RsChatLobbyListRequestItem& cmi)
|
RsSerialType* init_item(RsChatLobbyListRequestItem& )
|
||||||
{
|
{
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
}
|
}
|
||||||
@ -50,13 +50,17 @@ RsSerialType* init_item(RsChatLobbyListItem& cmi)
|
|||||||
|
|
||||||
cmi.lobby_ids.resize(n) ;
|
cmi.lobby_ids.resize(n) ;
|
||||||
cmi.lobby_names.resize(n) ;
|
cmi.lobby_names.resize(n) ;
|
||||||
|
cmi.lobby_topics.resize(n) ;
|
||||||
cmi.lobby_counts.resize(n) ;
|
cmi.lobby_counts.resize(n) ;
|
||||||
|
cmi.lobby_privacy_levels.resize(n) ;
|
||||||
|
|
||||||
for(int i=0;i<n;++i)
|
for(int i=0;i<n;++i)
|
||||||
{
|
{
|
||||||
cmi.lobby_ids[i] = RSRandom::random_u64() ;
|
cmi.lobby_ids[i] = RSRandom::random_u64() ;
|
||||||
randString(5+(rand()%10), cmi.lobby_names[i]);
|
randString(5+(rand()%10), cmi.lobby_names[i]);
|
||||||
|
randString(20+(rand()%15), cmi.lobby_topics[i]);
|
||||||
cmi.lobby_counts[i] = RSRandom::random_u32() ;
|
cmi.lobby_counts[i] = RSRandom::random_u32() ;
|
||||||
|
cmi.lobby_privacy_levels[i] = RSRandom::random_u32()%3 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
@ -75,7 +79,10 @@ RsSerialType* init_item(RsChatLobbyMsgItem& cmi)
|
|||||||
}
|
}
|
||||||
RsSerialType *init_item(RsChatLobbyEventItem& cmi)
|
RsSerialType *init_item(RsChatLobbyEventItem& cmi)
|
||||||
{
|
{
|
||||||
cmi.event_type = rand()%256 ;
|
cmi.lobby_id = RSRandom::random_u64() ;
|
||||||
|
cmi.msg_id = RSRandom::random_u64() ;
|
||||||
|
randString(20, cmi.nick);
|
||||||
|
cmi.event_type = RSRandom::random_u32()%256 ;
|
||||||
randString(20, cmi.string1);
|
randString(20, cmi.string1);
|
||||||
|
|
||||||
return new RsChatSerialiser();
|
return new RsChatSerialiser();
|
||||||
@ -193,7 +200,7 @@ bool operator ==(const RsChatLobbyListItem& cmiLeft,const RsChatLobbyListItem&
|
|||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
bool operator ==(const RsChatLobbyListRequestItem& cmiLeft,const RsChatLobbyListRequestItem& cmiRight)
|
bool operator ==(const RsChatLobbyListRequestItem& ,const RsChatLobbyListRequestItem& )
|
||||||
{
|
{
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user