diff --git a/src/libraries/util/cdb.cpp b/src/libraries/util/cdb.cpp index 9e8be13..acc17c5 100644 --- a/src/libraries/util/cdb.cpp +++ b/src/libraries/util/cdb.cpp @@ -57,21 +57,21 @@ inline uint32_t strlen(const char *s) { } // anon namespace -cdb::cdb(buffer data) : +cdb::cdb(const_buffer data) : m_data(data) { if (data.count < min_length) m_data = {0, 0}; } -const buffer +const_buffer cdb::retrieve(const char *key) const { uint32_t len = strlen(key); return retrieve(reinterpret_cast(key), len); } -const buffer +const_buffer cdb::retrieve(const uint8_t *key, uint32_t len) const { if (!m_data.pointer || !m_data.count) @@ -95,7 +95,7 @@ cdb::retrieve(const uint8_t *key, uint32_t len) const if (s->hash == h) { record const *r = at(s->position); if (equal(key, len, &r->data[0], r->keylen)) - return buffer::from_const( &r->data[r->keylen], r->vallen ); + return const_buffer::from( &r->data[r->keylen], r->vallen ); } i = (i + 1) % p->length; diff --git a/src/libraries/util/util/cdb.h b/src/libraries/util/util/cdb.h index 5e80b21..b679ceb 100644 --- a/src/libraries/util/util/cdb.h +++ b/src/libraries/util/util/cdb.h @@ -10,20 +10,20 @@ namespace util { class cdb { public: - cdb(buffer data); + cdb(const_buffer data); /// Retrieve a value from the database for the given key. /// \arg key A null-terminated string key /// \returns A const util::buffer pointing to the data in memory. /// The buffer will be {0, 0} if the key is not found. - const buffer retrieve(const char *key) const; + const_buffer retrieve(const char *key) const; /// Retrieve a value from the database for the given key. /// \arg key Pointer to a key as an array of bytes /// \arg len Length of the key /// \returns A const util::buffer pointing to the data in memory. /// The buffer will be {0, 0} if the key is not found. - const buffer retrieve(const uint8_t *key, uint32_t len) const; + const_buffer retrieve(const uint8_t *key, uint32_t len) const; private: template @@ -31,7 +31,7 @@ private: return reinterpret_cast(util::offset_pointer(m_data.pointer, offset)); } - buffer m_data; + const_buffer m_data; }; } // namespace