json and variant bug fixes
This commit is contained in:
parent
e7075f6b3a
commit
105948ea65
4 changed files with 12 additions and 4 deletions
|
|
@ -213,8 +213,7 @@ namespace fc
|
|||
template<typename T>
|
||||
variant& operator=( T&& v )
|
||||
{
|
||||
*this = variant( fc::forward<T>(v) );
|
||||
return *this;
|
||||
return *this = variant( fc::forward<T>(v) );
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@
|
|||
#include <fc/variant.hpp>
|
||||
#include <fc/crypto/base64.hpp>
|
||||
|
||||
#include <fc/exception/exception.hpp>
|
||||
|
||||
namespace fc {
|
||||
bigint::bigint( const char* bige, uint32_t l ) {
|
||||
n = BN_bin2bn( (const unsigned char*)bige, l, NULL );
|
||||
FC_ASSERT( n != nullptr );
|
||||
}
|
||||
bigint::bigint( const std::vector<char>& bige ) {
|
||||
n = BN_bin2bn( (const unsigned char*)bige.data(), bige.size(), NULL );
|
||||
FC_ASSERT( n != nullptr );
|
||||
}
|
||||
bigint::bigint( BIGNUM* in )
|
||||
{
|
||||
|
|
@ -151,6 +155,8 @@ namespace fc {
|
|||
bigint& bigint::operator <<= ( uint32_t i )
|
||||
{
|
||||
bigint tmp;
|
||||
FC_ASSERT( tmp.n != nullptr );
|
||||
FC_ASSERT( n != nullptr );
|
||||
BN_lshift( tmp.n, n, i );
|
||||
std::swap(*this,tmp);
|
||||
return *this;
|
||||
|
|
|
|||
|
|
@ -298,7 +298,9 @@ namespace fc
|
|||
case 0x04: // ^D end of transmission
|
||||
FC_THROW_EXCEPTION( eof_exception, "unexpected end of file" );
|
||||
default:
|
||||
in.get(); //
|
||||
ilog( "unhandled char '${c}' int ${int}", ("c", fc::string( &c, 1 ) )("int", int(c)) );
|
||||
return variant();
|
||||
}
|
||||
}
|
||||
return variant();
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ void variant::clear()
|
|||
default:
|
||||
break;
|
||||
}
|
||||
memset( this, 0, sizeof(*this) );
|
||||
set_variant_type( this, null_type );
|
||||
}
|
||||
|
||||
variant::variant( const variant& v )
|
||||
|
|
@ -207,8 +207,9 @@ variant::~variant()
|
|||
variant& variant::operator=( variant&& v )
|
||||
{
|
||||
if( this == &v ) return *this;
|
||||
clear();
|
||||
memcpy( (char*)this, (char*)&v, sizeof(v) );
|
||||
v.clear();
|
||||
set_variant_type( &v, null_type );
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue