From 1205ab5ea223a72253db9c36b19707978b122a9e Mon Sep 17 00:00:00 2001 From: Dan Rose Date: Fri, 27 Sep 2019 03:05:55 -0500 Subject: [PATCH] Remove dead string serialization code (#41) * Remove dead string serialization code code * Remove more dead cstring code --- .../include/rmw_cyclonedds_cpp/serdes.hpp | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/serdes.hpp b/rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/serdes.hpp index b93d66f..4cdb678 100755 --- a/rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/serdes.hpp +++ b/rmw_cyclonedds_cpp/include/rmw_cyclonedds_cpp/serdes.hpp @@ -47,7 +47,6 @@ public: inline cycser & operator<<(uint64_t x) {serialize(x); return *this;} inline cycser & operator<<(float x) {serialize(x); return *this;} inline cycser & operator<<(double x) {serialize(x); return *this;} - inline cycser & operator<<(const char * x) {serialize(x); return *this;} inline cycser & operator<<(const std::string & x) {serialize(x); return *this;} inline cycser & operator<<(const std::wstring & x) {serialize(x); return *this;} template @@ -80,14 +79,6 @@ public: { serialize(static_cast(x)); } - inline void serialize(const char * x) - { - size_t sz = strlen(x) + 1; - serialize(static_cast(sz)); - resize(off + sz); - memcpy(data() + off, x, sz); - off += sz; - } inline void serialize(const std::string & x) { size_t sz = x.size() + 1; @@ -242,7 +233,6 @@ public: inline cycdeser & operator>>(uint64_t & x) {deserialize(x); return *this;} inline cycdeser & operator>>(float & x) {deserialize(x); return *this;} inline cycdeser & operator>>(double & x) {deserialize(x); return *this;} - inline cycdeser & operator>>(char * & x) {deserialize(x); return *this;} inline cycdeser & operator>>(std::string & x) {deserialize(x); return *this;} inline cycdeser & operator>>(std::wstring & x) {deserialize(x); return *this;} template @@ -288,14 +278,6 @@ public: validate_size(sz, el_sz); return sz; } - inline void deserialize(char * & x) - { - const uint32_t sz = deserialize_len(sizeof(char)); - validate_str(sz); - x = reinterpret_cast(malloc(sz)); - memcpy(x, data + pos, sz); - pos += sz; - } inline void deserialize(std::string & x) { const uint32_t sz = deserialize_len(sizeof(char)); @@ -404,7 +386,6 @@ public: inline cycprint & operator>>(uint64_t & x) {print(x); return *this;} inline cycprint & operator>>(float & x) {print(x); return *this;} inline cycprint & operator>>(double & x) {print(x); return *this;} - inline cycprint & operator>>(char * & x) {print(x); return *this;} inline cycprint & operator>>(std::string & x) {print(x); return *this;} inline cycprint & operator>>(std::wstring & x) {print(x); return *this;} template @@ -470,15 +451,6 @@ public: validate_size(sz, el_sz); return sz; } - inline void print(char * & x) - { - const uint32_t sz = get_len(sizeof(char)); - validate_str(sz); - const int len = (sz == 0) ? 0 : (sz > INT32_MAX) ? INT32_MAX : static_cast(sz - 1); - static_cast(x); - prtf(&buf, &bufsize, "\"%*.*s\"", len, len, static_cast(data + pos)); - pos += sz; - } inline void print(std::string & x) { const uint32_t sz = get_len(sizeof(char));