Win32 compile fixes (replace nonstandard runtime-sized auto arrays with alloca)
This commit is contained in:
parent
dacdb997f8
commit
2b2dfc62fc
3 changed files with 19 additions and 4 deletions
|
|
@ -304,7 +304,10 @@ target_include_directories(fc
|
|||
)
|
||||
|
||||
#target_link_libraries( fc PUBLIC udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${ECC_LIB} )
|
||||
target_link_libraries( fc PUBLIC -L/usr/local/lib udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} )
|
||||
IF(NOT WIN32)
|
||||
set(LINK_USR_LOCAL_LIB -L/usr/local/lib)
|
||||
ENDIF()
|
||||
target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} udt ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES} ${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library} ${readline_libraries} ${ECC_LIB} )
|
||||
|
||||
if(MSVC)
|
||||
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
|
||||
|
|
|
|||
|
|
@ -5,6 +5,12 @@
|
|||
#include <fc/crypto/openssl.hpp>
|
||||
#include <fc/crypto/ripemd160.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
#else
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
|
||||
/* stuff common to all ecc implementations */
|
||||
|
||||
#define BTC_EXT_PUB_MAGIC (0x0488B21E)
|
||||
|
|
@ -225,7 +231,7 @@ namespace fc { namespace ecc {
|
|||
|
||||
static fc::string _to_base58( const extended_key_data& key )
|
||||
{
|
||||
char buffer[key.size() + 4];
|
||||
char *buffer = (char*)alloca(key.size() + 4);
|
||||
memcpy( buffer, key.begin(), key.size() );
|
||||
fc::sha256 double_hash = fc::sha256::hash( fc::sha256::hash( key.begin(), key.size() ));
|
||||
memcpy( buffer + key.size(), double_hash.data(), 4 );
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
#include <assert.h>
|
||||
#include <secp256k1.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# include <malloc.h>
|
||||
#else
|
||||
# include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include "_elliptic_impl_priv.hpp"
|
||||
|
||||
namespace fc { namespace ecc {
|
||||
|
|
@ -183,7 +189,7 @@ namespace fc { namespace ecc {
|
|||
{
|
||||
if ( *in & 0x80 )
|
||||
{
|
||||
unsigned char buffer[len + 1];
|
||||
unsigned char *buffer = (unsigned char*)alloca(len + 1);
|
||||
*buffer = 0;
|
||||
memcpy( buffer + 1, in, len );
|
||||
BN_bin2bn( buffer, sizeof(buffer), out );
|
||||
|
|
@ -204,7 +210,7 @@ namespace fc { namespace ecc {
|
|||
unsigned int l = BN_num_bytes( in );
|
||||
if ( l > len )
|
||||
{
|
||||
unsigned char buffer[l];
|
||||
unsigned char *buffer = (unsigned char*)alloca(l);
|
||||
BN_bn2bin( in, buffer );
|
||||
memcpy( out, buffer + l - len, len );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue