fixed a few bugs in config items

This commit is contained in:
csoler 2017-04-24 22:36:03 +02:00
parent fcabe6359f
commit 43b3b87782
3 changed files with 41 additions and 18 deletions
libretroshare/src/serialization

View file

@ -1,3 +1,5 @@
#include <typeinfo>
#include "util/rsprint.h"
#include "serialization/rsserializer.h"
#include "serialization/rstypeserializer.h"
@ -14,7 +16,7 @@ RsItem *RsServiceSerializer::deserialise(void *data, uint32_t *size)
if(!item)
{
std::cerr << "(EE) cannot deserialise: unknown item type " << std::hex << rstype << std::dec << std::endl;
std::cerr << "(EE) " << typeid(*this).name() << ": cannot deserialise unknown item subtype " << std::hex << getRsItemSubType(rstype) << std::dec << std::endl;
std::cerr << "(EE) Data is: " << RsUtil::BinToHex(static_cast<uint8_t*>(data),std::min(50u,*size)) << ((*size>50)?"...":"") << std::endl;
return NULL ;
}
@ -40,11 +42,11 @@ RsItem *RsConfigSerializer::deserialise(void *data, uint32_t *size)
{
uint32_t rstype = getRsItemId(const_cast<void*>((const void*)data)) ;
RsItem *item = create_item(getRsItemClass(rstype),getRsItemSubType(rstype)) ;
RsItem *item = create_item(getRsItemType(rstype),getRsItemSubType(rstype)) ;
if(!item)
{
std::cerr << "(EE) cannot deserialise: unknown item type " << std::hex << rstype << std::dec << std::endl;
std::cerr << "(EE) " << typeid(*this).name() << ": cannot deserialise unknown item subtype " << std::hex << getRsItemSubType(rstype) << std::dec << std::endl;
std::cerr << "(EE) Data is: " << RsUtil::BinToHex(static_cast<uint8_t*>(data),std::min(50u,*size)) << ((*size>50)?"...":"") << std::endl;
return NULL ;
}