Remove dead string serialization code (#41)

* Remove dead string serialization code code

* Remove more dead cstring code
This commit is contained in:
Dan Rose 2019-09-27 03:05:55 -05:00 committed by eboasson
parent a55c9cb605
commit 1205ab5ea2

View file

@ -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<class T>
@ -80,14 +79,6 @@ public:
{
serialize(static_cast<unsigned char>(x));
}
inline void serialize(const char * x)
{
size_t sz = strlen(x) + 1;
serialize(static_cast<uint32_t>(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<class T>
@ -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<char *>(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<class T>
@ -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<int>(sz - 1);
static_cast<void>(x);
prtf(&buf, &bufsize, "\"%*.*s\"", len, len, static_cast<const char *>(data + pos));
pos += sz;
}
inline void print(std::string & x)
{
const uint32_t sz = get_len(sizeof(char));