#include "common/ceph_crypto.h"
using ceph::crypto::SHA1;
-boost::optional<sha1_digest_t> buffer::list::sha1()
+sha1_digest_t buffer::list::sha1()
{
- ptr nb;
unsigned char fingerprint[CEPH_CRYPTO_SHA1_DIGESTSIZE];
- if (_len == 0) {
- return boost::none;
- }
- nb = buffer::create(_len);
SHA1 sha1_gen;
- for (std::list<ptr>::iterator it = _buffers.begin();
- it != _buffers.end();
- ++it) {
- sha1_gen.Update((const unsigned char *)it->c_str(), it->length());
+ for (auto& p : _buffers) {
+ sha1_gen.Update((const unsigned char *)p.c_str(), p.length());
}
sha1_gen.Final(fingerprint);
- sha1_digest_t fp_t(fingerprint);
- return fp_t;
+ return sha1_digest_t(fingerprint);
}
/**
#endif
#include "inline_memory.h"
-#include <boost/optional.hpp>
#if __GNUC__ >= 4
#define CEPH_BUFFER_API __attribute__ ((visibility ("default")))
}
uint32_t crc32c(uint32_t crc) const;
void invalidate_crc();
- boost::optional<sha1_digest_t> sha1();
+ sha1_digest_t sha1();
// These functions return a bufferlist with a pointer to a single
// static buffer. They /must/ not outlive the memory they
switch (fp_algo_t) {
case pg_pool_t::TYPE_FINGERPRINT_SHA1:
{
- boost::optional<sha1_digest_t> fp_t = chunk_data.sha1();
- object_t fp_oid;
+ sha1_digest_t sha1r = chunk_data.sha1();
+ object_t fp_oid = sha1r.to_str();
bufferlist in;
- if (fp_t != boost::none) {
- fp_oid = fp_t.get().to_str();
- }
if (fp_oid != tgt_soid.oid) {
// decrement old chunk's reference count
ObjectOperation dec_op;