Updates from BitShares FC #22

Closed
nathanielhourt wants to merge 693 commits from dapp-support into latest-fc
Showing only changes of commit f4866b777e - Show all commits

View file

@ -28,6 +28,8 @@
#include <vector>
#include <openssl/bn.h>
namespace fc { namespace detail {
/** Errors thrown by the bignum class */
class bignum_error : public std::runtime_error
{
@ -605,11 +607,10 @@ inline bool DecodeBase58(const std::string& str, std::vector<unsigned char>& vch
return DecodeBase58(str.c_str(), vchRet);
}
namespace fc {
} // detail
std::string to_base58( const char* d, size_t s ) {
return EncodeBase58( (const unsigned char*)d, (const unsigned char*)d+s ).c_str();
return fc::detail::EncodeBase58( (const unsigned char*)d, (const unsigned char*)d+s ).c_str();
}
std::string to_base58( const std::vector<char>& d )
@ -620,8 +621,9 @@ std::string to_base58( const std::vector<char>& d )
}
std::vector<char> from_base58( const std::string& base58_str ) {
std::vector<unsigned char> out;
if( !DecodeBase58( base58_str.c_str(), out ) ) {
FC_THROW_EXCEPTION( parse_error_exception, "Unable to decode base58 string ${base58_str}", ("base58_str",base58_str) );
if( !fc::detail::DecodeBase58( base58_str.c_str(), out ) ) {
FC_THROW_EXCEPTION( parse_error_exception, "Unable to decode base58 string ${base58_str}",
("base58_str",base58_str) );
}
return std::vector<char>((const char*)out.data(), ((const char*)out.data())+out.size() );
}
@ -629,10 +631,10 @@ std::vector<char> from_base58( const std::string& base58_str ) {
* @return the number of bytes decoded
*/
size_t from_base58( const std::string& base58_str, char* out_data, size_t out_data_len ) {
//slog( "%s", base58_str.c_str() );
std::vector<unsigned char> out;
if( !DecodeBase58( base58_str.c_str(), out ) ) {
FC_THROW_EXCEPTION( parse_error_exception, "Unable to decode base58 string ${base58_str}", ("base58_str",base58_str) );
if( !fc::detail::DecodeBase58( base58_str.c_str(), out ) ) {
FC_THROW_EXCEPTION( parse_error_exception, "Unable to decode base58 string ${base58_str}",
("base58_str",base58_str) );
}
FC_ASSERT( out.size() <= out_data_len );
if (!out.empty()) {
@ -640,6 +642,7 @@ size_t from_base58( const std::string& base58_str, char* out_data, size_t out_da
}
return out.size();
}
}
} // fc
#endif