From 7e039ecdb974544a3c780fd87717d15bc775c85f Mon Sep 17 00:00:00 2001 From: Andrew Pouliot Date: Thu, 1 Oct 2015 15:15:08 -0700 Subject: [PATCH] Fix compatibility with -Wshadow and ObjC++ --- .../msgpack/adaptor/boost/msgpack_variant.hpp | 14 +++++------ include/msgpack/adaptor/fixint.hpp | 2 +- include/msgpack/adaptor/nil.hpp | 24 +++++++++---------- include/msgpack/object_fwd.hpp | 2 +- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/msgpack/adaptor/boost/msgpack_variant.hpp b/include/msgpack/adaptor/boost/msgpack_variant.hpp index 4bbeebd21..3b7e011a3 100644 --- a/include/msgpack/adaptor/boost/msgpack_variant.hpp +++ b/include/msgpack/adaptor/boost/msgpack_variant.hpp @@ -51,7 +51,7 @@ namespace type { template struct basic_variant : boost::variant< - nil, // NIL + nil_t, // NIL bool, // BOOL int64_t, // NEGATIVE_INTEGER uint64_t, // POSITIVE_INTEGER @@ -70,7 +70,7 @@ struct basic_variant : >, private boost::totally_ordered > { typedef boost::variant< - nil, // NIL + nil_t, // NIL bool, // BOOL int64_t, // NEGATIVE_INTEGER uint64_t, // POSITIVE_INTEGER @@ -112,7 +112,7 @@ struct basic_variant : basic_variant(unsigned long long v):base(uint64_t(v)) {} bool is_nil() const { - return boost::get(this); + return boost::get(this); } bool is_bool() const { return boost::get(this); @@ -276,7 +276,7 @@ struct as > { msgpack::type::basic_variant operator()(msgpack::object const& o) const { switch(o.type) { case type::NIL: - return o.as(); + return o.as(); case type::BOOLEAN: return o.as(); case type::POSITIVE_INTEGER: @@ -312,7 +312,7 @@ struct convert > { msgpack::type::basic_variant& v) const { switch(o.type) { case type::NIL: - v = o.as(); + v = o.as(); break; case type::BOOLEAN: v = o.as(); @@ -374,8 +374,8 @@ struct pack > { namespace detail { struct object_imp : boost::static_visitor { - void operator()(msgpack::type::nil const& v) const { - object()(o_, v); + void operator()(msgpack::type::nil_t const& v) const { + object()(o_, v); } void operator()(bool const& v) const { object()(o_, v); diff --git a/include/msgpack/adaptor/fixint.hpp b/include/msgpack/adaptor/fixint.hpp index 31bd0cdb9..fdf7cd7b9 100644 --- a/include/msgpack/adaptor/fixint.hpp +++ b/include/msgpack/adaptor/fixint.hpp @@ -34,7 +34,7 @@ namespace type { template struct fix_int { fix_int() : value(0) { } - fix_int(T value) : value(value) { } + fix_int(T v) : value(v) { } operator T() const { return value; } diff --git a/include/msgpack/adaptor/nil.hpp b/include/msgpack/adaptor/nil.hpp index 607f767a5..a50ffc50f 100644 --- a/include/msgpack/adaptor/nil.hpp +++ b/include/msgpack/adaptor/nil.hpp @@ -29,13 +29,13 @@ MSGPACK_API_VERSION_NAMESPACE(v1) { namespace type { -struct nil { }; +struct nil_t { }; -inline bool operator<(nil const& lhs, nil const& rhs) { +inline bool operator<(nil_t const& lhs, nil_t const& rhs) { return &lhs < &rhs; } -inline bool operator==(nil const& lhs, nil const& rhs) { +inline bool operator==(nil_t const& lhs, nil_t const& rhs) { return &lhs == &rhs; } @@ -44,32 +44,32 @@ inline bool operator==(nil const& lhs, nil const& rhs) { namespace adaptor { template <> -struct convert { - msgpack::object const& operator()(msgpack::object const& o, type::nil&) const { +struct convert { + msgpack::object const& operator()(msgpack::object const& o, type::nil_t&) const { if(o.type != msgpack::type::NIL) { throw msgpack::type_error(); } return o; } }; template <> -struct pack { +struct pack { template - msgpack::packer& operator()(msgpack::packer& o, const type::nil&) const { + msgpack::packer& operator()(msgpack::packer& o, const type::nil_t&) const { o.pack_nil(); return o; } }; template <> -struct object { - void operator()(msgpack::object& o, type::nil) const { +struct object { + void operator()(msgpack::object& o, type::nil_t) const { o.type = msgpack::type::NIL; } }; template <> -struct object_with_zone { - void operator()(msgpack::object::with_zone& o, type::nil v) const { +struct object_with_zone { + void operator()(msgpack::object::with_zone& o, type::nil_t v) const { static_cast(o) << v; } }; @@ -79,7 +79,7 @@ struct object_with_zone { template <> inline void msgpack::object::as() const { - msgpack::type::nil v; + msgpack::type::nil_t v; convert(v); } diff --git a/include/msgpack/object_fwd.hpp b/include/msgpack/object_fwd.hpp index ac4467295..05ef4f30a 100644 --- a/include/msgpack/object_fwd.hpp +++ b/include/msgpack/object_fwd.hpp @@ -188,7 +188,7 @@ struct object_kv { }; struct object::with_zone : object { - with_zone(msgpack::zone& zone) : zone(zone) { } + with_zone(msgpack::zone& z) : zone(z) { } msgpack::zone& zone; private: with_zone();