From 746f4d729260aa94bd8673a198e0d3bd98f13ba8 Mon Sep 17 00:00:00 2001 From: Gio Date: Thu, 25 Aug 2016 15:11:58 +0200 Subject: [PATCH] libretroshare remove unuseful code from RsRawItem --- libretroshare/src/serialiser/rsserial.h | 33 +++++++++---------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/libretroshare/src/serialiser/rsserial.h b/libretroshare/src/serialiser/rsserial.h index 47b0666fc..bb8b84d8c 100644 --- a/libretroshare/src/serialiser/rsserial.h +++ b/libretroshare/src/serialiser/rsserial.h @@ -178,32 +178,21 @@ std::ostream &printIndent(std::ostream &out, uint16_t indent); class RsRawItem: public RsItem { - public: - RsRawItem(uint32_t t, uint32_t size) - :RsItem(t), len(size) - { - data = rs_malloc(len); - } +public: + RsRawItem(uint32_t t, uint32_t size) : RsItem(t), len(size) + { data = rs_malloc(len); } + virtual ~RsRawItem() { free(data); } - virtual ~RsRawItem() - { - if (data) - free(data); - data = NULL; - len = 0; - } + uint32_t getRawLength() { return len; } + void * getRawData() { return data; } - uint32_t getRawLength() { return len; } - void *getRawData() { return data; } + virtual void clear() {} + virtual std::ostream &print(std::ostream &out, uint16_t indent = 0); - virtual void clear() { return; } /* what can it do? */ - virtual std::ostream &print(std::ostream &out, uint16_t indent = 0); - - private: - void *data; - uint32_t len; +private: + void *data; + uint32_t len; }; - #endif /* RS_BASE_SERIALISER_H */