mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-26 23:36:59 -05:00
fixed serialization of posts with images
fix by cyril
This commit is contained in:
parent
019233e840
commit
c7e4986710
@ -28,6 +28,17 @@ void RsGxsPostedPostItem::serial_process(RsGenericSerializer::SerializeJob j,RsG
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LINK,mPost.mLink,"mPost.mLink") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG ,mPost.mNotes,"mPost.mNotes") ;
|
||||
|
||||
// Do not serialize mImage member if it is empty (keeps compatibility of new posts without image toward older RS)
|
||||
// and do not expect to deserialize mImage member if the data block has been consummed entirely (keeps compatibility
|
||||
// of new RS with older posts.
|
||||
|
||||
if(j == RsGenericSerializer::DESERIALIZE && ctx.mOffset == ctx.mSize)
|
||||
return ;
|
||||
|
||||
if((j == RsGenericSerializer::SIZE_ESTIMATE || j == RsGenericSerializer::SERIALIZE) && mImage.empty())
|
||||
return ;
|
||||
|
||||
RsTypeSerializer::serial_process<RsTlvItem>(j,ctx,mImage,"mImage") ;
|
||||
}
|
||||
|
||||
|
@ -33,18 +33,19 @@
|
||||
|
||||
class RsTlvImage: public RsTlvItem
|
||||
{
|
||||
public:
|
||||
RsTlvImage();
|
||||
RsTlvImage(const RsTlvImage& );
|
||||
virtual ~RsTlvImage() { return; }
|
||||
virtual uint32_t TlvSize() const;
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) const;
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset);
|
||||
public:
|
||||
RsTlvImage();
|
||||
RsTlvImage(const RsTlvImage& );
|
||||
virtual ~RsTlvImage() { return; }
|
||||
virtual uint32_t TlvSize() const;
|
||||
virtual void TlvClear();
|
||||
virtual bool SetTlv(void *data, uint32_t size, uint32_t *offset) const;
|
||||
virtual bool GetTlv(void *data, uint32_t size, uint32_t *offset);
|
||||
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) const;
|
||||
bool empty() const { return binData.bin_len == 0 ; }
|
||||
virtual std::ostream &print(std::ostream &out, uint16_t indent) const;
|
||||
|
||||
uint32_t image_type; // Mandatory:
|
||||
uint32_t image_type; // Mandatory:
|
||||
RsTlvBinaryData binData; // Mandatory: serialised file info
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user