From: Fred Morcos Date: Wed, 25 Sep 2024 12:18:10 +0000 (+0200) Subject: Replace memcpy with std::append X-Git-Tag: rec-5.2.0-alpha1~61^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F14620%2Fhead;p=thirdparty%2Fpdns.git Replace memcpy with std::append --- diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 38533b1590..e632c88ed6 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -918,15 +918,15 @@ std::string serializeToBuffer(const LMDBBackend::LMDBResourceRecord& value) buffer.reserve(sizeof(len) + len + sizeof(value.ttl) + sizeof(value.auth) + sizeof(value.disabled) + sizeof(value.ordername)); // Store the size of the resource record. - buffer.resize(sizeof(len)); - std::memcpy(&buffer.at(0), &len, sizeof(len)); + // NOLINTNEXTLINE. + buffer.assign((const char*)&len, sizeof(len)); // Store the contents of the resource record. buffer += value.content; // The few other things. - buffer.resize(buffer.size() + sizeof(value.ttl)); - std::memcpy(&buffer.at(sizeof(len) + len), &value.ttl, sizeof(value.ttl)); + // NOLINTNEXTLINE. + buffer.append((const char*)&value.ttl, sizeof(value.ttl)); buffer.append(1, (char)value.auth); buffer.append(1, (char)value.disabled); buffer.append(1, (char)value.ordername);