From: Kefu Chai Date: Fri, 24 Mar 2017 03:45:15 +0000 (+0800) Subject: include/denc: define value_type to avoid repeating the type X-Git-Tag: v12.0.2~286^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aa597ae00f88d3fd78851f397d6577ebf8425751;p=ceph.git include/denc: define value_type to avoid repeating the type Signed-off-by: Kefu Chai --- diff --git a/src/include/denc.h b/src/include/denc.h index d9350c530c7e..350178085b89 100644 --- a/src/include/denc.h +++ b/src/include/denc.h @@ -524,21 +524,24 @@ inline typename std::enable_if struct denc_traits,A>> { +private: + using value_type = std::basic_string,A>; + +public: static constexpr bool supported = true; static constexpr bool featured = false; static constexpr bool bounded = false; - static void bound_encode(const std::basic_string,A>& s, size_t& p, - uint64_t f=0) { + + static void bound_encode(const value_type& s, size_t& p, uint64_t f=0) { p += sizeof(uint32_t) + s.size(); } - static void encode(const std::basic_string,A>& s, + static void encode(const value_type& s, buffer::list::contiguous_appender& p, uint64_t f=0) { ::denc((uint32_t)s.size(), p); memcpy(p.get_pos_add(s.size()), s.data(), s.size()); } - static void decode(std::basic_string,A>& s, + static void decode(value_type& s, buffer::ptr::iterator& p, uint64_t f=0) { uint32_t len;