fix byte_buffer copy and assignment ctor

master
Andre Puschmann 6 years ago
parent 601b2a357b
commit 1985d7b37c

@ -134,6 +134,9 @@ public:
byte_buffer_t(const byte_buffer_t& buf) byte_buffer_t(const byte_buffer_t& buf)
{ {
bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES); bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES);
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
next = NULL;
// copy actual contents
N_bytes = buf.N_bytes; N_bytes = buf.N_bytes;
memcpy(msg, buf.msg, N_bytes); memcpy(msg, buf.msg, N_bytes);
} }
@ -143,6 +146,8 @@ public:
if (&buf == this) if (&buf == this)
return *this; return *this;
bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES); bzero(buffer, SRSLTE_MAX_BUFFER_SIZE_BYTES);
msg = &buffer[SRSLTE_BUFFER_HEADER_OFFSET];
next = NULL;
N_bytes = buf.N_bytes; N_bytes = buf.N_bytes;
memcpy(msg, buf.msg, N_bytes); memcpy(msg, buf.msg, N_bytes);
return *this; return *this;

Loading…
Cancel
Save