From 963302bae9662bc11271ff52c55efed5c4348f93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20K=2E=20Guti=C3=A9rrez?= Date: Wed, 28 Aug 2024 07:37:53 -0600 Subject: [PATCH] Implement assignment operator for qvi_bbuff. (#271) Signed-off-by: Samuel K. Gutierrez --- src/qvi-bbuff.cc | 8 ++++++++ src/qvi-bbuff.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qvi-bbuff.cc b/src/qvi-bbuff.cc index b0d7853..b50bf65 100644 --- a/src/qvi-bbuff.cc +++ b/src/qvi-bbuff.cc @@ -37,6 +37,14 @@ qvi_bbuff::~qvi_bbuff(void) if (m_data) free(m_data); } +void +qvi_bbuff::operator=( + const qvi_bbuff &src +) { + const int rc = append(src.m_data, src.m_size); + if (qvi_unlikely(rc != QV_SUCCESS)) throw qvi_runtime_error(); +} + size_t qvi_bbuff::size(void) const { diff --git a/src/qvi-bbuff.h b/src/qvi-bbuff.h index 49e2ab2..6f3b3e1 100644 --- a/src/qvi-bbuff.h +++ b/src/qvi-bbuff.h @@ -42,7 +42,7 @@ struct qvi_bbuff { ~qvi_bbuff(void); /** Assignment operator. */ void - operator=(const qvi_bbuff &src) = delete; + operator=(const qvi_bbuff &src); /** Returns the size of the data stored in the byte buffer. */ size_t size(void) const;