Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with -Wshadow and ObjC++ #368

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/msgpack/adaptor/boost/msgpack_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace type {
template <typename STR, typename BIN, typename EXT>
struct basic_variant :
boost::variant<
nil, // NIL
nil_t, // NIL
bool, // BOOL
int64_t, // NEGATIVE_INTEGER
uint64_t, // POSITIVE_INTEGER
Expand All @@ -70,7 +70,7 @@ struct basic_variant :
>,
private boost::totally_ordered<basic_variant<STR, BIN, EXT> > {
typedef boost::variant<
nil, // NIL
nil_t, // NIL
bool, // BOOL
int64_t, // NEGATIVE_INTEGER
uint64_t, // POSITIVE_INTEGER
Expand Down Expand Up @@ -112,7 +112,7 @@ struct basic_variant :
basic_variant(unsigned long long v):base(uint64_t(v)) {}

bool is_nil() const {
return boost::get<nil>(this);
return boost::get<nil_t>(this);
}
bool is_bool() const {
return boost::get<bool>(this);
Expand Down Expand Up @@ -276,7 +276,7 @@ struct as<msgpack::type::basic_variant<STR, BIN, EXT> > {
msgpack::type::basic_variant<STR, BIN, EXT> operator()(msgpack::object const& o) const {
switch(o.type) {
case type::NIL:
return o.as<msgpack::type::nil>();
return o.as<msgpack::type::nil_t>();
case type::BOOLEAN:
return o.as<bool>();
case type::POSITIVE_INTEGER:
Expand Down Expand Up @@ -312,7 +312,7 @@ struct convert<msgpack::type::basic_variant<STR, BIN, EXT> > {
msgpack::type::basic_variant<STR, BIN, EXT>& v) const {
switch(o.type) {
case type::NIL:
v = o.as<msgpack::type::nil>();
v = o.as<msgpack::type::nil_t>();
break;
case type::BOOLEAN:
v = o.as<bool>();
Expand Down Expand Up @@ -374,8 +374,8 @@ struct pack<msgpack::type::basic_variant<STR, BIN, EXT> > {
namespace detail {

struct object_imp : boost::static_visitor<void> {
void operator()(msgpack::type::nil const& v) const {
object<msgpack::type::nil>()(o_, v);
void operator()(msgpack::type::nil_t const& v) const {
object<msgpack::type::nil_t>()(o_, v);
}
void operator()(bool const& v) const {
object<bool>()(o_, v);
Expand Down
2 changes: 1 addition & 1 deletion include/msgpack/adaptor/fixint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace type {
template <typename T>
struct fix_int {
fix_int() : value(0) { }
fix_int(T value) : value(value) { }
fix_int(T v) : value(v) { }

operator T() const { return value; }

Expand Down
24 changes: 12 additions & 12 deletions include/msgpack/adaptor/nil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -44,32 +44,32 @@ inline bool operator==(nil const& lhs, nil const& rhs) {
namespace adaptor {

template <>
struct convert<type::nil> {
msgpack::object const& operator()(msgpack::object const& o, type::nil&) const {
struct convert<type::nil_t> {
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<type::nil> {
struct pack<type::nil_t> {
template <typename Stream>
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const type::nil&) const {
msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, const type::nil_t&) const {
o.pack_nil();
return o;
}
};

template <>
struct object<type::nil> {
void operator()(msgpack::object& o, type::nil) const {
struct object<type::nil_t> {
void operator()(msgpack::object& o, type::nil_t) const {
o.type = msgpack::type::NIL;
}
};

template <>
struct object_with_zone<type::nil> {
void operator()(msgpack::object::with_zone& o, type::nil v) const {
struct object_with_zone<type::nil_t> {
void operator()(msgpack::object::with_zone& o, type::nil_t v) const {
static_cast<msgpack::object&>(o) << v;
}
};
Expand All @@ -79,7 +79,7 @@ struct object_with_zone<type::nil> {
template <>
inline void msgpack::object::as<void>() const
{
msgpack::type::nil v;
msgpack::type::nil_t v;
convert(v);
}

Expand Down
2 changes: 1 addition & 1 deletion include/msgpack/object_fwd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down