-
Notifications
You must be signed in to change notification settings - Fork 90
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
Variant fix #21
Variant fix #21
Conversation
include/fc/io/raw.hpp
Outdated
@@ -57,15 +57,17 @@ namespace fc { | |||
inline void pack( Stream& s, const fc::log_message& msg, uint32_t _max_depth ) | |||
{ | |||
FC_ASSERT( _max_depth > 0 ); | |||
fc::raw::pack( s, variant(msg), _max_depth - 1 ); // TODO check variant depth? | |||
--_max_depth; | |||
fc::raw::pack( s, variant( msg, _max_depth ), _max_depth ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we have different definitions on depth. I suggest we change the variant to:
variant( msg, min( _max_depth, FC_MAX_LOG_OBJECT_DEPTH ) )
.
include/fc/io/raw.hpp
Outdated
msg = vmsg.as<log_message>(); // TODO check depth? | ||
--_max_depth; | ||
fc::raw::unpack( s, vmsg, _max_depth ); | ||
msg = vmsg.as<log_message>( _max_depth ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
include/fc/reflect/variant.hpp
Outdated
{ | ||
template<typename IsEnum=fc::false_type> | ||
struct if_enum | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix indentation.
include/fc/rpc/api_connection.hpp
Outdated
{ | ||
FC_ASSERT( a0 != e ); | ||
return call_generic<R,Args...>( bind_first_arg<R,Arg0,Args...>( f, a0->as< typename std::decay<Arg0>::type >() ), a0+1, e ); | ||
return call_generic<R,Args...>( bind_first_arg<R,Arg0,Args...>( f, a0->as< typename std::decay<Arg0>::type >( max_depth - 1 ) ), a0+1, e, max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
include/fc/rpc/api_connection.hpp
Outdated
return [=]( const variants& args ) { | ||
return variant( call_generic( f, args.begin(), args.end() ) ); | ||
return [=]( const variants& args, uint32_t max_depth ) { | ||
return variant( call_generic( f, args.begin(), args.end(), max_depth - 1 ), max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
include/fc/rpc/api_connection.hpp
Outdated
return [=]( const variants& args ) { | ||
call_generic( f, args.begin(), args.end() ); | ||
return [=]( const variants& args, uint32_t max_depth ) { | ||
call_generic( f, args.begin(), args.end(), max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
include/fc/rpc/api_connection.hpp
Outdated
detail::callback_functor<Signature> arg0( get_connection(), a0->as<uint64_t>() ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,std::function<Signature>,Args...>( f, std::function<Signature>(arg0) ), a0+1, e ); | ||
detail::callback_functor<Signature> arg0( get_connection(), a0->as<uint64_t>(1) ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,std::function<Signature>,Args...>( f, std::function<Signature>(arg0) ), a0+1, e, max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
include/fc/rpc/api_connection.hpp
Outdated
detail::callback_functor<Signature> arg0( get_connection(), a0->as<uint64_t>() ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,const std::function<Signature>&,Args...>( f, arg0 ), a0+1, e ); | ||
detail::callback_functor<Signature> arg0( get_connection(), a0->as<uint64_t>(1) ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,const std::function<Signature>&,Args...>( f, arg0 ), a0+1, e, max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
include/fc/rpc/api_connection.hpp
Outdated
{ | ||
FC_ASSERT( a0 != e, "too few arguments passed to method" ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,Arg0,Args...>( f, a0->as< typename std::decay<Arg0>::type >() ), a0+1, e ); | ||
return call_generic<R,Args...>( this->bind_first_arg<R,Arg0,Args...>( f, a0->as< typename std::decay<Arg0>::type >( max_depth - 1 ) ), a0+1, e, max_depth - 1 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check max_depth > 0
?
Work in progressLimit recursion in variant conversions